Commit 0a29e4a3 authored by smestry's avatar smestry

W15FSUN008, Updated class file for Palletization and Palletization Confirm, as per requirment.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99278 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 27ee64a2
...@@ -8,6 +8,7 @@ package ibase.webitm.ejb.wms; ...@@ -8,6 +8,7 @@ package ibase.webitm.ejb.wms;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.DistCommon; import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
...@@ -76,12 +77,22 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -76,12 +77,22 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
System.out.println("xtraParams ::::::::::::: " + xtraParams); System.out.println("xtraParams ::::::::::::: " + xtraParams);
System.out.println("tranId----------->>["+tranId+"]"); System.out.println("tranId----------->>["+tranId+"]");
String objName = getObjNameFromDom( dom, "objName", "1" );
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
System.out.println("childNodeListLength----------->>["+childNodeListLength+"]"); System.out.println("childNodeListLength----------->>["+childNodeListLength+"]");
if("palletization".equalsIgnoreCase(objName))
{
System.out.println("Calling confirm for palletization :::::::::::::::::::: ");
confirm(tranId, siteCode, conn1);
}
else
{
tranIdList = getTranId(siteCode, conn1); tranIdList = getTranId(siteCode, conn1);
for (ctr = 0; ctr < childNodeListLength; ctr++) for (ctr = 0; ctr < childNodeListLength; ctr++)
...@@ -90,6 +101,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -90,6 +101,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
System.out.println("childNodeName ------->>["+childNodeName+"]"); System.out.println("childNodeName ------->>["+childNodeName+"]");
if("tran_id".equalsIgnoreCase(childNodeName)) if("tran_id".equalsIgnoreCase(childNodeName))
{ {
//System.out.println("Inside tran_id ::::::::::: "); //System.out.println("Inside tran_id ::::::::::: ");
...@@ -100,6 +112,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -100,6 +112,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
errList.add( errCode ); errList.add( errCode );
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else if(!tranIdList.contains(tranId) && tranId.length() > 0) else if(!tranIdList.contains(tranId) && tranId.length() > 0)
{ {
System.out.println("Tran Id does not exist in pallet hdr :::::::::: "); System.out.println("Tran Id does not exist in pallet hdr :::::::::: ");
...@@ -110,11 +123,13 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -110,11 +123,13 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
if(tranIdList.contains(tranId)) if(tranIdList.contains(tranId))
{ {
System.out.println("Calling confirm :::::::::::::::::::: "); System.out.println("Calling confirm for palletization confirm menu :::::::::::::::::::: ");
confirm(tranId, siteCode, conn1); confirm(tranId, siteCode, conn1);
} }
} }
} }
}
int errListSize = errList.size(); int errListSize = errList.size();
cnt =0; cnt =0;
...@@ -149,7 +164,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -149,7 +164,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
} }
else else
{ {
errStringXml = new StringBuffer( "" ); return getError(tranId, "VTTRANCONF", conn1);
} }
errString = errStringXml.toString(); errString = errStringXml.toString();
} }
...@@ -596,6 +611,53 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -596,6 +611,53 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
} }
} }
private String getError(String tranId, String Code, Connection conn) throws ITMException, Exception
{
String mainStr ="";
try
{
String errString = "";
errString = new ITMDBAccessEJB().getErrorString("",Code,"","",conn);
String begPart = errString.substring(0,errString.indexOf("<message>")+9);
String endDesc = errString.substring(errString.indexOf("</description>"));
mainStr= begPart+"Transaction confirmed."+"</message><description>";
mainStr= mainStr+"Transaction confirmed for Transaction ID : ["+tranId+"]."+endDesc;
System.out.println("mainStr:::::::::::::::::: "+mainStr);
begPart = null;
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return mainStr;
}
private String getObjNameFromDom( Document dom, String attribute, String objContext ) throws RemoteException,ITMException
{
NodeList detailList = null;
Node currDetail = null, reqDetail = null;
String objName = "";
int detailListLength = 0;
try
{
detailList = dom.getElementsByTagName("Detail"+objContext);
detailListLength = detailList.getLength();
for (int ctr = 0; ctr < detailListLength; ctr++)
{
currDetail = detailList.item(ctr);
objName = currDetail.getAttributes().getNamedItem(attribute).getNodeValue();
}
}
catch ( Exception e )
{
throw new ITMException(e);
}
return objName;
}
} }
...@@ -157,59 +157,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -157,59 +157,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
//System.out.println("palletNo ------->>["+palletNo+"]"); //System.out.println("palletNo ------->>["+palletNo+"]");
//locStockList = getLocationCode(conn, loginSite); //locStockList = getLocationCode(conn, loginSite);
for (ctr = 0; ctr < childNodeListLength; ctr++) for (ctr = 0; ctr < childNodeListLength; ctr++)
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
//System.out.println("childNodeName ------->>["+childNodeName+"]"); //System.out.println("childNodeName ------->>["+childNodeName+"]");
/*
if("loc_code".equalsIgnoreCase(childNodeName))
{
System.out.println("Inside loc_code ::::::::::: ");
if(locationCode.length() <= 0)
{
System.out.println("Blank for Location Code :::::::::: ");
errCode = "VTINVLPNO";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
if(!locStockList.contains(locationCode) && locationCode.length() > 0)
{
System.out.println("Location Code does not exist in stock table :::::::::: ");
errCode = "INVLOCCODE";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
}*/
/*if("pallet_no__source".equalsIgnoreCase(childNodeName))
{
System.out.println("Inside pallet_no__source ::::::::::: ");
if(locationCode.length() <= 0 && palletNoSource.length() <= 0)
{
System.out.println("Blank for Location Code and pallet No Source :::::::::: ");
errCode = "VTINVLPNO";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else if(locationCode.length() > 0 && palletNoSource.length() > 0)
{
System.out.println(" value found for Location Code and pallet No Source :::::::::: ");
errCode = "VTPNOLOC";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else if(!locStockList.contains(palletNoSource) && palletNoSource.length() > 0)
{
System.out.println("Pallet No Source does not exist in stock table :::::::::: ");
errCode = "INVPALTSRC";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
}*/
if("pallet_no".equalsIgnoreCase(childNodeName)) if("pallet_no".equalsIgnoreCase(childNodeName))
{ {
if(palletNo.length() <= 0) // blank if(palletNo.length() <= 0) // blank
...@@ -250,25 +203,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -250,25 +203,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} }
} }
/*if(locationCode.equals(palletNo))
{
System.out.println("Location Code or Pallet No Source and Pallet No is same :::::::::: ");
errCode = "VTLOCPLT";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}*/
/*if(locationCode.equals(palletNo) || palletNoSource.equals(palletNo))
{
System.out.println("Location Code or Pallet No Source and Pallet No is same :::::::::: ");
errCode = "VTLOCPLT";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}*/
} }
} }
break; break;
...@@ -340,6 +276,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -340,6 +276,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
HashMap hm = new HashMap(); HashMap hm = new HashMap();
HashMap hm1 = new HashMap(); HashMap hm1 = new HashMap();
int count = 0;
parentNodeList = dom.getElementsByTagName("Detail3"); parentNodeList = dom.getElementsByTagName("Detail3");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
...@@ -349,8 +287,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -349,8 +287,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
quantity = checkNullAndTrim(genericUtility.getColumnValue("quantity",dom)); quantity = checkNullAndTrim(genericUtility.getColumnValue("quantity",dom));
lotNo = checkNullAndTrim(genericUtility.getColumnValue("lot_no",dom)); lotNo = checkNullAndTrim(genericUtility.getColumnValue("lot_no",dom));
lotSl = checkNullAndTrim(genericUtility.getColumnValue("lot_sl",dom)); lotSl = checkNullAndTrim(genericUtility.getColumnValue("lot_sl",dom));
//locationCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code",dom1));
palletNo = checkNullAndTrim(genericUtility.getColumnValue("pallet_no",dom1)); palletNo = checkNullAndTrim(genericUtility.getColumnValue("pallet_no",dom1));
System.out.println("itemCode :::::::::::::: " + itemCode); System.out.println("itemCode :::::::::::::: " + itemCode);
...@@ -359,74 +295,96 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -359,74 +295,96 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("lotSl :::::::::::::: " + lotSl); System.out.println("lotSl :::::::::::::: " + lotSl);
System.out.println("palletNo :::::::::::::: " + palletNo); System.out.println("palletNo :::::::::::::: " + palletNo);
/*sql ="select distinct(item_code) from pallet_hdr h, pallet_det d where d.loc_code = ? and d.pallet_no = ? and " for (ctr = 0; ctr < childNodeListLength; ctr++)
+ "h.confirmed = 'N' and d.tran_id = h.tran_id and rownum < 2 ";*/ {
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
//System.out.println("childNodeName ------->>["+childNodeName+"]");
//Changed by Sneha on 06-11-2015, Request ID: W15FSUN008 if("lot_no".equalsIgnoreCase(childNodeName))
sql ="select distinct(item_code) from pallet_hdr h, pallet_det d where d.pallet_no = ? and " {
+ "h.confirmed = ? and d.tran_id = h.tran_id and rownum < 2 "; if(lotNo.length() <= 0) // blank
//End by Sneha on 06-11-2015, Request ID: W15FSUN008 {
System.out.println("lot No is blank :::::::::::::::: ");
errCode = "VTLOTBLNK";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
}
if("lot_sl".equalsIgnoreCase(childNodeName))
{
if(lotSl.length() <= 0) // blank
{
System.out.println("lot sl is blank ::::::::::: ");
errCode = "VTLSLBLNK";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else
{
sql = "select count(*) from pallet_det d, pallet_hdr h where d.lot_no = ? and d.lot_sl = ? and "
+ "d.pallet_no = ? and d.site_code = ? and d.tran_id = h.tran_id and h.confirmed = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
//pstmt.setString(1, locationCode); pstmt.setString(1, lotNo);
pstmt.setString(1, palletNo); pstmt.setString(2, lotSl);
pstmt.setString(2, "N"); pstmt.setString(3, palletNo);
pstmt.setString(4, loginSite);
pstmt.setString(5, "Y");
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
itemCodeDB = checkNullAndTrim(rs.getString("item_code")); count = rs.getInt(1);
} }
if(pstmt != null){pstmt.close();pstmt = null;} if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;} if(rs != null){rs.close();rs = null;}
//System.out.println("itemCodeDB ------->>["+itemCodeDB+"]");
//parseQuantity = Double.parseDouble(quantity); if(count > 0)
//System.out.println("parseQuantity ------->>["+parseQuantity+"]"); {
System.out.println("Record already scanned :::::::::: ");
/*sql = "select (quantity - (alloc_qty + hold_qty)) as quantity from stock where loc_code in (?,?) " errCode = "VTSMRCD";
+ "and (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? and item_code = ? and lot_no = ? and lot_sl = ? "; errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else
{
sql = "select count(*) from stock where lot_no = ? and lot_sl = ? "
+ "and site_code = ? and inv_stat != ? and (quantity - (alloc_qty + hold_qty)) > 0 ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locationCode); pstmt.setString(1, lotNo);
pstmt.setString(2, palletNoSource); pstmt.setString(2, lotSl);
//pstmt.setString(3, palletNo);
pstmt.setString(3, loginSite); pstmt.setString(3, loginSite);
pstmt.setString(4, itemCode); pstmt.setString(4, "AWMS");
pstmt.setString(5, lotNo);
pstmt.setString(6, lotSl);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
quantityDB = rs.getDouble("quantity"); count = rs.getInt(1);
} }
if(pstmt != null){pstmt.close();pstmt = null;} if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}*/ if(rs != null){rs.close();rs = null;}
for (ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
//System.out.println("childNodeName ------->>["+childNodeName+"]");
if("lot_sl".equalsIgnoreCase(childNodeName))
{
//System.out.println("Inside lot_sl ::::::::::: ");
/*if(parseQuantity <= 0) if(count <= 0)
{ {
System.out.println("quantity less than zero :::::::::: "); System.out.println("No record found :::::::::: ");
errCode = "VTISS1"; errCode = "VTINVREC";
errList.add( errCode ); errList.add( errCode );
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else if(parseQuantity > quantityDB) else
{ {
System.out.println("quantity greater than available quantity in stock :::::::::: ");
errCode = "VTSTKQTY";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}*/
if( itemCodeDB != null && itemCodeDB.trim().length() > 0 ) sql ="select distinct(item_code) from pallet_hdr h, pallet_det d where d.pallet_no = ? and "
+ "h.confirmed = ? and d.tran_id = h.tran_id and rownum < 2 ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo);
pstmt.setString(2, "N");
rs = pstmt.executeQuery();
if(rs.next())
{ {
System.out.println("Inside if loop for analysis class :::::::::: "); itemCodeDB = checkNullAndTrim(rs.getString("item_code"));
}
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
hm = commonWmsUtility.getPalletizedAttributes(itemCode, loginSite, conn); hm = commonWmsUtility.getPalletizedAttributes(itemCode, loginSite, conn);
familyGrp = (String) hm.get("LOC_ZONE__PREF"); familyGrp = (String) hm.get("LOC_ZONE__PREF");
...@@ -438,14 +396,14 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -438,14 +396,14 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
qcTypeDB = (String) hm1.get("PROC_MTH"); qcTypeDB = (String) hm1.get("PROC_MTH");
stroPrefDB = (String) hm1.get("ANALYSIS_CLASS"); stroPrefDB = (String) hm1.get("ANALYSIS_CLASS");
System.out.println("familyGrp :::::::::: " + familyGrp); /* System.out.println("familyGrp :::::::::: " + familyGrp);
System.out.println("qcType :::::::::: " + qcType); System.out.println("qcType :::::::::: " + qcType);
System.out.println("stroPref :::::::::: " + stroPref); System.out.println("stroPref :::::::::: " + stroPref);
System.out.println("familyGrpDB :::::::::: " + familyGrpDB); System.out.println("familyGrpDB :::::::::: " + familyGrpDB);
System.out.println("qcTypeDB :::::::::: " + qcTypeDB); System.out.println("qcTypeDB :::::::::: " + qcTypeDB);
System.out.println("stroPrefDB :::::::::: " + stroPrefDB); System.out.println("stroPrefDB :::::::::: " + stroPrefDB);
*/
if(!familyGrpDB.equalsIgnoreCase(familyGrp) || !qcTypeDB.equalsIgnoreCase(qcType) || !stroPrefDB.equalsIgnoreCase(stroPref)) if(!familyGrpDB.equalsIgnoreCase(familyGrp) || !qcTypeDB.equalsIgnoreCase(qcType) || !stroPrefDB.equalsIgnoreCase(stroPref))
{ {
System.out.println(" item code is not of same analysis grp :::::::::: "); System.out.println(" item code is not of same analysis grp :::::::::: ");
...@@ -453,6 +411,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -453,6 +411,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
errList.add( errCode ); errList.add( errCode );
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}
}
} }
} }
} }
...@@ -1020,115 +984,69 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1020,115 +984,69 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
case 3://Case 3. Start case 3://Case 3. Start
{ {
String palletNo = "", domID = "", itemCode = "", descr = "", lotNo = "", lotSl = "", unit = "", locCode = "";
int noArt = 0, lineNo = 0;
double quantity = 0;
System.out.println("-------------- itemchanged in Details 3 ----------------------"); System.out.println("-------------- itemchanged in Details 3 ----------------------");
System.out.println("hdrDataDom------->>["+genericUtility.serializeDom(hdrDataDom)+"]"); System.out.println("hdrDataDom------->>["+genericUtility.serializeDom(hdrDataDom)+"]");
System.out.println("currFormDataDom------>>["+genericUtility.serializeDom(currFormDataDom)+"]"); System.out.println("currFormDataDom------>>["+genericUtility.serializeDom(currFormDataDom)+"]");
System.out.println("allFormDataDom------>>["+genericUtility.serializeDom(allFormDataDom)+"]"); System.out.println("allFormDataDom------>>["+genericUtility.serializeDom(allFormDataDom)+"]");
double quantity = 0;
String itemCode = "", lotNo = "", lotSl = "", locationCode ="", palletNo = "", invstat = "", descr = "", unit = "";
int noArt = 0, lineNo = 0, domIdEdit = 0;
String[] disparmInvstat;
tranId = checkNull(genericUtility.getColumnValue("tran_id", allFormDataDom, "2" )); tranId = checkNull(genericUtility.getColumnValue("tran_id", allFormDataDom, "2" ));
System.out.println("Tran_id----------->>["+tranId+"]");
//locationCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code", hdrDataDom));
palletNo = checkNullAndTrim(genericUtility.getColumnValue("pallet_no", hdrDataDom)); palletNo = checkNullAndTrim(genericUtility.getColumnValue("pallet_no", hdrDataDom));
lotNo = checkNullAndTrim(genericUtility.getColumnValue("lot_no", currFormDataDom));
lotSl = checkNullAndTrim(genericUtility.getColumnValue("lot_sl", currFormDataDom));
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) ) System.out.println("Tran_id----------->>["+tranId+"]");
{ System.out.println("palletNo----------->>["+palletNo+"]");
sql = "Select max(line_no) as line_no from pallet_det where tran_id = ? "; System.out.println("lotNo 1st ----------->>["+lotNo+"]");
pstmt = conn.prepareStatement(sql); System.out.println("lotSl 1st ----------->>["+lotSl+"]");
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
domIdEdit = rs.getInt("line_no");
}
if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; }
invstatForQstk = discommon.getDisparams("999999","INVSTAT_FOR_QSTK",conn);
//disparmInvstat = invstatForQstk.split(",");
invstatForQstk = invstatForQstk.replaceAll(",", "','"); NodeList nodeList = allFormDataDom.getElementsByTagName("Detail3");
invstatForQstk = "'"+invstatForQstk+"'"; System.out.println("sds : "+nodeList.item(0).getNodeName());
System.out.println("invstatForQstk :::::::::::: " + invstatForQstk); domID = nodeList.item(0).getAttributes().getNamedItem("domID").getNodeValue();
System.out.println("domID=="+domID);
/*for (int i = 0; i < disparmInvstat.length; i++) if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
{ {
invstat = disparmInvstat[i]; System.out.println("--------------inside itm_default ----------------------");
} if( tranId != null && tranId.trim().length() > 0 )
//System.out.println("invstat :::::::::::: " + invstat);
*/ if( tranId != null && tranId.trim().length() > 0 )
{ {
System.out.println("-------------- itemchanged Edit mode in Details 3 ----------------------"); System.out.println("--------------inside itm_default edit mode details 3 ----------------------");
/*sql = "select d.item_code, d.lot_no, d.lot_sl, d.quantity, d.no_art, d.line_no as line_no "
+ "from pallet_det d, pallet_hdr h where d.loc_code = ? "
+ "and d.pallet_no = ? and h.confirmed = ? and d.site_code = ? and d.tran_id = ? "
+ "and d.tran_id = h.tran_id "
+ "union all "
+ "select item_code, lot_no, lot_sl, (quantity - (alloc_qty + hold_qty)) as quantity, no_art, 0 as line_no "
+ "from stock where loc_code = ? "
+ "and (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? "; */
//Change by Sneha on 06-11-2015, Request ID: W15FSUN008 sql = "select d.item_code, i.descr, d.lot_no, d.lot_sl, d.quantity, i.unit, d.no_art, d.loc_code, d.line_no "
sql = "select d.item_code, i.descr, d.lot_no, d.lot_sl, d.quantity, i.unit, d.no_art, d.line_no as line_no, d.loc_code " + "from pallet_hdr h, pallet_det d, item i "
+ "from pallet_det d, pallet_hdr h, item i where " + "where d.site_code = ? and d.tran_id = ? and d.tran_id = h.tran_id and "
+ "d.pallet_no = ? and h.confirmed = ? and d.site_code = ? and d.tran_id = ? " +"d.item_code = i.item_code ";
+ "and d.tran_id = h.tran_id and i.item_code = d.item_code "
+ "union all "
+ "select s.item_code, i.descr, s.lot_no, s.lot_sl, (quantity - (alloc_qty + hold_qty)) as quantity, i.unit, s.no_art, 0 as line_no, s.loc_code "
+ "from stock s, item i where inv_stat in ("+invstatForQstk+") "
+ "and (quantity - (alloc_qty + hold_qty)) > 0 and s.site_code = ? and i.item_code = s.item_code ";
//End by Sneha on 06-11-2015, Request ID: W15FSUN008
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
//pstmt.setString(1, locationCode); pstmt.setString(1, loginSite);
pstmt.setString(1, palletNo); pstmt.setString(2, tranId);
pstmt.setString(2, "N");
pstmt.setString(3, loginSite);
pstmt.setString(4, tranId);
//pstmt.setString(5, invstat);
//pstmt.setString(6, locationCode);
pstmt.setString(5, loginSite);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
itemCode = checkNullAndTrim(rs.getString("item_code")); itemCode = checkNullAndTrim(rs.getString("item_code"));
lineNo = rs.getInt("line_no");
descr = checkNullAndTrim(rs.getString("descr")); descr = checkNullAndTrim(rs.getString("descr"));
lotNo = checkNullAndTrim(rs.getString("lot_no")); lotNo = checkNullAndTrim(rs.getString("lot_no"));
lotSl = checkNullAndTrim(rs.getString("lot_sl")); lotSl = checkNullAndTrim(rs.getString("lot_sl"));
quantity = rs.getDouble("quantity"); quantity = rs.getDouble("quantity");
unit = checkNullAndTrim(rs.getString("unit")); unit = checkNullAndTrim(rs.getString("unit"));
noArt = rs.getInt("no_art"); noArt = rs.getInt("no_art");
lineNo = rs.getInt("line_no"); locCode = checkNullAndTrim(rs.getString("loc_code"));
locationCode = checkNullAndTrim(rs.getString("loc_code"));
domIdEdit++;
//System.out.println("domIdEdit::::::::::::: " + domIdEdit); valueXmlString.append("<Detail3 domID='"+domID+"' selected=\"Y\">\r\n");
if(isScanningDone(tranId, itemCode, loginSite, locationCode, lotNo, lotSl, palletNo, conn))
{
valueXmlString.append("<Detail3 domID='"+lineNo+"' selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n"); valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n");
valueXmlString.append( "<tran_id><![CDATA[" ).append( tranId ).append( "]]></tran_id>\r\n" ); valueXmlString.append( "<tran_id><![CDATA[" ).append( tranId ).append( "]]></tran_id>\r\n" );
valueXmlString.append( "<line_no><![CDATA[" ).append( lineNo ).append( "]]></line_no>\r\n" ); valueXmlString.append( "<line_no><![CDATA[" ).append( lineNo ).append( "]]></line_no>\r\n" );
}
else
{
valueXmlString.append("<Detail3 domID='"+domIdEdit+"' selected=\"N\">\r\n");
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append( "<tran_id><![CDATA[" ).append( tranId ).append( "]]></tran_id>\r\n" );
valueXmlString.append( "<line_no><![CDATA[" ).append( domIdEdit ).append( "]]></line_no>\r\n" );
}
valueXmlString.append( "<item_code><![CDATA[" ).append( itemCode ).append( "]]></item_code>\r\n" ); valueXmlString.append( "<item_code><![CDATA[" ).append( itemCode ).append( "]]></item_code>\r\n" );
valueXmlString.append( "<item_descr><![CDATA[" ).append( "("+descr+")" ).append( "]]></item_descr>\r\n" ); valueXmlString.append( "<item_descr><![CDATA[" ).append( descr ).append( "]]></item_descr>\r\n" );
valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" ); valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" );
valueXmlString.append( "<loc_code><![CDATA[" ).append( locationCode ).append( "]]></loc_code>\r\n" ); valueXmlString.append( "<loc_code><![CDATA[" ).append( locCode ).append( "]]></loc_code>\r\n" );
valueXmlString.append( "<lot_no><![CDATA[" ).append( lotNo ).append( "]]></lot_no>\r\n" ); valueXmlString.append( "<lot_no><![CDATA[" ).append( lotNo ).append( "]]></lot_no>\r\n" );
valueXmlString.append( "<lot_sl><![CDATA[" ).append( lotSl ).append( "]]></lot_sl>\r\n" ); valueXmlString.append( "<lot_sl><![CDATA[" ).append( lotSl ).append( "]]></lot_sl>\r\n" );
valueXmlString.append( "<pallet_no><![CDATA[" ).append( palletNo ).append( "]]></pallet_no>\r\n" ); valueXmlString.append( "<pallet_no><![CDATA[" ).append( palletNo ).append( "]]></pallet_no>\r\n" );
...@@ -1140,64 +1058,96 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1140,64 +1058,96 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
if(pstmt != null) { pstmt.close(); pstmt = null; } if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; } if(rs != null) { rs.close(); rs = null; }
} }
}
if(currentColumn.trim().equalsIgnoreCase("itm_default_add"))
{
System.out.println("--------------inside itm_default_add ----------------------");
if( tranId != null && tranId.trim().length() > 0 )
{
sql = "select max(line_no)+1 as line_no from pallet_det where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
lineNo = rs.getInt("line_no");
}
if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; }
valueXmlString.append("<Detail3 domID='"+lineNo+"' selected=\"N\">\r\n");
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append( "<tran_id><![CDATA[" ).append( tranId ).append( "]]></tran_id>\r\n" );
valueXmlString.append( "<line_no><![CDATA[" ).append( lineNo ).append( "]]></line_no>\r\n" );
}
else else
{ {
System.out.println("-------------- itemchanged Add mode in Details 3 ----------------------"); valueXmlString.append("<Detail3 domID='"+domID+"' selected=\"N\">\r\n");
/*sql = "select d.item_code, d.lot_no, d.lot_sl, d.quantity, d.no_art " valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
+ "from pallet_det d, pinvstatallet_hdr h where d.loc_code = ? "
+ "and d.pallet_no = ? and h.confirmed = ? and d.site_code = ? and d.tran_id = h.tran_id " valueXmlString.append( "<tran_id><![CDATA[]]></tran_id>\r\n" );
+ "union all " valueXmlString.append( "<line_no><![CDATA[]]></line_no>\r\n" );
+ "select item_code, lot_no, lot_sl, (quantity - (alloc_qty + hold_qty)) as quantity, no_art " }
+ "from stock where loc_code = ? "
+ "and (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? "; */ valueXmlString.append( "<item_code><![CDATA[]]></item_code>\r\n" );
valueXmlString.append( "<item_descr><![CDATA[]]></item_descr>\r\n" );
//Change by Sneha on 06-11-2015, Request ID: W15FSUN008 valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" );
sql = "select d.item_code, i.descr, d.lot_no, d.lot_sl, d.quantity, i.unit, d.no_art, d.line_no as line_no, d.loc_code " valueXmlString.append( "<loc_code><![CDATA[]]></loc_code>\r\n" );
+ "from pallet_det d, pallet_hdr h, item i where " valueXmlString.append( "<lot_no><![CDATA[]]></lot_no>\r\n" );
+ "d.pallet_no = ? and h.confirmed = ? and d.site_code = ? and d.tran_id = h.tran_id and i.item_code = d.item_code " valueXmlString.append( "<lot_sl><![CDATA[]]></lot_sl>\r\n" );
+ "union all " valueXmlString.append( "<pallet_no><![CDATA[" ).append( palletNo ).append( "]]></pallet_no>\r\n" );
+ "select s.item_code, i.descr, s.lot_no, s.lot_sl, (quantity - (alloc_qty + hold_qty)) as quantity, i.unit, s.no_art, 0 as line_no, s.loc_code " valueXmlString.append( "<quantity><![CDATA[]]></quantity>\r\n" );
+ "from stock s, item i where s.inv_stat in ("+invstatForQstk+") " valueXmlString.append( "<item_unit><![CDATA[]]></item_unit>\r\n" );
+ "and (quantity - (alloc_qty + hold_qty)) > 0 and s.site_code = ? and i.item_code = s.item_code "; valueXmlString.append( "<no_art><![CDATA[]]></no_art>\r\n" );
//End by Sneha on 06-11-2015, Request ID: W15FSUN008 valueXmlString.append("</Detail3>\r\n");
}
else if(currentColumn.trim().equalsIgnoreCase("lot_sl"))
{
System.out.println("--------------inside lot_sl ----------------------");
sql = "select s.item_code, i.descr, s.quantity, s.unit, s.no_art, s.loc_code from stock s, item i "
+ "where s.lot_no = ? and s.lot_sl = ? and s.site_code = ? and (s.quantity - (s.alloc_qty + s.hold_qty )) > 0 "
+ "and s.item_code = i.item_code ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
//pstmt.setString(1, locationCode); pstmt.setString(1, lotNo);
pstmt.setString(1, palletNo); pstmt.setString(2, lotSl);
pstmt.setString(2, "N");
pstmt.setString(3, loginSite); pstmt.setString(3, loginSite);
//pstmt.setString(4, invstat);
pstmt.setString(4, loginSite);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) if(rs.next())
{ {
itemCode = checkNullAndTrim(rs.getString("item_code")); itemCode = checkNullAndTrim(rs.getString("item_code"));
descr = checkNullAndTrim(rs.getString("descr")); descr = checkNullAndTrim(rs.getString("descr"));
lotNo = checkNullAndTrim(rs.getString("lot_no"));
lotSl = checkNullAndTrim(rs.getString("lot_sl"));
quantity = rs.getDouble("quantity"); quantity = rs.getDouble("quantity");
unit = checkNullAndTrim(rs.getString("unit")); unit = checkNullAndTrim(rs.getString("unit"));
noArt = rs.getInt("no_art"); noArt = rs.getInt("no_art");
locationCode = checkNullAndTrim(rs.getString("loc_code")); locCode = checkNullAndTrim(rs.getString("loc_code"));
domId++;
if(isScanningDone(tranId, itemCode, loginSite, locationCode, lotNo, lotSl, palletNo, conn)) if( tranId != null && tranId.trim().length() > 0 )
{ {
valueXmlString.append("<Detail3 domID='"+domId+"' selected=\"Y\">\r\n"); valueXmlString.append("<Detail3 domID='"+lineNo+"' selected=\"N\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n"); valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append( "<tran_id><![CDATA[" ).append( tranId ).append( "]]></tran_id>\r\n" );
valueXmlString.append( "<line_no><![CDATA[" ).append( lineNo ).append( "]]></line_no>\r\n" );
} }
else else
{ {
valueXmlString.append("<Detail3 domID='"+domId+"' selected=\"N\">\r\n"); valueXmlString.append("<Detail3 domID='"+domID+"' selected=\"N\">\r\n");
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n"); valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append( "<tran_id><![CDATA[" ).append( "" ).append( "]]></tran_id>\r\n" );
valueXmlString.append( "<line_no><![CDATA[" ).append( domID ).append( "]]></line_no>\r\n" );
} }
valueXmlString.append( "<tran_id><![CDATA[" ).append( "").append( "]]></tran_id>\r\n" );
valueXmlString.append( "<line_no><![CDATA[" ).append( domId ).append( "]]></line_no>\r\n" );
valueXmlString.append( "<item_code><![CDATA[" ).append( itemCode ).append( "]]></item_code>\r\n" ); valueXmlString.append( "<item_code><![CDATA[" ).append( itemCode ).append( "]]></item_code>\r\n" );
valueXmlString.append( "<item_descr><![CDATA[" ).append( "("+descr+")" ).append( "]]></item_descr>\r\n" ); valueXmlString.append( "<item_descr><![CDATA[" ).append( descr ).append( "]]></item_descr>\r\n" );
valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" ); valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" );
valueXmlString.append( "<loc_code><![CDATA[" ).append( locationCode ).append( "]]></loc_code>\r\n" ); valueXmlString.append( "<loc_code><![CDATA[" ).append( locCode ).append( "]]></loc_code>\r\n" );
valueXmlString.append( "<lot_no><![CDATA[" ).append( lotNo ).append( "]]></lot_no>\r\n" ); valueXmlString.append( "<lot_no><![CDATA[" ).append( lotNo ).append( "]]></lot_no>\r\n" );
valueXmlString.append( "<lot_sl><![CDATA[" ).append( lotSl ).append( "]]></lot_sl>\r\n" ); valueXmlString.append( "<lot_sl><![CDATA[" ).append( lotSl ).append( "]]></lot_sl>\r\n" );
valueXmlString.append( "<pallet_no><![CDATA[" ).append( palletNo ).append( "]]></pallet_no>\r\n" ); valueXmlString.append( "<pallet_no><![CDATA[" ).append( palletNo ).append( "]]></pallet_no>\r\n" );
...@@ -1208,9 +1158,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1208,9 +1158,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
} }
if(pstmt != null) { pstmt.close(); pstmt = null; } if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; } if(rs != null) { rs.close(); rs = null; }
}
}
}
} //Case 3. End } //Case 3. End
break; break;
...@@ -1273,7 +1222,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1273,7 +1222,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
return inputVal; return inputVal;
} }
private boolean isScanningDone(String tranId, String itemCode, String loginSite, String locationCode, String lotNo, String lotSl, String palletNo, Connection conn) throws ITMException,Exception /*private boolean isScanningDone(String tranId, String itemCode, String loginSite, String locationCode, String lotNo, String lotSl, String palletNo, Connection conn) throws ITMException,Exception
{ {
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
...@@ -1342,6 +1291,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1342,6 +1291,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
} }
return false; return false;
} }
} }*/
} }
...@@ -9,10 +9,12 @@ package ibase.webitm.ejb.wms; ...@@ -9,10 +9,12 @@ package ibase.webitm.ejb.wms;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.ejb.dis.InvAllocTraceBean; import ibase.webitm.ejb.dis.InvAllocTraceBean;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.TransIDGenerator; import ibase.webitm.utility.TransIDGenerator;
import ibase.webitm.utility.wms.CommonWmsUtil;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
...@@ -22,6 +24,7 @@ import java.sql.ResultSet; ...@@ -22,6 +24,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
...@@ -255,6 +258,298 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -255,6 +258,298 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
} }
return retString; return retString;
} }
private void confirm( String tranId, String siteCode, Connection conn1 ) throws ITMException, SQLException
{/*
String sql = "", tranDate = "", invStat = "", qcType = "",
expDate = "", mfgDate = "", palletStatus = "", qcReqd = "", procMth = "", lineNoInterface = "";
double holdQuantity = 0, quantityDB = 0, packSize = 0, interfaceQty = 0, interfaceQtyRem = 0, totQuantity = 0, qtyPerArt = 0, noArt = 0;
PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null, rs1 = null;
boolean isError = false;
DistCommon distComm = new DistCommon();
String nexpLoc = "", lockCode = "", expLoc = "";
ArrayList interfaceArrList = new ArrayList();
int interfaceQty1 = 0;
try
{
System.out.println("::::::::::::::::: Inside confirm for palletization confirm :::::::::::::::: ");
System.out.println("tranId :::::::::::::::: " + tranId);
System.out.println("siteCode :::::::::::::::: " + siteCode);
CommonWmsUtil commonWmsUtility = CommonWmsUtil.getInstance();
GenericUtility genericUtility = GenericUtility.getInstance();
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat simpleDateFormatObj = new SimpleDateFormat(genericUtility.getApplDateFormat());
tranDate = simpleDateFormatObj.format(currentDate.getTime());
System.out.println("tranDate ::::::::::::: " + tranDate);
Date today = new Timestamp(System.currentTimeMillis());
sql = "update pallet_hdr set confirmed = ?, conf_date = ? where tran_id = ? ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, "Y");
pstmt.setTimestamp(2, new Timestamp(System.currentTimeMillis()));
pstmt.setString(3, tranId);
pstmt.executeUpdate();
pstmt.close();
pstmt = null;
sql = "select det.item_code, det.lot_no, det.lot_sl, det.quantity, det.pallet_no, "
+ "hdr.inv_stat, det.site_code, det.loc_code, hdr.tran_date, det.line_no, i.descr, i.unit, i.item_type "
+ "from pallet_hdr hdr, pallet_det det, item i where hdr.tran_id = det.tran_id and det.tran_id = ? and i.item_code = det.item_code ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
sql = "select hold_qty, qty_per_art, no_art from stock where quantity > 0 and site_code = ? and loc_code = ? and "
+ "item_code = ? and lot_no = ? and lot_sl = ? ";
pstmt1 = conn1.prepareStatement(sql);
pstmt1.setString(1, rs.getString("site_code"));
pstmt1.setString(2, rs.getString("loc_code"));
pstmt1.setString(3, rs.getString("item_code"));
pstmt1.setString(4, rs.getString("lot_no"));
pstmt1.setString(5, rs.getString("lot_sl"));
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
holdQuantity = rs1.getDouble("hold_qty");
qtyPerArt = rs1.getDouble("qty_per_art");
noArt = rs1.getDouble("no_art");
}
if(pstmt1 != null){ pstmt1.close(); pstmt1 = null; }
if(rs1 != null){ rs1.close(); rs1 = null; }
System.out.println("holdQuantity ::::::::::::: " + holdQuantity);
System.out.println("qtyPerArt ::::::::::::: " + qtyPerArt);
System.out.println("noArt ::::::::::::: " + noArt);
// InvStat
if(holdQuantity > 0)
{
//System.out.println("inside hold quantity greater than zero :::::::::::::::::: ");
nexpLoc = distComm.getDisparams("999999","NEAR_EXP_LOCK",conn1);
expLoc = distComm.getDisparams("999999","EXP_LOCK",conn1);
sql = "select i.lock_code from inv_hold i, inv_hold_det d where i.tran_id = d.tran_id and i.site_code = d.site_code and "
+ "d.item_code = ? and d.site_code = ? and d.loc_code = ? and d.lot_no = ? and d.lot_sl = ? and d.hold_status = ? ";
pstmt1 = conn1.prepareStatement(sql);
pstmt1.setString(1, rs.getString("item_code"));
pstmt1.setString(2, rs.getString("site_code"));
pstmt1.setString(3, rs.getString("loc_code"));
pstmt1.setString(4, rs.getString("lot_no"));
pstmt1.setString(5, rs.getString("lot_sl"));
pstmt1.setString(6, "H");
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
lockCode = checkNullAndTrim(rs1.getString("lock_code"));
}
if(pstmt1 != null){ pstmt1.close(); pstmt1 = null; }
if(rs1 != null){ rs1.close(); rs1 = null; }
System.out.println("lockCode ::::::::::::: " + lockCode);
if(lockCode.equalsIgnoreCase(nexpLoc))
{
invStat = "N";
}
else if(lockCode.equalsIgnoreCase(expLoc))
{
invStat = "E";
}
else
{
invStat = "H";
}
}
else
{
invStat = "A";
}
System.out.println("invStat final ::::::::::::: " + invStat);
// Quantity, no of Arts, Total Quantity
HashMap hm1 = new HashMap();
hm1 = commonWmsUtility.getItemVoumeMap(rs.getString("item_code"), rs.getString("lot_no"), conn1);
packSize = (Double) hm1.get("PACK_SIZE");
quantityDB = rs.getDouble("quantity");
interfaceQty = quantityDB / packSize;
interfaceQtyRem = quantityDB % packSize;
interfaceQty1 = (int) interfaceQty;
System.out.println("packSize ::::::::::::: " + packSize);
System.out.println("quantityDB ::::::::::::: " + quantityDB);
System.out.println("interfaceQty ::::::::::::: " + interfaceQty);
System.out.println("interfaceQtyRem ::::::::::::: " + interfaceQtyRem);
System.out.println("interfaceQty1 ::::::::::::: " + interfaceQty1);
if(interfaceQtyRem > 0)
{
interfaceQty = interfaceQty1 + 1;
}
else
{
interfaceQty = interfaceQty1;
}
totQuantity = packSize * interfaceQty;
System.out.println("Final Quantity for interface table ::::::::::::: " + interfaceQty);
System.out.println("totQuantity ::::::::::::: " + totQuantity);
// Expiry Date, Mfg Date
sql = "select exp_date, mfg_date from stock where item_code = ? and site_code = ? and lot_no = ? and lot_sl = ? and loc_code = ? ";
pstmt1 = conn1.prepareStatement(sql);
pstmt1.setString(1, rs.getString("item_code"));
pstmt1.setString(2, rs.getString("site_code"));
pstmt1.setString(3, rs.getString("lot_no"));
pstmt1.setString(4, rs.getString("lot_sl"));
pstmt1.setString(5, rs.getString("loc_code"));
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
expDate = rs1.getString("exp_date");
mfgDate = rs1.getString("mfg_date");
}
if(pstmt1 != null){ pstmt1.close(); pstmt1 = null; }
if(rs1 != null){ rs1.close(); rs1 = null; }
//Pallet Status
if(interfaceQtyRem == 0)
{
palletStatus = "F";
}
else
{
palletStatus = "P";
}
System.out.println("palletStatus ::::::::::::: " + palletStatus);
// QC Type
sql = "select qc_reqd from siteitem where item_code = ? and site_code = ? ";
pstmt1 = conn1.prepareStatement(sql);
pstmt1.setString(1, rs.getString("item_code"));
pstmt1.setString(2, rs.getString("site_code"));
rs1 = pstmt1.executeQuery();
if (rs1.next())
{
qcReqd = rs1.getString("qc_reqd");
}
if(pstmt1 != null){ pstmt1.close(); pstmt1 = null; }
if(rs1 != null){ rs1.close(); rs1 = null; }
HashMap hm2 = new HashMap();
hm2 = commonWmsUtility.getPalletizedAttributes(rs.getString("item_code"), siteCode, conn1);
procMth = (String) hm2.get("PROC_MTH");
if("".equalsIgnoreCase(procMth) && procMth.length() <= 0)
{
qcType = "N";
}
else if(!"".equalsIgnoreCase(procMth) && "Y".equalsIgnoreCase(qcReqd))
{
qcType = "F";
}
else
{
qcType = "C";
}
System.out.println("qcReqd ::::::::::::: " + qcReqd);
System.out.println("procMth ::::::::::::: " + procMth);
System.out.println("qcType ::::::::::::: " + qcType);
lineNoInterface = " " + rs.getString("line_no");
lineNoInterface = lineNoInterface.substring( lineNoInterface.length()-3 );
lineNoInterface = checkNullAndTrim(rs.getString("line_no"));
HashMap hm = new HashMap();
hm.put("TRAN_ID", "");
hm.put("ITEM_CODE", checkNullAndTrim(rs.getString("item_code")));
hm.put("DESCR", checkNullAndTrim(rs.getString("descr")));
hm.put("UNIT", checkNullAndTrim(rs.getString("unit")));
hm.put("ITEM_TYPE", checkNullAndTrim(rs.getString("item_type")));
hm.put("FAMILY_GRP", "");
hm.put("IN_OUT", "I");
hm.put("REF_SER", "PZ");
hm.put("REF_ID", tranId);
//hm.put("TRAN_DATE", checkNullAndTrim(String.valueOf(rs.getTimestamp("TRAN_DATE"))));
// Changed by Sneha on 17-11-2015
hm.put("TRAN_DATE", checkNullAndTrim(String.valueOf(today)));
//End by Sneha
hm.put("LOT_NO", rs.getString("lot_no"));
hm.put("LOT_SL", rs.getString("lot_sl"));
hm.put("QUANTITY", checkNullAndTrim((String.valueOf(noArt))));
hm.put("QTY_PER_ART",checkNullAndTrim((String.valueOf(qtyPerArt))));
hm.put("TOTAL_QTY", checkNullAndTrim(rs.getString("quantity")));
hm.put("QUANTITY", checkNullAndTrim((String.valueOf(interfaceQty))));
hm.put("QTY_PER_ART", checkNullAndTrim((String.valueOf(packSize))));
hm.put("TOTAL_QTY", checkNullAndTrim((String.valueOf(totQuantity))));
hm.put("EXP_DATE", checkNullAndTrim(expDate));
hm.put("MFG_DATE", checkNullAndTrim(mfgDate));
hm.put("PALLET_NO", checkNullAndTrim(rs.getString("pallet_no")));
hm.put("PALLET_STATUS", checkNullAndTrim(palletStatus));
hm.put("MSG_STAT", "N");
hm.put("LOCK_STAT", checkNullAndTrim(invStat));
hm.put("ERR_COD", "");
hm.put("ERR_DESC", "");
hm.put("QC_TYPE", checkNullAndTrim(qcType));
hm.put("TRANS_DT_ACK", "");
hm.put("STRO_PREF", "");
hm.put("LINE_NO", lineNoInterface);
interfaceArrList.add(hm);
}
commonWmsUtility.updateAwmsInterface(interfaceArrList, siteCode, conn1);
System.out.println("Inserted into interface2 table ::::::::::::: ");
if(pstmt != null){ pstmt.close(); pstmt = null; }
if(rs != null){ rs.close(); rs = null; }
}
catch (SQLException ex)
{
isError = true;
System.out.println("Exception ::" +sql+ ex.getMessage() + ":");
ex.printStackTrace();
throw new ITMException(ex);
}
catch (Exception e)
{
isError = true;
System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if( !isError )
{
System.out.println("commmit");
conn1.commit();
}
else if ( isError )
{
System.out.println("rollback");
conn1.rollback();
}
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = 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