Commit d5a17ae0 authored by pjain's avatar pjain

changed by sankara on 26/08/14 update wavecancelejb and DeallocArtConf


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96071 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 017e4570
......@@ -2389,6 +2389,13 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
//changed by sankara on 26/06/14 update cancel mode in repl_ord_det end.
}
pstmt.close(); pstmt = null;
//changed by sankara on 23/08/14 update active repl quantity to repl quantity start.
int activereplcount = updateActiveReplquantity(parentReplOrder, parentReplOrdLine, conn);
if(activereplcount > 0 )
{
System.out.println("update active repl dso quantity to normal repl...........");
}
//changed by sankara on 23/08/14 update active repl quantity to repl quantity ned.
//changed by sankara on 20/06/14 update status in wave_task_det start.
int replcount = 0;
sql = " SELECT COUNT(*) AS COUNT FROM REPL_ORD_DET RO WHERE RO.REPL_ORDER = ? AND ( RO.CANCEL_MODE <> ? OR RO.CANCEL_MODE IS NULL ) " ;
......@@ -3513,6 +3520,14 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
System.out.println(" REPL_ORD_DET updated succesfully");
}
pstmt.close(); pstmt = null;
//changed by sankara on 23/08/14 update active repl quuantity to normal repl start.
int activereplpso = updateActiveReplquantity(replOrder, replLine, conn);
if( activereplpso > 0 )
{
System.out.println("updated pso active repl ");
}
//changed by sankara on 23/08/14 update active repl quuantity to normal repl end.
//changed by sankara on 21/06/14 not update confirmed in replisshdr start.
/*sql = " UPDATE REPL_ISS_HDR SET CONFIRMED ='Y', CONF_DATE = ? , EMP_CODE__APRV = ? WHERE REPL_ORDER = ? AND CONFIRMED = 'N'";
pstmt = conn.prepareStatement(sql);
......@@ -4308,4 +4323,197 @@ public class DeallocArtConf extends ActionHandlerEJB implements DeallocArtConfLo
return updateCount;
}
//Changed By Pragyan 02-JUL-14 (Issue tracker No 396)To update status as C if consolidated to doc called.start
//changed by sankara on 23/08/14 for update active repl quantity to normal repl start.
private int updateActiveReplquantity(String parentReplOrder, int parentReplOrdLine, Connection conn) throws ITMException
{
String sql = "";
PreparedStatement pstmt = null, pstmt1=null, pstmt2=null;
ResultSet rs = null, rs1=null;
String refSeries = "";
int updateCount = 0;
int deallocQty = 0;
int count = 0;
String ptcn = "";
String siteCode = "";
String itemCode = "";
String locCode = "";
String lotNo = "";
String Lotsl = "";
String replOrder = "";
String replOrderpnd = "";
int activereplquantity = 0;
int repllineNo = 0;
try
{
System.out.println("parentReplOrder["+parentReplOrder+"]");
System.out.println("parentReplOrdLine::::::["+parentReplOrdLine+"]");
sql = " SELECT REF_SER FROM WAVE_TASK_DET WHERE REF_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, parentReplOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
refSeries = checkNull(rs.getString(1));
System.out.println("refSeries:::::::"+refSeries);
}
rs.close();rs = null;
pstmt.close(); pstmt = null;
if( "RD-DSA".equalsIgnoreCase(refSeries) || "RR-DSA".equalsIgnoreCase(refSeries) )
{
System.out.println("inside dsa");
sql = " SELECT RT.QUANTITY,RT.SITE_CODE, RT.ITEM_CODE, RT.LOC_CODE, RT.LOT_NO, RT.LOT_SL FROM REPL_ORD_DET RT " +
" WHERE RT.REPL_ORDER = ? AND RT.LINE_NO = ? AND RT.CANCEL_MODE = 'Y' " ;
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, parentReplOrder);
pstmt1.setInt(2, parentReplOrdLine);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
activereplquantity = rs1.getInt(1);
siteCode = checkNull(rs1.getString(2));
itemCode = checkNull(rs1.getString(3));
locCode = checkNull(rs1.getString(4));
lotNo = checkNull(rs1.getString(5));
Lotsl = checkNull(rs1.getString(6));
}
rs1.close();rs1 = null;
pstmt1.close(); pstmt1 = null;
System.out.println("activereplquantity["+activereplquantity+"]");
System.out.println("siteCode["+siteCode+"]");
System.out.println("itemCode["+itemCode+"]");
System.out.println("locCode["+locCode+"]");
System.out.println("lotNo["+lotNo+"]");
System.out.println("Lotsl["+Lotsl+"]");
sql = " SELECT RD.REPL_ORDER, RD.LINE_NO FROM REPL_ORD_DET RD WHERE RD.SITE_CODE = ? AND RD.ITEM_CODE = ? AND RD.LOC_CODE = ? " +
" AND RD.LOT_NO = ? AND RD.LOT_SL = ? AND (CASE WHEN RD.CANCEL_MODE IS NULL THEN 'N' ELSE RD.CANCEL_MODE END) = 'N' ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, siteCode);
pstmt1.setString(2, itemCode);
pstmt1.setString(3, locCode);
pstmt1.setString(4, lotNo);
pstmt1.setString(5, Lotsl);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
replOrder = checkNull(rs1.getString(1));
repllineNo = rs1.getInt(2);
System.out.println("replOrder:::::::"+replOrder);
sql = " SELECT REF_SER FROM WAVE_TASK_DET WHERE REF_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, replOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
refSeries = checkNull(rs.getString(1));
System.out.println("refSeries:::::::"+refSeries);
}
rs.close();rs = null;
pstmt.close(); pstmt = null;
if("R-DSO".equalsIgnoreCase(refSeries.trim()) || "R-TASK".equalsIgnoreCase(refSeries.trim())) //DSO Update
{
sql = " UPDATE REPL_ORD_DET SET QUANTITY = ( QUANTITY + ? ), ACTUAL_QTY = ( ACTUAL_QTY + ? ) WHERE REPL_ORDER = ? AND LINE_NO = ? " ;
pstmt2 = conn.prepareStatement(sql);
pstmt2.setInt(1, activereplquantity);
pstmt2.setInt(2, activereplquantity);
pstmt2.setString(3, replOrder);
pstmt2.setInt(4, repllineNo);
updateCount = pstmt2.executeUpdate();
if(updateCount > 0)
{
System.out.println("wave_task_det Has been updated["+updateCount+"]");
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
if( !"R-TASK".equalsIgnoreCase(refSeries.trim()))
{
sql = " SELECT REPL_ORDER,LINE_NO FROM REPL_ORD_DET WHERE PICK_ORDER = ? AND LINE_NO__PICK = ? " ; //PND Update
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, replOrder);
pstmt.setInt(2, repllineNo);
rs = pstmt.executeQuery();
if(rs.next())
{
replOrderpnd = checkNull(rs.getString(1));
System.out.println("replOrderpnd:::::"+replOrderpnd);
repllineNo = rs.getInt(2);
System.out.println("repllineNo:::::"+repllineNo);
System.out.println("replOrder["+replOrderpnd+"]");
sql = " UPDATE REPL_ORD_DET SET QUANTITY = ( QUANTITY + ? ) WHERE REPL_ORDER = ? AND LINE_NO = ? " ;
pstmt2 = conn.prepareStatement(sql);
pstmt2.setInt(1, activereplquantity);
pstmt2.setString(2, replOrderpnd);
pstmt2.setInt(3, repllineNo);
updateCount = pstmt2.executeUpdate();
if(updateCount > 0)
{
System.out.println("repl_ord_det pnd Has been updated["+updateCount+"]");
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
}
rs.close();rs = null;
pstmt.close(); pstmt = null;
}
}
}
rs1.close();rs1 = null;
pstmt1.close(); pstmt1 = null;
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs1 != null)
{
rs1.close();
rs1 = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
}
catch (Exception e2)
{
e2.printStackTrace();
throw new ITMException(e2);
}
}
return updateCount;
}
//changed by sankara on 23/08/14 for update active repl quantity to normal repl end.
}
......@@ -996,6 +996,13 @@ public class WaveCancelEJB extends ActionHandlerEJB implements WaveCancelEJBLoca
System.out.println("RefSeries checking for void packages"+refSer+"}");
System.out.println("PTCN LIST"+ptcnVoidPackagesMap.toString()+"}");
//changed by sankara on 25/08/14 for update active repl quantity to normal repl in repl_ord_det at wave calcel start.
if( "RD-DSA".equalsIgnoreCase(refSer) || "RR-DSA".equalsIgnoreCase(refSer) )
{
System.out.println("calling repl ord det update");
updateReplorderqty(refId,refSer ,conn);
}
//changed by sankara on 25/08/14 for update active repl quantity to normal repl in repl_ord_det at wave calcel end.
//isADSIConnReq
//Changed by Rohan on 16-07-13 for define map of ptcn for void packages.start
......@@ -2936,5 +2943,180 @@ public class WaveCancelEJB extends ActionHandlerEJB implements WaveCancelEJBLoca
}
return isAparcelWave;
}
//changed by sankara on 25/08/14 for update active repl quantity to normal repl in repl_ord_det at wave calcel start.
private int updateReplorderqty(String replOrd, String refser ,Connection conn) throws ITMException
{
String sql = "";
PreparedStatement pstmt = null, pstmt1=null, pstmt2 = null;
ResultSet rs = null, rs1=null;
String refSeries = "";
int updateCount = 0;
int deallocQty = 0;
int count = 0;
String ptcn = "";
String siteCode = "";
String itemCode = "";
String locCode = "";
String lotNo = "";
String Lotsl = "";
String replOrder = "";
String dsoReplOrder = "";
String replOrderpnd = "";
int activereplquantity = 0;
int repllineNo = 0;
try
{
System.out.println("replOrd["+replOrd+"]");
System.out.println("refser["+refser+"]");
sql = " SELECT RT.QUANTITY,RT.SITE_CODE, RT.ITEM_CODE, RT.LOC_CODE, RT.LOT_NO, RT.LOT_SL FROM REPL_ORD_DET RT " +
" WHERE RT.REPL_ORDER = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, replOrd);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
activereplquantity = rs1.getInt(1);
siteCode = checkNull(rs1.getString(2));
itemCode = checkNull(rs1.getString(3));
locCode = checkNull(rs1.getString(4));
lotNo = checkNull(rs1.getString(5));
Lotsl = checkNull(rs1.getString(6));
}
rs1.close();rs1 = null;
pstmt1.close(); pstmt1 = null;
System.out.println("activereplquantity["+activereplquantity+"]");
System.out.println("siteCode["+siteCode+"]");
System.out.println("itemCode["+itemCode+"]");
System.out.println("locCode["+locCode+"]");
System.out.println("lotNo["+lotNo+"]");
System.out.println("Lotsl["+Lotsl+"]");
sql = " SELECT RD.REPL_ORDER,RD.LINE_NO FROM REPL_ORD_DET RD WHERE RD.SITE_CODE = ? AND RD.ITEM_CODE = ? AND RD.LOC_CODE = ? " +
" AND RD.LOT_NO = ? AND RD.LOT_SL = ? AND ( CANCEL_MODE IS NULL OR CANCEL_MODE = 'N' ) " ;
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, siteCode);
pstmt1.setString(2, itemCode);
pstmt1.setString(3, locCode);
pstmt1.setString(4, lotNo);
pstmt1.setString(5, Lotsl);
rs1 = pstmt1.executeQuery();
while(rs1.next())
{
replOrder = checkNull(rs1.getString(1));
repllineNo = rs1.getInt(2);
System.out.println("replOrder:::::"+replOrder);
sql = " SELECT REF_SER FROM WAVE_TASK_DET WHERE REF_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, replOrder);
rs = pstmt.executeQuery();
if(rs.next())
{
refSeries = checkNull(rs.getString(1));
System.out.println("refSeries:::::::"+refSeries);
}
rs.close();rs = null;
pstmt.close(); pstmt = null;
if("R-DSO".equalsIgnoreCase(refSeries.trim()) || "R-TASK".equalsIgnoreCase(refSeries.trim())) //DSO Update
{
sql = " UPDATE REPL_ORD_DET SET QUANTITY = ( QUANTITY + ? ), ACTUAL_QTY = ( ACTUAL_QTY + ? ) WHERE REPL_ORDER = ? AND LINE_NO = ? " ;
pstmt2 = conn.prepareStatement(sql);
pstmt2.setInt(1, activereplquantity);
pstmt2.setInt(2, activereplquantity);
pstmt2.setString(3, replOrder);
pstmt2.setInt(4, repllineNo);
updateCount = pstmt2.executeUpdate();
if(updateCount > 0)
{
System.out.println("wave_task_det Has been updated["+updateCount+"]");
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
}
if("R-DSO".equalsIgnoreCase(refSeries.trim()))
{
sql = " SELECT REPL_ORDER,LINE_NO FROM REPL_ORD_DET WHERE PICK_ORDER = ? AND LINE_NO__PICK = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, replOrder);
pstmt.setInt(2, repllineNo);
rs = pstmt.executeQuery();
if(rs.next())
{
replOrderpnd = checkNull(rs.getString(1));
System.out.println("replOrderpnd:::::"+replOrderpnd);
repllineNo = rs.getInt(2);
System.out.println("repllineNo:::::"+repllineNo);
sql = " UPDATE REPL_ORD_DET SET QUANTITY = ( QUANTITY + ? ) WHERE REPL_ORDER = ? AND LINE_NO = ? " ;
pstmt2 = conn.prepareStatement(sql);
pstmt2.setInt(1, activereplquantity);
pstmt2.setString(2, replOrderpnd);
pstmt2.setInt(3, repllineNo);
updateCount = pstmt2.executeUpdate();
if(updateCount > 0)
{
System.out.println("repl_ord_det Has been updated["+updateCount+"]");
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
}
rs.close();rs = null;
pstmt.close(); pstmt = null;
}
}
rs1.close();rs1 = null;
pstmt1.close(); pstmt1 = null;
}
catch(Exception e)
{
System.out.println("Exception in == >"+e);
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(rs1 != null)
{
rs1.close();
rs1 = null;
}
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
}
catch (Exception e1)
{
throw new ITMException(e1);
}
}
return updateCount;
}
//changed by sankara on 25/08/14 for update active repl quantity to normal repl in repl_ord_det at wave calcel end.
}
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