Commit ff670e5a authored by jshinde's avatar jshinde

Request Id:[W16CSUN008] Duel approval is required for taking damage / Hold...

Request Id:[W16CSUN008] Duel approval is required for taking damage / Hold material out. after click on"Pallet req" button in Hold inventory transaction. Unconfirmed request  of pallet out will generate which will further approve by QA.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@102096 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2009c607
...@@ -29,6 +29,7 @@ import ibase.utility.CommonConstants; ...@@ -29,6 +29,7 @@ import ibase.utility.CommonConstants;
import ibase.utility.UserInfoBean; import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.ActionHandlerEJB; import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator; import ibase.webitm.utility.TransIDGenerator;
...@@ -40,7 +41,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -40,7 +41,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
CommonWmsUtil commonWmsUtility = CommonWmsUtil.getInstance(); CommonWmsUtil commonWmsUtility = CommonWmsUtil.getInstance();
DistCommon distComm = new DistCommon();
public String distActionHandler(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException public String distActionHandler(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{ {
System.out.println("--------------ActionHandler method of Distribution Pallet Requisition ------------- : ["+tranId+"]"); System.out.println("--------------ActionHandler method of Distribution Pallet Requisition ------------- : ["+tranId+"]");
...@@ -48,12 +49,12 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -48,12 +49,12 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
Connection conn = null; Connection conn = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
Boolean isError = false; Boolean isError = false;
try try
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
connDriver = null; connDriver = null;
retString = distPalletRequisition(tranId,xtraParams,forcedFlag,conn); retString = distPalletRequisition(tranId,xtraParams,forcedFlag,conn);
//String sql = "select item_code,line_no,quantity,unit,lot_no,lot_sl,mfg_date,exp_date,pallet_no from distord_issdet where dist_order = ?"; //String sql = "select item_code,line_no,quantity,unit,lot_no,lot_sl,mfg_date,exp_date,pallet_no from distord_issdet where dist_order = ?";
//retString = distPalletRequisition(tranId,xtraParams,forcedFlag,sql,conn); //retString = distPalletRequisition(tranId,xtraParams,forcedFlag,sql,conn);
} }
...@@ -85,7 +86,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -85,7 +86,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
System.out.println("Final return="+retString); System.out.println("Final return="+retString);
return retString; return retString;
} }
public String sorderActionHandler(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException public String sorderActionHandler(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{ {
System.out.println("--------------ActionHandler method of Sorder Pallet Requisition ------------- : ["+tranId+"]"); System.out.println("--------------ActionHandler method of Sorder Pallet Requisition ------------- : ["+tranId+"]");
...@@ -93,7 +94,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -93,7 +94,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
Connection conn = null; Connection conn = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
Boolean isError = false; Boolean isError = false;
try try
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
...@@ -129,7 +130,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -129,7 +130,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
System.out.println("Final return="+retString); System.out.println("Final return="+retString);
return retString; return retString;
} }
public String distPalletRequisition(String tranId,String xtraParams,String forcedFlag,Connection conn) throws RemoteException,ITMException public String distPalletRequisition(String tranId,String xtraParams,String forcedFlag,Connection conn) throws RemoteException,ITMException
{ {
System.out.println("==================In distPalletRequisition======================="); System.out.println("==================In distPalletRequisition=======================");
...@@ -139,124 +140,224 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -139,124 +140,224 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
int flag = 0; int flag = 0;
Boolean isError = false; Boolean isError = false;
HashMap hm = new HashMap(); HashMap hm = new HashMap();
String loginEmpCode = "",userId = "",loginSite = "",errString = "",itemDescr = ""; String loginEmpCode = "",userId = "",loginSite = "",errString = "",itemDescr = "";
String itemCode = "",lineNo = "",descr = "",unit = "",itemType = "",familyGrp = "",refSer = "",lotNo = "",refId = "",lotSl = "", String itemCode = "",lineNo = "",descr = "",unit = "",itemType = "",familyGrp = "",refSer = "",lotNo = "",refId = "",lotSl = "",
palletNo = "",palletStatus = "",lockStat = "",qcType = "",stroPref = "",palletRej = "",palletRejDesc = "",confirmed = "",siteCode = ""; palletNo = "",palletStatus = "",lockStat = "",qcType = "",stroPref = "",palletRej = "",palletRejDesc = "",confirmed = "",siteCode = "";
String transactionId = ""; String transactionId = "";
Timestamp today = new Timestamp(System.currentTimeMillis()); Timestamp today = new Timestamp(System.currentTimeMillis());
Timestamp expDate = null; Timestamp expDate = null;
Timestamp mfgDate = null; Timestamp mfgDate = null;
double quantity = 0, noArtQuot = 0,noArtRem = 0,notArt = 0,shipperSize = 0,totalQuantity = 0, qtyPerArt = 0; double quantity = 0, noArtQuot = 0,noArtRem = 0,notArt = 0,shipperSize = 0,totalQuantity = 0, qtyPerArt = 0;
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
System.out.println("XTRA PARAMS ["+xtraParams+"]"); System.out.println("XTRA PARAMS ["+xtraParams+"]");
loginEmpCode = checkNullAndTrim(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode")); loginEmpCode = checkNullAndTrim(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode"));
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
loginSite = checkNullAndTrim((genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"))); loginSite = checkNullAndTrim((genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode")));
ArrayList interfaceArrList = new ArrayList(); ArrayList interfaceArrList = new ArrayList();
try try
{ {
System.out.println("Inside try block distribution....."); System.out.println("Inside try block distribution.....");
sql = "SELECT CONFIRMED FROM DISTORDER WHERE DIST_ORDER = ?"; sql = "SELECT CONFIRMED FROM DISTORDER WHERE DIST_ORDER = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
confirmed = checkNullAndTrim(rs.getString("CONFIRMED"));
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if("Y".equalsIgnoreCase(confirmed))
{
//sql = "SELECT * FROM INTERFACE2 WHERE REF_ID = ?";
sql = "SELECT * FROM SWMS_TO_AWMS WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
confirmed = checkNullAndTrim(rs.getString("CONFIRMED")); System.out.println("Transaction is already present in interface2 table");
errString = itmDBAccessEJB.getErrorString("","ALRDYSUBMT","","",conn);
return errString;
} }
rs.close();rs = null; else
pstmt.close();pstmt = null;
if("Y".equalsIgnoreCase(confirmed))
{ {
//sql = "SELECT * FROM INTERFACE2 WHERE REF_ID = ?"; //Changed by wasim on 09-11-2015 for taking data from stock and distorderalloc join.
sql = "SELECT * FROM SWMS_TO_AWMS WHERE REF_ID = ?"; //sql = "SELECT ITEM_CODE,LINE_NO,QUANTITY,UNIT,LOT_NO,LOT_SL,MFG_DATE,EXP_DATE,LOC_CODE,SITE_CODE__MFG FROM DISTORDER_ALLOC WHERE DIST_ORDER = ?";
sql = "SELECT D.ITEM_CODE,I.DESCR,D.LINE_NO,D.QUANTITY,D.UNIT,D.LOT_NO,D.LOT_SL,S.SITE_CODE,D.LOC_CODE,S.NO_ART,S.QTY_PER_ART"
//+" FROM STOCK S,DISTORDER_ALLOC D,DISTORDER H WHERE" //Changed by wasim on 20-08-2015 to add inv_stat AWMS validation
+" FROM STOCK S,DISTORDER_ALLOC D,DISTORDER H,LOCATION L,ITEM I WHERE"
+" S.ITEM_CODE = D.ITEM_CODE"
+" AND S.LOT_NO = D.LOT_NO"
+" AND S.LOT_SL = D.LOT_SL"
+" AND S.LOC_CODE = D.LOC_CODE"
+" AND S.SITE_CODE = H.SITE_CODE"
+" AND H.DIST_ORDER = D.DIST_ORDER"
+" AND L.LOC_CODE = D.LOC_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND L.INV_STAT = 'AWMS'" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND I.ITEM_CODE = D.ITEM_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND D.DIST_ORDER = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) while(rs.next())
{ {
System.out.println("Transaction is already present in interface2 table"); flag = 1;//record found in distribution order
errString = itmDBAccessEJB.getErrorString("","ALRDYSUBMT","","",conn);
return errString; itemCode = checkNullAndTrim(rs.getString("ITEM_CODE"));
itemDescr = checkNullAndTrim(rs.getString("DESCR"));
lineNo = checkNullAndTrim(rs.getString("LINE_NO"));
//Changed by wasim on 26-11-2015 to remove space for interface table [START]
/*lineNo = " " + lineNo;
lineNo = lineNo.substring(lineNo.length()-3);*/
//Changed by wasim on 26-11-2015 to remove space for interface table [END]
quantity = rs.getDouble("QUANTITY");
unit = checkNullAndTrim(rs.getString("UNIT"));
lotNo = checkNullAndTrim(rs.getString("LOT_NO"));
lotSl = checkNullAndTrim(rs.getString("LOT_SL"));
//mfgDate = rs.getTimestamp("MFG_DATE");
//expDate = rs.getTimestamp("EXP_DATE");
palletNo = checkNullAndTrim(rs.getString("LOC_CODE"));
siteCode = checkNullAndTrim(rs.getString("SITE_CODE"));
notArt = rs.getDouble("NO_ART");
qtyPerArt = rs.getDouble("QTY_PER_ART");
/*hm = getPalletizedAttributes(itemCode,siteCode,conn);
familyGrp = (String) hm.get("LOC_ZONE__PREF");
qcType = (String) hm.get("PROC_MTH");
stroPref = (String) hm.get("ANALYSIS_CLASS");*/
//transactionId = generateTranTd("w_interface2",today.toString(),loginSite,conn);
palletStatus = commonWmsUtility.getFullOrPrtialPalletOut(palletNo,"D-SO",tranId,siteCode,conn);
System.out.println("Pallet Status recevied from common util="+palletStatus);
HashMap interfaceHmap = new HashMap();
/*hm = commonWmsUtility.getItemVoumeMap(itemCode,lotNo,conn);
shipperSize = (Double) hm.get("PACK_SIZE");
noArtQuot= quantity / shipperSize ;
noArtRem = quantity % shipperSize ;
if(noArtRem > 0)
{
noArtRem = 1;
}
notArt = noArtQuot + noArtRem;
totalQuantity = notArt * shipperSize;
System.out.println("Quantity["+quantity+"]ShipperSize["+shipperSize+"]noArtQuot["+noArtQuot+"]"
+ "noArtRem["+noArtRem+"]notArt["+notArt+"]TotalQuantity["+totalQuantity+"]");*/
noArtQuot= quantity / qtyPerArt ;
noArtRem = quantity % qtyPerArt ;
if(noArtRem > 0)
{
noArtRem = 1;
}
noArtQuot = (int) noArtQuot;
notArt = noArtQuot + noArtRem;
totalQuantity = notArt * qtyPerArt;
System.out.println("Quantity["+quantity+"]ShipperSize["+qtyPerArt+"]noArtQuot["+noArtQuot+"]"
+ "noArtRem["+noArtRem+"]notArt["+notArt+"]TotalQuantity["+totalQuantity+"]");
System.out.println("Pallet No before removing suffix: "+palletNo);
palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') ||
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
(palletNo.charAt(palletNo.trim().length()-1)=='P') ? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo);
interfaceHmap.put("TRAN_ID", "");
interfaceHmap.put("ITEM_CODE", itemCode);
interfaceHmap.put("DESCR", itemDescr);
interfaceHmap.put("UNIT", unit);
interfaceHmap.put("ITEM_TYPE", "");
interfaceHmap.put("FAMILY_GRP", "");
interfaceHmap.put("IN_OUT", "O");
interfaceHmap.put("REF_SER", "D-SO");
interfaceHmap.put("REF_ID", tranId);
interfaceHmap.put("TRAN_DATE", checkNullAndTrim(String.valueOf(today)));
interfaceHmap.put("LOT_NO", lotNo);
interfaceHmap.put("LOT_SL", lotSl);
interfaceHmap.put("QUANTITY", String.valueOf(notArt));
interfaceHmap.put("QTY_PER_ART", String.valueOf(qtyPerArt));
interfaceHmap.put("TOTAL_QTY", String.valueOf(totalQuantity));
System.out.println("exp_date="+expDate);
System.out.println("Mfg_date="+mfgDate);
interfaceHmap.put("EXP_DATE", "");
interfaceHmap.put("MFG_DATE", "");
interfaceHmap.put("PALLET_NO", palletNo);
interfaceHmap.put("MSG_STAT", "N");
interfaceHmap.put("PALLET_STATUS", palletStatus);
interfaceHmap.put("LOCK_STAT", "");
interfaceHmap.put("ERR_COD", "");
interfaceHmap.put("ERR_DESC", "");
interfaceHmap.put("QC_TYPE", "");
interfaceHmap.put("TRANS_DT_ACK", "");
interfaceHmap.put("STRO_PREF", "");
interfaceHmap.put("LINE_NO", lineNo);
interfaceArrList.add(interfaceHmap);
} }
else rs.close();rs = null;
pstmt.close();pstmt = null;
if(flag == 0)
{ {
//Changed by wasim on 09-11-2015 for taking data from stock and distorderalloc join. sql = "SELECT D.ITEM_CODE,I.DESCR,D.LINE_NO,D.QUANTITY,D.UNIT,D.LOT_NO,D.LOT_SL,D.LOC_CODE,S.NO_ART,S.QTY_PER_ART,H.SITE_CODE"
//sql = "SELECT ITEM_CODE,LINE_NO,QUANTITY,UNIT,LOT_NO,LOT_SL,MFG_DATE,EXP_DATE,LOC_CODE,SITE_CODE__MFG FROM DISTORDER_ALLOC WHERE DIST_ORDER = ?"; //+" FROM STOCK S,DISTORD_ISSDET D,DISTORD_ISS H WHERE" //Changed by wasim on 20-08-2015 to add inv_stat AWMS validation
sql = "SELECT D.ITEM_CODE,I.DESCR,D.LINE_NO,D.QUANTITY,D.UNIT,D.LOT_NO,D.LOT_SL,S.SITE_CODE,D.LOC_CODE,S.NO_ART,S.QTY_PER_ART" +" FROM STOCK S,DISTORD_ISSDET D,DISTORD_ISS H,LOCATION L,ITEM I WHERE"
//+" FROM STOCK S,DISTORDER_ALLOC D,DISTORDER H WHERE" //Changed by wasim on 20-08-2015 to add inv_stat AWMS validation +" S.ITEM_CODE = D.ITEM_CODE"
+" FROM STOCK S,DISTORDER_ALLOC D,DISTORDER H,LOCATION L,ITEM I WHERE" +" AND S.LOT_NO = D.LOT_NO"
+" S.ITEM_CODE = D.ITEM_CODE" +" AND S.LOT_SL = D.LOT_SL"
+" AND S.LOT_NO = D.LOT_NO" +" AND S.LOC_CODE = D.LOC_CODE"
+" AND S.LOT_SL = D.LOT_SL" +" AND S.SITE_CODE = H.SITE_CODE"
+" AND S.LOC_CODE = D.LOC_CODE" +" AND D.TRAN_ID = H.TRAN_ID"
+" AND S.SITE_CODE = H.SITE_CODE" +" AND H.CONFIRMED = 'N'"
+" AND H.DIST_ORDER = D.DIST_ORDER" +" AND L.LOC_CODE = D.LOC_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND L.LOC_CODE = D.LOC_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation +" AND L.INV_STAT = 'AWMS'"
+" AND L.INV_STAT = 'AWMS'" //Changed by wasim on 20-08-2015 to add inv_stat validation +" AND I.ITEM_CODE = D.ITEM_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND I.ITEM_CODE = D.ITEM_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation +" AND D.DIST_ORDER = ? ";
+" AND D.DIST_ORDER = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
flag = 1;//record found in distribution order flag = 1;
itemCode = checkNullAndTrim(rs.getString("ITEM_CODE")); itemCode = checkNullAndTrim(rs.getString("ITEM_CODE"));
itemDescr = checkNullAndTrim(rs.getString("DESCR")); itemDescr = checkNullAndTrim(rs.getString("DESCR"));
lineNo = checkNullAndTrim(rs.getString("LINE_NO")); lineNo = checkNullAndTrim(rs.getString("LINE_NO"));
//Changed by wasim on 26-11-2015 to remove space for interface table [START] //Changed by wasim on 26-11-2015 to remove space for interface table [START]
/*lineNo = " " + lineNo; /*lineNo = " " + lineNo;
lineNo = lineNo.substring(lineNo.length()-3);*/ lineNo = lineNo.substring(lineNo.length()-3);*/
//Changed by wasim on 26-11-2015 to remove space for interface table [END] //Changed by wasim on 26-11-2015 to remove space for interface table [END]
quantity = rs.getDouble("QUANTITY"); quantity = rs.getDouble("QUANTITY");
unit = checkNullAndTrim(rs.getString("UNIT")); unit = checkNullAndTrim(rs.getString("UNIT"));
lotNo = checkNullAndTrim(rs.getString("LOT_NO")); lotNo = checkNullAndTrim(rs.getString("LOT_NO"));
lotSl = checkNullAndTrim(rs.getString("LOT_SL")); lotSl = checkNullAndTrim(rs.getString("LOT_SL"));
//mfgDate = rs.getTimestamp("MFG_DATE");
//expDate = rs.getTimestamp("EXP_DATE");
palletNo = checkNullAndTrim(rs.getString("LOC_CODE")); palletNo = checkNullAndTrim(rs.getString("LOC_CODE"));
siteCode = checkNullAndTrim(rs.getString("SITE_CODE"));
notArt = rs.getDouble("NO_ART"); notArt = rs.getDouble("NO_ART");
qtyPerArt = rs.getDouble("QTY_PER_ART"); qtyPerArt = rs.getDouble("QTY_PER_ART");
/*hm = getPalletizedAttributes(itemCode,siteCode,conn); siteCode = checkNullAndTrim(rs.getString("SITE_CODE"));
familyGrp = (String) hm.get("LOC_ZONE__PREF");
qcType = (String) hm.get("PROC_MTH");
stroPref = (String) hm.get("ANALYSIS_CLASS");*/
//transactionId = generateTranTd("w_interface2",today.toString(),loginSite,conn);
palletStatus = commonWmsUtility.getFullOrPrtialPalletOut(palletNo,"D-SO",tranId,siteCode,conn);
System.out.println("Pallet Status recevied from common util="+palletStatus);
HashMap interfaceHmap = new HashMap();
/*hm = commonWmsUtility.getItemVoumeMap(itemCode,lotNo,conn);
shipperSize = (Double) hm.get("PACK_SIZE");
noArtQuot= quantity / shipperSize ;
noArtRem = quantity % shipperSize ;
if(noArtRem > 0)
{
noArtRem = 1;
}
notArt = noArtQuot + noArtRem;
totalQuantity = notArt * shipperSize;
System.out.println("Quantity["+quantity+"]ShipperSize["+shipperSize+"]noArtQuot["+noArtQuot+"]"
+ "noArtRem["+noArtRem+"]notArt["+notArt+"]TotalQuantity["+totalQuantity+"]");*/
noArtQuot= quantity / qtyPerArt ; noArtQuot= quantity / qtyPerArt ;
noArtRem = quantity % qtyPerArt ; noArtRem = quantity % qtyPerArt ;
if(noArtRem > 0) if(noArtRem > 0)
...@@ -264,21 +365,25 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -264,21 +365,25 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
noArtRem = 1; noArtRem = 1;
} }
noArtQuot = (int) noArtQuot; noArtQuot = (int) noArtQuot;
notArt = noArtQuot + noArtRem; notArt = noArtQuot + noArtRem;
totalQuantity = notArt * qtyPerArt; totalQuantity = notArt * qtyPerArt;
System.out.println("Quantity["+quantity+"]ShipperSize["+qtyPerArt+"]noArtQuot["+noArtQuot+"]" System.out.println("Quantity["+quantity+"]ShipperSize["+qtyPerArt+"]noArtQuot["+noArtQuot+"]"
+ "noArtRem["+noArtRem+"]notArt["+notArt+"]TotalQuantity["+totalQuantity+"]"); + "noArtRem["+noArtRem+"]notArt["+notArt+"]TotalQuantity["+totalQuantity+"]");
palletStatus = commonWmsUtility.getFullOrPrtialPalletOut(palletNo,"D-SO",tranId,siteCode,conn);
System.out.println("Pallet Status recevied from common util="+palletStatus);
System.out.println("Pallet No before removing suffix: "+palletNo); System.out.println("Pallet No before removing suffix: "+palletNo);
palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') || palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') ||
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') || (palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') || (palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
(palletNo.charAt(palletNo.trim().length()-1)=='P') ? palletNo.substring(0,palletNo.trim().length()-1):palletNo; (palletNo.charAt(palletNo.trim().length()-1)=='P') ? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo); System.out.println("Pallet No After removing suffix: "+palletNo);
HashMap interfaceHmap = new HashMap();
interfaceHmap.put("TRAN_ID", ""); interfaceHmap.put("TRAN_ID", "");
interfaceHmap.put("ITEM_CODE", itemCode); interfaceHmap.put("ITEM_CODE", itemCode);
interfaceHmap.put("DESCR", itemDescr); interfaceHmap.put("DESCR", itemDescr);
...@@ -293,9 +398,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -293,9 +398,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
interfaceHmap.put("LOT_SL", lotSl); interfaceHmap.put("LOT_SL", lotSl);
interfaceHmap.put("QUANTITY", String.valueOf(notArt)); interfaceHmap.put("QUANTITY", String.valueOf(notArt));
interfaceHmap.put("QTY_PER_ART", String.valueOf(qtyPerArt)); interfaceHmap.put("QTY_PER_ART", String.valueOf(qtyPerArt));
interfaceHmap.put("TOTAL_QTY", String.valueOf(totalQuantity)); interfaceHmap.put("TOTAL_QTY", String.valueOf(quantity));
System.out.println("exp_date="+expDate);
System.out.println("Mfg_date="+mfgDate);
interfaceHmap.put("EXP_DATE", ""); interfaceHmap.put("EXP_DATE", "");
interfaceHmap.put("MFG_DATE", ""); interfaceHmap.put("MFG_DATE", "");
interfaceHmap.put("PALLET_NO", palletNo); interfaceHmap.put("PALLET_NO", palletNo);
...@@ -308,135 +411,33 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -308,135 +411,33 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
interfaceHmap.put("TRANS_DT_ACK", ""); interfaceHmap.put("TRANS_DT_ACK", "");
interfaceHmap.put("STRO_PREF", ""); interfaceHmap.put("STRO_PREF", "");
interfaceHmap.put("LINE_NO", lineNo); interfaceHmap.put("LINE_NO", lineNo);
interfaceArrList.add(interfaceHmap); interfaceArrList.add(interfaceHmap);
} }
rs.close();rs = null; rs.close();rs = null;
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
if(flag == 0) if(flag == 0)
{ {
sql = "SELECT D.ITEM_CODE,I.DESCR,D.LINE_NO,D.QUANTITY,D.UNIT,D.LOT_NO,D.LOT_SL,D.LOC_CODE,S.NO_ART,S.QTY_PER_ART,H.SITE_CODE" errString = itmDBAccessEJB.getErrorString("","RECNOTSORA","","",conn);
//+" FROM STOCK S,DISTORD_ISSDET D,DISTORD_ISS H WHERE" //Changed by wasim on 20-08-2015 to add inv_stat AWMS validation return errString;
+" FROM STOCK S,DISTORD_ISSDET D,DISTORD_ISS H,LOCATION L,ITEM I WHERE"
+" S.ITEM_CODE = D.ITEM_CODE"
+" AND S.LOT_NO = D.LOT_NO"
+" AND S.LOT_SL = D.LOT_SL"
+" AND S.LOC_CODE = D.LOC_CODE"
+" AND S.SITE_CODE = H.SITE_CODE"
+" AND D.TRAN_ID = H.TRAN_ID"
+" AND H.CONFIRMED = 'N'"
+" AND L.LOC_CODE = D.LOC_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND L.INV_STAT = 'AWMS'"
+" AND I.ITEM_CODE = D.ITEM_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND D.DIST_ORDER = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
flag = 1;
itemCode = checkNullAndTrim(rs.getString("ITEM_CODE"));
itemDescr = checkNullAndTrim(rs.getString("DESCR"));
lineNo = checkNullAndTrim(rs.getString("LINE_NO"));
//Changed by wasim on 26-11-2015 to remove space for interface table [START]
/*lineNo = " " + lineNo;
lineNo = lineNo.substring(lineNo.length()-3);*/
//Changed by wasim on 26-11-2015 to remove space for interface table [END]
quantity = rs.getDouble("QUANTITY");
unit = checkNullAndTrim(rs.getString("UNIT"));
lotNo = checkNullAndTrim(rs.getString("LOT_NO"));
lotSl = checkNullAndTrim(rs.getString("LOT_SL"));
palletNo = checkNullAndTrim(rs.getString("LOC_CODE"));
notArt = rs.getDouble("NO_ART");
qtyPerArt = rs.getDouble("QTY_PER_ART");
siteCode = checkNullAndTrim(rs.getString("SITE_CODE"));
noArtQuot= quantity / qtyPerArt ;
noArtRem = quantity % qtyPerArt ;
if(noArtRem > 0)
{
noArtRem = 1;
}
noArtQuot = (int) noArtQuot;
notArt = noArtQuot + noArtRem;
totalQuantity = notArt * qtyPerArt;
System.out.println("Quantity["+quantity+"]ShipperSize["+qtyPerArt+"]noArtQuot["+noArtQuot+"]"
+ "noArtRem["+noArtRem+"]notArt["+notArt+"]TotalQuantity["+totalQuantity+"]");
palletStatus = commonWmsUtility.getFullOrPrtialPalletOut(palletNo,"D-SO",tranId,siteCode,conn);
System.out.println("Pallet Status recevied from common util="+palletStatus);
System.out.println("Pallet No before removing suffix: "+palletNo);
palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') ||
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
(palletNo.charAt(palletNo.trim().length()-1)=='P') ? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo);
HashMap interfaceHmap = new HashMap();
interfaceHmap.put("TRAN_ID", "");
interfaceHmap.put("ITEM_CODE", itemCode);
interfaceHmap.put("DESCR", itemDescr);
interfaceHmap.put("UNIT", unit);
interfaceHmap.put("ITEM_TYPE", "");
interfaceHmap.put("FAMILY_GRP", "");
interfaceHmap.put("IN_OUT", "O");
interfaceHmap.put("REF_SER", "D-SO");
interfaceHmap.put("REF_ID", tranId);
interfaceHmap.put("TRAN_DATE", checkNullAndTrim(String.valueOf(today)));
interfaceHmap.put("LOT_NO", lotNo);
interfaceHmap.put("LOT_SL", lotSl);
interfaceHmap.put("QUANTITY", String.valueOf(notArt));
interfaceHmap.put("QTY_PER_ART", String.valueOf(qtyPerArt));
interfaceHmap.put("TOTAL_QTY", String.valueOf(quantity));
interfaceHmap.put("EXP_DATE", "");
interfaceHmap.put("MFG_DATE", "");
interfaceHmap.put("PALLET_NO", palletNo);
interfaceHmap.put("MSG_STAT", "N");
interfaceHmap.put("PALLET_STATUS", palletStatus);
interfaceHmap.put("LOCK_STAT", "");
interfaceHmap.put("ERR_COD", "");
interfaceHmap.put("ERR_DESC", "");
interfaceHmap.put("QC_TYPE", "");
interfaceHmap.put("TRANS_DT_ACK", "");
interfaceHmap.put("STRO_PREF", "");
interfaceHmap.put("LINE_NO", lineNo);
interfaceArrList.add(interfaceHmap);
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if(flag == 0)
{
errString = itmDBAccessEJB.getErrorString("","RECNOTSORA","","",conn);
return errString;
}
else
{
commonWmsUtility.updateAwmsInterface(interfaceArrList,loginSite,conn);
}
} }
else else
{ {
commonWmsUtility.updateAwmsInterface(interfaceArrList,loginSite,conn); commonWmsUtility.updateAwmsInterface(interfaceArrList,loginSite,conn);
} }
} }
else
{
commonWmsUtility.updateAwmsInterface(interfaceArrList,loginSite,conn);
}
} }
else }
{ else
errString = itmDBAccessEJB.getErrorString("","VTTSORNTCF","","",conn); {
return errString; errString = itmDBAccessEJB.getErrorString("","VTTSORNTCF","","",conn);
} return errString;
}
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -457,7 +458,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -457,7 +458,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
conn.commit(); conn.commit();
errString = itmDBAccessEJB.getErrorString("","VTCONPARM","","",conn); errString = itmDBAccessEJB.getErrorString("","VTCONPARM","","",conn);
} }
if(pstmt != null){pstmt.close();pstmt=null;} if(pstmt != null){pstmt.close();pstmt=null;}
if(interfacePstmt != null){interfacePstmt.close();interfacePstmt=null;} if(interfacePstmt != null){interfacePstmt.close();interfacePstmt=null;}
if(rs != null){rs.close();rs=null;} if(rs != null){rs.close();rs=null;}
...@@ -475,113 +476,113 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -475,113 +476,113 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
String sql = "", interfaceSql = ""; String sql = "", interfaceSql = "";
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt = null, interfacePstmt = null; PreparedStatement pstmt = null, interfacePstmt = null;
int caseCount = 0,flag = 0; int caseCount = 0,flag = 0;
Boolean isError = false; Boolean isError = false;
String loginEmpCode = "",userId = "",loginSite = "",errString = "",objName = "",itemDescr = ""; String loginEmpCode = "",userId = "",loginSite = "",errString = "",objName = "",itemDescr = "";
String itemCode = "",lineNo = "",descr = "",unit = "",itemType = "",familyGrp = "",refSer = "",lotNo = "",refId = "",lotSl = "", String itemCode = "",lineNo = "",descr = "",unit = "",itemType = "",familyGrp = "",refSer = "",lotNo = "",refId = "",lotSl = "",
palletNo = "",palletStatus = "",lockStat = "",qcType = "",stroPref = "",palletRej = "",palletRejDesc = "",confirmed = "",siteCode = ""; palletNo = "",palletStatus = "",lockStat = "",qcType = "",stroPref = "",palletRej = "",palletRejDesc = "",confirmed = "",siteCode = "";
String transactionId = ""; String transactionId = "";
double quantity = 0, noArtQuot = 0,noArtRem = 0,notArt = 0,shipperSize = 0,totalQuantity = 0,qtyPerArt = 0; double quantity = 0, noArtQuot = 0,noArtRem = 0,notArt = 0,shipperSize = 0,totalQuantity = 0,qtyPerArt = 0;
Timestamp today = new Timestamp(System.currentTimeMillis()); Timestamp today = new Timestamp(System.currentTimeMillis());
Timestamp expDate = null; Timestamp expDate = null;
Timestamp mfgDate = null; Timestamp mfgDate = null;
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
System.out.println("XTRA PARAMS ["+xtraParams+"]"); System.out.println("XTRA PARAMS ["+xtraParams+"]");
loginEmpCode = checkNullAndTrim(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode")); loginEmpCode = checkNullAndTrim(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode"));
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
loginSite = checkNullAndTrim((genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"))); loginSite = checkNullAndTrim((genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode")));
ArrayList interfaceArrList = new ArrayList(); ArrayList interfaceArrList = new ArrayList();
try try
{ {
System.out.println("Inside try block sale order....."); System.out.println("Inside try block sale order.....");
System.out.println("Today="+today); System.out.println("Today="+today);
sql = "SELECT CONFIRMED FROM SORDER WHERE SALE_ORDER = ?"; sql = "SELECT CONFIRMED FROM SORDER WHERE SALE_ORDER = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
confirmed = checkNullAndTrim(rs.getString("CONFIRMED"));
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if("Y".equalsIgnoreCase(confirmed))
{
//sql = "SELECT * FROM INTERFACE2 WHERE REF_ID = ?";SWMS_TO_AWMS
sql = "SELECT * FROM SWMS_TO_AWMS WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
confirmed = checkNullAndTrim(rs.getString("CONFIRMED")); System.out.println("Transaction is already present in interface2 table");
errString = itmDBAccessEJB.getErrorString("","ALRDYSUBMT","","",conn);
return errString;
} }
rs.close();rs = null; else
pstmt.close();pstmt = null;
if("Y".equalsIgnoreCase(confirmed))
{ {
//sql = "SELECT * FROM INTERFACE2 WHERE REF_ID = ?";SWMS_TO_AWMS //sql = "SELECT ITEM_CODE,LINE_NO,QUANTITY,UNIT__STD,LOT_NO,LOT_SL,MFG_DATE,EXP_DATE,LOC_CODE,SITE_CODE FROM SORDALLOC WHERE SALE_ORDER = ?";
sql = "SELECT * FROM SWMS_TO_AWMS WHERE REF_ID = ?"; sql = "SELECT S.ITEM_CODE,I.DESCR,D.LINE_NO,S.QUANTITY,D.UNIT,S.LOT_NO,S.LOT_SL,S.SITE_CODE,S.LOC_CODE,S.NO_ART,S.QTY_PER_ART,"
+" I.ITEM_TYPE"//+" FROM STOCK S,SORDALLOC D WHERE" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" FROM STOCK S,SORDALLOC D,LOCATION L,ITEM I WHERE"
+" S.ITEM_CODE = D.ITEM_CODE"
+" AND S.LOT_NO = D.LOT_NO"
+" AND S.LOT_SL = D.LOT_SL"
+" AND S.LOC_CODE = D.LOC_CODE"
+" AND S.SITE_CODE = D.SITE_CODE"
+" AND L.LOC_CODE = D.LOC_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND L.INV_STAT = 'AWMS'" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND I.ITEM_CODE = D.ITEM_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND D.SALE_ORDER = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) while(rs.next())
{
System.out.println("Transaction is already present in interface2 table");
errString = itmDBAccessEJB.getErrorString("","ALRDYSUBMT","","",conn);
return errString;
}
else
{ {
//sql = "SELECT ITEM_CODE,LINE_NO,QUANTITY,UNIT__STD,LOT_NO,LOT_SL,MFG_DATE,EXP_DATE,LOC_CODE,SITE_CODE FROM SORDALLOC WHERE SALE_ORDER = ?"; flag = 1;
sql = "SELECT S.ITEM_CODE,I.DESCR,D.LINE_NO,S.QUANTITY,D.UNIT,S.LOT_NO,S.LOT_SL,S.SITE_CODE,S.LOC_CODE,S.NO_ART,S.QTY_PER_ART,"
+" I.ITEM_TYPE"//+" FROM STOCK S,SORDALLOC D WHERE" //Changed by wasim on 20-08-2015 to add inv_stat validation itemCode = checkNullAndTrim(rs.getString("ITEM_CODE"));
+" FROM STOCK S,SORDALLOC D,LOCATION L,ITEM I WHERE" itemDescr = checkNullAndTrim(rs.getString("DESCR"));
+" S.ITEM_CODE = D.ITEM_CODE" lineNo = checkNullAndTrim(rs.getString("LINE_NO"));
+" AND S.LOT_NO = D.LOT_NO"
+" AND S.LOT_SL = D.LOT_SL" //Changed by wasim on 26-11-2015 to remove space for interface table [START]
+" AND S.LOC_CODE = D.LOC_CODE" /*lineNo = " " + lineNo;
+" AND S.SITE_CODE = D.SITE_CODE"
+" AND L.LOC_CODE = D.LOC_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND L.INV_STAT = 'AWMS'" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND I.ITEM_CODE = D.ITEM_CODE" //Changed by wasim on 20-08-2015 to add inv_stat validation
+" AND D.SALE_ORDER = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
flag = 1;
itemCode = checkNullAndTrim(rs.getString("ITEM_CODE"));
itemDescr = checkNullAndTrim(rs.getString("DESCR"));
lineNo = checkNullAndTrim(rs.getString("LINE_NO"));
//Changed by wasim on 26-11-2015 to remove space for interface table [START]
/*lineNo = " " + lineNo;
lineNo = lineNo.substring(lineNo.length()-3);*/ lineNo = lineNo.substring(lineNo.length()-3);*/
//Changed by wasim on 26-11-2015 to remove space for interface table [END] //Changed by wasim on 26-11-2015 to remove space for interface table [END]
quantity = rs.getDouble("QUANTITY"); quantity = rs.getDouble("QUANTITY");
unit = checkNullAndTrim(rs.getString("UNIT")); unit = checkNullAndTrim(rs.getString("UNIT"));
lotNo = checkNullAndTrim(rs.getString("LOT_NO")); lotNo = checkNullAndTrim(rs.getString("LOT_NO"));
lotSl = checkNullAndTrim(rs.getString("LOT_SL")); lotSl = checkNullAndTrim(rs.getString("LOT_SL"));
//mfgDate = rs.getTimestamp("MFG_DATE"); //mfgDate = rs.getTimestamp("MFG_DATE");
//expDate = rs.getTimestamp("EXP_DATE"); //expDate = rs.getTimestamp("EXP_DATE");
palletNo = checkNullAndTrim(rs.getString("LOC_CODE")); palletNo = checkNullAndTrim(rs.getString("LOC_CODE"));
notArt = rs.getDouble("NO_ART"); notArt = rs.getDouble("NO_ART");
qtyPerArt = rs.getDouble("QTY_PER_ART"); qtyPerArt = rs.getDouble("QTY_PER_ART");
itemType = checkNullAndTrim(rs.getString("ITEM_TYPE")); itemType = checkNullAndTrim(rs.getString("ITEM_TYPE"));
/*hm = getPalletizedAttributes(itemCode,siteCode,conn); /*hm = getPalletizedAttributes(itemCode,siteCode,conn);
familyGrp = (String) hm.get("LOC_ZONE__PREF"); familyGrp = (String) hm.get("LOC_ZONE__PREF");
qcType = (String) hm.get("PROC_MTH"); qcType = (String) hm.get("PROC_MTH");
stroPref = (String) hm.get("ANALYSIS_CLASS");*/ stroPref = (String) hm.get("ANALYSIS_CLASS");*/
//transactionId = generateTranTd("w_interface2",today.toString(),loginSite,conn); //transactionId = generateTranTd("w_interface2",today.toString(),loginSite,conn);
/*HashMap hm = new HashMap(); /*HashMap hm = new HashMap();
hm = commonWmsUtility.getItemVoumeMap(itemCode,lotNo,conn); hm = commonWmsUtility.getItemVoumeMap(itemCode,lotNo,conn);
shipperSize = (Double) hm.get("PACK_SIZE"); shipperSize = (Double) hm.get("PACK_SIZE");
noArtQuot= quantity / shipperSize ; noArtQuot= quantity / shipperSize ;
noArtRem = quantity % shipperSize ; noArtRem = quantity % shipperSize ;
if(noArtRem > 0) if(noArtRem > 0)
...@@ -592,79 +593,79 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -592,79 +593,79 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
totalQuantity = notArt * shipperSize; totalQuantity = notArt * shipperSize;
System.out.println("Quantity["+quantity+"]ShipperSize["+shipperSize+"]noArtQuot["+noArtQuot+"]" System.out.println("Quantity["+quantity+"]ShipperSize["+shipperSize+"]noArtQuot["+noArtQuot+"]"
+ "noArtRem["+noArtRem+"]notArt["+notArt+"]TotalQuantity["+totalQuantity+"]");*/ + "noArtRem["+noArtRem+"]notArt["+notArt+"]TotalQuantity["+totalQuantity+"]");*/
noArtQuot= quantity / qtyPerArt ; noArtQuot= quantity / qtyPerArt ;
noArtRem = quantity % qtyPerArt ; noArtRem = quantity % qtyPerArt ;
if(noArtRem > 0) if(noArtRem > 0)
{
noArtRem = 1;
}
noArtQuot = (int) noArtQuot;
notArt = noArtQuot + noArtRem;
totalQuantity = notArt * qtyPerArt;
System.out.println("Quantity["+quantity+"]ShipperSize["+qtyPerArt+"]noArtQuot["+noArtQuot+"]"
+ "noArtRem["+noArtRem+"]notArt["+notArt+"]TotalQuantity["+totalQuantity+"]");
System.out.println("Pallet No before removing suffix: "+palletNo);
palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') ||
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
(palletNo.charAt(palletNo.trim().length()-1)=='P') ? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo);
HashMap interfaceHmap = new HashMap();
interfaceHmap.put("TRAN_ID", "");
interfaceHmap.put("ITEM_CODE", itemCode);
interfaceHmap.put("DESCR", itemDescr);
interfaceHmap.put("UNIT", unit);
interfaceHmap.put("ITEM_TYPE", itemType);
interfaceHmap.put("FAMILY_GRP", "");
interfaceHmap.put("IN_OUT", "O");
interfaceHmap.put("REF_SER", "S-ORD");
interfaceHmap.put("REF_ID", tranId);
interfaceHmap.put("TRAN_DATE", checkNullAndTrim(String.valueOf(today)));
interfaceHmap.put("LOT_NO", lotNo);
interfaceHmap.put("LOT_SL", lotSl);
interfaceHmap.put("QUANTITY", String.valueOf(notArt));
interfaceHmap.put("QTY_PER_ART", String.valueOf(qtyPerArt));
interfaceHmap.put("TOTAL_QTY", String.valueOf(quantity));
interfaceHmap.put("EXP_DATE", "");
interfaceHmap.put("MFG_DATE", "");
interfaceHmap.put("PALLET_NO", palletNo);
interfaceHmap.put("MSG_STAT", "N");
interfaceHmap.put("PALLET_STATUS", "");
interfaceHmap.put("LOCK_STAT", "");
interfaceHmap.put("ERR_COD", "");
interfaceHmap.put("ERR_DESC", "");
interfaceHmap.put("QC_TYPE", "");
interfaceHmap.put("TRANS_DT_ACK", "");
interfaceHmap.put("STRO_PREF", "");
interfaceHmap.put("LINE_NO", lineNo);
interfaceArrList.add(interfaceHmap);
}
rs.close();rs = null;
pstmt.close();pstmt = null;
if(flag == 0)
{ {
errString = itmDBAccessEJB.getErrorString("","RECNOTSORA","","",conn); noArtRem = 1;
return errString;
} }
else noArtQuot = (int) noArtQuot;
{
commonWmsUtility.updateAwmsInterface(interfaceArrList,loginSite,conn); notArt = noArtQuot + noArtRem;
} totalQuantity = notArt * qtyPerArt;
System.out.println("Quantity["+quantity+"]ShipperSize["+qtyPerArt+"]noArtQuot["+noArtQuot+"]"
+ "noArtRem["+noArtRem+"]notArt["+notArt+"]TotalQuantity["+totalQuantity+"]");
System.out.println("Pallet No before removing suffix: "+palletNo);
palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') ||
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
(palletNo.charAt(palletNo.trim().length()-1)=='P') ? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo);
HashMap interfaceHmap = new HashMap();
interfaceHmap.put("TRAN_ID", "");
interfaceHmap.put("ITEM_CODE", itemCode);
interfaceHmap.put("DESCR", itemDescr);
interfaceHmap.put("UNIT", unit);
interfaceHmap.put("ITEM_TYPE", itemType);
interfaceHmap.put("FAMILY_GRP", "");
interfaceHmap.put("IN_OUT", "O");
interfaceHmap.put("REF_SER", "S-ORD");
interfaceHmap.put("REF_ID", tranId);
interfaceHmap.put("TRAN_DATE", checkNullAndTrim(String.valueOf(today)));
interfaceHmap.put("LOT_NO", lotNo);
interfaceHmap.put("LOT_SL", lotSl);
interfaceHmap.put("QUANTITY", String.valueOf(notArt));
interfaceHmap.put("QTY_PER_ART", String.valueOf(qtyPerArt));
interfaceHmap.put("TOTAL_QTY", String.valueOf(quantity));
interfaceHmap.put("EXP_DATE", "");
interfaceHmap.put("MFG_DATE", "");
interfaceHmap.put("PALLET_NO", palletNo);
interfaceHmap.put("MSG_STAT", "N");
interfaceHmap.put("PALLET_STATUS", "");
interfaceHmap.put("LOCK_STAT", "");
interfaceHmap.put("ERR_COD", "");
interfaceHmap.put("ERR_DESC", "");
interfaceHmap.put("QC_TYPE", "");
interfaceHmap.put("TRANS_DT_ACK", "");
interfaceHmap.put("STRO_PREF", "");
interfaceHmap.put("LINE_NO", lineNo);
interfaceArrList.add(interfaceHmap);
} }
rs.close();rs = null;
pstmt.close();pstmt = null;
if(flag == 0)
{
errString = itmDBAccessEJB.getErrorString("","RECNOTSORA","","",conn);
return errString;
}
else
{
commonWmsUtility.updateAwmsInterface(interfaceArrList,loginSite,conn);
}
} }
else }
{ else
errString = itmDBAccessEJB.getErrorString("","VTTSORNTCF","","",conn); {
return errString; errString = itmDBAccessEJB.getErrorString("","VTTSORNTCF","","",conn);
} return errString;
}
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -706,7 +707,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -706,7 +707,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
} }
return input.trim(); return input.trim();
} }
//Changed by wasim on 21-04-2016 to stock transfer for damage and hold items [START] //Changed by wasim on 21-04-2016 to stock transfer for damage and hold items [START]
public String palletRequestLock(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException public String palletRequestLock(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{ {
...@@ -715,7 +716,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -715,7 +716,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
Connection conn = null; Connection conn = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
boolean isError = false; boolean isError = false;
try try
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
...@@ -751,7 +752,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -751,7 +752,7 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
System.out.println("Final return="+retString); System.out.println("Final return="+retString);
return retString; return retString;
} }
public String palletRequestLock(String refId,String xtraParams,String forcedFlag,Connection conn) throws RemoteException,ITMException public String palletRequestLock(String refId,String xtraParams,String forcedFlag,Connection conn) throws RemoteException,ITMException
{ {
System.out.println("==================In palletRequestDamageHold======================="); System.out.println("==================In palletRequestDamageHold=======================");
...@@ -761,26 +762,30 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -761,26 +762,30 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
boolean isError = false,isRecordExist = false; boolean isError = false,isRecordExist = false;
String sql = "",errString = "",loginSiteCode = "",userId = "",chgTerm = "",tranID = "",sqlStock = ""; String sql = "",errString = "",loginSiteCode = "",userId = "",chgTerm = "",tranID = "",sqlStock = "";
String itemCode="",lotNo="",lotSl = "",locCode = "",siteCode = "",noArt = "",locCodeFrom = "",locCodeTo = "", String itemCode="",lotNo="",lotSl = "",locCode = "",siteCode = "",noArt = "",locCodeFrom = "",locCodeTo = "",
lineNoInvHold = "",tranType = "",confirmed = "",sqlUpdate = "",refNo = "",palletNo = "",holdStatus = ""; lineNoInvHold = "",tranType = "",confirmed = "",sqlUpdate = "",refNo = "",palletNo = "",holdStatus = "",
confReqDsp="";
int updCnt = 0,lineNo = 0; int updCnt = 0,lineNo = 0;
double quantity = 0,allocQty = 0,palletCnt = 0; double quantity = 0,allocQty = 0,palletCnt = 0;
ResultSet rsStock = null; ResultSet rsStock = null;
//Changed by Jagruti Shinde Request Id:[W16CSUN008]
confReqDsp = checkNullAndTrim(distComm.getDisparams("999999", "CONF_REQ", conn));
System.out.println("CONF_REQ in disparm::::"+confReqDsp);
PalletReqConf palletConf = new PalletReqConf(); PalletReqConf palletConf = new PalletReqConf();
try try
{ {
loginSiteCode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" ); loginSiteCode = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" );
userId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" ); userId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" );
chgTerm = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "chgTerm" ); chgTerm = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "chgTerm" );
java.sql.Timestamp currDate = getCurrtDate(); java.sql.Timestamp currDate = getCurrtDate();
SimpleDateFormat sdfAppl = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdfAppl = new SimpleDateFormat(genericUtility.getApplDateFormat());
String currDateStr = sdfAppl.format(currDate); String currDateStr = sdfAppl.format(currDate);
sql = "SELECT CONFIRMED FROM INV_HOLD WHERE TRAN_ID = ?"; sql = "SELECT CONFIRMED FROM INV_HOLD WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refId); pstmt.setString(1, refId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
confirmed = checkNullAndTrim(rs.getString("CONFIRMED")); confirmed = checkNullAndTrim(rs.getString("CONFIRMED"));
...@@ -793,190 +798,196 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR ...@@ -793,190 +798,196 @@ public class PalletRequisitionActEJB extends ActionHandlerEJB implements PalletR
{ {
rs.close();rs=null; rs.close();rs=null;
} }
System.out.println("INV_HOLD_ID["+refId+"] CONFIRMED["+confirmed+"]"); System.out.println("INV_HOLD_ID["+refId+"] CONFIRMED["+confirmed+"]");
if("Y".equalsIgnoreCase(confirmed)) if("Y".equalsIgnoreCase(confirmed))
{ {
sql = "SELECT REF_NO FROM INV_HOLD WHERE TRAN_ID = ?"; sql = "SELECT REF_NO FROM INV_HOLD WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refId);
rs = pstmt.executeQuery();
if(rs.next())
{
refNo = checkNullAndTrim(rs.getString("REF_NO"));
}
if(pstmt != null){pstmt.close();pstmt=null;}
if(rs != null){rs.close();rs=null;}
if(refNo != null && refNo.length() > 0)
{
//sql = "SELECT COUNT(*) FROM SWMS_TO_AWMS WHERE REF_ID = ?";
sql = "SELECT REF_ID FROM SWMS_TO_AWMS WHERE REF_ID = ? AND REF_SER = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refId); pstmt.setString(1, refNo);
pstmt.setString(2, "PRS");
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
refNo = checkNullAndTrim(rs.getString("REF_NO")); System.out.println("Transaction is already present in interface2 table");
errString = itmDBAccessEJB.getErrorString("","VTNOTEDIT","","",conn);
return errString;
} }
if(pstmt != null){pstmt.close();pstmt=null;} if(pstmt != null)
if(rs != null){rs.close();rs=null;}
if(refNo != null && refNo.length() > 0)
{ {
//sql = "SELECT COUNT(*) FROM SWMS_TO_AWMS WHERE REF_ID = ?"; pstmt.close();pstmt=null;
sql = "SELECT REF_ID FROM SWMS_TO_AWMS WHERE REF_ID = ? AND REF_SER = ?"; }
pstmt = conn.prepareStatement(sql); if(rs != null)
pstmt.setString(1, refNo); {
pstmt.setString(2, "PRS"); rs.close();rs=null;
rs = pstmt.executeQuery();
if(rs.next())
{
System.out.println("Transaction is already present in interface2 table");
errString = itmDBAccessEJB.getErrorString("","VTNOTEDIT","","",conn);
return errString;
}
if(pstmt != null)
{
pstmt.close();pstmt=null;
}
if(rs != null)
{
rs.close();rs=null;
}
} }
}
tranID = commonWmsUtility.generateTranTd("w_pallet_req_stk", currDateStr, loginSiteCode, conn);
tranID = commonWmsUtility.generateTranTd("w_pallet_req_stk", currDateStr, loginSiteCode, conn);
sql = "INSERT INTO PALLET_REQ_DET (TRAN_ID,LINE_NO,PALLET_NO,LOC_CODE,STATUS,ITEM_CODE,LOT_NO,LOT_SL,QUANTITY,NO_ART) "
+ "values (?,?,?,?,?,?,?,?,?,?)"; sql = "INSERT INTO PALLET_REQ_DET (TRAN_ID,LINE_NO,PALLET_NO,LOC_CODE,STATUS,ITEM_CODE,LOT_NO,LOT_SL,QUANTITY,NO_ART) "
pstmtDet = conn.prepareStatement(sql); + "values (?,?,?,?,?,?,?,?,?,?)";
pstmtDet = conn.prepareStatement(sql);
sql = "INSERT INTO PALLET_REQ_HDR (TRAN_ID,TRAN_DATE,SITE_CODE,LOC_CODE,REMARKS,CONFIRMED,CONF_DATE,EMP_CODE__APRV,"//8
+ "ADD_USER,ADD_DATE,ADD_TERM,CHG_USER,CHG_DATE,CHG_TERM,TRAN_TYPE) "//15 sql = "INSERT INTO PALLET_REQ_HDR (TRAN_ID,TRAN_DATE,SITE_CODE,LOC_CODE,REMARKS,CONFIRMED,CONF_DATE,EMP_CODE__APRV,"//8
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + "ADD_USER,ADD_DATE,ADD_TERM,CHG_USER,CHG_DATE,CHG_TERM,TRAN_TYPE) "//15
+ "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmtHdr = conn.prepareStatement(sql);
pstmtHdr.setString( 1, tranID ); pstmtHdr = conn.prepareStatement(sql);
pstmtHdr.setTimestamp( 2, currDate ); pstmtHdr.setString( 1, tranID );
pstmtHdr.setString( 3, loginSiteCode ); pstmtHdr.setTimestamp( 2, currDate );
pstmtHdr.setString( 4, locCode); pstmtHdr.setString( 3, loginSiteCode );
pstmtHdr.setString( 5, "Pallet Out for Hold/Damage"); pstmtHdr.setString( 4, locCode);
pstmtHdr.setString( 6, "N" ); pstmtHdr.setString( 5, "Pallet Out for Hold/Damage");
pstmtHdr.setTimestamp( 7, currDate ); pstmtHdr.setString( 6, "N" );
pstmtHdr.setString( 8, "" ); pstmtHdr.setTimestamp( 7, currDate );
pstmtHdr.setString( 9, userId ); pstmtHdr.setString( 8, "" );
pstmtHdr.setTimestamp( 10, currDate ); pstmtHdr.setString( 9, userId );
pstmtHdr.setString( 11, chgTerm ); pstmtHdr.setTimestamp( 10, currDate );
pstmtHdr.setString( 12, userId ); pstmtHdr.setString( 11, chgTerm );
pstmtHdr.setTimestamp( 13, currDate ); pstmtHdr.setString( 12, userId );
pstmtHdr.setString( 14, chgTerm ); pstmtHdr.setTimestamp( 13, currDate );
pstmtHdr.setString( 15, "O" ); pstmtHdr.setString( 14, chgTerm );
pstmtHdr.setString( 15, "O" );
/*updCnt = pstmtHdr.executeUpdate();
/*updCnt = pstmtHdr.executeUpdate();
if(pstmtHdr != null){pstmtHdr.close();pstmtHdr=null;}*/ if(pstmtHdr != null){pstmtHdr.close();pstmtHdr=null;}*/
sqlStock= " SELECT S.ITEM_CODE,S.LOC_CODE,S.SITE_CODE,S.LOT_NO,S.LOT_SL,S.QUANTITY,S.ALLOC_QTY,S.NO_ART,D.LINE_NO " sqlStock= " SELECT S.ITEM_CODE,S.LOC_CODE,S.SITE_CODE,S.LOT_NO,S.LOT_SL,S.QUANTITY,S.ALLOC_QTY,S.NO_ART,D.LINE_NO "
+" FROM STOCK S, INV_HOLD H,INV_HOLD_DET D" +" FROM STOCK S, INV_HOLD H,INV_HOLD_DET D"
+" WHERE S.QUANTITY > 0 AND S.ITEM_CODE = D.ITEM_CODE AND S.LOC_CODE = D. LOC_CODE AND " +" WHERE S.QUANTITY > 0 AND S.ITEM_CODE = D.ITEM_CODE AND S.LOC_CODE = D. LOC_CODE AND "
+" S.SITE_CODE = D. SITE_CODE AND S.LOT_NO = D.LOT_NO AND S.LOT_SL = D.LOT_SL AND" +" S.SITE_CODE = D. SITE_CODE AND S.LOT_NO = D.LOT_NO AND S.LOT_SL = D.LOT_SL AND"
+" S.LOC_CODE = D.LOC_CODE AND H.TRAN_ID = D.TRAN_ID AND H.TRAN_ID = ? AND D.HOLD_STATUS != 'R'"; +" S.LOC_CODE = D.LOC_CODE AND H.TRAN_ID = D.TRAN_ID AND H.TRAN_ID = ? AND D.HOLD_STATUS != 'R'";
pstmtStock = conn.prepareStatement(sqlStock); pstmtStock = conn.prepareStatement(sqlStock);
pstmtStock.setString(1, refId); pstmtStock.setString(1, refId);
rsStock = pstmtStock.executeQuery(); rsStock = pstmtStock.executeQuery();
while(rsStock.next()) while(rsStock.next())
{
itemCode = checkNullAndTrim(rsStock.getString("ITEM_CODE"));
palletNo = checkNullAndTrim(rsStock.getString("LOC_CODE"));
siteCode = rsStock.getString("SITE_CODE");
lotNo = rsStock.getString("LOT_NO");
lotSl = rsStock.getString("LOT_SL");
quantity = rsStock.getDouble("QUANTITY");
allocQty = rsStock.getDouble("ALLOC_QTY");
noArt = checkNullAndTrim(rsStock.getString("NO_ART"));
//lineNoInvHold = checkNullAndTrim(rsStock.getString("LINE_NO"));
System.out.println("Pallet No After before suffix: "+palletNo);
palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') ||
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
(palletNo.charAt(palletNo.trim().length()-1)=='P') || (palletNo.charAt(palletNo.trim().length()-1)=='R')
? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo);
palletCnt = 0;
sql = "SELECT FN_CHK_PR(TRIM(?),'') FROM DUAL";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo);
rs = pstmt.executeQuery();
if(rs.next())
{ {
itemCode = checkNullAndTrim(rsStock.getString("ITEM_CODE")); palletCnt = rs.getInt(1);
palletNo = checkNullAndTrim(rsStock.getString("LOC_CODE"));
siteCode = rsStock.getString("SITE_CODE");
lotNo = rsStock.getString("LOT_NO");
lotSl = rsStock.getString("LOT_SL");
quantity = rsStock.getDouble("QUANTITY");
allocQty = rsStock.getDouble("ALLOC_QTY");
noArt = checkNullAndTrim(rsStock.getString("NO_ART"));
//lineNoInvHold = checkNullAndTrim(rsStock.getString("LINE_NO"));
System.out.println("Pallet No After before suffix: "+palletNo);
palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') ||
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
(palletNo.charAt(palletNo.trim().length()-1)=='P') || (palletNo.charAt(palletNo.trim().length()-1)=='R')
? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo);
palletCnt = 0;
sql = "SELECT FN_CHK_PR(TRIM(?),'') FROM DUAL";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo);
rs = pstmt.executeQuery();
if(rs.next())
{
palletCnt = rs.getInt(1);
}
if(pstmt != null)
{
pstmt.close();pstmt=null;
}
if(rs != null)
{
rs.close();rs=null;
}
if(palletCnt > 0)
{
System.out.println("Pallet is already requested so not considering this pallet");
continue;
}
lineNo++;
pstmtDet.setString( 1, tranID );
pstmtDet.setInt( 2, lineNo );
pstmtDet.setString( 3, palletNo );
pstmtDet.setString( 4, locCode );
pstmtDet.setString( 5, "P" );
pstmtDet.setString( 6, itemCode );
pstmtDet.setString( 7, lotNo );
pstmtDet.setString( 8, lotSl );
pstmtDet.setDouble( 9, quantity );
pstmtDet.setString( 10, noArt );
pstmtDet.addBatch();
isRecordExist = true;
} }
if(isRecordExist) if(pstmt != null)
{
updCnt = pstmtHdr.executeUpdate();
if(pstmtHdr != null)
{
pstmtHdr.close();pstmtHdr=null;
}
pstmtDet.executeBatch();
}
if(pstmtStock != null)
{ {
pstmtStock.close();pstmtStock=null; pstmt.close();pstmt=null;
} }
if(rsStock != null) if(rs != null)
{ {
rsStock.close();rsStock=null; rs.close();rs=null;
} }
if(pstmtDet != null)
if(palletCnt > 0)
{ {
pstmtDet.close();pstmtDet=null; System.out.println("Pallet is already requested so not considering this pallet");
continue;
} }
System.out.println("isRecordExist="+isRecordExist); lineNo++;
if(isRecordExist) pstmtDet.setString( 1, tranID );
{ pstmtDet.setInt( 2, lineNo );
pstmtDet.setString( 3, palletNo );
pstmtDet.setString( 4, locCode );
pstmtDet.setString( 5, "P" );
pstmtDet.setString( 6, itemCode );
pstmtDet.setString( 7, lotNo );
pstmtDet.setString( 8, lotSl );
pstmtDet.setDouble( 9, quantity );
pstmtDet.setString( 10, noArt );
pstmtDet.addBatch();
isRecordExist = true;
}
if(isRecordExist)
{
updCnt = pstmtHdr.executeUpdate();
if(pstmtHdr != null)
{
pstmtHdr.close();pstmtHdr=null;
}
pstmtDet.executeBatch();
}
if(pstmtStock != null)
{
pstmtStock.close();pstmtStock=null;
}
if(rsStock != null)
{
rsStock.close();rsStock=null;
}
if(pstmtDet != null)
{
pstmtDet.close();pstmtDet=null;
}
System.out.println("isRecordExist="+isRecordExist);
if(isRecordExist)
{
//Changed by Jagruti Shinde Request Id:[W16CSUN008][Start]
if("Y".equalsIgnoreCase(checkNullAndTrim(confReqDsp)))
{
errString = palletConf.confirm(tranID,xtraParams,forcedFlag,conn,false); errString = palletConf.confirm(tranID,xtraParams,forcedFlag,conn,false);
System.out.println("String after confirm pallet request="+errString); System.out.println("String after confirm pallet request="+errString);
if(errString != null && (errString.indexOf("VMTRANSACN") != -1))
{
sqlUpdate = "UPDATE INV_HOLD SET REF_NO = ?, REF_SER = ? WHERE TRAN_ID = ? ";
pstmtUpdate = conn.prepareStatement(sqlUpdate);
pstmtUpdate.setString(1, tranID);
pstmtUpdate.setString(2, "PRS");
pstmtUpdate.setString(3, refId);
updCnt = pstmtUpdate.executeUpdate();
System.out.println("Updated ="+updCnt);
if(pstmtUpdate != null)
{
pstmtUpdate.close();pstmtUpdate=null;
}
}
} }
//if(errString != null && (errString.indexOf("VMTRANSACN") != -1))
//{
//Changed by Jagruti Shinde Request Id:[W16CSUN008][End]
sqlUpdate = "UPDATE INV_HOLD SET REF_NO = ?, REF_SER = ? WHERE TRAN_ID = ? ";
pstmtUpdate = conn.prepareStatement(sqlUpdate);
pstmtUpdate.setString(1, tranID);
pstmtUpdate.setString(2, "PRS");
pstmtUpdate.setString(3, refId);
updCnt = pstmtUpdate.executeUpdate();
System.out.println("Updated ="+updCnt);
if(pstmtUpdate != null)
{
pstmtUpdate.close();pstmtUpdate=null;
}
//Changed by Jagruti Shinde Request Id:[W16CSUN008]
//}
}
} }
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