Commit 7d9e7b31 authored by ssarkar's avatar ssarkar

changed by sumit on 22/03/13 for bug of deallocation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92862 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 61cb12a2
...@@ -27,6 +27,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -27,6 +27,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
String loginEmpCode = ""; String loginEmpCode = "";
String confDateStr = ""; String confDateStr = "";
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
DistCommon discommon = new DistCommon();
/** /**
* The public function is used to confirm a transaction corresponding to the tran id it takes as an argument * The public function is used to confirm a transaction corresponding to the tran id it takes as an argument
* @param : tranId * @param : tranId
...@@ -217,7 +218,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -217,7 +218,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
if("S".equalsIgnoreCase(pPickType)) if("S".equalsIgnoreCase(pPickType))
{ {
errString = deallocatedRepl(pickOrder, pickLineNo, siteCode, itemCode, lotNo, lotSl, DeallocQty, saleOrder, saleOrderLine, expLev, custCode, xtraParams, waveId,cartonNo, conn); errString = deallocatedRepl(pickOrder, pickLineNo,pPickType, siteCode, itemCode, lotNo, lotSl, DeallocQty, saleOrder, saleOrderLine, expLev, custCode, xtraParams, waveId,cartonNo, conn);
errString = sorderDeAllocate(saleOrder, saleOrderLine, itemCode, DeallocQty, expLev, custCode, lotSl, lotNo, locCode, xtraParams, waveId, ""); errString = sorderDeAllocate(saleOrder, saleOrderLine, itemCode, DeallocQty, expLev, custCode, lotSl, lotNo, locCode, xtraParams, waveId, "");
continue; continue;
} }
...@@ -288,8 +289,9 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -288,8 +289,9 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]"); System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]");
//Updating pick_order //Updating pick_order
isReplDone = true; isReplDone = true;
updateReplOrder(replOrder,replOrderLine, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0,"",0); updateReplOrder(replOrder,replOrderLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0,"",0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType); updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
confReplOrder(replOrder,replOrderLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0,"",0);
} }
else if ("N".equalsIgnoreCase(confirmed) && "NO".equalsIgnoreCase(replParent.get("paren_exist").toString())) //parentExist.put("paren_exist", "NO"); else if ("N".equalsIgnoreCase(confirmed) && "NO".equalsIgnoreCase(replParent.get("paren_exist").toString())) //parentExist.put("paren_exist", "NO");
...@@ -299,10 +301,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -299,10 +301,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
//lotSl = replParent.get("lot_sl").toString(); //lotSl = replParent.get("lot_sl").toString();
System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]"); System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]");
isReplDone = false; isReplDone = false;
updateReplOrder(replOrder,replOrderLine, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0,"",0); updateReplOrder(replOrder,replOrderLine, siteCode,pPickType, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0,"",0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType); updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updateReplOrderForActive(pPickType, replOrder,replOrderLine, empCode, conn, "",0,"",0);
updateReplOrderForActive(pPickType, replOrder,replOrderLine, empCode, conn); confReplOrder(replOrder,replOrderLine, siteCode,pPickType, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0,"",0);
} }
else if ( "N".equalsIgnoreCase(confirmed) && "YES".equalsIgnoreCase(replParent.get("paren_exist").toString())) else if ( "N".equalsIgnoreCase(confirmed) && "YES".equalsIgnoreCase(replParent.get("paren_exist").toString()))
{ {
...@@ -331,9 +333,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -331,9 +333,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
//System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]"); //System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]");
isReplDone = true; isReplDone = true;
updateReplOrder(currentReplOrder,currReplOrdLine, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0, "", 0); updateReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0, "", 0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType); updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn); updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn, "",0, "", 0);
confReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0, "", 0);
} }
else if ("N".equalsIgnoreCase(confirmed) && "NO".equalsIgnoreCase(replParent.get("paren_exist").toString())) //parentExist.put("paren_exist", "NO"); else if ("N".equalsIgnoreCase(confirmed) && "NO".equalsIgnoreCase(replParent.get("paren_exist").toString())) //parentExist.put("paren_exist", "NO");
{ {
...@@ -343,9 +346,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -343,9 +346,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
//System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]"); //System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]");
isReplDone = false; isReplDone = false;
updateReplOrder(currentReplOrder,currReplOrdLine, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,"", 0); updateReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,"", 0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType); updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn); updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn,replOrder,replOrderLine,"", 0);
confReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,"", 0);
} }
else if ( "N".equalsIgnoreCase(confirmed) && "YES".equalsIgnoreCase(replParent.get("paren_exist").toString())) else if ( "N".equalsIgnoreCase(confirmed) && "YES".equalsIgnoreCase(replParent.get("paren_exist").toString()))
{ {
...@@ -363,16 +367,19 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -363,16 +367,19 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
if("Y".equalsIgnoreCase(confirmed)) if("Y".equalsIgnoreCase(confirmed))
{ {
isReplDone = true; isReplDone = true;
updateReplOrder(currentReplOrder,currReplOrdLine, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,"", 0); updateReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,"", 0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType); updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn); updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn, replOrder,replOrderLine,"", 0);
confReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,"", 0);
} }
else if ("N".equalsIgnoreCase(confirmed) ) //parentExist.put("paren_exist", "NO"); else if ("N".equalsIgnoreCase(confirmed) ) //parentExist.put("paren_exist", "NO");
{ {
//confReplOrder
isReplDone = false; isReplDone = false;
updateReplOrder(currentReplOrder,currReplOrdLine, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,supRerplOrder, supReplLine); updateReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,supRerplOrder, supReplLine);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType); updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn); updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn,replOrder,replOrderLine,supRerplOrder, supReplLine);
confReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,supRerplOrder, supReplLine);
} }
} }
...@@ -387,6 +394,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -387,6 +394,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
else else
{ {
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType); updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
} }
int update = updateWaveTaskDet(pickOrder, "PICK", conn, pPickType, empCode); int update = updateWaveTaskDet(pickOrder, "PICK", conn, pPickType, empCode);
...@@ -436,10 +444,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -436,10 +444,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
sql = "UPDATE PACK_DET SET STATUS = 'R' WHERE CARTON_NO = ? "; sql = "UPDATE PACK_DET SET STATUS = 'R' WHERE CARTON_NO = ? ";
pstmt2 = conn.prepareStatement(sql); pstmt2 = conn.prepareStatement(sql);
pstmt2.setString(1, cartonNo); pstmt2.setString(1, cartonNo);
pstmt2.executeUpdate();
if( update > 0 ) if( pstmt2.executeUpdate() > 0 )
{ {
System.out.println(cartonNo+" cartonNo updated successfully from PACK_DET table "); System.out.println(cartonNo+" cartonNo of PACK_DET updated successfully from PACK_DET table ");
} }
pstmt2.close(); pstmt2 = null; pstmt2.close(); pstmt2 = null;
} }
...@@ -523,9 +531,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -523,9 +531,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
try try
{ {
System.out.println("isError =["+isError+"]"); System.out.println("isError =["+isError+"]");
System.out.println("Commiting and Closing Connection..........");
if ( !(isError) && conStat == true ) if ( !(isError) && conStat == true )
{ {
System.out.println("Commiting and Closing Connection..........");
conn.commit(); conn.commit();
errString = itmdbAccess.getErrorString("","VTSUCC1",loginEmpCode); errString = itmdbAccess.getErrorString("","VTSUCC1",loginEmpCode);
} }
...@@ -546,6 +555,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -546,6 +555,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
} }
if( conn != null && conStat == true && !conn.isClosed() ) if( conn != null && conStat == true && !conn.isClosed() )
{ {
System.out.println(" commiting connection ");
conn.commit();
conn.close(); conn.close();
conn = null; conn = null;
} }
...@@ -1164,18 +1175,76 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1164,18 +1175,76 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
return parentExist; return parentExist;
} }
// Updating repl order // Updating repl order
private int updateReplOrder(String currentReplOrder,int replOrderLine, String siteCode, String itemCode, String locCode, String lotNo, String lotSl, double DeallocQty, Connection conn, boolean isReplDone, String parentReplOrder, int parentReplOrdLine, String supRerplOrder,int supReplLine) throws ITMException private int updateReplOrder(String currentReplOrder,int replOrderLine, String pickTye, String siteCode, String itemCode, String locCode, String lotNo, String lotSl, double DeallocQty, Connection conn, boolean isReplDone, String parentReplOrder, int parentReplOrdLine, String supRerplOrder,int supReplLine) throws ITMException
{ {
String sql = ""; String sql = "";
String dsoInvStat = "";
String psoInvStat = "";
String invStat = "";
double quantity = 0; double quantity = 0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
//boolean isDsoloc = false;
int update = 0; int update = 0;
try try
{ {
System.out.println(" currentReplOrder ["+currentReplOrder+"] isReplDone ["+isReplDone+"] parentReplOrder["+parentReplOrder+"] supRerplOrder ["+supRerplOrder+"] supReplLine ["+supReplLine+"]"); System.out.println(" updateReplOrder pickTye ["+pickTye+"] currentReplOrder ["+currentReplOrder+"] isReplDone ["+isReplDone+"] parentReplOrder["+parentReplOrder+"] supRerplOrder ["+supRerplOrder+"] supReplLine ["+supReplLine+"]");
//sql = ""; //sql = "";
//sql = "UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? "; //sql = "UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? ";
/*dsoInvStat = discommon.getDisparams("999999","DEEP_STORE_INVSTAT",conn).trim();
psoInvStat = discommon.getDisparams("999999","RESERVE_LOCATION",conn).trim();
System.out.println(" dsoInvStat ["+dsoInvStat+"] psoInvStat["+psoInvStat+"]");
sql = "SELECT INV_STAT FROM LOCATION WHERE LOC_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locCode);
rs = pstmt.executeQuery();
if( rs.next())
{
if(dsoInvStat.equalsIgnoreCase(rs.getString("INV_STAT").trim()))
{
invStat = "DSO";
}
else if(psoInvStat.equalsIgnoreCase(rs.getString("INV_STAT").trim()))
{
invStat = "PSO";
}
else
{
invStat = "PND";
}
}
System.out.println(" inv_stat ["+invStat+"]");
rs.close(); rs = null;
pstmt.close(); pstmt = null;*/
if( isReplDone && parentReplOrder.trim().length() == 0)
{
sql = "UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty );
pstmt.setString(2, currentReplOrder);
pstmt.setInt(3, replOrderLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
{
System.out.println(currentReplOrder+" repl_order updated successfully ");
}
pstmt.close();pstmt = null;
sql = "UPDATE REPL_ORD_DET SET DEALLOC_QTY = (CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty );
pstmt.setString(2, currentReplOrder);
pstmt.setInt(3, replOrderLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
{
System.out.println(currentReplOrder+" repl_order updated successfully ");
}
pstmt.close();pstmt = null;
}
if( !isReplDone && parentReplOrder.trim().length() == 0) if( !isReplDone && parentReplOrder.trim().length() == 0)
{ {
sql = "UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL"; sql = "UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL";
...@@ -1205,9 +1274,9 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1205,9 +1274,9 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
} }
else if( isReplDone && parentReplOrder.trim().length() == 0) else if( isReplDone && parentReplOrder.trim().length() > 0 && supRerplOrder.trim().length() == 0)
{ {
/*sql = "UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL"; sql = "UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty ); pstmt.setDouble(1, DeallocQty );
pstmt.setString(2, currentReplOrder); pstmt.setString(2, currentReplOrder);
...@@ -1231,7 +1300,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1231,7 +1300,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
{ {
System.out.println(currentReplOrder+" repl_order updated successfully "); System.out.println(currentReplOrder+" repl_order updated successfully ");
} }
pstmt.close();pstmt = null;*/ pstmt.close();pstmt = null;
} }
else if( !isReplDone && parentReplOrder.trim().length() > 0 && supRerplOrder.trim().length() == 0) else if( !isReplDone && parentReplOrder.trim().length() > 0 && supRerplOrder.trim().length() == 0)
...@@ -1275,6 +1344,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1275,6 +1344,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
} }
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
if( !"A".equalsIgnoreCase(pickTye))
{
sql = "UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL "; sql = "UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty ); pstmt.setDouble(1, DeallocQty );
...@@ -1287,6 +1358,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1287,6 +1358,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
System.out.println(parentReplOrder+" repl_order REPL_ORD_DET updated successfully "); System.out.println(parentReplOrder+" repl_order REPL_ORD_DET updated successfully ");
} }
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
}
sql = "UPDATE REPL_ISS_DET SET DEALLOC_QTY = (CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?) WHERE REPL_ORDER = ? AND LINE_NO__ORD = ?"; sql = "UPDATE REPL_ISS_DET SET DEALLOC_QTY = (CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?) WHERE REPL_ORDER = ? AND LINE_NO__ORD = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -1388,6 +1460,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1388,6 +1460,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
////////////////for pnd ////////////////for pnd
if( !"A".equalsIgnoreCase(pickTye))
{
sql = " UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL "; sql = " UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty ); pstmt.setDouble(1, DeallocQty );
...@@ -1400,6 +1474,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1400,6 +1474,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
System.out.println(parentReplOrder+" repl_order of REPL_ORD_DET updated successfully "); System.out.println(parentReplOrder+" repl_order of REPL_ORD_DET updated successfully ");
} }
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
}
sql = "UPDATE REPL_ORD_DET SET DEALLOC_QTY = (CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?) WHERE REPL_ORDER = ? AND LINE_NO = ?"; sql = "UPDATE REPL_ORD_DET SET DEALLOC_QTY = (CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?) WHERE REPL_ORDER = ? AND LINE_NO = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -1415,6 +1490,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1415,6 +1490,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
/////for dso repl /////for dso repl
if( !"A".equalsIgnoreCase(pickTye))
{
sql = " UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL "; sql = " UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty ); pstmt.setDouble(1, DeallocQty );
...@@ -1427,6 +1504,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1427,6 +1504,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
System.out.println(supRerplOrder+" repl_order of REPL_ORD_DET updated successfully "); System.out.println(supRerplOrder+" repl_order of REPL_ORD_DET updated successfully ");
} }
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
}
sql = "UPDATE REPL_ORD_DET SET DEALLOC_QTY = (CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?) WHERE REPL_ORDER = ? AND LINE_NO = ?"; sql = "UPDATE REPL_ORD_DET SET DEALLOC_QTY = (CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?) WHERE REPL_ORDER = ? AND LINE_NO = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -1538,7 +1616,58 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1538,7 +1616,58 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
pstmt.close();pstmt = null;*/ pstmt.close();pstmt = null;*/
} }
////////////////////// replenishment deallocating
/*if( currentReplOrder.trim().length() > 0 && "PSO".equalsIgnoreCase(invStat) && parentReplOrder.trim().length() == 0)
{
boolean recordFound = false;
sql = " SELECT (QUANTITY - CASE WHEN ACTUAL_QTY IS NULL THEN 0 ELSE ACTUAL_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
pstmt.setInt(2, replOrderLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
else
{
recordFound = false;
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if( quantity == 0 && recordFound)
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
pstmt.setInt(2, replOrderLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
}
// this below task is usefull for stock to dock case start
if( parentReplOrder.trim().length() > 0 ) if( parentReplOrder.trim().length() > 0 )
{
// -- PSO
boolean recordFound = false;
System.out.println(" inside repl deallocation pickTye["+pickTye+"]");
if( "S".equalsIgnoreCase(pickTye))
{ {
sql = " SELECT (QUANTITY - CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END ) AS QUANTITY " + sql = " SELECT (QUANTITY - CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ?"; " FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ?";
...@@ -1548,12 +1677,103 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1548,12 +1677,103 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if( rs.next()) if( rs.next())
{ {
recordFound = true;
quantity = rs.getDouble("QUANTITY"); quantity = rs.getDouble("QUANTITY");
} }
else
{
recordFound = false;
}
rs.close(); rs = null; rs.close(); rs = null;
pstmt.close(); pstmt = null; pstmt.close(); pstmt = null;
if( quantity == 0 ) if( quantity == 0 && recordFound)
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
}
else
{
////////////// FOR PSO TASK CANCELLING IF NO DEPENDANCY START
sql = " SELECT (QUANTITY - CASE WHEN ACTUAL_QTY IS NULL THEN 0 ELSE ACTUAL_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
else
{
recordFound = false;
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if( quantity == 0 && recordFound)
{
if( "DSO".equalsIgnoreCase(invStat) )
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
pstmt.setInt(2, replOrderLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
else if( "PSO".equalsIgnoreCase(invStat) )
{ {
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? "; sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -1575,7 +1795,14 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1575,7 +1795,14 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
pstmt.close(); pstmt = null; pstmt.close(); pstmt = null;
} }
} }
////////////// FOR PSO TASK CANCELLING IF NO DEPENDANCY END
}
}
if( supRerplOrder.trim().length() > 0 ) if( supRerplOrder.trim().length() > 0 )
{
boolean recordFound = false;
System.out.println(" inside DSO repl deallocation pickTye["+pickTye+"]");
if( "S".equalsIgnoreCase(pickTye))
{ {
sql = " SELECT (QUANTITY - CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END ) AS QUANTITY " + sql = " SELECT (QUANTITY - CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ?"; " FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ?";
...@@ -1585,12 +1812,13 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1585,12 +1812,13 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if( rs.next()) if( rs.next())
{ {
recordFound = true;
quantity = rs.getDouble("QUANTITY"); quantity = rs.getDouble("QUANTITY");
} }
rs.close(); rs = null; rs.close(); rs = null;
pstmt.close(); pstmt = null; pstmt.close(); pstmt = null;
if( quantity == 0 ) if( quantity == 0 && recordFound )
{ {
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? "; sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -1612,6 +1840,77 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1612,6 +1840,77 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
pstmt.close(); pstmt = null; pstmt.close(); pstmt = null;
} }
} }
else
{
////////////// FOR DSO TASK CANCELLING IF NO DEPENDANCY START
sql = " SELECT (QUANTITY - CASE WHEN ACTUAL_QTY IS NULL THEN 0 ELSE ACTUAL_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
pstmt.setInt(2, supReplLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
else
{
recordFound = false;
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
System.out.println("*********quantity ["+quantity+"] recordFound ["+recordFound+"]");
if( quantity == 0 && recordFound)
{
System.out.println(" PND deallocating ");
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(parentReplOrder+" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
///////////////////////////////////////////////
System.out.println(" DSO repl deallocating ");
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
pstmt.setInt(2, supReplLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(supRerplOrder+" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
////////////// FOR DSO TASK CANCELLING IF NO DEPENDANCY END
}
}*/
// this below task is usefull for stock to dock case end
} }
catch(Exception e) catch(Exception e)
...@@ -1637,28 +1936,767 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1637,28 +1936,767 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
return update; return update;
} }
private int updatePickOrder(String pickOrder, int pickLineNo, double DeallocQty, Connection conn, boolean isPickIssueDone,String pickType) throws ITMException private int confReplOrder(String currentReplOrder,int replOrderLine, String pickTye, String siteCode, String itemCode, String locCode, String lotNo, String lotSl, double DeallocQty, Connection conn, boolean isReplDone, String parentReplOrder, int parentReplOrdLine, String supRerplOrder,int supReplLine) throws ITMException
{ {
String sql = ""; String sql = "";
String dsoInvStat = "";
String psoInvStat = "";
String invStat = "";
double quantity = 0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
//boolean isDsoloc = false;
int update = 0; int update = 0;
boolean isAllDeallocated = false;
try try
{ {
System.out.println(" inside updatePickOrder *****"); System.out.println("confReplOrder pickTye ["+pickTye+"] currentReplOrder ["+currentReplOrder+"] isReplDone ["+isReplDone+"] parentReplOrder["+parentReplOrder+"] supRerplOrder ["+supRerplOrder+"] supReplLine ["+supReplLine+"]");
if( !isPickIssueDone )
{ //sql = "";
sql = " UPDATE PICK_ORD_DET SET DEALLOC_QTY = ( CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?)" + //sql = "UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? ";
" WHERE PICK_ORDER = ? AND LINE_NO = ? "; dsoInvStat = discommon.getDisparams("999999","DEEP_STORE_INVSTAT",conn).trim();
psoInvStat = discommon.getDisparams("999999","RESERVE_LOCATION",conn).trim();
System.out.println(" dsoInvStat ["+dsoInvStat+"] psoInvStat["+psoInvStat+"]");
sql = "SELECT INV_STAT FROM LOCATION WHERE LOC_CODE = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty ); pstmt.setString(1, locCode);
pstmt.setString(2, pickOrder); rs = pstmt.executeQuery();
pstmt.setInt(3, pickLineNo); if( rs.next())
update = pstmt.executeUpdate();
if( update > 0 )
{ {
System.out.println(pickOrder+" pick_order OF PICK_ORD_DET updated successfully "); if(dsoInvStat.equalsIgnoreCase(rs.getString("INV_STAT").trim()))
{
invStat = "DSO";
}
else if(psoInvStat.equalsIgnoreCase(rs.getString("INV_STAT").trim()))
{
invStat = "PSO";
}
else
{
invStat = "PND";
}
}
System.out.println(" inv_stat ["+invStat+"]");
rs.close(); rs = null;
pstmt.close(); pstmt = null;
////////////////////// replenishment deallocating
if( currentReplOrder.trim().length() > 0 && "PSO".equalsIgnoreCase(invStat) && parentReplOrder.trim().length() == 0)
{
boolean recordFound = false;
sql = " SELECT (QUANTITY - CASE WHEN ACTUAL_QTY IS NULL THEN 0 ELSE ACTUAL_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
pstmt.setInt(2, replOrderLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
else
{
recordFound = false;
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if( quantity == 0 && recordFound)
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
pstmt.setInt(2, replOrderLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
}
// this below task is usefull for stock to dock case start
if( parentReplOrder.trim().length() > 0 )
{
// -- PSO
boolean recordFound = false;
System.out.println(" inside repl deallocation pickTye["+pickTye+"]");
if( "S".equalsIgnoreCase(pickTye))
{
sql = " SELECT (QUANTITY - CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
else
{
recordFound = false;
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if( quantity == 0 && recordFound)
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
pstmt.setInt(2, replOrderLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
}
else
{
////////////// FOR PSO TASK CANCELLING IF NO DEPENDANCY START
sql = " SELECT (QUANTITY - CASE WHEN ACTUAL_QTY IS NULL THEN 0 ELSE ACTUAL_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
else
{
recordFound = false;
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if( quantity == 0 && recordFound)
{
if( "DSO".equalsIgnoreCase(invStat) )
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
pstmt.setInt(2, replOrderLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
else if( "PSO".equalsIgnoreCase(invStat) )
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
}
////////////// FOR PSO TASK CANCELLING IF NO DEPENDANCY END
}
}
if( supRerplOrder.trim().length() > 0 )
{
boolean recordFound = false;
System.out.println(" inside DSO repl deallocation pickTye["+pickTye+"]");
if( "S".equalsIgnoreCase(pickTye))
{
sql = " SELECT (QUANTITY - CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
pstmt.setInt(2, supReplLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if( quantity == 0 && recordFound )
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
pstmt.setInt(2, supReplLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
}
else
{
////////////// FOR DSO TASK CANCELLING IF NO DEPENDANCY START
sql = " SELECT (QUANTITY - CASE WHEN ACTUAL_QTY IS NULL THEN 0 ELSE ACTUAL_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
pstmt.setInt(2, supReplLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
else
{
recordFound = false;
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
System.out.println("*********quantity ["+quantity+"] recordFound ["+recordFound+"]");
if( quantity == 0 && recordFound)
{
System.out.println(" PND deallocating ");
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(parentReplOrder+" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
///////////////////////////////////////////////
System.out.println(" DSO repl deallocating ");
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
pstmt.setInt(2, supReplLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(supRerplOrder+" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
////////////// FOR DSO TASK CANCELLING IF NO DEPENDANCY END
}
}
// this below task is usefull for stock to dock case end
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if( pstmt != null)
{
pstmt.close(); pstmt = null;
}
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
return update;
}
private int confStockToDockReplOrder(String currentReplOrder,int replOrderLine, String pickTye, String siteCode, String itemCode, String locCode, String lotNo, String lotSl, double DeallocQty, Connection conn, boolean isReplDone, String parentReplOrder, int parentReplOrdLine, String supRerplOrder,int supReplLine) throws ITMException
{
String sql = "";
String dsoInvStat = "";
String psoInvStat = "";
String invStat = "";
double quantity = 0;
PreparedStatement pstmt = null;
ResultSet rs = null;
//boolean isDsoloc = false;
int update = 0;
try
{
System.out.println("confStockToDockReplOrder pickTye ["+pickTye+"] currentReplOrder ["+currentReplOrder+"] isReplDone ["+isReplDone+"] parentReplOrder["+parentReplOrder+"] supRerplOrder ["+supRerplOrder+"] supReplLine ["+supReplLine+"]");
if("S".equalsIgnoreCase(pickTye))
{
if( parentReplOrder.trim().length() > 0 )
{
sql = " UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty );
pstmt.setString(2, parentReplOrder);
pstmt.setInt(3, parentReplOrdLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
{
System.out.println(parentReplOrder+" repl_order of REPL_ORD_DET updated successfully ");
}
pstmt.close();pstmt = null;
sql = "UPDATE REPL_ORD_DET SET DEALLOC_QTY = (CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?) WHERE REPL_ORDER = ? AND LINE_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty );
pstmt.setString(2, parentReplOrder);
pstmt.setInt(3, parentReplOrdLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
{
System.out.println(parentReplOrder+" repl_order OF REPL_ORD_DET updated successfully ");
}
pstmt.close();pstmt = null;
sql = " UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty );
pstmt.setString(2, currentReplOrder);
pstmt.setInt(3, replOrderLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
{
System.out.println(parentReplOrder+" repl_order of REPL_ORD_DET updated successfully ");
}
pstmt.close();pstmt = null;
sql = "UPDATE REPL_ORD_DET SET DEALLOC_QTY = (CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?) WHERE REPL_ORDER = ? AND LINE_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty );
pstmt.setString(2, currentReplOrder);
pstmt.setInt(3, replOrderLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
{
System.out.println(parentReplOrder+" repl_order OF REPL_ORD_DET updated successfully ");
}
pstmt.close();pstmt = null;
}
if( parentReplOrder.trim().length() == 0 )
{
sql = " UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ?) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty );
pstmt.setString(2, currentReplOrder);
pstmt.setInt(3, replOrderLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
{
System.out.println(parentReplOrder+" repl_order of REPL_ORD_DET updated successfully ");
}
pstmt.close();pstmt = null;
sql = "UPDATE REPL_ORD_DET SET DEALLOC_QTY = (CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?) WHERE REPL_ORDER = ? AND LINE_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty );
pstmt.setString(2, currentReplOrder);
pstmt.setInt(3, replOrderLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
{
System.out.println(parentReplOrder+" repl_order OF REPL_ORD_DET updated successfully ");
}
pstmt.close();pstmt = null;
}
}
// this below task is usefull for stock to dock case start
if( parentReplOrder.trim().length() == 0 && "S".equalsIgnoreCase(pickTye))
{
boolean recordFound = false;
sql = " SELECT (QUANTITY - CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
pstmt.setInt(2, replOrderLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
else
{
recordFound = false;
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if( quantity == 0 && recordFound)
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
pstmt.setInt(2, replOrderLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
}
if( parentReplOrder.trim().length() > 0 )
{
// -- PSO
boolean recordFound = false;
System.out.println(" inside repl deallocation pickTye["+pickTye+"]");
if( "S".equalsIgnoreCase(pickTye))
{
sql = " SELECT (QUANTITY - CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
else
{
recordFound = false;
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if( quantity == 0 && recordFound)
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
pstmt.setInt(2, replOrderLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, currentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
}
}
/*if( supRerplOrder.trim().length() > 0 )
{
boolean recordFound = false;
System.out.println(" inside DSO repl deallocation pickTye["+pickTye+"]");
if( "S".equalsIgnoreCase(pickTye))
{
sql = " SELECT (QUANTITY - CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
pstmt.setInt(2, supReplLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if( quantity == 0 && recordFound )
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
pstmt.setInt(2, supReplLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
}
else
{
////////////// FOR DSO TASK CANCELLING IF NO DEPENDANCY START
sql = " SELECT (QUANTITY - CASE WHEN ACTUAL_QTY IS NULL THEN 0 ELSE ACTUAL_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
pstmt.setInt(2, supReplLine);
rs = pstmt.executeQuery();
if( rs.next())
{
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
else
{
recordFound = false;
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
System.out.println("*********quantity ["+quantity+"] recordFound ["+recordFound+"]");
if( quantity == 0 && recordFound)
{
System.out.println(" PND deallocating ");
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(parentReplOrder+" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
///////////////////////////////////////////////
System.out.println(" DSO repl deallocating ");
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
pstmt.setInt(2, supReplLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(supRerplOrder+" REPL_ORD_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, supRerplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
}
////////////// FOR DSO TASK CANCELLING IF NO DEPENDANCY END
}
}*/
// this below task is usefull for stock to dock case end
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if( pstmt != null)
{
pstmt.close(); pstmt = null;
}
}
catch(Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
}
return update;
}
private int updatePickOrder(String pickOrder, int pickLineNo, double DeallocQty, Connection conn, boolean isPickIssueDone,String pickType) throws ITMException
{
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
int update = 0;
boolean isAllDeallocated = false;
try
{
System.out.println(" inside updatePickOrder *****");
if( !isPickIssueDone )
{
sql = " UPDATE PICK_ORD_DET SET DEALLOC_QTY = ( CASE WHEN DEALLOC_QTY IS NULL THEN 0 ELSE DEALLOC_QTY END + ?)" +
" WHERE PICK_ORDER = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, DeallocQty );
pstmt.setString(2, pickOrder);
pstmt.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
{
System.out.println(pickOrder+" pick_order OF PICK_ORD_DET updated successfully ");
} }
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
...@@ -1758,7 +2796,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1758,7 +2796,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
return update; return update;
} }
private int updateWaveTaskDet(String refId, String task, Connection conn , String pickType, String empCode ) throws ITMException private int updateWaveTaskDet(String refId, String task, Connection conn , String pickType, String empCode) throws ITMException
{ {
String sql = ""; String sql = "";
double quantity = 0.0; double quantity = 0.0;
...@@ -1786,6 +2824,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1786,6 +2824,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
if( quantity == 0 ) if( quantity == 0 )
{ {
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ? AND STATUS = 'N'"; sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ? AND STATUS = 'N'";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refId); pstmt.setString(1, refId);
...@@ -1795,9 +2834,11 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -1795,9 +2834,11 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
{ {
System.out.println(refId+ " WAVE_TASK_DET is updated susessfully "); System.out.println(refId+ " WAVE_TASK_DET is updated susessfully ");
} }
if("M".equalsIgnoreCase(pickType)) if("M".equalsIgnoreCase(pickType))
{ {
sql = "UPDATE PACK_HDR SET CONFIRMED = 'Y', CONF_DATE = ?, EMP_CODE__APRV = ? WHERE PICK_ORDER = ?"; sql = "UPDATE PACK_HDR SET CONFIRMED = 'Y', CONF_DATE = ?, EMP_CODE__APRV = ? WHERE PICK_ORDER = ? AND CONFIRMED = 'N'";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, currDate); pstmt.setTimestamp(1, currDate);
pstmt.setString(2, empCode); pstmt.setString(2, empCode);
pstmt.setString(3, refId); pstmt.setString(3, refId);
...@@ -2047,18 +3088,20 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -2047,18 +3088,20 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
return task; return task;
} }
private String updateReplOrderForActive(String pickType, String replOrder,int replLine, String empCode, Connection conn) throws ITMException private String updateReplOrderForActive(String pickType, String replOrder,int replLine, String empCode, Connection conn, String parentReplOrder, int parentReplOrdLine, String supRerplOrder,int supReplLine) throws ITMException
{ {
String sql = ""; String sql = "";
double quantity = 0.0; double quantity = 0.0;
double realQty = 0.0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
java.sql.Timestamp currDate = new java.sql.Timestamp( System.currentTimeMillis() ); java.sql.Timestamp currDate = new java.sql.Timestamp( System.currentTimeMillis() );
try try
{ {
System.out.println(" current repl ["+replOrder+"] currreplLine ["+replLine+"] parentReplOrder ["+parentReplOrder+"] parentReplOrdLine ["+parentReplOrdLine+"] supRerplOrder ["+supRerplOrder+"] supReplLine ["+supReplLine+"]");
if("A".equalsIgnoreCase(pickType)) if("A".equalsIgnoreCase(pickType))
{ {
sql = " SELECT SUM(ROD.QUANTITY - CASE WHEN ROD.ACTUAL_QTY IS NULL THEN 0 ELSE ROD.ACTUAL_QTY END ) AS QUANTITY " + sql = " SELECT QUANTITY AS REL_QTY, (ROD.QUANTITY - CASE WHEN ROD.ACTUAL_QTY IS NULL THEN 0 ELSE ROD.ACTUAL_QTY END ) AS QUANTITY " +
" FROM REPL_ORD_DET ROD, REPL_ORD_HDR ROH WHERE ROD.REPL_ORDER = ? AND ROD.LINE_NO = ? " + " FROM REPL_ORD_DET ROD, REPL_ORD_HDR ROH WHERE ROD.REPL_ORDER = ? AND ROD.LINE_NO = ? " +
" AND ROH.REPL_ORDER = ROD.REPL_ORDER AND ROH.ORDER_TYPE = 'Q' "; " AND ROH.REPL_ORDER = ROD.REPL_ORDER AND ROH.ORDER_TYPE = 'Q' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -2068,6 +3111,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -2068,6 +3111,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
if( rs.next()) if( rs.next())
{ {
quantity = rs.getDouble("QUANTITY"); quantity = rs.getDouble("QUANTITY");
realQty = rs.getDouble("REL_QTY");
} }
rs.close(); rs = null; rs.close(); rs = null;
pstmt.close(); pstmt = null; pstmt.close(); pstmt = null;
...@@ -2103,6 +3147,34 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -2103,6 +3147,34 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
System.out.println(" wave_task_det updated succesfully"); System.out.println(" wave_task_det updated succesfully");
} }
pstmt.close(); pstmt = null; pstmt.close(); pstmt = null;
if(parentReplOrder.trim().length() > 0)
{
sql = " UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ? ) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, realQty);
pstmt.setString(2, parentReplOrder);
pstmt.setInt(3, parentReplOrdLine);
if( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully");
}
pstmt.close(); pstmt = null;
}
if(supRerplOrder.trim().length() > 0)
{
sql = " UPDATE REPL_ORD_DET SET ACTUAL_QTY = ( ACTUAL_QTY + ? ) WHERE REPL_ORDER = ? AND LINE_NO = ? AND ACTUAL_QTY IS NOT NULL ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, realQty);
pstmt.setString(2, supRerplOrder);
pstmt.setInt(3, supReplLine);
if( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully");
}
pstmt.close(); pstmt = null;
}
} }
/*sql = " SELECT SUM(ROD.QUANTITY - CASE WHEN ROD.ACTUAL_QTY IS NULL THEN 0 ELSE ROD.ACTUAL_QTY END ) AS QUANTITY " + /*sql = " SELECT SUM(ROD.QUANTITY - CASE WHEN ROD.ACTUAL_QTY IS NULL THEN 0 ELSE ROD.ACTUAL_QTY END ) AS QUANTITY " +
...@@ -2160,11 +3232,11 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -2160,11 +3232,11 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
return null; return null;
} }
private String deallocatedRepl(String refId, int pickLineNo,String siteCode, String itemCode, String lotNo, String lotSl, double DeallocQty,String saleOrder, String saleOrderLine, String expLev,String custCode,String xtraParams,String waveId,String cartonNo, Connection conn) throws ITMException private String deallocatedRepl(String refId, int pickLineNo,String pickType,String siteCode, String itemCode, String lotNo, String lotSl, double DeallocQty,String saleOrder, String saleOrderLine, String expLev,String custCode,String xtraParams,String waveId,String cartonNo, Connection conn) throws ITMException
{ {
String sql = ""; String sql = "";
String confirmed =""; String confirmed ="";
String pickType = ""; //String pickType = "";
String locCode =""; String locCode ="";
String locCodeTo = ""; String locCodeTo = "";
String replOrder = ""; String replOrder = "";
...@@ -2240,7 +3312,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -2240,7 +3312,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
lotSl = replParent.get("lot_sl").toString(); lotSl = replParent.get("lot_sl").toString();
//System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]"); //System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]");
updateReplOrder(refId, pickLineNo, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, true, replPickOrder, replPickLine,"",0); //updateReplOrder(refId, pickLineNo,pickType, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, true, "", 0,"",0);
confStockToDockReplOrder(refId, pickLineNo,pickType, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, true, "", 0,"",0);
} }
else if ("N".equalsIgnoreCase(confirmed) /*&& "NO".equalsIgnoreCase(replParent.get("paren_exist").toString())*/) //parentExist.put("paren_exist", "NO"); else if ("N".equalsIgnoreCase(confirmed) /*&& "NO".equalsIgnoreCase(replParent.get("paren_exist").toString())*/) //parentExist.put("paren_exist", "NO");
...@@ -2253,7 +3326,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -2253,7 +3326,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
//updateReplOrder(replOrder, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn); //updateReplOrder(replOrder, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn);
//updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn); //updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn);
updateReplOrder(refId, pickLineNo, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, false, replPickOrder, replPickLine,"",0); //updateReplOrder(refId, pickLineNo,pickType, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, false, replPickOrder, replPickLine,"",0);
confStockToDockReplOrder(refId, pickLineNo,pickType, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, false, replPickOrder, replPickLine,"",0);
} }
/*else if ( "N".equalsIgnoreCase(confirmed) && "YES".equalsIgnoreCase(replParent.get("paren_exist").toString())) /*else if ( "N".equalsIgnoreCase(confirmed) && "YES".equalsIgnoreCase(replParent.get("paren_exist").toString()))
{ {
...@@ -2299,7 +3373,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -2299,7 +3373,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
} }
else else
{ {
updateReplOrder(refId, pickLineNo, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, true, "", 0,"",0); //updateReplOrder(refId, pickLineNo,pickType, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, true, "", 0,"",0);
confStockToDockReplOrder(refId, pickLineNo,pickType, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, true, "", 0,"",0);
} }
} }
...@@ -2319,7 +3394,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo ...@@ -2319,7 +3394,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
/*stockDetail.put("loc_code", locCode); /*stockDetail.put("loc_code", locCode);
stockDetail.put("ref_id", refId); stockDetail.put("ref_id", refId);
stockDetail.put("ref_line_no", pickLineNo);*/ stockDetail.put("ref_line_no", pickLineNo);*/
updateReplOrder(refId, pickLineNo, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, true, "", 0,"",0); //updateReplOrder(refId, pickLineNo,pickType, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, true, "", 0,"",0);
} }
System.out.println(" final locCode ["+locCode+"]"); System.out.println(" final locCode ["+locCode+"]");
......
...@@ -612,6 +612,7 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal, ...@@ -612,6 +612,7 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
String lotSl ="", saleOrder =""; String lotSl ="", saleOrder ="";
String lineNoSord = "",cartonPickOrder = ""; String lineNoSord = "",cartonPickOrder = "";
String cartonPickLine = "", confirmed = ""; String cartonPickLine = "", confirmed = "";
String pndInvStat = "";
int tranLineNo = 0; int tranLineNo = 0;
java.sql.Date currDate = new java.sql.Date( System.currentTimeMillis() ); java.sql.Date currDate = new java.sql.Date( System.currentTimeMillis() );
...@@ -849,8 +850,24 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal, ...@@ -849,8 +850,24 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
} }
// CHECKING QUANTITY AGAINST // CHECKING QUANTITY AGAINST
if( !"S".equalsIgnoreCase(pickType))
{
pndInvStat = discommon.getDisparams("999999","PND_INVSTAT",conn);
sql = "SELECT LOC_CODE FROM LOCATION WHERE LOC_CODE = ? AND INV_STAT = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, locCode);
pstmt1.setString(2, pndInvStat);
rs = pstmt1.executeQuery();
if( rs.next())
{
errString="INVDEALLQ5";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
return errString;
}
rs.close(); rs = null;
pstmt1.close(); pstmt1 = null;
}
//sql = " "
String refId = checkForReplOrPick(pickOrder, conn); String refId = checkForReplOrPick(pickOrder, conn);
if("REPL".equalsIgnoreCase(refId)) if("REPL".equalsIgnoreCase(refId))
{ {
...@@ -924,7 +941,10 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal, ...@@ -924,7 +941,10 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
deallocArtConfLocal = (DeallocArtConfLocal)ctx.lookup("ibase/DeallocArtConf/local"); deallocArtConfLocal = (DeallocArtConfLocal)ctx.lookup("ibase/DeallocArtConf/local");
errString = deallocArtConfLocal.confirm(tranId, xtraParams, "", conn, false); errString = deallocArtConfLocal.confirm(tranId, xtraParams, "", conn, false);
System.out.println(" ************ errString ******** ["+errString+"]"); System.out.println(" ************ errString ******** ["+errString+"]");
if (errString.indexOf("VTSUCC1") > -1)
{
errString = "";
}
}//try end }//try end
catch(Exception e) catch(Exception e)
...@@ -932,7 +952,7 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal, ...@@ -932,7 +952,7 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
e.printStackTrace(); e.printStackTrace();
try try
{ {
if ( conn != null && !conn.isClosed() ) if ( conn != null && !conn.isClosed())
{ {
conn.rollback(); conn.rollback();
} }
...@@ -961,8 +981,8 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal, ...@@ -961,8 +981,8 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
else else
{ {
System.out.println("errString.indexOf(<Errors>)---------------"+errString.indexOf("<Errors>")); System.out.println("errString.indexOf(<Errors>)---------------"+errString.indexOf("<Errors>"));
if(errString.indexOf("<Errors>") == -1 ) /*if(errString.indexOf("<Errors>") == -1 )
{ {*/
if( errString.trim().length() > 0) if( errString.trim().length() > 0)
{ {
conn.rollback(); conn.rollback();
...@@ -970,7 +990,7 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal, ...@@ -970,7 +990,7 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
errString="VTPRCERR"; errString="VTPRCERR";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn); errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
} }
} //}
} }
if( rs != null ) if( rs != 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