Commit 270c12b0 authored by kshinde's avatar kshinde

Code optimisation : took preparedStatement outside loop & closed where necessary.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106507 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b0dda0dd
......@@ -433,6 +433,11 @@ public class DespatchPos extends ValidatorEJB implements DespatchPosLocal, Despa
allocQty = rs.getDouble(4);
deAllocQty = rs.getDouble(5);
}
if(pstmt !=null)
{
pstmt.close();
}
pstmt=null;
rs = null;
////////
//conn = getConnection();
......
......@@ -3287,6 +3287,13 @@ public class PostOrderProcess extends ProcessEJB implements PostOrderProcessLoca
int vaildateData=0;
double totInputQty=0.0;
//System.out.println("sordItemList lenth@@@"+sordItemList.size());
sql = "select b.tran_id, b.line_no, (b.quantity - b.dealloc_qty) as pending_dealloc_qty" +
" from sord_alloc a, sord_alloc_det b where a.tran_id = b.tran_id " +
" and a.cust_code = ? and a.site_code = ? and a.sale_order " +
" is null and b.item_code = ? and b.loc_code = ? " +
" and b.lot_no = ? and b.lot_sl = ? " +
" and b.quantity - b.dealloc_qty > 0 ";
pstmt1 = conn.prepareStatement(sql);
for(SordItemBean sordItemBean :sordItemList )//required for update sorditem accordingly line no and sale order
{
sordItmQty = sordItemBean.getSordItmQty();
......@@ -3522,20 +3529,20 @@ public class PostOrderProcess extends ProcessEJB implements PostOrderProcessLoca
sql = "select b.tran_id, b.line_no, (b.quantity - b.dealloc_qty) as pending_dealloc_qty" +
/*sql = "select b.tran_id, b.line_no, (b.quantity - b.dealloc_qty) as pending_dealloc_qty" +
" from sord_alloc a, sord_alloc_det b where a.tran_id = b.tran_id " +
" and a.cust_code = ? and a.site_code = ? and a.sale_order " +
" is null and b.item_code = ? and b.loc_code = ? " +
" and b.lot_no = ? and b.lot_sl = ? " +
" and b.quantity - b.dealloc_qty > 0 ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode);
pstmt.setString(2,siteCode);
pstmt.setString(3,itemCodeOrd);
pstmt.setString(4,locCode);
pstmt.setString(5,lotNo);
pstmt.setString(6,lotSl);
rs = pstmt.executeQuery();
pstmt = conn.prepareStatement(sql);*/
pstmt1.setString(1,custCode);
pstmt1.setString(2,siteCode);
pstmt1.setString(3,itemCodeOrd);
pstmt1.setString(4,locCode);
pstmt1.setString(5,lotNo);
pstmt1.setString(6,lotSl);
rs = pstmt1.executeQuery();
if(rs.next())
{
tranidSoalloc = rs.getString("tran_id");
......@@ -3545,8 +3552,8 @@ public class PostOrderProcess extends ProcessEJB implements PostOrderProcessLoca
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
/*pstmt.close();
pstmt = null;*/
if(tranidSoalloc != null && tranidSoalloc.trim().length() > 0)
......@@ -3671,7 +3678,10 @@ public class PostOrderProcess extends ProcessEJB implements PostOrderProcessLoca
}
//End Added by chandrashekar on 13-sep-2016
}//end of for(SordItemBean sordItemBean :sordItemList )...2nd
}
pstmt1.close();
pstmt1 = null;
//end of for(SordItemBean sordItemBean :sordItemList )...2nd
/*System.out.println("********************************************************");
System.out.println("records["+records+"]"+"stockOpt["+stockOpt+"]"+"saleOrder["+saleOrder+"]");
int updSordCnt=0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment