Commit ee1acddd authored by smestry's avatar smestry

W15FSUN008, Updated class file for Palletization and palletization confirm.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99339 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f5207f18
......@@ -39,20 +39,22 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
}
public String postSave( String domString, String tranId, String editFlag, String xtraParams, Connection conn ) throws RemoteException, ITMException
{
String errString = "", siteCode = "";
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = "" ;
int ctr = 0, childNodeListLength = 0, cnt = 0;
boolean isError = false;
Connection conn1 = null;
String userId = "", errorType = "", errCode = "";
String errString = "", siteCode = "", palletNo = "", sql = "", objName = "", childNodeName = "", userId = "", errorType = "", errCode = "",
tranIdDB = "";
int ctr = 0, childNodeListLength = 0, cnt = 0, tranIdScanCount = 0, tranIdCount = 0;
boolean isError = false;
ArrayList <String> errList = new ArrayList<String>();
ArrayList <String> errFields = new ArrayList <String> ();
ArrayList<String> tranIdList = new ArrayList<String>();
PreparedStatement pstmt = null;
ResultSet rs = null;
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
try
......@@ -67,18 +69,20 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
Document dom = null;
dom = genericUtility.parseString(domString);
siteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" ));
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("siteCode ::::::::::::: " + siteCode);
System.out.println("userId ::::::::::::: " + userId);
palletNo = checkNull(genericUtility.getColumnValue("pallet_no", dom, "3" ));
objName = getObjNameFromDom( dom, "objName", "1" );
System.out.println("domString ::::::::::::: " + domString);
System.out.println("xtraParams ::::::::::::: " + xtraParams);
System.out.println("tranId----------->>["+tranId+"]");
String objName = getObjNameFromDom( dom, "objName", "1" );
System.out.println("siteCode ::::::::::::: " + siteCode);
System.out.println("userId ::::::::::::: " + userId);
System.out.println("palletNo ::::::::::::: " + palletNo);
System.out.println("objName ::::::::::::: " + objName);
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
......@@ -88,12 +92,60 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
if("palletization".equalsIgnoreCase(objName))
{
System.out.println("Calling confirm for palletization :::::::::::::::::::: ");
confirm(tranId, siteCode, conn1);
if( tranId == null || tranId.trim().length() <= 0) // Add mode
{
System.out.println("tranId inside add mode ----------->>");
sql = "select tran_id from pallet_hdr where confirmed = ? and site_code = ? and pallet_no = ? ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, "N");
pstmt.setString(2, siteCode);
pstmt.setString(3, palletNo);
rs = pstmt.executeQuery();
if(rs.next())
{
tranIdDB = checkNullAndTrim(rs.getString("tran_id"));
}
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
System.out.println("tranIdDB----------->>["+tranIdDB+"]");
tranIdScanCount = getTranIdScanDet(tranIdDB, siteCode, conn1);
if(tranIdScanCount <= 0)
{
System.out.println("No records scan for this transaction for palletization confirm :::::::::: ");
errCode = "VTINVTID";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else
{
System.out.println("Calling confirm for palletization confirm menu :::::::::::::::::::: ");
confirm(tranIdDB, siteCode, conn1);
}
}
else // edit mode
{
System.out.println("tranId in edit mode for palletization ----------->>["+tranId+"]");
tranIdScanCount = getTranIdScanDet(tranId, siteCode, conn1);
if(tranIdScanCount <= 0)
{
System.out.println("No records scan for this transaction for palletization confirm :::::::::: ");
errCode = "VTINVTID";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else
{
System.out.println("Calling confirm for palletization confirm menu :::::::::::::::::::: ");
confirm(tranId, siteCode, conn1);
}
}
}
else
else // Palletization Confirm
{
tranIdList = getTranId(siteCode, conn1);
for (ctr = 0; ctr < childNodeListLength; ctr++)
{
......@@ -101,10 +153,12 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
childNodeName = childNode.getNodeName();
System.out.println("childNodeName ------->>["+childNodeName+"]");
if("tran_id".equalsIgnoreCase(childNodeName))
{
//System.out.println("Inside tran_id ::::::::::: ");
tranIdScanCount = getTranIdScanDet(tranId, siteCode, conn1);
tranIdCount = getTranId(tranId, siteCode, conn1);
if(tranId.length() <= 0)
{
System.out.println("Tran Id found blank :::::::::: ");
......@@ -112,16 +166,21 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else if(!tranIdList.contains(tranId) && tranId.length() > 0)
else if(tranIdCount <= 0)
{
System.out.println("Transaction ID not found :::::::::: ");
errCode = "VTINVTRID";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else if(tranIdScanCount <= 0)
{
System.out.println("Tran Id does not exist in pallet hdr :::::::::: ");
System.out.println("No records scan for this transaction for palletization confirm :::::::::: ");
errCode = "VTINVTID";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
if(tranIdList.contains(tranId))
else
{
System.out.println("Calling confirm for palletization confirm menu :::::::::::::::::::: ");
confirm(tranId, siteCode, conn1);
......@@ -164,7 +223,15 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
}
else
{
return getError(tranId, "VTTRANCONF", conn1);
if( tranId == null || tranId.trim().length() <= 0)
{
return getError(tranIdDB, "VTTRANCONF", conn1);
}
else
{
return getError(tranId, "VTTRANCONF", conn1);
}
}
errString = errStringXml.toString();
}
......@@ -234,7 +301,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
return inputVal;
}
private String errorType( Connection conn , String errorCode )
public String errorType( Connection conn , String errorCode )
{
String msgType = "";
PreparedStatement pstmt = null ;
......@@ -277,25 +344,24 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
return msgType;
}
private ArrayList<String> getTranId( String siteCode, Connection conn ) throws Exception
public int getTranId(String tranId, String siteCode, Connection conn1) throws Exception
{
ArrayList<String> colVal = new ArrayList<String>();
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "";
int count = 0;
try
{
sql = "select det.tran_id as TRAN_ID from pallet_det det, pallet_hdr hdr where hdr.confirmed = ? and hdr.site_code = ? and hdr.tran_id = det.tran_id ";
pstmt = conn.prepareStatement(sql);
sql = "select count(*) from pallet_hdr where confirmed = ? and site_code = ? and tran_id = ? ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, "N");
pstmt.setString(2, siteCode);
pstmt.setString(3, tranId);
rs = pstmt.executeQuery();
while(rs.next())
if(rs.next())
{
colVal.add(checkNull(rs.getString("TRAN_ID")));
count = rs.getInt(1);
}
rs.close();rs = null;
pstmt.close();pstmt = null;
}
catch(Exception e)
{
......@@ -316,11 +382,54 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
pstmt = null;
}
}
System.out.println("Return List from getTranId ------>>" + colVal);
return colVal;
System.out.println("Return List from getTranId ------>>" + count);
return count;
}
public int getTranIdScanDet(String tranId, String siteCode, Connection conn1) throws Exception
{
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "";
int count = 0;
try
{
sql = "select count(det.tran_id) from pallet_det det, pallet_hdr hdr where hdr.confirmed = ? and hdr.site_code = ? and "
+" hdr.tran_id = det.tran_id and hdr.tran_id = ? ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, "N");
pstmt.setString(2, siteCode);
pstmt.setString(3, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
}
catch(Exception e)
{
System.out.println("Exception in getTranIdScanDet ::::::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
finally
{
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
System.out.println("Return value form getTranIdScanDet ------>>" + count);
return count;
}
private void confirm( String tranId, String siteCode, Connection conn1 ) throws ITMException, SQLException
public void confirm( String tranId, String siteCode, Connection conn1 ) throws ITMException, SQLException
{
String sql = "", tranDate = "", invStat = "", qcType = "",
expDate = "", mfgDate = "", palletStatus = "", qcReqd = "", procMth = "", lineNoInterface = "";
......@@ -340,13 +449,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
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);*/
GenericUtility genericUtility = GenericUtility.getInstance();
Date today = new Timestamp(System.currentTimeMillis());
sql = "update pallet_hdr set confirmed = ?, conf_date = ? where tran_id = ? ";
......@@ -612,7 +715,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
}
}
private String getError(String tranId, String Code, Connection conn) throws ITMException, Exception
public String getError(String tranId, String Code, Connection conn) throws ITMException, Exception
{
String mainStr ="";
......
......@@ -139,9 +139,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("DOM1----->>["+genericUtility.serializeDom(dom1).toString()+"]");
System.out.println("DOM2----->>["+genericUtility.serializeDom(dom2).toString()+"]");
String locationCode ="", palletNo = "", sql = "";
//ArrayList<String> locStockList = new ArrayList<String>();
//ArrayList<String> palletList = new ArrayList<String>();
String palletNo = "", sql = "";
PreparedStatement pstmt = null ;
ResultSet rs = null ;
int palletNoCount = 0, palletAWMSCount = 0;
......@@ -152,7 +150,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
//locationCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code", dom));
palletNo = checkNullAndTrim(genericUtility.getColumnValue("pallet_no", dom));
//System.out.println("palletNo ------->>["+palletNo+"]");
//locStockList = getLocationCode(conn, loginSite);
......@@ -165,7 +162,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
if("pallet_no".equalsIgnoreCase(childNodeName))
{
if(palletNo.length() <= 0) // blank
if(palletNo.length() <= 0)
{
System.out.println("Pallet No length less than 0 :::::::::: ");
errCode = "VMNLPALLET";
......@@ -234,14 +231,14 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
if("".equalsIgnoreCase(tranType))
{
System.out.println(" Blank Transcation Type :::::::::: ");
//System.out.println(" Blank Transcation Type :::::::::: ");
errCode = "VMNULLTT";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else if(tranType.length() > 3)
{
System.out.println(" Blank Transcation Type :::::::::: ");
//System.out.println(" Blank Transcation Type :::::::::: ");
errCode = "VMTTYPELEN";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
......@@ -255,12 +252,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
}*/
if(remarks.length() > 60)
{
System.out.println(" Remarks cannot be greater than 60 :::::::::: ");
//System.out.println(" Remarks cannot be greater than 60 :::::::::: ");
errCode = "VTREMLEN";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
} //end detail2 for loop
}
break;
case 3:
......@@ -269,12 +266,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("DOM---->>["+genericUtility.serializeDom(dom).toString()+"]");
System.out.println("DOM1----->>["+genericUtility.serializeDom(dom1).toString()+"]");
System.out.println("DOM2----->>["+genericUtility.serializeDom(dom2).toString()+"]");
String itemCode = "", itemCodeDB = "", quantity = "";
String familyGrp = "", qcType = "", stroPref = "", familyGrpDB = "", qcTypeDB = "", stroPrefDB = "", lotNo = "", lotSl = "";
String familyGrp = "", qcType = "", stroPref = "", familyGrpDB = "", qcTypeDB = "", stroPrefDB = "", lotNo = "",
lotSl = "", statusDB = "", status = "", itemCode = "", itemCodeDB = "", quantity = "", statusQ = "", lotNoDB = "", lotSlDB = "";
HashMap hm = new HashMap();
HashMap hm1 = new HashMap();
HashMap hm2 = new HashMap();
int count = 0;
......@@ -303,7 +300,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
if("lot_no".equalsIgnoreCase(childNodeName))
{
if(lotNo.length() <= 0) // blank
if(lotNo.length() <= 0)
{
System.out.println("lot No is blank :::::::::::::::: ");
errCode = "VTLOTBLNK";
......@@ -313,7 +310,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
}
if("lot_sl".equalsIgnoreCase(childNodeName))
{
if(lotSl.length() <= 0) // blank
if(lotSl.length() <= 0)
{
System.out.println("lot sl is blank ::::::::::: ");
errCode = "VTLSLBLNK";
......@@ -329,7 +326,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
pstmt.setString(2, lotSl);
pstmt.setString(3, palletNo);
pstmt.setString(4, loginSite);
pstmt.setString(5, "Y");
pstmt.setString(5, "N");
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -348,13 +345,13 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
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 ";
+ "and site_code = ? and inv_stat not in (?,?) and quantity > 0 ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lotNo);
pstmt.setString(2, lotSl);
//pstmt.setString(3, palletNo);
pstmt.setString(3, loginSite);
pstmt.setString(4, "AWMS");
pstmt.setString(5, "AWMSQ");
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -372,22 +369,16 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
}
else
{
hm2 = getScanItem(palletNo, loginSite, conn);
itemCodeDB = (String) hm2.get("ITEM_CODE");
lotNoDB = (String) hm2.get("LOT_NO");
lotSlDB = (String) hm2.get("LOT_SL");
/*
System.out.println("itemCodeDB :::::::::: " + itemCodeDB);
System.out.println("lotNoDB :::::::::: " + lotNoDB);
System.out.println("lotSlDB :::::::::: " + lotSlDB);*/
sql ="select distinct(item_code) as 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())
{
itemCodeDB = checkNullAndTrim(rs.getString("item_code"));
}
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
System.out.println("itemCodeDB :::::::::: " + itemCodeDB);
if(itemCodeDB.length() > 0)
if(itemCodeDB.length() > 0) // not blank
{
hm = commonWmsUtility.getPalletizedAttributes(itemCode, loginSite, conn);
familyGrp = (String) hm.get("LOC_ZONE__PREF");
......@@ -407,6 +398,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("qcTypeDB :::::::::: " + qcTypeDB);
System.out.println("stroPrefDB :::::::::: " + stroPrefDB);
*/
if(!familyGrpDB.equalsIgnoreCase(familyGrp) || !qcTypeDB.equalsIgnoreCase(qcType) || !stroPrefDB.equalsIgnoreCase(stroPref))
{
System.out.println(" item code is not of same analysis grp :::::::::: ");
......@@ -414,14 +406,34 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
System.out.println("Checking condition for QC order status :::::::::: " );
statusDB = getItemQcStatus(itemCodeDB, lotNoDB, lotSlDB, loginSite, conn);
status = getItemQcStatus(itemCode, lotNo, lotSl, loginSite, conn);
if("".equalsIgnoreCase(statusDB) || statusDB == null)
{
statusDB = "C";
}
if("".equalsIgnoreCase(status) || status == null)
{
status = "C";
}
/*System.out.println("value of statusDB :::::::::: " + statusDB);
System.out.println("value of status :::::::::: " + status);
*/
if(!statusDB.equalsIgnoreCase(status))
{
System.out.println(" item code is not of same qc order status :::::::::: ");
errCode = "VTINVQCS";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
}
}
}
}
}
}
......@@ -536,26 +548,48 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
return msgType;
}
/*private ArrayList<String> getLocationCode(Connection conn, String loginSite) throws Exception
private Double getPalletNoQty(String palletNo, String loginSite, Connection conn) throws Exception
{
ArrayList<String> colVal = new ArrayList<String>();
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "";
double quantity = 0;
try
{
sql ="select distinct(loc_code) as loc_code from stock where (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? and inv_stat != 'AWMS' ";
sql = "select sum(quantity) from stock where loc_code = ? and site_code = ? and inv_stat = ? group by loc_code ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSite);
pstmt.setString(1, palletNo);
pstmt.setString(2, loginSite);
pstmt.setString(3, "AWMS");
rs = pstmt.executeQuery();
while(rs.next())
if(rs.next())
{
colVal.add(checkNull(rs.getString("loc_code")));
quantity = rs.getInt(1);
}
if(pstmt != null){ pstmt.close(); pstmt = null; }
if(rs != null){ rs.close(); rs = null; }
if(quantity <= 0)
{
sql = "select sum(quantity) from stock where loc_code = ? and site_code = ? and inv_stat = ? group by loc_code ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo+"Q");
pstmt.setString(2, loginSite);
pstmt.setString(3, "AWMSQ");
rs = pstmt.executeQuery();
if(rs.next())
{
quantity = rs.getInt(1);
}
if(pstmt != null){ pstmt.close(); pstmt = null; }
if(rs != null){ rs.close(); rs = null; }
}
}
catch(Exception e)
{
System.out.println("Exception in locCode " + e);
System.out.println("Exception in getPalletNoQty ::::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
......@@ -572,33 +606,32 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
pstmt = null;
}
}
System.out.println("Return List from getLocationCode------>>" + colVal);
return colVal;
}*/
//private ArrayList<String> getPalletNo(String palletNo, String loginSite, Connection conn) throws Exception
private Double getPalletNoQty(String palletNo, String loginSite, Connection conn) throws Exception
System.out.println("Return from getPalletNoQty ------>>" + quantity);
return quantity;
}
private int getPalletNoCount(String palletNo, String loginSite, Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "";
double quantity = 0;
int count = 0;
try
{
sql = "select sum(quantity) from stock where loc_code = ? and site_code = ? and inv_stat = ? group by loc_code ";
sql = "select count(loc_code) from location where site_code = ? and inv_stat = ? and loc_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo);
pstmt.setString(2, loginSite);
pstmt.setString(3, "AWMS");
pstmt.setString(1, loginSite);
pstmt.setString(2, "AWMS");
pstmt.setString(3, palletNo);
rs = pstmt.executeQuery();
if(rs.next())
{
quantity = rs.getInt(1);
count = rs.getInt(1);
}
}
catch(Exception e)
{
System.out.println("Exception in getPalletNoQty ::::::::: " + e);
System.out.println("Exception in getPalletNoCount ::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
......@@ -615,35 +648,32 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
pstmt = null;
}
}
System.out.println("Return from getPalletNoQty ------>>" + quantity);
return quantity;
System.out.println("return value from getPalletNoCount :::::::::: " + count);
return count;
}
//private ArrayList<String> getPalletNoList(String loginSite, Connection conn) throws Exception
private int getPalletNoCount(String palletNo, String loginSite, Connection conn) throws Exception
{
//ArrayList<String> colVal = new ArrayList<String>();
private int getPalletAWMSCount(String palletNo, Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "";
int count = 0;
try
{
sql = "select count(loc_code) from location where site_code = ? and inv_stat = ? and loc_code = ? ";
//sql = "select distinct(loc_code) as loc_code from location where site_code = ? and inv_stat = ? ";
sql ="select count(*) from swms_to_awms where pallet_no = ? and schedule_status = ? and ref_ser = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSite);
pstmt.setString(2, "AWMS");
pstmt.setString(3, palletNo);
pstmt.setString(1, palletNo);
pstmt.setString(2, "N");
pstmt.setString(3, "PZ");
rs = pstmt.executeQuery();
if(rs.next())
{
//colVal.add(checkNull(rs.getString("loc_code")));
count = rs.getInt(1);
count = rs.getInt(1);
}
}
catch(Exception e)
{
System.out.println("Exception in getPalletNoCount ::::::: " + e);
System.out.println("Exception in getPalletAWMSCount ::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
......@@ -660,32 +690,39 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
pstmt = null;
}
}
System.out.println("return value from getPalletNoCount :::::::::: " + count);
System.out.println("return value from getPalletAWMSCount :::::::::: " + count);
return count;
}
private int getPalletAWMSCount(String palletNo, Connection conn) throws Exception
private HashMap getScanItem(String palletNo, String siteCode, Connection conn) throws Exception
{
HashMap hm = new HashMap();
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "";
int count = 0;
String sql = "", itemCodeDB = "", lotNoDB = "", lotSlDB = "";
try
{
sql ="select count(*) from swms_to_awms where pallet_no = ? and schedule_status = ? and ref_ser = ? ";
sql ="select distinct(item_code) as item_code, lot_no, lot_sl from pallet_hdr h, pallet_det d where d.pallet_no = ? and "
+ "h.confirmed = ? and h.site_code = ? and d.tran_id = h.tran_id and rownum < 2 ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, palletNo);
pstmt.setString(2, "N");
pstmt.setString(3, "PZ");
pstmt.setString(3, siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
itemCodeDB = checkNullAndTrim(rs.getString("item_code"));
lotNoDB = checkNullAndTrim(rs.getString("lot_no"));
lotSlDB = checkNullAndTrim(rs.getString("lot_sl"));
}
hm.put("ITEM_CODE", itemCodeDB);
hm.put("LOT_NO", lotNoDB);
hm.put("LOT_SL", lotSlDB);
}
catch(Exception e)
{
System.out.println("Exception in getPalletAWMSCount ::::::: " + e);
System.out.println("Exception in getScanItem ::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
......@@ -702,30 +739,61 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
pstmt = null;
}
}
System.out.println("return value from getPalletAWMSCount :::::::::: " + count);
return count;
System.out.println("return value from getScanItem :::::::::: " + hm);
return hm;
}
//private String getItemQcStatus(String itemCode, String lotNo, String lotSl, String siteCode, String palletNo, Connection conn) throws Exception
private String getItemQcStatus(String itemCode, String lotNo, String lotSl, String siteCode, Connection conn) throws Exception
{
PreparedStatement pstmt = null ;
ResultSet rs = null ;
String sql = "", status = "";
try
{
sql ="select status from qc_order where item_code = ? and lot_no = ? and lot_sl = ? and site_code = ? " ;
//"and loc_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
pstmt.setString(2, lotNo);
pstmt.setString(3, lotSl);
pstmt.setString(4, siteCode);
//pstmt.setString(5, palletNo);
rs = pstmt.executeQuery();
if(rs.next())
{
status = checkNullAndTrim(rs.getString("status"));
}
}
catch(Exception e)
{
System.out.println("Exception in getItemQcStatus ::::::: " + e);
e.printStackTrace();
throw new Exception(e);
}
finally
{
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
System.out.println("return value from getItemQcStatus :::::::::: " + status);
return status;
}
/**
* The public method is defined without any parameters and returns blank string
*/
@Override
public String itemChanged() throws RemoteException, ITMException
{
return "";
}
/**
* The public method is used for converting the current form data into a document(dom)
* The dom is then given as argument to the overloaded function wfValData to perform validation
* Returns validation string if exists else returns null in XML format
* @param xmlString contains the current form data in XML format
* @param xmlString1 contains all the header information in the XML format
* @param xmlString2 contains the data of all the forms in XML format
* @param objContext represents the form number
* @param editFlag represents the mode of transaction(A-Add or E-Edit)
* @param xtraParams contains additional information such as loginEmpCode,loginCode,chgTerm etc
*/
@Override
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
......@@ -765,17 +833,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
return errString;
}
/**
* The public overloaded method takes a document as input and is used for the validation of required fields
* Returns validation string if exist otherwise returns null in XML format
* @param currFormDataDom contains the current form data as a document object model
* @param hdrDataDom contains all the header information
* @param allFormDataDom contains the field data of all the forms
* @param objContext represents form number
* @param currentColumn represents the current field
* @param editFlag represents the mode of transaction(A-Add or E-Edit)
* @param xtraParams contains additional information
*/
@Override
public String itemChanged( Document currFormDataDom, Document hdrDataDom, Document allFormDataDom, String objContext, String currentColumn,String editFlag, String xtraParams ) throws RemoteException,ITMException
{
......@@ -834,40 +891,24 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("currFormDataDom------>>["+genericUtility.serializeDom(currFormDataDom)+"]");
System.out.println("allFormDataDom------>>["+genericUtility.serializeDom(allFormDataDom)+"]");
String locationCode ="", palletNo = "";
String siteCodeEdit = "", tranTypeEdit = "", locCodeEdit = "", palletTypeEdit = "", invStatEdit = "", palletNoEdit = "",
String palletNo = "";
String siteCodeEdit = "", tranTypeEdit = "", palletTypeEdit = "", invStatEdit = "", palletNoEdit = "",
remarksEdit = "", chgUserEdit = "", chgTermEdit = "", invStat = "", tranIdEdit = "", palletNoCheck = "";
Date chgDateEdit = null, tranDateEdit = null;
//locationCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code", hdrDataDom));
palletNo = checkNullAndTrim(genericUtility.getColumnValue("pallet_no", hdrDataDom));
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
{
System.out.println(" Inside if details 2 for itm_default ::::::::::::::::: ");
/*sql = "select tran_id, tran_date, site_code, tran_type, loc_code, pallet_type, inv_stat, pallet_no, remarks, "
+ " chg_user, chg_date, chg_term from pallet_hdr "
+ "where loc_code = ? and pallet_no = ? "
+ "and site_code = ? and add_user = ? and case when confirmed is null then 'N' else confirmed end = 'N' ";*/
//Changed by Sneha on 06-11-2015, Request ID: W15FSUN008
/*sql = "select tran_id, tran_date, site_code, tran_type, pallet_type, pallet_no, remarks, "
+ "chg_user, chg_date, chg_term from pallet_hdr "
+ "where pallet_no = ? "
+ "and site_code = ? and add_user = ? and case when confirmed is null then 'N' else confirmed end = 'N' ";
*/
sql = "select tran_id, tran_date, site_code, tran_type, pallet_type, pallet_no, remarks, "
+ "chg_user, chg_date, chg_term from pallet_hdr "
+ "where pallet_no = ? "
+ "and site_code = ? and case when confirmed is null then 'N' else confirmed end = 'N' ";
//End by Sneha on 06-11-2015, Request ID: W15FSUN008
pstmt = conn.prepareStatement(sql);
//pstmt.setString(1, locationCode);
//pstmt.setString(2, palletNoSource);
pstmt.setString(1, palletNo);
pstmt.setString(2, loginSite);
//pstmt.setString(3, chgUser);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -875,9 +916,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
tranDateEdit = rs.getDate("tran_date");
siteCodeEdit = checkNullAndTrim(rs.getString("site_code"));
tranTypeEdit = checkNullAndTrim(rs.getString("tran_type"));
//locCodeEdit = checkNullAndTrim(rs.getString("loc_code"));
palletTypeEdit = checkNullAndTrim(rs.getString("pallet_type"));
//invStatEdit = checkNullAndTrim(rs.getString("inv_stat"));
palletNoEdit = checkNullAndTrim(rs.getString("pallet_no"));
remarksEdit = checkNullAndTrim(rs.getString("remarks"));
chgUserEdit = checkNullAndTrim(rs.getString("chg_user"));
......@@ -894,18 +933,9 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
valueXmlString.append( "<tran_date><![CDATA[" ).append( sdf.format(tranDateEdit).toString() ).append( "]]></tran_date>\r\n" );
valueXmlString.append( "<site_code><![CDATA[" ).append( siteCodeEdit ).append( "]]></site_code>\r\n" );
valueXmlString.append( "<tran_type><![CDATA[" ).append( tranTypeEdit ).append( "]]></tran_type>\r\n" );
//valueXmlString.append( "<loc_code><![CDATA[" ).append( locCodeEdit ).append( "]]></loc_code>\r\n" );
//Changed by Sneha on 06-11-2015, Request ID: W15FSUN008
valueXmlString.append( "<loc_code><![CDATA[" ).append( "" ).append( "]]></loc_code>\r\n" );
//End by Sneha on 06-11-2015, Request ID: W15FSUN008
valueXmlString.append( "<pallet_type><![CDATA[" ).append( palletTypeEdit ).append( "]]></pallet_type>\r\n" );
//valueXmlString.append( "<inv_stat><![CDATA[" ).append( invStatEdit ).append( "]]></inv_stat>\r\n" );
//Changed by Sneha on 06-11-2015, Request ID: W15FSUN008
valueXmlString.append( "<inv_stat><![CDATA[" ).append( "" ).append( "]]></inv_stat>\r\n" );
//End by Sneha on 06-11-2015, Request ID: W15FSUN008
valueXmlString.append( "<pallet_no><![CDATA[" ).append( palletNoEdit ).append( "]]></pallet_no>\r\n" );
valueXmlString.append( "<remarks><![CDATA[" ).append( remarksEdit ).append( "]]></remarks>\r\n" );
valueXmlString.append( "<confirmed><![CDATA[" ).append( "N" ).append( "]]></confirmed>\r\n" );
......@@ -924,19 +954,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{
System.out.println("in itm_default@@@@@.........." + tranId);
System.out.println("-------------- itemchanged Add mode in Details 2 ----------------------");
/*
sql = "select inv_stat from location where loc_code = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, locationCode);
//pstmt1.setString(2, palletNoSource);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
invStat = checkNullAndTrim(rs1.getString("inv_stat"));
}
if(pstmt1 != null) { pstmt1.close(); pstmt1 = null; }
if(rs1 != null) { rs1.close(); rs1 = null; }
*/
valueXmlString.append("<Detail2 domID=\"1\" selected=\"N\">\r\n");
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
......@@ -944,9 +961,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
valueXmlString.append( "<tran_date><![CDATA[" ).append( currDate ).append( "]]></tran_date>\r\n" );
valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" );
valueXmlString.append( "<tran_type><![CDATA[" ).append( "P" ).append( "]]></tran_type>\r\n" );
//valueXmlString.append( "<loc_code><![CDATA[" ).append( locationCode ).append( "]]></loc_code>\r\n" );
//Changed by Sneha on 06-11-2015, Request ID: W15FSUN008
valueXmlString.append( "<loc_code><![CDATA[" ).append( "" ).append( "]]></loc_code>\r\n" );
palletNoCheck = String.valueOf(palletNo.charAt(0));
......@@ -966,13 +981,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{
valueXmlString.append( "<pallet_type><![CDATA[" ).append( "N" ).append( "]]></pallet_type>\r\n" );
}
//End by Sneha on 06-11-2015, Request ID: W15FSUN008
//valueXmlString.append( "<inv_stat><![CDATA[" ).append( invStat ).append( "]]></inv_stat>\r\n" );
//Changed by Sneha on 06-11-2015, Request ID: W15FSUN008
valueXmlString.append( "<inv_stat><![CDATA[" ).append( "" ).append( "]]></inv_stat>\r\n" );
//End by Sneha on 06-11-2015, Request ID: W15FSUN008
valueXmlString.append( "<inv_stat><![CDATA[" ).append( "" ).append( "]]></inv_stat>\r\n" );
valueXmlString.append( "<pallet_no><![CDATA[" ).append( palletNo ).append( "]]></pallet_no>\r\n" );
valueXmlString.append( "<remarks><![CDATA[" ).append( "" ).append( "]]></remarks>\r\n" );
valueXmlString.append( "<confirmed><![CDATA[" ).append( "N" ).append( "]]></confirmed>\r\n" );
......@@ -997,7 +1007,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{
String palletNo = "", domID = "", itemCode = "", descr = "", lotNo = "", lotSl = "", unit = "", locCode = "";
int noArt = 0, lineNo = 0;
double quantity = 0;
double quantity = 0, allocQty = 0;
System.out.println("-------------- itemchanged in Details 3 ----------------------");
......@@ -1028,7 +1038,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{
System.out.println("--------------inside itm_default edit mode details 3 ----------------------");
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.loc_code, d.line_no, d.alloc_qty "
+ "from pallet_hdr h, pallet_det d, item i "
+ "where d.site_code = ? and d.tran_id = ? and d.tran_id = h.tran_id and "
+"d.item_code = i.item_code ";
......@@ -1048,6 +1058,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
unit = checkNullAndTrim(rs.getString("unit"));
noArt = rs.getInt("no_art");
locCode = checkNullAndTrim(rs.getString("loc_code"));
allocQty = rs.getDouble("alloc_qty");
valueXmlString.append("<Detail3 domID='"+domID+"' selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n");
......@@ -1064,37 +1075,22 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
valueXmlString.append( "<quantity><![CDATA[" ).append( quantity ).append( "]]></quantity>\r\n" );
valueXmlString.append( "<item_unit><![CDATA[" ).append( unit ).append( "]]></item_unit>\r\n" );
valueXmlString.append( "<no_art><![CDATA[" ).append( noArt ).append( "]]></no_art>\r\n" );
valueXmlString.append( "<alloc_qty><![CDATA[" ).append( allocQty ).append( "]]></alloc_qty>\r\n" );
valueXmlString.append("</Detail3>\r\n");
}
if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; }
}
}
/*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; }
if(lineNo == 0)
{
lineNo = 1;
}*/
if(currentColumn.trim().equalsIgnoreCase("itm_default_add"))
{
System.out.println("--------------inside itm_default_add ----------------------");
lineNo = getMaxLineNo(tranId, conn);
if( tranId != null && tranId.trim().length() > 0 )
{
lineNo = getMaxLineNo(tranId, conn);
valueXmlString.append("<Detail3 domID='"+lineNo+"' selected=\"N\">\r\n");
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
......@@ -1108,7 +1104,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
valueXmlString.append( "<tran_id><![CDATA[]]></tran_id>\r\n" );
//valueXmlString.append( "<line_no><![CDATA[]]></line_no>\r\n" );
valueXmlString.append( "<line_no><![CDATA[" ).append( domID ).append( "]]></line_no>\r\n" );
}
......@@ -1122,6 +1117,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
valueXmlString.append( "<quantity><![CDATA[]]></quantity>\r\n" );
valueXmlString.append( "<item_unit><![CDATA[]]></item_unit>\r\n" );
valueXmlString.append( "<no_art><![CDATA[]]></no_art>\r\n" );
valueXmlString.append( "<alloc_qty><![CDATA[]]></alloc_qty>\r\n" );
valueXmlString.append("</Detail3>\r\n");
}
......@@ -1129,17 +1125,15 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
if(currentColumn.trim().equalsIgnoreCase("lot_sl"))
{
System.out.println("--------------inside lot_sl ----------------------");
lineNo = getMaxLineNo(tranId, conn);
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 "
sql = "select s.item_code, i.descr, s.quantity, s.unit, s.no_art, s.loc_code, s.alloc_qty from stock s, item i "
+ "where s.lot_no = ? and s.lot_sl = ? and s.site_code = ? and s.quantity > 0 and inv_stat != ? "
+ "and s.item_code = i.item_code ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lotNo);
pstmt.setString(2, lotSl);
pstmt.setString(3, loginSite);
pstmt.setString(3, loginSite);
pstmt.setString(4, "AWMS");
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -1149,10 +1143,11 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
unit = checkNullAndTrim(rs.getString("unit"));
noArt = rs.getInt("no_art");
locCode = checkNullAndTrim(rs.getString("loc_code"));
allocQty = rs.getDouble("alloc_qty");
if( tranId != null && tranId.trim().length() > 0 )
{
lineNo = getMaxLineNo(tranId, conn);
valueXmlString.append("<Detail3 domID='"+lineNo+"' selected=\"N\">\r\n");
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
......@@ -1166,6 +1161,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
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( "<line_no><![CDATA[]]></line_no>\r\n" );
}
valueXmlString.append( "<item_code><![CDATA[" ).append( itemCode ).append( "]]></item_code>\r\n" );
......@@ -1178,6 +1174,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
valueXmlString.append( "<quantity><![CDATA[" ).append( quantity ).append( "]]></quantity>\r\n" );
valueXmlString.append( "<item_unit><![CDATA[" ).append( unit ).append( "]]></item_unit>\r\n" );
valueXmlString.append( "<no_art><![CDATA[" ).append( noArt ).append( "]]></no_art>\r\n" );
valueXmlString.append( "<alloc_qty><![CDATA[" ).append( allocQty ).append( "]]></alloc_qty>\r\n" );
valueXmlString.append("</Detail3>\r\n");
}
if(pstmt != null) { pstmt.close(); pstmt = null; }
......@@ -1215,11 +1212,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
return valueXmlString.toString();
}
/**
* The function checks whether the input string is null.
* If null, the function returns blank string.
* @param input
*/
private String checkNull( String input )
{
if ( input == null )
......@@ -1228,11 +1220,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
}
return input.trim();
}
/**
* The function checks whether the input string is null.
* If null, the function returns blank string otherwise trim the input string and return.
* @param input
*/
private String checkNullAndTrim( String inputVal )
{
if ( inputVal == null )
......@@ -1246,7 +1234,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
return inputVal;
}
private int getMaxLineNo ( String tranId, Connection conn) throws Exception
private int getMaxLineNo(String tranId, Connection conn) throws Exception
{
ResultSet rs = null;
......@@ -1272,75 +1260,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
return lineNo;
}
/*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;
PreparedStatement pstmt = null;
String sql = "";
int count = 0;
tranId = tranId == null ? "" : tranId.trim();
//System.out.println("in isScanningDone--------->[" +tranId+"]");
if("".equalsIgnoreCase(tranId) || tranId.trim().length() < 0 || tranId == null )
{
//System.out.println("Inside if is scanning done ................");
sql = "select count(*) from pallet_det det, pallet_hdr hdr where det.item_code = ? and det.site_code = ? "
+ "and det.lot_no = ? and det.lot_sl = ? "
+ "and hdr.pallet_no = ? and hdr.confirmed = ? and det.tran_id = hdr.tran_id ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
pstmt.setString(2, loginSite);
//pstmt.setString(3, locationCode);
pstmt.setString(3, lotNo);
pstmt.setString(4, lotSl);
pstmt.setString(5, palletNo);
pstmt.setString(6, "N");
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; }
System.out.println("count in isScanningDone@@----->>["+count+"]");
if(count > 0)
{
return true;
}
return false;
}
else
{
//System.out.println("Inside else is scanning done ................");
sql = "select count(*) from pallet_det where tran_id = ? and item_code = ? and site_code = ? and loc_code = ? and lot_no = ? and lot_sl = ? "
+ " and pallet_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
pstmt.setString(2,itemCode);
pstmt.setString(3,loginSite);
pstmt.setString(4,locationCode);
pstmt.setString(5,lotNo);
pstmt.setString(6,lotSl);
pstmt.setString(7,palletNo);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
}
if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; }
System.out.println("count in isScanningDone@@----->>["+count+"]");
if(count > 0)
{
return true;
}
return false;
}
}*/
}
......@@ -43,14 +43,14 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
public String postSave( String domString, String tranId, String editFlag, String xtraParams, Connection conn ) throws RemoteException, ITMException
{
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
String errString = "", siteCode = "",lineNo = "", locCode = "", itemCode = "", lotNo = "", lotSl = "", quantity = "", objName = "",
updateFlag = "";
double parseQuantity = 0;
updateFlag = "", palletNo = "", allocQty = "";
double actualQuantity = 0, actualAllocQty = 0;
HashMap strAllocate = new HashMap();
Connection conn1 = null;
boolean isError = false;
boolean isDelete = false;
boolean isDelete = false;
try
{
ConnDriver connDriver = new ConnDriver();
......@@ -68,14 +68,15 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
SimpleDateFormat sdf = new SimpleDateFormat(applDateFormat);
String currDateStr = sdf.format(currDate1);
Timestamp tranDate = Timestamp.valueOf(genericUtility.getValidDateString( currDateStr , applDateFormat, dbDateFormat ) + " 00:00:00.0");
System.out.println("Calling Post Save for Palletization ::::::::::::: " );
System.out.println("Calling Post Save for Palletization @@@@@@@@ ::::::::::::: " );
System.out.println("domString ::::::::::::: " + domString);
System.out.println("xtraParams ::::::::::::: " + xtraParams);
System.out.println("tranId ::::::::::::: " + tranId);
lineNo = checkNullAndTrim(genericUtility.getColumnValue("line_no", dom, "3" ));
lineNo = checkNullAndTrim(genericUtility.getColumnValue("line_no", dom, "3" ));
updateFlag = getUpdateFlagFromDom(dom, "3");
System.out.println("updateFlag--------->>["+updateFlag+"]");
......@@ -84,52 +85,67 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
if( tranId != null && tranId.trim().length() > 0 && lineNo != null && lineNo.trim().length() > 0)
{
System.out.println("Inside if for post save palletization ::::::::: " );
System.out.println("Inside if loop for post save palletization ::::::::: " );
siteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" ));
itemCode = checkNull(genericUtility.getColumnValue("item_code", dom, "3" ));
palletNo = checkNull(genericUtility.getColumnValue("pallet_no", dom, "3" ));
locCode = checkNull(genericUtility.getColumnValue("loc_code", dom, "3" ));
lotNo = checkNull(genericUtility.getColumnValue("lot_no", dom, "3" ));
lotSl = checkNull(genericUtility.getColumnValue("lot_sl", dom, "3" ));
quantity = checkNull(genericUtility.getColumnValue("quantity", dom, "3" ));
parseQuantity = Double.parseDouble(quantity);
allocQty = checkNull(genericUtility.getColumnValue("alloc_qty", dom, "3" ));
actualQuantity = Double.parseDouble(quantity);
actualAllocQty = Double.parseDouble(allocQty);
/*
System.out.println("lineNo----------->>["+lineNo+"]");
System.out.println("siteCode----------->>["+siteCode+"]");
System.out.println("itemCode----------->>["+itemCode+"]");
System.out.println("locCode----------->>["+locCode+"]");
System.out.println("lotNo----------->>["+lotNo+"]");
System.out.println("lotSl----------->>["+lotSl+"]");
System.out.println("allocQty----------->>["+allocQty+"]");
System.out.println("quantity----------->>["+quantity+"]");
System.out.println("actualQuantity from DOM ----------->>["+actualQuantity+"]");
System.out.println("actualAllocQty----------->>["+actualAllocQty+"]");*/
actualQuantity = actualQuantity - actualAllocQty;
System.out.println("actualQuantity to be allocated ----------->>["+actualQuantity+"]");
if("D".equalsIgnoreCase(updateFlag))
{
isDelete = true;
}
//System.out.println("isDelete----------->>["+isDelete+"]");
strAllocate.put("tran_date", tranDate);
strAllocate.put("ref_ser","PZ");
strAllocate.put("ref_id", tranId);
strAllocate.put("ref_line", lineNo);
strAllocate.put("site_code", siteCode);
strAllocate.put("item_code", itemCode);
strAllocate.put("loc_code", locCode);
strAllocate.put("lot_no", lotNo);
strAllocate.put("lot_sl", lotSl);
if(isDelete)
{
strAllocate.put("alloc_qty", -parseQuantity);
}
else
if (actualQuantity != 0)
{
strAllocate.put("alloc_qty", parseQuantity);
strAllocate.put("tran_date", tranDate);
strAllocate.put("ref_ser","PZ");
strAllocate.put("ref_id", tranId);
strAllocate.put("ref_line", lineNo);
strAllocate.put("site_code", siteCode);
strAllocate.put("item_code", itemCode);
strAllocate.put("loc_code", locCode);
strAllocate.put("lot_no", lotNo);
strAllocate.put("lot_sl", lotSl);
if(isDelete)
{
strAllocate.put("alloc_qty", -actualQuantity);
}
else
{
strAllocate.put("alloc_qty", actualQuantity);
}
strAllocate.put("chg_user", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win", "W_PALLETIZATION");
errString = invAllocTrace.updateInvallocTrace(strAllocate, conn1);
}
strAllocate.put("chg_user", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win", "W_PALLETIZATION");
errString = invAllocTrace.updateInvallocTrace(strAllocate, conn1);
System.out.println("errString ::: " + errString);
if (errString != null && errString.trim().length() > 0 )
......@@ -138,10 +154,10 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
return errString;
}
strAllocate = null;
System.out.println("Allocated the quantity in stock::::::::::: ");
System.out.println("Allocated complete for the quantity in stock::::::::::: ");
}
}
}
}
catch(Exception e)
{
try
......@@ -249,7 +265,6 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
}
}
}
//test = detail3Node.getAttributes().getNamedItem("updateFlag").getNodeValue();
}
}
catch ( Exception e )
......@@ -258,298 +273,6 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
}
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