Commit d84e4e73 authored by cpatil's avatar cpatil

modify logic of quantity calculation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94535 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d9177518
...@@ -170,6 +170,8 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -170,6 +170,8 @@ QCTransferConfLocal, QCTransferConfRemote
double convertedQty=0,netWeight=0; double convertedQty=0,netWeight=0;
boolean isByProduct=false; boolean isByProduct=false;
double noArt=0,convertedNoArt=0,convertedNetWeight=0;
try try
{ {
StockUpdate stockUpdate = new StockUpdate(); StockUpdate stockUpdate = new StockUpdate();
...@@ -181,8 +183,8 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -181,8 +183,8 @@ QCTransferConfLocal, QCTransferConfRemote
System.out.println("Now the date is :=> " + sysDateStr); System.out.println("Now the date is :=> " + sysDateStr);
sysDate= Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0"); sysDate= Timestamp.valueOf(genericUtility.getValidDateString(sysDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()) + " 00:00:00.0");
sql = " Select confirmed, qorder_no, tran_date ,site_code,loc_code__trf,quantity,lot_sl,lot_no,porcp_no," + sql = " Select confirmed, qorder_no, tran_date ,site_code,loc_code__trf,quantity," +
" loc_code,item_code " + " lot_sl,lot_no,porcp_no, loc_code,item_code " +
" from qc_transfer where tran_id = ? "; " from qc_transfer where tran_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
...@@ -200,6 +202,8 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -200,6 +202,8 @@ QCTransferConfLocal, QCTransferConfRemote
porcpNo= rs.getString("porcp_no"); porcpNo= rs.getString("porcp_no");
fromLoc= rs.getString("loc_code"); fromLoc= rs.getString("loc_code");
itemCode= rs.getString("item_code"); itemCode= rs.getString("item_code");
//noArtQCTransfer= rs.getDouble("no_art");
//netWeightQCTransfer= rs.getDouble("net_weight");
} }
rs.close(); rs.close();
...@@ -208,7 +212,7 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -208,7 +212,7 @@ QCTransferConfLocal, QCTransferConfRemote
pstmt = null; pstmt = null;
sql = " Select status,Quantity, item_code, net_weight from qc_order where qorder_no = ? "; // added net_weight by cpatil on 05/04/14 sql = " Select status,Quantity, item_code, net_weight, no_art from qc_order where qorder_no = ? "; // added net_weight by cpatil on 05/04/14
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, qorderNo); pstmt.setString(1, qorderNo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -219,6 +223,7 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -219,6 +223,7 @@ QCTransferConfLocal, QCTransferConfRemote
qcQty= rs.getDouble("Quantity"); qcQty= rs.getDouble("Quantity");
qcOrderItem= rs.getString("item_code"); qcOrderItem= rs.getString("item_code");
netWeight= rs.getDouble("net_weight"); netWeight= rs.getDouble("net_weight");
noArt= rs.getDouble("no_art");
} }
rs.close(); rs.close();
rs = null; rs = null;
...@@ -353,17 +358,22 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -353,17 +358,22 @@ QCTransferConfLocal, QCTransferConfRemote
{ {
//convertedQty=roundVal(dcommon.convQtyFactor(byprodUnit, qcOrdItemUnit, "X", qty, conn),3); // commented by cpatil on 05/04/14 //convertedQty=roundVal(dcommon.convQtyFactor(byprodUnit, qcOrdItemUnit, "X", qty, conn),3); // commented by cpatil on 05/04/14
// modify by cpatil 05/04/14 start // modify by cpatil 05/04/14 start // // modify by cpatil on 09/04/14
System.out.println("@@@@ qc order Qty[qcQty]["+qcQty+"]qc transfer qty[qty]["+qty+"]netWeight["+netWeight+"]noArt["+noArt+"]");
System.out.println("@@@@ qc order Qty[qcQty]["+qcQty+"]qc transfer qty[qty]["+qty+"]netWeight["+netWeight+"]"); convertedQty = qty * qcQty / netWeight ;
convertedQty = netWeight * qty / qcQty ; //convertedNetWeight = netWeight ;
convertedNetWeight = netWeight * convertedQty / qcQty ;
System.out.println("@@@@convertedQty["+convertedQty+"]"); convertedNoArt = noArt * qty / netWeight ;
//// cpatil end System.out.println("@@@@convertedQty["+convertedQty+"]convertedNetWeight["+convertedNetWeight+"]convertedNoArt["+convertedNoArt+"]");
System.out.println("convertedQty-----"+convertedQty); //// cpatil end // modify by cpatil on 09/04/14 end
System.out.println("@@@----qcQty["+qcQty+"]convertedQty["+convertedQty+"]");
if(qcQty < convertedQty ) if(qcQty < convertedQty )
{ {
errCode = "QCTRFQTY"; //'QC Transfer quantity more then QC Order Quantity' errCode = "QCTRFQTY"; //'QC Transfer quantity more then QC Order Quantity'
...@@ -375,6 +385,7 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -375,6 +385,7 @@ QCTransferConfLocal, QCTransferConfRemote
} }
else else
{ {
System.out.println("@@@----qcQty["+qcQty+"]qty["+qty+"]");
if(qcQty < qty ) if(qcQty < qty )
{ {
errCode = "QCTRFQTY"; //'QC Transfer quantity more then QC Order Quantity' errCode = "QCTRFQTY"; //'QC Transfer quantity more then QC Order Quantity'
...@@ -594,24 +605,36 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -594,24 +605,36 @@ QCTransferConfLocal, QCTransferConfRemote
if (errCode == null || errCode.trim().length() == 0 ) if (errCode == null || errCode.trim().length() == 0 )
{ //if gs_run_mode = 'I' then { //if gs_run_mode = 'I' then
if(isByProduct) if(isByProduct)
{ {
if ( qcQty > convertedQty ) if ( qcQty > convertedQty )
{ {
sql = " Update qc_order set quantity = (quantity - ? ) where qorder_no = ? "; sql = " Update qc_order set quantity = ( quantity - ? ) " +
" , net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ) " + // modify by cpatil on 09/04/14
" where qorder_no = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, convertedQty); pstmt.setDouble(1, convertedQty );
pstmt.setString(2, qorderNo); pstmt.setDouble(2, convertedNetWeight );
pstmt.setDouble(3, convertedNoArt );
pstmt.setString(4, qorderNo);
updCnt = pstmt.executeUpdate(); updCnt = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
else else
{ {
sql = " Update qc_order set quantity = (quantity - ? ), status = 'C' where qorder_no = ? " ; sql = " Update qc_order set quantity = (quantity - ? ), status = 'C' " +
" , net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ) " + // modify by cpatil on 09/04/14
" where qorder_no = ? " ;
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, convertedQty); pstmt.setDouble(1, convertedQty );
pstmt.setString(2, qorderNo); pstmt.setDouble(2, convertedNetWeight );
pstmt.setDouble(3, convertedNoArt );
pstmt.setString(4, qorderNo);
updCnt = pstmt.executeUpdate(); updCnt = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -620,22 +643,37 @@ QCTransferConfLocal, QCTransferConfRemote ...@@ -620,22 +643,37 @@ QCTransferConfLocal, QCTransferConfRemote
} }
else else
{ {
System.out.println("@@@ noArt["+noArt+"]qty["+qty+"]qcQty["+qcQty+"]netWeight["+netWeight+"]"); // modify by cpatil on 09/04/14
convertedNoArt = noArt * qty / qcQty ;
convertedNetWeight = netWeight * qty / qcQty ;
System.out.println("@@@ convertedNoArt["+convertedNoArt+"]convertedNetWeight["+convertedNetWeight+"]");
if ( qcQty > qty ) if ( qcQty > qty )
{ {
sql = " Update qc_order set quantity = (quantity - ? ) where qorder_no = ? "; sql = " Update qc_order set quantity = (quantity - ? ) " +
" , net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ) " + // modify by cpatil on 09/04/14
" where qorder_no = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, qty); pstmt.setDouble(1, qty);
pstmt.setString(2, qorderNo); pstmt.setDouble(2, convertedNetWeight);
pstmt.setDouble(3, convertedNoArt);
pstmt.setString(4, qorderNo);
updCnt = pstmt.executeUpdate(); updCnt = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
else else
{ {
sql = " Update qc_order set quantity = (quantity - ? ), status = 'C' where qorder_no = ? " ; sql = " Update qc_order set quantity = (quantity - ? ), status = 'C' " +
" , net_weight = ( net_weight - ? ) , no_art = ( no_art - ? ) " + // modify by cpatil on 09/04/14
" where qorder_no = ? " ;
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, qty); pstmt.setDouble(1, qty);
pstmt.setString(2, qorderNo); pstmt.setDouble(2, convertedNetWeight);
pstmt.setDouble(3, convertedNoArt);
pstmt.setString(4, qorderNo);
updCnt = pstmt.executeUpdate(); updCnt = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
......
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