Commit 0a327fe9 authored by cpatil's avatar cpatil

modify code for validating quantity


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96760 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8dbe4b7f
...@@ -351,6 +351,8 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -351,6 +351,8 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
DecimalFormat df = new DecimalFormat("0.000"); DecimalFormat df = new DecimalFormat("0.000");
CommonConstants commonConstants = new CommonConstants(); CommonConstants commonConstants = new CommonConstants();
String itemCodeInv=""; double quantityInv=0,issueQtyInv=0; // added by cpatil
try try
{ {
...@@ -519,6 +521,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -519,6 +521,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
pstmt1.close();pstmt1=null; pstmt1.close();pstmt1=null;
System.out.println("@@@@@@ issuedQty for the item--->["+issuedQty+"]"); System.out.println("@@@@@@ issuedQty for the item--->["+issuedQty+"]");
/*
propReqQty = (issueQtyBill/woQty)*batchQuantity; propReqQty = (issueQtyBill/woQty)*batchQuantity;
propReqQty = Double.parseDouble(df.format(propReqQty)); propReqQty = Double.parseDouble(df.format(propReqQty));
...@@ -528,7 +531,8 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -528,7 +531,8 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
issueQtyDiff = Double.parseDouble(df.format(issueQtyDiff)); issueQtyDiff = Double.parseDouble(df.format(issueQtyDiff));
System.out.println("@@@@@@ issueQtyDiff for the item--->["+issueQtyDiff+"]"); System.out.println("@@@@@@ issueQtyDiff for the item--->["+issueQtyDiff+"]");
*/
/*
if(propReqQty > issueQtyDiff) if(propReqQty > issueQtyDiff)
{ {
list.add(itemCode); list.add(itemCode);
...@@ -538,26 +542,33 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -538,26 +542,33 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
break; // added break condition on 05/11/14 by cpatil break; // added break condition on 05/11/14 by cpatil
} }
*/
if(flag == false) if(flag == false)
{ {
sql2 = " SELECT LOC_CODE,LOT_NO,LOT_SL FROM INV_ALLOC_DET WHERE TRAN_ID IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER = ? ) AND ITEM_CODE = ? "; //sql2 = " SELECT LOC_CODE,LOT_NO,LOT_SL FROM INV_ALLOC_DET WHERE TRAN_ID IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER = ? ) AND ITEM_CODE = ? ";
sql2 = " SELECT LOC_CODE,LOT_NO,LOT_SL,ITEM_CODE,SITE_CODE, quantity , issue_qty " +
" FROM INV_ALLOC_DET " +
" WHERE TRAN_ID IN (SELECT TRAN_ID FROM INV_ALLOCATE WHERE WORK_ORDER = ? ) " +
" and 'Y' <> case when deallocated is null then 'N' else deallocated end ";
pstmt2 = conn.prepareStatement(sql2); pstmt2 = conn.prepareStatement(sql2);
pstmt2.setString(1,worder); pstmt2.setString(1,worder);
pstmt2.setString(2,itemCode); //pstmt2.setString(2,itemCode);
rs2 = pstmt2.executeQuery(); rs2 = pstmt2.executeQuery();
while(rs2.next()) while(rs2.next())
{ {
lineNo++; lineNo++;
locCode =rs2.getString(1); locCode =rs2.getString("LOC_CODE");
lotNoInv =rs2.getString(2); lotNoInv =rs2.getString("LOT_NO");
lotSlInv =rs2.getString(3); lotSlInv =rs2.getString("LOT_SL");
itemCodeInv =rs2.getString("ITEM_CODE");
siteCode =rs2.getString("SITE_CODE");
quantityInv =rs2.getDouble("quantity");
issueQtyInv =rs2.getDouble(" issue_qty");
String propReqQtyStr = df.format(propReqQty); String propReqQtyStr = df.format(propReqQty);
propReqQty = Double.parseDouble(propReqQtyStr); propReqQty = Double.parseDouble(propReqQtyStr);
System.out.println("propReqQty @@@::[ "+propReqQty+" ]for item [ "+itemCode + " ]"); System.out.println("propReqQty @@@::[ "+propReqQty+" ]for item [ "+itemCode + " ]");
/*
stockSql ="select a.lot_no, a.loc_code, a.lot_sl, a.rate, a.gross_rate,a.supp_code__mfg " stockSql ="select a.lot_no, a.loc_code, a.lot_sl, a.rate, a.gross_rate,a.supp_code__mfg "
+" ,(a.quantity-a.alloc_qty) as stockBalQty " +" ,(a.quantity-a.alloc_qty) as stockBalQty "
+" from stock a, invstat b, item c " +" from stock a, invstat b, item c "
...@@ -568,6 +579,18 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -568,6 +579,18 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
+" and a.loc_code in ( select loc_code from location where loc_group ='"+locGroup+"' ) " +" and a.loc_code in ( select loc_code from location where loc_group ='"+locGroup+"' ) "
+" and lot_no in ('" +lotNoIss+ "')" +" and lot_no in ('" +lotNoIss+ "')"
+" and ( a.quantity - a.alloc_qty ) > 0 "; +" and ( a.quantity - a.alloc_qty ) > 0 ";
*/
stockSql ="select a.lot_no, a.loc_code, a.lot_sl, a.rate, a.gross_rate,a.supp_code__mfg "
+" ,(a.quantity-a.alloc_qty) as stockBalQty "
+" from stock a, invstat b, item c "
+" Where a.inv_stat = b.inv_stat and a.item_code = c.item_code "
+" and a.item_code = '" + itemCodeInv + "' "
+" and a.site_code = '"+siteCode+"' "
+" and b.stat_type <> 'S' and b.available = 'Y' "
+" and a.loc_code ='"+locCode+"' ) "
+" and a.lot_no = ('" +lotNoInv+ "')"
+" and ( a.quantity - a.alloc_qty ) > 0 ";
pstmt1 = conn.prepareStatement(stockSql); pstmt1 = conn.prepareStatement(stockSql);
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
if(rs1.next()) if(rs1.next())
...@@ -583,6 +606,30 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -583,6 +606,30 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
rs1.close();rs1=null; rs1.close();rs1=null;
pstmt1.close();pstmt1=null; pstmt1.close();pstmt1=null;
// for quantity check
propReqQty = (quantityInv/woQty)*batchQuantity;
propReqQty = Double.parseDouble(df.format(propReqQty));
System.out.println("@@@@@@ propReqQty for the item--->["+propReqQty+"]");
issueQtyDiff = quantityInv - issuedQty ;
issueQtyDiff = Double.parseDouble(df.format(issueQtyDiff));
System.out.println("@@@@@@ issueQtyDiff for the item--->["+issueQtyDiff+"]");
if(propReqQty > issueQtyDiff)
{
list.add(itemCode);
list.add(issuedQty);
list.add(issueQtyBill);
flag = true;
break; // added break condition on 05/11/14 by cpatil
}
// end
insertDetail ="insert into workorder_issdet (tran_id,line_no,exp_lev,item_code,loc_code,lot_no," + insertDetail ="insert into workorder_issdet (tran_id,line_no,exp_lev,item_code,loc_code,lot_no," +
" lot_sl,quantity,unit,rate,gross_rate,calc_potency, potency_adj," + " lot_sl,quantity,unit,rate,gross_rate,calc_potency, potency_adj," +
" match_potency,min_potency_perc,adj_potency,work_order)" + " match_potency,min_potency_perc,adj_potency,work_order)" +
...@@ -591,7 +638,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -591,7 +638,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
pstmt1.setString(1,tranId); pstmt1.setString(1,tranId);
pstmt1.setInt(2,lineNo); pstmt1.setInt(2,lineNo);
pstmt1.setString(3,expLev); pstmt1.setString(3,expLev);
pstmt1.setString(4,itemCode); pstmt1.setString(4,itemCodeInv); // added by cpatil instead of itemCode
pstmt1.setString(5,locCode); pstmt1.setString(5,locCode);
pstmt1.setString(6,lotNoInv); pstmt1.setString(6,lotNoInv);
pstmt1.setString(7,lotSlInv); pstmt1.setString(7,lotSlInv);
...@@ -616,7 +663,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal, ...@@ -616,7 +663,7 @@ public class WoIssPartialPrc extends ProcessEJB implements WoIssPartialPrcLocal,
pstmt1.setDouble(1,propReqQty); pstmt1.setDouble(1,propReqQty);
pstmt1.setDouble(2,propReqQty); pstmt1.setDouble(2,propReqQty);
pstmt1.setString(3,worder); pstmt1.setString(3,worder);
pstmt1.setString(4,itemCode); pstmt1.setString(4,itemCodeInv); // added by cpatil instead of itemCode
pstmt1.setString(5,lotSlInv); pstmt1.setString(5,lotSlInv);
pstmt1.setString(6,lotNoInv); pstmt1.setString(6,lotNoInv);
pstmt1.setString(7,siteCode); pstmt1.setString(7,siteCode);
......
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