Commit a0470ddb authored by ssalve's avatar ssalve

changes made for Replenishment issue confirmation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@43871 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4c7feb4b
...@@ -130,7 +130,8 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -130,7 +130,8 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
double shipperSize = 0,itemGrossWeight = 0, caseGrossWeight = 0, itemNetWeight = 0, caseNetWeight = 0; double shipperSize = 0,itemGrossWeight = 0, caseGrossWeight = 0, itemNetWeight = 0, caseNetWeight = 0;
int updCnt = 0, lineNo = 0 , lineNoPick = 0 ; int updCnt = 0, lineNo = 0 , lineNoPick = 0 ;
// added by sarita 22.05.2017
int updCnt1 = 0;
HashMap updateRowMap = null; HashMap updateRowMap = null;
HashMap strAllocate = null; HashMap strAllocate = null;
HashMap itmVolumeMap = null; HashMap itmVolumeMap = null;
...@@ -142,9 +143,13 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -142,9 +143,13 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement pstmtStock = null; PreparedStatement pstmtStock = null;
PreparedStatement pstmtUpd = null, pstmt1 = null,pstmtPick = null; PreparedStatement pstmtUpd = null, pstmt1 = null,pstmtPick = null;
// Added by sarita 22.05.2017
PreparedStatement pstmt3=null;
PreparedStatement pstmtReplUpd = null; PreparedStatement pstmtReplUpd = null;
ResultSet rsStock = null,rsPick = null; ResultSet rsStock = null,rsPick = null;
ResultSet rs = null, rs1 = null; ResultSet rs = null, rs1 = null;
// Added by sarita 22.05.2017
ResultSet rs3=null;
boolean isError = false; boolean isError = false;
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
...@@ -167,6 +172,8 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -167,6 +172,8 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
double holdQuantity =0.0; double holdQuantity =0.0;
//Changed by Dhanraj 22/JUL/14 to get actual rate and set in map for update. //Changed by Dhanraj 22/JUL/14 to get actual rate and set in map for update.
double actualRate =0.0; double actualRate =0.0;
// Added by sarita 22.05.2017
int cnt = 0;
try try
{ {
...@@ -1166,19 +1173,33 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -1166,19 +1173,33 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
//changed by manish on 18/09/15 for Ms sql server database [start] //changed by manish on 18/09/15 for Ms sql server database [start]
if("mssql".equalsIgnoreCase(DB)) if("mssql".equalsIgnoreCase(DB))
{ {
sql = " SELECT S.SALE_ORDER, S.LINE_NO,S.QTY_ALLOC, S.EXP_LEV, S.ITEM_CODE, S.LOT_NO, S.LOT_SL, S.LOC_CODE, " + //Commented and Changes by Santosh on 18/05/2017 [Start]
/*sql = " SELECT S.SALE_ORDER, S.LINE_NO,S.QTY_ALLOC, S.EXP_LEV, S.ITEM_CODE, S.LOT_NO, S.LOT_SL, S.LOC_CODE, " +
" S.ALLOC_MODE,S.QUANTITY FROM SORDALLOC S " + " S.ALLOC_MODE,S.QUANTITY FROM SORDALLOC S " +
" WHERE S.ITEM_CODE = ? AND S.LOT_NO = ? AND S.LOT_SL = ? AND S.LOC_CODE = ? AND CASE WHEN WAVE_FLAG IS NULL THEN 'N' ELSE WAVE_FLAG END <> 'Y' " + " WHERE S.ITEM_CODE = ? AND S.LOT_NO = ? AND S.LOT_SL = ? AND S.LOC_CODE = ? AND CASE WHEN WAVE_FLAG IS NULL THEN 'N' ELSE WAVE_FLAG END <> 'Y' " +
" AND isnull((SELECT COUNT(1) FROM REPL_ORD_DET R WHERE R.SALE_ORDER = S.SALE_ORDER AND R.LINE_NO__SORD = S.LINE_NO ),0) = 0 " + " AND isnull((SELECT COUNT(1) FROM REPL_ORD_DET R WHERE R.SALE_ORDER = S.SALE_ORDER AND R.LINE_NO__SORD = S.LINE_NO ),0) = 0 " +
" AND S.QTY_ALLOC >0 ORDER BY QTY_ALLOC ";*/
sql = " SELECT S.SALE_ORDER, S.LINE_NO,S.QTY_ALLOC, S.EXP_LEV, S.ITEM_CODE, S.LOT_NO, S.LOT_SL, S.LOC_CODE, " +
" S.ALLOC_MODE,S.QUANTITY FROM SORDALLOC S " +
" WHERE S.ITEM_CODE = ? AND S.LOT_NO = ? AND S.LOT_SL = ? AND S.LOC_CODE = ? AND CASE WHEN WAVE_FLAG IS NULL THEN 'N' ELSE WAVE_FLAG END <> 'Y' " +
" AND isnull((SELECT COUNT(1) FROM REPL_ORD_DET R WHERE R.SALE_ORDER = S.SALE_ORDER AND R.LINE_NO__SORD = S.LINE_NO AND CASE WHEN CANCEL_MODE IS NULL THEN 'N' ELSE CANCEL_MODE END <> 'Y'),0) = 0 " +
" AND S.QTY_ALLOC >0 ORDER BY QTY_ALLOC "; " AND S.QTY_ALLOC >0 ORDER BY QTY_ALLOC ";
//Commented and Changes by Santosh on 18/05/2017 [End]
} }
else else
{ {
sql = " SELECT S.SALE_ORDER, S.LINE_NO,S.QTY_ALLOC, S.EXP_LEV, S.ITEM_CODE, S.LOT_NO, S.LOT_SL, S.LOC_CODE, " + //Commented and Changes by Santosh on 18/05/2017 [Start]
/*sql = " SELECT S.SALE_ORDER, S.LINE_NO,S.QTY_ALLOC, S.EXP_LEV, S.ITEM_CODE, S.LOT_NO, S.LOT_SL, S.LOC_CODE, " +
" S.ALLOC_MODE,S.QUANTITY FROM SORDALLOC S " + " S.ALLOC_MODE,S.QUANTITY FROM SORDALLOC S " +
" WHERE S.ITEM_CODE = ? AND S.LOT_NO = ? AND S.LOT_SL = ? AND S.LOC_CODE = ? AND CASE WHEN WAVE_FLAG IS NULL THEN 'N' ELSE WAVE_FLAG END <> 'Y' " + " WHERE S.ITEM_CODE = ? AND S.LOT_NO = ? AND S.LOT_SL = ? AND S.LOC_CODE = ? AND CASE WHEN WAVE_FLAG IS NULL THEN 'N' ELSE WAVE_FLAG END <> 'Y' " +
" AND NVL((SELECT COUNT(1) FROM REPL_ORD_DET R WHERE R.SALE_ORDER = S.SALE_ORDER AND R.LINE_NO__SORD = S.LINE_NO ),0) = 0 " + " AND NVL((SELECT COUNT(1) FROM REPL_ORD_DET R WHERE R.SALE_ORDER = S.SALE_ORDER AND R.LINE_NO__SORD = S.LINE_NO ),0) = 0 " +
" AND S.QTY_ALLOC >0 ORDER BY QTY_ALLOC ";*/
sql = " SELECT S.SALE_ORDER, S.LINE_NO,S.QTY_ALLOC, S.EXP_LEV, S.ITEM_CODE, S.LOT_NO, S.LOT_SL, S.LOC_CODE, " +
" S.ALLOC_MODE,S.QUANTITY FROM SORDALLOC S " +
" WHERE S.ITEM_CODE = ? AND S.LOT_NO = ? AND S.LOT_SL = ? AND S.LOC_CODE = ? AND CASE WHEN WAVE_FLAG IS NULL THEN 'N' ELSE WAVE_FLAG END <> 'Y' " +
" AND NVL((SELECT COUNT(1) FROM REPL_ORD_DET R WHERE R.SALE_ORDER = S.SALE_ORDER AND R.LINE_NO__SORD = S.LINE_NO AND CASE WHEN CANCEL_MODE IS NULL THEN 'N' ELSE CANCEL_MODE END <> 'Y'),0) = 0 " +
" AND S.QTY_ALLOC >0 ORDER BY QTY_ALLOC "; " AND S.QTY_ALLOC >0 ORDER BY QTY_ALLOC ";
//Commented and Changes by Santosh on 18/05/2017 [End]
} }
//changed by manish on 18/09/15 for Ms sql server database[end] //changed by manish on 18/09/15 for Ms sql server database[end]
...@@ -1204,8 +1225,6 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -1204,8 +1225,6 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
{ {
if( spltblQty > lastCaseUpdQty) if( spltblQty > lastCaseUpdQty)
{ {
updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ?" updateSql = "UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ?"
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? " + " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND EXP_LEV = ? " + " AND EXP_LEV = ? "
...@@ -1226,7 +1245,7 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -1226,7 +1245,7 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
updCnt = pstmtUpd.executeUpdate(); updCnt = pstmtUpd.executeUpdate();
if( updCnt > 0 ) if( updCnt > 0 )
{ {
System.out.println( " updated successfullt in sordalloc "); System.out.println( " updated successfull in sordalloc ");
} }
else else
{ {
...@@ -1234,9 +1253,48 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -1234,9 +1253,48 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
isError = true; isError = true;
throw new Exception(" Update fail in sordalloc"); throw new Exception(" Update fail in sordalloc");
} }
pstmtUpd.close(); pstmtUpd = null; if(pstmtUpd != null)
{
pstmtUpd.close();
pstmtUpd = null;
}
updateSql = "insert into sordalloc( SALE_ORDER, LINE_NO, EXP_LEV, ITEM_CODE__ORD, " // changed by sarita on 19/05/2017
sql = "select count(*) as cnt from SORDALLOC where SALE_ORDER=? " +
"AND LINE_NO=? " +
"AND EXP_LEV=? " +
"AND ITEM_CODE__ORD=? " +
"AND ITEM_CODE=? " +
"AND LOT_NO=? " +
"AND LOT_SL=? " +
"AND LOC_CODE=?";
pstmtUpd = conn.prepareStatement(sql);
pstmtUpd.setString(1, sordUpdNo);
pstmtUpd.setString(2, updLineNo);
pstmtUpd.setString(3, expLev);
pstmtUpd.setString(4, itemCodeOrd);
pstmtUpd.setString(5, itemCode);
pstmtUpd.setString(6, lotNo);
pstmtUpd.setString(7, lotSlNew);
pstmtUpd.setString(8, locCodeTo);
rs1 = pstmtUpd.executeQuery();
if(rs1.next())
{
cnt = rs.getInt("cnt");
}
if(pstmtUpd != null)
{
pstmtUpd.close();
pstmtUpd = null;
}
if(rs1 != null)
{
rs1.close();
rs1 = null;
}
if(cnt > 0)
{
updateSql = " insert into sordalloc( SALE_ORDER, LINE_NO, EXP_LEV, ITEM_CODE__ORD, "
+ " ITEM_CODE, LOT_NO, LOT_SL, LOC_CODE, ITEM_REF, QUANTITY, UNIT, " + " ITEM_CODE, LOT_NO, LOT_SL, LOC_CODE, ITEM_REF, QUANTITY, UNIT, "
+ " QTY_ALLOC, DATE_ALLOC, STATUS, ITEM_GRADE, EXP_DATE, ALLOC_MODE, SITE_CODE, " + " QTY_ALLOC, DATE_ALLOC, STATUS, ITEM_GRADE, EXP_DATE, ALLOC_MODE, SITE_CODE, "
+ " CONV__QTY_STDUOM, UNIT__STD, QUANTITY__STDUOM, MFG_DATE, SITE_CODE__MFG, " + " CONV__QTY_STDUOM, UNIT__STD, QUANTITY__STDUOM, MFG_DATE, SITE_CODE__MFG, "
...@@ -1245,7 +1303,6 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -1245,7 +1303,6 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
+ " ?,?, ?, ?, ?, ?, ?, " + " ?,?, ?, ?, ?, ?, ?, "
+ " ?, ?, ? , ?, ?, ?, ?) "; + " ?, ?, ? , ?, ?, ?, ?) ";
pstmtUpd = conn.prepareStatement(updateSql); pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, sordUpdNo); pstmtUpd.setString(1, sordUpdNo);
pstmtUpd.setString(2, updLineNo); pstmtUpd.setString(2, updLineNo);
...@@ -1277,7 +1334,6 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -1277,7 +1334,6 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
if(updCnt > 0 ) if(updCnt > 0 )
{ {
System.out.println(" insertion done in sordalloc"); System.out.println(" insertion done in sordalloc");
lastCaseUpdQty = 0.0; lastCaseUpdQty = 0.0;
} }
else else
...@@ -1286,14 +1342,147 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -1286,14 +1342,147 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
isError = true; isError = true;
throw new Exception(" INSERTION FAIL IN SORDALLOC TABLE"); throw new Exception(" INSERTION FAIL IN SORDALLOC TABLE");
} }
pstmtUpd.close(); pstmtUpd = null;
if(pstmtUpd != null)
{
pstmtUpd.close();
pstmtUpd = null;
}
}
else
{
updateSql = " UPDATE SORDALLOC SET LOC_CODE = ?,LOT_SL = ?"
+ " WHERE SALE_ORDER = ? "
+ " AND LINE_NO = ? "
+ " AND EXP_LEV = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
}//if( spltblQty > lastCaseUpdQty) pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, locCodeTo);
pstmtUpd.setString(2, lotSlNew);
pstmtUpd.setString(3, sordUpdNo);
pstmtUpd.setString(4, updLineNo);
pstmtUpd.setString(5, expLev);
pstmtUpd.setString(6, itemCode);
pstmtUpd.setString(7, locCode);
pstmtUpd.setString(8, lotNo);
pstmtUpd.setString(9, lotSl);
updCnt = pstmtUpd.executeUpdate();
if( updCnt > 0 )
{
System.out.println( " updated successfull in sordalloc ");
lastCaseUpdQty = lastCaseUpdQty - spltblQty;
}
else else
{ {
//Changed by Pragyan on 27/06/14 to check isError true
isError = true;
throw new Exception(" Update fail in sordalloc");
}
updateSql = "UPDATE SORDALLOC SET LOC_CODE = ?,LOT_SL = ?" if(pstmtUpd != null)
{
pstmtUpd.close();
pstmtUpd = null;
}
}
}
else
{
System.out.println("===MANISH111111111=========");
sql = "SELECT COUNT(*) AS CNT FROM SORDALLOC WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND EXP_LEV = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? ";
pstmt3 = conn.prepareStatement(sql);
pstmt3.setString(1, sordUpdNo);
pstmt3.setString(2, updLineNo);
pstmt3.setString(3, expLev);
pstmt3.setString(4, itemCode);
pstmt3.setString(5, locCodeTo);
pstmt3.setString(6, lotNo);
pstmt3.setString(7, lotSlNew);
rs3 = pstmt3.executeQuery();
if(rs3.next())
{
cnt = rs3.getInt("CNT");
}
if(cnt>0)
{
System.out.println( "==== count in sordalloc for new location ===");
updateSql = " UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC - ? "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND EXP_LEV = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? ";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setDouble(1, spltblQty);
pstmtUpd.setString(2, sordUpdNo);
pstmtUpd.setString(3, updLineNo);
pstmtUpd.setString(4, expLev);
pstmtUpd.setString(5, itemCode);
pstmtUpd.setString(6, locCode);
pstmtUpd.setString(7, lotNo);
pstmtUpd.setString(8, lotSl);
updCnt = pstmtUpd.executeUpdate();
if(pstmtUpd != null)
{
pstmtUpd.close();
pstmtUpd = null;
}
updateSql = " UPDATE SORDALLOC SET QTY_ALLOC = QTY_ALLOC + ? "
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND EXP_LEV = ? "
+ " AND ITEM_CODE = ? "
+ " AND LOC_CODE = ? "
+ " AND LOT_NO = ? "
+ " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setDouble(1, spltblQty);
pstmtUpd.setString(2, sordUpdNo);
pstmtUpd.setString(3, updLineNo);
pstmtUpd.setString(4, expLev);
pstmtUpd.setString(5, itemCode);
pstmtUpd.setString(6, locCodeTo);
pstmtUpd.setString(7, lotNo);
pstmtUpd.setString(8, lotSlNew);
updCnt1 = pstmtUpd.executeUpdate();
if( updCnt1 > 0 )
{
System.out.println( " updated successfull in sordalloc ");
}
else
{
isError = true;
throw new Exception(" Update fail in sordalloc");
}
if(pstmtUpd != null)
{
pstmtUpd.close();
pstmtUpd = null;
}
}
else
{
updateSql = " UPDATE SORDALLOC SET LOC_CODE = ?,LOT_SL = ?"
+ " WHERE SALE_ORDER = ? AND LINE_NO = ? " + " WHERE SALE_ORDER = ? AND LINE_NO = ? "
+ " AND EXP_LEV = ? " + " AND EXP_LEV = ? "
+ " AND ITEM_CODE = ? " + " AND ITEM_CODE = ? "
...@@ -1301,6 +1490,7 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -1301,6 +1490,7 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
+ " AND LOT_NO = ? " + " AND LOT_NO = ? "
+ " AND LOT_SL = ? " + " AND LOT_SL = ? "
+ " AND QTY_ALLOC > 0"; + " AND QTY_ALLOC > 0";
pstmtUpd = conn.prepareStatement(updateSql); pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, locCodeTo); pstmtUpd.setString(1, locCodeTo);
pstmtUpd.setString(2, lotSlNew); pstmtUpd.setString(2, lotSlNew);
...@@ -1312,10 +1502,10 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -1312,10 +1502,10 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
pstmtUpd.setString(8, lotNo); pstmtUpd.setString(8, lotNo);
pstmtUpd.setString(9, lotSl); pstmtUpd.setString(9, lotSl);
updCnt = pstmtUpd.executeUpdate(); updCnt = pstmtUpd.executeUpdate();
if( updCnt > 0 ) if( updCnt > 0 )
{ {
System.out.println( " updated successfullt in sordalloc "); System.out.println( " updated successfull in sordalloc ");
lastCaseUpdQty = lastCaseUpdQty - spltblQty; lastCaseUpdQty = lastCaseUpdQty - spltblQty;
} }
else else
...@@ -1324,10 +1514,14 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote, ...@@ -1324,10 +1514,14 @@ public class ReplIssConf extends ActionHandlerEJB implements ReplIssConfRemote,
isError = true; isError = true;
throw new Exception(" Update fail in sordalloc"); throw new Exception(" Update fail in sordalloc");
} }
pstmtUpd.close(); pstmtUpd = null;
}//else
if(pstmtUpd != null)
{
pstmtUpd.close();
pstmtUpd = null;
}
}
}//else
}//if(lastCaseUpdQty > 0) }//if(lastCaseUpdQty > 0)
else else
{ {
......
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