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
String loginEmpCode = "";
String confDateStr = "";
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
* @param : tranId
......@@ -217,7 +218,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
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, "");
continue;
}
......@@ -288,8 +289,9 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]");
//Updating pick_order
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);
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");
......@@ -299,10 +301,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
//lotSl = replParent.get("lot_sl").toString();
System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]");
isReplDone = false;
updateReplOrder(replOrder,replOrderLine, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0,"",0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updateReplOrderForActive(pPickType, replOrder,replOrderLine, empCode, conn);
updateReplOrder(replOrder,replOrderLine, siteCode,pPickType, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0,"",0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updateReplOrderForActive(pPickType, replOrder,replOrderLine, empCode, conn, "",0,"",0);
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()))
{
......@@ -331,9 +333,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
//System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]");
isReplDone = true;
updateReplOrder(currentReplOrder,currReplOrdLine, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0, "", 0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn);
updateReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, "",0, "", 0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
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");
{
......@@ -343,9 +346,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
//System.out.println(" locCode ["+locCode+"] lotNo ["+lotNo+"] lotSl ["+lotSl+"]");
isReplDone = false;
updateReplOrder(currentReplOrder,currReplOrdLine, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,"", 0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn);
updateReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,"", 0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
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()))
{
......@@ -363,16 +367,19 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
if("Y".equalsIgnoreCase(confirmed))
{
isReplDone = true;
updateReplOrder(currentReplOrder,currReplOrdLine, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,"", 0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn);
updateReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,"", 0);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
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");
{
//confReplOrder
isReplDone = false;
updateReplOrder(currentReplOrder,currReplOrdLine, siteCode, itemCode, locCodeTo, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,supRerplOrder, supReplLine);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updateReplOrderForActive(pPickType, currentReplOrder,currReplOrdLine, empCode, conn);
updateReplOrder(currentReplOrder,currReplOrdLine,pPickType, siteCode, itemCode, locCode, lotNo, lotSl, DeallocQty, conn, isReplDone, replOrder,replOrderLine,supRerplOrder, supReplLine);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
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);
}
}
......@@ -381,12 +388,13 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
}
else
{
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
}
}
else
{
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
updatePickOrder(pickOrder, pickLineNo, DeallocQty, conn, isPickIssueDone,pPickType);
}
int update = updateWaveTaskDet(pickOrder, "PICK", conn, pPickType, empCode);
......@@ -436,10 +444,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
sql = "UPDATE PACK_DET SET STATUS = 'R' WHERE CARTON_NO = ? ";
pstmt2 = conn.prepareStatement(sql);
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;
}
......@@ -523,9 +531,10 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
try
{
System.out.println("isError =["+isError+"]");
System.out.println("Commiting and Closing Connection..........");
if ( !(isError) && conStat == true )
{
{
System.out.println("Commiting and Closing Connection..........");
conn.commit();
errString = itmdbAccess.getErrorString("","VTSUCC1",loginEmpCode);
}
......@@ -546,6 +555,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
}
if( conn != null && conStat == true && !conn.isClosed() )
{
System.out.println(" commiting connection ");
conn.commit();
conn.close();
conn = null;
}
......@@ -1164,18 +1175,76 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
return parentExist;
}
// 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 dsoInvStat = "";
String psoInvStat = "";
String invStat = "";
double quantity = 0;
PreparedStatement pstmt = null;
ResultSet rs = null;
//boolean isDsoloc = false;
int update = 0;
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 = "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)
{
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
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.setDouble(1, DeallocQty );
pstmt.setString(2, currentReplOrder);
......@@ -1231,7 +1300,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
{
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)
......@@ -1275,18 +1344,21 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
}
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, parentReplOrder);
pstmt.setInt(3, parentReplOrdLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
if( !"A".equalsIgnoreCase(pickTye))
{
System.out.println(parentReplOrder+" repl_order 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, parentReplOrder);
pstmt.setInt(3, parentReplOrdLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
{
System.out.println(parentReplOrder+" repl_order REPL_ORD_DET updated successfully ");
}
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 = ?";
pstmt = conn.prepareStatement(sql);
......@@ -1388,18 +1460,21 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
pstmt.close();pstmt = null;
////////////////for pnd
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;
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 ";
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);
......@@ -1414,19 +1489,22 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
}
pstmt.close();pstmt = null;
/////for dso repl
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, supRerplOrder);
pstmt.setInt(3, supReplLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
/////for dso repl
if( !"A".equalsIgnoreCase(pickTye))
{
System.out.println(supRerplOrder+" 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, supRerplOrder);
pstmt.setInt(3, supReplLine);
//pstmt2.setInt(3, pickLineNo);
update = pstmt.executeUpdate();
if( update > 0 )
{
System.out.println(supRerplOrder+" 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);
......@@ -1538,27 +1616,34 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
pstmt.close();pstmt = null;*/
}
if( parentReplOrder.trim().length() > 0 )
////////////////////// replenishment deallocating
/*if( currentReplOrder.trim().length() > 0 && "PSO".equalsIgnoreCase(invStat) && parentReplOrder.trim().length() == 0)
{
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 = ?";
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, parentReplOrder);
pstmt.setInt(2, parentReplOrdLine);
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 )
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);
pstmt.setString(1, currentReplOrder);
pstmt.setInt(2, replOrderLine);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" REPL_ORD_DET updated succesfully ");
......@@ -1567,51 +1652,265 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
pstmt.setString(1, currentReplOrder);
if ( pstmt.executeUpdate() > 0 )
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
}
pstmt.close(); pstmt = null;
pstmt.close(); pstmt = null;
}
}
if( supRerplOrder.trim().length() > 0 )
{
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())
// 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))
{
quantity = rs.getDouble("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 = ?";
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;
}
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if( quantity == 0 )
else
{
sql = "UPDATE REPL_ORD_DET SET CANCEL_MODE = 'Y' WHERE REPL_ORDER = ? AND LINE_NO = ? ";
////////////// 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);
if ( pstmt.executeUpdate() > 0 )
rs = pstmt.executeQuery();
if( rs.next())
{
System.out.println(" REPL_ORD_DET updated succesfully ");
recordFound = true;
quantity = rs.getDouble("QUANTITY");
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ?";
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);
if ( pstmt.executeUpdate() > 0 )
pstmt.setString(1, supRerplOrder);
pstmt.setInt(2, supReplLine);
rs = pstmt.executeQuery();
if( rs.next())
{
System.out.println(" WAVE_TASK_DET updated succesfully ");
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;
}
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)
......@@ -1637,22 +1936,761 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
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 dsoInvStat = "";
String psoInvStat = "";
String invStat = "";
double quantity = 0;
PreparedStatement pstmt = null;
ResultSet rs = null;
//boolean isDsoloc = false;
int update = 0;
boolean isAllDeallocated = false;
try
{
System.out.println(" inside updatePickOrder *****");
if( !isPickIssueDone )
System.out.println("confReplOrder pickTye ["+pickTye+"] currentReplOrder ["+currentReplOrder+"] isReplDone ["+isReplDone+"] parentReplOrder["+parentReplOrder+"] supRerplOrder ["+supRerplOrder+"] supReplLine ["+supReplLine+"]");
//sql = "";
//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())
{
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 );
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();
......@@ -1758,7 +2796,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
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 = "";
double quantity = 0.0;
......@@ -1786,6 +2824,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
if( quantity == 0 )
{
sql = "UPDATE WAVE_TASK_DET SET STATUS = 'Y' WHERE REF_ID = ? AND STATUS = 'N'";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refId);
......@@ -1795,9 +2834,11 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
{
System.out.println(refId+ " WAVE_TASK_DET is updated susessfully ");
}
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.setString(2, empCode);
pstmt.setString(3, refId);
......@@ -2047,18 +3088,20 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
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 = "";
double quantity = 0.0;
double realQty = 0.0;
PreparedStatement pstmt = null;
ResultSet rs = null;
java.sql.Timestamp currDate = new java.sql.Timestamp( System.currentTimeMillis() );
try
{
System.out.println(" current repl ["+replOrder+"] currreplLine ["+replLine+"] parentReplOrder ["+parentReplOrder+"] parentReplOrdLine ["+parentReplOrdLine+"] supRerplOrder ["+supRerplOrder+"] supReplLine ["+supReplLine+"]");
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 = ? " +
" AND ROH.REPL_ORDER = ROD.REPL_ORDER AND ROH.ORDER_TYPE = 'Q' ";
pstmt = conn.prepareStatement(sql);
......@@ -2068,6 +3111,7 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
if( rs.next())
{
quantity = rs.getDouble("QUANTITY");
realQty = rs.getDouble("REL_QTY");
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
......@@ -2103,6 +3147,34 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
System.out.println(" wave_task_det updated succesfully");
}
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 " +
......@@ -2160,11 +3232,11 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
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 confirmed ="";
String pickType = "";
//String pickType = "";
String locCode ="";
String locCodeTo = "";
String replOrder = "";
......@@ -2239,8 +3311,9 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
lotNo = replParent.get("lot_no").toString();
lotSl = replParent.get("lot_sl").toString();
//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");
......@@ -2253,7 +3326,8 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
//updateReplOrder(replOrder, siteCode, itemCode, locCodeTo, lotNo, lotSl, 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()))
{
......@@ -2298,8 +3372,9 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
} */
}
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
/*stockDetail.put("loc_code", locCode);
stockDetail.put("ref_id", refId);
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+"]");
......
......@@ -612,6 +612,7 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
String lotSl ="", saleOrder ="";
String lineNoSord = "",cartonPickOrder = "";
String cartonPickLine = "", confirmed = "";
String pndInvStat = "";
int tranLineNo = 0;
java.sql.Date currDate = new java.sql.Date( System.currentTimeMillis() );
......@@ -849,8 +850,24 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
}
// 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);
if("REPL".equalsIgnoreCase(refId))
{
......@@ -924,7 +941,10 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
deallocArtConfLocal = (DeallocArtConfLocal)ctx.lookup("ibase/DeallocArtConf/local");
errString = deallocArtConfLocal.confirm(tranId, xtraParams, "", conn, false);
System.out.println(" ************ errString ******** ["+errString+"]");
if (errString.indexOf("VTSUCC1") > -1)
{
errString = "";
}
}//try end
catch(Exception e)
......@@ -932,7 +952,7 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
e.printStackTrace();
try
{
if ( conn != null && !conn.isClosed() )
if ( conn != null && !conn.isClosed())
{
conn.rollback();
}
......@@ -961,8 +981,8 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
else
{
System.out.println("errString.indexOf(<Errors>)---------------"+errString.indexOf("<Errors>"));
if(errString.indexOf("<Errors>") == -1 )
{
/*if(errString.indexOf("<Errors>") == -1 )
{*/
if( errString.trim().length() > 0)
{
conn.rollback();
......@@ -970,7 +990,7 @@ public class DeallocArtPrc extends ProcessEJB implements WaveGenerationPrcLocal,
errString="VTPRCERR";
errString = itmDBAccessEJB.getErrorString("",errString,"","",conn);
}
}
//}
}
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