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
......@@ -169,6 +169,8 @@ QCTransferConfLocal, QCTransferConfRemote
String qcOrdItemUnit="",byprodUnit="";
double convertedQty=0,netWeight=0;
boolean isByProduct=false;
double noArt=0,convertedNoArt=0,convertedNetWeight=0;
try
{
......@@ -181,8 +183,8 @@ QCTransferConfLocal, QCTransferConfRemote
System.out.println("Now the date is :=> " + sysDateStr);
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," +
" loc_code,item_code " +
sql = " Select confirmed, qorder_no, tran_date ,site_code,loc_code__trf,quantity," +
" lot_sl,lot_no,porcp_no, loc_code,item_code " +
" from qc_transfer where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
......@@ -200,6 +202,8 @@ QCTransferConfLocal, QCTransferConfRemote
porcpNo= rs.getString("porcp_no");
fromLoc= rs.getString("loc_code");
itemCode= rs.getString("item_code");
//noArtQCTransfer= rs.getDouble("no_art");
//netWeightQCTransfer= rs.getDouble("net_weight");
}
rs.close();
......@@ -208,7 +212,7 @@ QCTransferConfLocal, QCTransferConfRemote
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.setString(1, qorderNo);
rs = pstmt.executeQuery();
......@@ -219,6 +223,7 @@ QCTransferConfLocal, QCTransferConfRemote
qcQty= rs.getDouble("Quantity");
qcOrderItem= rs.getString("item_code");
netWeight= rs.getDouble("net_weight");
noArt= rs.getDouble("no_art");
}
rs.close();
rs = null;
......@@ -353,17 +358,22 @@ QCTransferConfLocal, QCTransferConfRemote
{
//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+"]");
System.out.println("@@@@ qc order Qty[qcQty]["+qcQty+"]qc transfer qty[qty]["+qty+"]netWeight["+netWeight+"]noArt["+noArt+"]");
convertedQty = netWeight * qty / qcQty ;
convertedQty = qty * qcQty / netWeight ;
System.out.println("@@@@convertedQty["+convertedQty+"]");
//convertedNetWeight = netWeight ;
convertedNetWeight = netWeight * convertedQty / qcQty ;
//// cpatil end
convertedNoArt = noArt * qty / netWeight ;
System.out.println("convertedQty-----"+convertedQty);
System.out.println("@@@@convertedQty["+convertedQty+"]convertedNetWeight["+convertedNetWeight+"]convertedNoArt["+convertedNoArt+"]");
//// cpatil end // modify by cpatil on 09/04/14 end
System.out.println("@@@----qcQty["+qcQty+"]convertedQty["+convertedQty+"]");
if(qcQty < convertedQty )
{
errCode = "QCTRFQTY"; //'QC Transfer quantity more then QC Order Quantity'
......@@ -375,6 +385,7 @@ QCTransferConfLocal, QCTransferConfRemote
}
else
{
System.out.println("@@@----qcQty["+qcQty+"]qty["+qty+"]");
if(qcQty < qty )
{
errCode = "QCTRFQTY"; //'QC Transfer quantity more then QC Order Quantity'
......@@ -594,24 +605,36 @@ QCTransferConfLocal, QCTransferConfRemote
if (errCode == null || errCode.trim().length() == 0 )
{ //if gs_run_mode = 'I' then
if(isByProduct)
{
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.setDouble(1, convertedQty);
pstmt.setString(2, qorderNo);
pstmt.setDouble(1, convertedQty );
pstmt.setDouble(2, convertedNetWeight );
pstmt.setDouble(3, convertedNoArt );
pstmt.setString(4, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
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.setDouble(1, convertedQty);
pstmt.setString(2, qorderNo);
pstmt.setDouble(1, convertedQty );
pstmt.setDouble(2, convertedNetWeight );
pstmt.setDouble(3, convertedNoArt );
pstmt.setString(4, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
......@@ -620,22 +643,37 @@ QCTransferConfLocal, QCTransferConfRemote
}
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 )
{
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.setDouble(1, qty);
pstmt.setString(2, qorderNo);
pstmt.setDouble(2, convertedNetWeight);
pstmt.setDouble(3, convertedNoArt);
pstmt.setString(4, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
}
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.setDouble(1, qty);
pstmt.setString(2, qorderNo);
pstmt.setDouble(2, convertedNetWeight);
pstmt.setDouble(3, convertedNoArt);
pstmt.setString(4, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
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