Commit 535e445b authored by smestry's avatar smestry

W15FSUN008, Create transaction screen Palletization and palletization Confirm for AWMS.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98817 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9d58a786
...@@ -63,8 +63,6 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -63,8 +63,6 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
conn1.setAutoCommit(false); conn1.setAutoCommit(false);
connDriver = null; connDriver = null;
//CommonWmsUtil commonWmsUtility = CommonWmsUtil.getInstance();
Document dom = null; Document dom = null;
dom = genericUtility.parseString(domString); dom = genericUtility.parseString(domString);
...@@ -93,7 +91,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -93,7 +91,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
if("tran_id".equalsIgnoreCase(childNodeName)) if("tran_id".equalsIgnoreCase(childNodeName))
{ {
System.out.println("Inside tran_id ::::::::::: "); //System.out.println("Inside tran_id ::::::::::: ");
if(tranId.length() <= 0) if(tranId.length() <= 0)
{ {
System.out.println("Tran Id found blank :::::::::: "); System.out.println("Tran Id found blank :::::::::: ");
...@@ -226,7 +224,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -226,7 +224,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
ResultSet rs = null; ResultSet rs = null;
try try
{ {
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? "; String sql = " select msg_type from messages where msg_no = ? ";
pstmt = conn.prepareStatement( sql ); pstmt = conn.prepareStatement( sql );
pstmt.setString(1, errorCode); pstmt.setString(1, errorCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -270,7 +268,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -270,7 +268,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
String sql = ""; String sql = "";
try try
{ {
sql = "SELECT TRAN_ID FROM PALLET_HDR WHERE CONFIRMED = ? AND SITE_CODE = ? "; sql = "select tran_id from pallet_hdr where confirmed = ? and site_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "N"); pstmt.setString(1, "N");
pstmt.setString(2, siteCode); pstmt.setString(2, siteCode);
...@@ -305,109 +303,21 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -305,109 +303,21 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
return colVal; return colVal;
} }
private String generateTranTd( String windowName, String tranDate, String siteCode, Connection conn1 )throws ITMException, SQLException
{
System.out.println("inside generateTranTd@@.........");
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
String tranId = "";
String tranSer1 = "",keyString = "",keyCol = "";
CommonConstants commonConstants = new CommonConstants();
try
{
sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, windowName);
rs = pstmt.executeQuery();
System.out.println("keyString :"+sql);
if (rs.next())
{
keyString = rs.getString(1);
keyCol = rs.getString(2);
tranSer1 = rs.getString(3);
}
else
{
sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, "GENERAL");
rs = pstmt.executeQuery();
System.out.println("keyString :"+sql);
if (rs.next())
{
keyString = rs.getString(1);
keyCol = rs.getString(2);
tranSer1 = rs.getString(3);
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("keyString :"+keyString);
System.out.println("keyCol :"+keyCol);
System.out.println("tranSer1 :"+tranSer1);
String xmlValues = "";
xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>";
xmlValues = xmlValues + "<tran_id></tran_id>";
xmlValues = xmlValues + "<site_code>" + siteCode + "</site_code>";
xmlValues = xmlValues + "<tran_date>"+ tranDate + "</tran_date>";
xmlValues = xmlValues + "<tran_type>"+"U"+"</tran_type>";
xmlValues = xmlValues + "</Detail1></Root>";
System.out.println("xmlValues :["+xmlValues+"]");
TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", commonConstants.DB_NAME);
tranId = tg.generateTranSeqID(tranSer1, keyCol, keyString, conn1);
System.out.println("tranId ::"+tranId);
}
catch (SQLException ex)
{
System.out.println("Exception ::" +sql+ ex.getMessage() + ":");
ex.printStackTrace();
throw new ITMException(ex);
}
catch (Exception e)
{
System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if(rs!=null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
return tranId;
}
private void confirm( String tranId, String siteCode, Connection conn1 ) throws ITMException, SQLException private void confirm( String tranId, String siteCode, Connection conn1 ) throws ITMException, SQLException
{ {
String errString = "", sql = "", interfaceTranId = "", tranDate = "", objName = "", invStat = "", available = "", familyGrp = "", qcType = "", String errString = "", sql = "", interfaceTranId = "", tranDate = "", objName = "", invStat = "", available = "", familyGrp = "", qcType = "",
stroPref = ""; stroPref = "", expDate = "", mfgDate = "", palletStatus = "", qcReqd = "", procMth = "";
double quantity = 0, holdQuantity = 0; double quantity = 0, holdQuantity = 0, quantityDB = 0, packSize = 0, interfaceQty = 0, qtyPerArt = 0, interfaceQtyRem = 0, totQuantity = 0;
PreparedStatement pstmt = null, pstmt1 = null; PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null, rs1 = null; ResultSet rs = null, rs1 = null;
DistCommon distComm = new DistCommon(); DistCommon distComm = new DistCommon();
String nexpLoc = "", lockCode = "", expLoc = ""; String nexpLoc = "", lockCode = "", expLoc = "";
ArrayList interfaceArrList = new ArrayList(); ArrayList interfaceArrList = new ArrayList();
int interfaceQty1 = 0;
try try
{ {
System.out.println("::::::::::::::::: Inside confirm :::::::::::::::: "); System.out.println("::::::::::::::::: Inside confirm for palletization confirm :::::::::::::::: ");
System.out.println("tranId :::::::::::::::: " + tranId); System.out.println("tranId :::::::::::::::: " + tranId);
System.out.println("siteCode :::::::::::::::: " + siteCode); System.out.println("siteCode :::::::::::::::: " + siteCode);
...@@ -428,8 +338,8 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -428,8 +338,8 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
sql = "select det.item_code as ITEM_CODE, det.lot_no as LOT_NO, det.lot_sl as LOT_SL, det.quantity as QTY, hdr.pallet_no as PALLET_NO, " sql = "select det.item_code, det.lot_no, det.lot_sl, det.quantity, hdr.pallet_no, "
+ "hdr.inv_stat as INV_STAT, det.site_code as SITE_CODE, det.loc_code as LOC_CODE, hdr.tran_date as TRAN_DATE " + "hdr.inv_stat, det.site_code, det.loc_code, hdr.tran_date, det.line_no "
+ "from pallet_hdr hdr, pallet_det det where hdr.tran_id = det.tran_id and det.tran_id = ? "; + "from pallet_hdr hdr, pallet_det det where hdr.tran_id = det.tran_id and det.tran_id = ? ";
pstmt = conn1.prepareStatement(sql); pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
...@@ -439,37 +349,37 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -439,37 +349,37 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
sql = "select hold_qty from stock where quantity > 0 and site_code = ? and loc_code = ? and " sql = "select hold_qty from stock where quantity > 0 and site_code = ? and loc_code = ? and "
+ "item_code = ? and lot_no = ? and lot_sl = ? "; + "item_code = ? and lot_no = ? and lot_sl = ? ";
pstmt1 = conn1.prepareStatement(sql); pstmt1 = conn1.prepareStatement(sql);
pstmt1.setString(1, rs.getString("SITE_CODE")); pstmt1.setString(1, rs.getString("site_code"));
pstmt1.setString(2, rs.getString("LOC_CODE")); pstmt1.setString(2, rs.getString("loc_code"));
pstmt1.setString(3, rs.getString("ITEM_CODE")); pstmt1.setString(3, rs.getString("item_code"));
pstmt1.setString(4, rs.getString("LOT_NO")); pstmt1.setString(4, rs.getString("lot_no"));
pstmt1.setString(5, rs.getString("LOT_SL")); pstmt1.setString(5, rs.getString("lot_sl"));
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
if (rs1.next()) if (rs1.next())
{ {
holdQuantity = rs1.getDouble("HOLD_QTY"); holdQuantity = rs1.getDouble("hold_qty");
} }
System.out.println("holdQuantity ::::::::::::: " + holdQuantity); System.out.println("holdQuantity ::::::::::::: " + holdQuantity);
pstmt1.close(); pstmt1.close();
pstmt1 = null; pstmt1 = null;
rs1.close(); rs1.close();
rs1 = null; rs1 = null;
// InvStat
if(holdQuantity >= 0) if(holdQuantity >= 0)
{ {
System.out.println("inside hold quantity greater than zero :::::::::::::::::: "); //System.out.println("inside hold quantity greater than zero :::::::::::::::::: ");
nexpLoc = distComm.getDisparams("999999","NEAR_EXP_LOCK",conn1); nexpLoc = distComm.getDisparams("999999","NEAR_EXP_LOCK",conn1);
expLoc = distComm.getDisparams("999999","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 " 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 = ? "; + "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 = conn1.prepareStatement(sql);
pstmt1.setString(1, rs.getString("ITEM_CODE")); pstmt1.setString(1, rs.getString("item_code"));
pstmt1.setString(2, rs.getString("SITE_CODE")); pstmt1.setString(2, rs.getString("site_code"));
pstmt1.setString(3, rs.getString("LOC_CODE")); pstmt1.setString(3, rs.getString("loc_code"));
pstmt1.setString(4, rs.getString("LOT_NO")); pstmt1.setString(4, rs.getString("lot_no"));
pstmt1.setString(5, rs.getString("LOT_SL")); pstmt1.setString(5, rs.getString("lot_sl"));
pstmt1.setString(6, "H"); pstmt1.setString(6, "H");
rs1 = pstmt1.executeQuery(); rs1 = pstmt1.executeQuery();
if (rs1.next()) if (rs1.next())
...@@ -501,47 +411,135 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -501,47 +411,135 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
} }
System.out.println("invStat final ::::::::::::: " + invStat); System.out.println("invStat final ::::::::::::: " + invStat);
interfaceTranId = generateTranTd("w_interface2", tranDate, siteCode, conn1); // Quantity, no of Arts, Total Quantity
System.out.println("interface2TranId ::::::::::::: " + interfaceTranId); 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");
}
pstmt1.close();
pstmt1 = 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");
}
pstmt1.close();
pstmt1 = null;
rs1.close();
rs1 = null;
HashMap hm2 = new HashMap();
hm2 = commonWmsUtility.getPalletizedAttributes(rs.getString("item_code"), siteCode, conn1);
procMth = (String) hm2.get("PROC_MTH");
System.out.println("qcReqd ::::::::::::: " + qcReqd);
System.out.println("procMth ::::::::::::: " + procMth);
if("".equalsIgnoreCase(procMth) && procMth.length() <= 0)
{
qcType = "N";
}
else if(qcReqd.length() > 0 && "Y".equalsIgnoreCase(qcReqd))
{
qcType = "F";
}
else
{
qcType = "C";
}
System.out.println("qcType ::::::::::::: " + qcType);
HashMap hm = new HashMap(); HashMap hm = new HashMap();
/*HashMap hm1 = new HashMap(); hm.put("TRAN_ID", "");
hm1 = getInterface2Data(rs.getString("ITEM_CODE"), conn, siteCode); hm.put("ITEM_CODE", checkNullAndTrim(rs.getString("item_code")));
familyGrp = (String) hm1.get("LOC_ZONE__PREF");
qcType = (String) hm1.get("PROC_MTH");
stroPref = (String) hm1.get("ANALYSIS_CLASS");*/
hm.put("IN_OUT", "I");
hm.put("ERR_COD", "");
hm.put("MSG_STAT", "N");
hm.put("TRANS_DT_ACK", checkNullAndTrim(String.valueOf(rs.getString("TRAN_DATE"))));
hm.put("TRAN_ID", interfaceTranId);
hm.put("ITEM_CODE", rs.getString("ITEM_CODE"));
hm.put("DESCR", ""); hm.put("DESCR", "");
hm.put("UNIT", ""); hm.put("UNIT", "");
hm.put("ITEM_TYPE", ""); hm.put("ITEM_TYPE", "");
hm.put("FAMILY_GRP", ""); hm.put("FAMILY_GRP", "");
hm.put("IN_OUT", "I");
hm.put("REF_SER", "PZ"); hm.put("REF_SER", "PZ");
hm.put("LOT_NO", rs.getString("LOT_NO"));
hm.put("REF_ID", tranId); hm.put("REF_ID", tranId);
hm.put("LOT_SL", rs.getString("LOT_SL")); hm.put("TRAN_DATE", checkNullAndTrim(String.valueOf(rs.getTimestamp("TRAN_DATE"))));
hm.put("QUANTITY", rs.getString("QTY")); hm.put("LOT_NO", rs.getString("lot_no"));
hm.put("EXP_DATE", ""); hm.put("LOT_SL", rs.getString("lot_sl"));
hm.put("MFG_DATE", ""); hm.put("QUANTITY", checkNullAndTrim((String.valueOf(interfaceQty))));
hm.put("PALLET_NO", rs.getString("PALLET_NO")); hm.put("QTY_PER_ART", checkNullAndTrim((String.valueOf(packSize))));
hm.put("PALLET_STATUS", ""); hm.put("TOTAL_QTY", checkNullAndTrim((String.valueOf(totQuantity))));
hm.put("LOCK_STAT", invStat); hm.put("EXP_DATE", checkNullAndTrim(expDate));
hm.put("QC_TYPE", ""); hm.put("MFG_DATE", checkNullAndTrim(mfgDate));
hm.put("PALLET_NO", checkNullAndTrim(rs.getString("loc_code")));
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("STRO_PREF", "");
hm.put("PALLET_REJ", ""); hm.put("LINE_NO",checkNullAndTrim(String.valueOf(rs.getString("line_no"))));
hm.put("QC_TYPE", "");
hm.put("PALLET_REJ_DESC", "");
hm.put("REF_LINE_NO", "");
interfaceArrList.add(hm); interfaceArrList.add(hm);
} }
commonWmsUtility.updateAwmsInterface(interfaceArrList, conn1); commonWmsUtility.updateAwmsInterface(interfaceArrList, siteCode, conn1);
System.out.println("Inserted into interface2 table ::::::::::::: "); System.out.println("Inserted into interface2 table ::::::::::::: ");
pstmt.close(); pstmt.close();
......
...@@ -95,7 +95,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -95,7 +95,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
@Override @Override
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String xtraParams) throws RemoteException, ITMException public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String xtraParams) throws RemoteException, ITMException
{ {
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
Node parentNode = null; Node parentNode = null;
...@@ -111,7 +110,9 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -111,7 +110,9 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
try try
{ {
genericUtility = GenericUtility.getInstance(); genericUtility = GenericUtility.getInstance();
CommonWmsUtil commonWmsUtility = CommonWmsUtil.getInstance();
System.out.println("xtraParam----->>["+xtraParams+"]"); System.out.println("xtraParam----->>["+xtraParams+"]");
System.out.println("DOM---->>["+genericUtility.serializeDom(dom).toString()+"]"); System.out.println("DOM---->>["+genericUtility.serializeDom(dom).toString()+"]");
System.out.println("DOM1----->>["+genericUtility.serializeDom(dom1).toString()+"]"); System.out.println("DOM1----->>["+genericUtility.serializeDom(dom1).toString()+"]");
...@@ -183,14 +184,14 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -183,14 +184,14 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
if(locationCode.length() <= 0 && palletNoSource.length() <= 0) if(locationCode.length() <= 0 && palletNoSource.length() <= 0)
{ {
System.out.println("Blank for Location Code and pallet No Source :::::::::: "); System.out.println("Blank for Location Code and pallet No Source :::::::::: ");
errCode = "VTINVLPNo"; errCode = "VTINVLPNO";
errList.add( errCode ); errList.add( errCode );
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else if(locationCode.length() > 0 && palletNoSource.length() > 0) else if(locationCode.length() > 0 && palletNoSource.length() > 0)
{ {
System.out.println(" value found for Location Code and pallet No Source :::::::::: "); System.out.println(" value found for Location Code and pallet No Source :::::::::: ");
errCode = "VTINVLPNo"; errCode = "VTINVLPNO";
errList.add( errCode ); errList.add( errCode );
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
...@@ -287,7 +288,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -287,7 +288,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
itemCode = checkNullAndTrim(genericUtility.getColumnValue("item_code",dom)); itemCode = checkNullAndTrim(genericUtility.getColumnValue("item_code",dom));
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));
...@@ -305,8 +306,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -305,8 +306,8 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("palletNoSource :::::::::::::: " + palletNoSource); System.out.println("palletNoSource :::::::::::::: " + palletNoSource);
System.out.println("palletNo :::::::::::::: " + palletNo); System.out.println("palletNo :::::::::::::: " + palletNo);
sql ="select item_code from pallet_hdr h, pallet_det d where d.loc_code in (?, ?) and d.pallet_no = ? and " sql ="select distinct(item_code) from pallet_hdr h, pallet_det d where d.loc_code in (?, ?) and d.pallet_no = ? and "
+ "h.confirmed = 'N' and d.tran_id = h.tran_id and rownum < 2 "; + "h.confirmed = 'N' and d.tran_id = h.tran_id and rownum < 2 ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locationCode); pstmt.setString(1, locationCode);
pstmt.setString(2, palletNoSource); pstmt.setString(2, palletNoSource);
...@@ -321,7 +322,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -321,7 +322,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
//System.out.println("itemCodeDB ------->>["+itemCodeDB+"]"); //System.out.println("itemCodeDB ------->>["+itemCodeDB+"]");
parseQuantity = Double.parseDouble(quantity); parseQuantity = Double.parseDouble(quantity);
System.out.println("parseQuantity ------->>["+parseQuantity+"]"); //System.out.println("parseQuantity ------->>["+parseQuantity+"]");
sql = "select (quantity - (alloc_qty + hold_qty)) as quantity from stock where loc_code in (?,?) " sql = "select (quantity - (alloc_qty + hold_qty)) as quantity from stock where loc_code in (?,?) "
+ "and (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? and item_code = ? and lot_no = ? and lot_sl = ? "; + "and (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? and item_code = ? and lot_no = ? and lot_sl = ? ";
...@@ -348,7 +349,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -348,7 +349,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
if("quantity".equalsIgnoreCase(childNodeName)) if("quantity".equalsIgnoreCase(childNodeName))
{ {
System.out.println("Inside quantity ::::::::::: "); //System.out.println("Inside quantity ::::::::::: ");
if(parseQuantity <= 0) if(parseQuantity <= 0)
{ {
...@@ -367,14 +368,14 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -367,14 +368,14 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
if( itemCodeDB != null && itemCodeDB.trim().length() > 0 ) if( itemCodeDB != null && itemCodeDB.trim().length() > 0 )
{ {
System.out.println("Inside if loop for analysis class :::::::::: "); //System.out.println("Inside if loop for analysis class :::::::::: ");
hm = getInterface2Data(itemCode, conn, loginSite); hm = commonWmsUtility.getPalletizedAttributes(itemCode, loginSite, conn);
familyGrp = (String) hm.get("LOC_ZONE__PREF"); familyGrp = (String) hm.get("LOC_ZONE__PREF");
qcType = (String) hm.get("PROC_MTH"); qcType = (String) hm.get("PROC_MTH");
stroPref = (String) hm.get("ANALYSIS_CLASS"); stroPref = (String) hm.get("ANALYSIS_CLASS");
hm1 = getInterface2Data(itemCodeDB, conn, loginSite); hm1 = commonWmsUtility.getPalletizedAttributes(itemCode, loginSite, conn);
familyGrpDB = (String) hm1.get("LOC_ZONE__PREF"); familyGrpDB = (String) hm1.get("LOC_ZONE__PREF");
qcTypeDB = (String) hm1.get("PROC_MTH"); qcTypeDB = (String) hm1.get("PROC_MTH");
stroPrefDB = (String) hm1.get("ANALYSIS_CLASS"); stroPrefDB = (String) hm1.get("ANALYSIS_CLASS");
...@@ -386,17 +387,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -386,17 +387,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("qcTypeDB :::::::::: " + qcTypeDB); System.out.println("qcTypeDB :::::::::: " + qcTypeDB);
System.out.println("stroPrefDB :::::::::: " + stroPrefDB); System.out.println("stroPrefDB :::::::::: " + stroPrefDB);
if(!familyGrpDB.equals(familyGrp) || !qcTypeDB.equals(qcType) || !stroPrefDB.equals(stroPref)) if(!familyGrpDB.equals(familyGrp) || !qcTypeDB.equals(qcType) || !stroPrefDB.equals(stroPref))
{ {
System.out.println("Error Message item code is not of same analysis grp :::::::::: "); System.out.println(" item code is not of same analysis grp :::::::::: ");
errCode = "VTINVAC"; errCode = "VTINVAC";
errList.add( errCode ); errList.add( errCode );
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}
else
{
System.out.println("Same analysis class for the scaned item code :::::::::: ");
} }
} }
} }
...@@ -520,13 +516,13 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -520,13 +516,13 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
String sql = ""; String sql = "";
try try
{ {
sql ="select distinct(loc_code) AS LOC_CODE from stock where (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? "; sql ="select distinct(loc_code) as loc_code from stock where (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSite); pstmt.setString(1, loginSite);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
colVal.add(checkNull(rs.getString("LOC_CODE"))); colVal.add(checkNull(rs.getString("loc_code")));
} }
} }
catch(Exception e) catch(Exception e)
...@@ -561,14 +557,14 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -561,14 +557,14 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
String location = ""; String location = "";
try try
{ {
sql = "select distinct(loc_code) as LOC_CODE from location where site_code = ? and inv_stat = ? "; sql = "select distinct(loc_code) as loc_code from location where site_code = ? and inv_stat = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSite); pstmt.setString(1, loginSite);
pstmt.setString(2, "AWMS"); pstmt.setString(2, "AWMS");
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
colVal.add(checkNull(rs.getString("LOC_CODE"))); colVal.add(checkNull(rs.getString("loc_code")));
} }
System.out.println("Location in getLocation :::::::::: " + location); System.out.println("Location in getLocation :::::::::: " + location);
} }
...@@ -594,74 +590,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -594,74 +590,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("Return List from getLocation------>>" + colVal); System.out.println("Return List from getLocation------>>" + colVal);
return colVal; return colVal;
} }
public HashMap getInterface2Data(String itemCode, Connection conn, String siteCode) throws ITMException, SQLException
{
HashMap hm = new HashMap();
PreparedStatement pstmt=null;
ResultSet rs = null;
String sql = "";
String familyGrp = "", qcType = "", stroPref = "";
try
{
sql = "SELECT LOC_ZONE__PREF, PROC_MTH, ANALYSIS_CLASS FROM SITEITEM WHERE ITEM_CODE = ? and site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
pstmt.setString(2, siteCode);
rs = pstmt.executeQuery();
if (rs.next())
{
familyGrp = rs.getString("LOC_ZONE__PREF");
qcType = rs.getString("PROC_MTH");
stroPref = rs.getString("ANALYSIS_CLASS");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
sql = "SELECT LOC_ZONE__PREF, PROC_MTH, ANALYSIS_CLASS FROM ITEM WHERE ITEM_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
rs = pstmt.executeQuery();
if (rs.next())
{
if(familyGrp == null || familyGrp.length() <= 0)
{
familyGrp = rs.getString("LOC_ZONE__PREF");
}
if(qcType == null || qcType.length() <= 0)
{
qcType = rs.getString("PROC_MTH");
}
if(stroPref == null || stroPref.length() <= 0)
{
stroPref = rs.getString("ANALYSIS_CLASS");
}
}
rs.close();rs = null;
pstmt.close();pstmt = null;
hm.put("LOC_ZONE__PREF", familyGrp);
hm.put("PROC_MTH", qcType);
hm.put("ANALYSIS_CLASS", stroPref);
}
catch(Exception e)
{
System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
finally
{
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
}
return hm;
}
/** /**
* The public method is defined without any parameters and returns blank string * The public method is defined without any parameters and returns blank string
*/ */
...@@ -797,28 +726,22 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -797,28 +726,22 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
String locationCode ="", palletNo = "", palletNoSource = ""; String locationCode ="", palletNo = "", palletNoSource = "";
String siteCodeEdit = "", tranTypeEdit = "", locCodeEdit = "", palletTypeEdit = "", invStatEdit = "", palletNoEdit = "", String siteCodeEdit = "", tranTypeEdit = "", locCodeEdit = "", palletTypeEdit = "", invStatEdit = "", palletNoEdit = "",
palletNoSourceEdit = "", remarksEdit = "", confirmEdit = "", chgUserEdit = "", palletNoSourceEdit = "", remarksEdit = "", chgUserEdit = "", confirmEdit = "",
chgTermEdit = "", invStat = "", tranIdEdit = ""; chgTermEdit = "", invStat = "", tranIdEdit = "";
Date confirmDateEdit = null, chgDateEdit = null, tranDateEdit = null; Date chgDateEdit = null, tranDateEdit = null, confirmDateEdit = null;
locationCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code", hdrDataDom)); locationCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code", hdrDataDom));
palletNoSource = checkNullAndTrim(genericUtility.getColumnValue("pallet_no__source", hdrDataDom)); palletNoSource = checkNullAndTrim(genericUtility.getColumnValue("pallet_no__source", hdrDataDom));
palletNo = checkNullAndTrim(genericUtility.getColumnValue("pallet_no", hdrDataDom)); palletNo = checkNullAndTrim(genericUtility.getColumnValue("pallet_no", hdrDataDom));
/*String tranId1 = checkNullAndTrim(genericUtility.getColumnValue("tran_id", allFormDataDom));
System.out.println("Tran_id----------->>["+tranId1+"]");
*/
//tranId = checkNull(genericUtility.getColumnValue("tran_id", allFormDataDom, "2" ));
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) ) if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
{ {
System.out.println(" Inside if details 2 for 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, pallet_no__source, remarks, " sql = "select tran_id, tran_date, site_code, tran_type, loc_code, pallet_type, inv_stat, pallet_no, pallet_no__source, remarks, "
+ "confirmed, conf_date, chg_user, chg_date, chg_term from pallet_hdr where (loc_code = ? or pallet_no__source = ?) and pallet_no = ? " + "confirmed, conf_date, chg_user, chg_date, chg_term from pallet_hdr "
+ "and site_code = ? and add_user = ? " + "where (loc_code = ? or pallet_no__source = ?) and pallet_no = ? "
+ "AND CASE WHEN CONFIRMED IS NULL THEN 'N' ELSE CONFIRMED END = 'N' "; + "and site_code = ? and add_user = ? and case when confirmed is null then 'N' else confirmed end = 'N' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locationCode); pstmt.setString(1, locationCode);
pstmt.setString(2, palletNoSource); pstmt.setString(2, palletNoSource);
...@@ -922,7 +845,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -922,7 +845,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("allFormDataDom------>>["+genericUtility.serializeDom(allFormDataDom)+"]"); System.out.println("allFormDataDom------>>["+genericUtility.serializeDom(allFormDataDom)+"]");
double quantity = 0; double quantity = 0;
String itemCode = "", lotNo = "", lotSl = "", locationCode ="", palletNo = "", palletNoSource = ""; String itemCode = "", lotNo = "", lotSl = "", locationCode ="", palletNo = "", palletNoSource = "", noArt = "";
tranId = checkNull(genericUtility.getColumnValue("tran_id", allFormDataDom, "2" )); tranId = checkNull(genericUtility.getColumnValue("tran_id", allFormDataDom, "2" ));
...@@ -936,15 +859,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -936,15 +859,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{ {
System.out.println(" Inside if details 3 for itm_default :::::::::::::::::: "); System.out.println(" Inside if details 3 for itm_default :::::::::::::::::: ");
/*sql = "select item_code, lot_no, lot_sl, (quantity - (alloc_qty + hold_qty)) as quantity from stock where loc_code in (?,?) " sql = "select item_code, lot_no, lot_sl, (quantity - (alloc_qty + hold_qty)) as quantity, no_art from stock where loc_code in (?,?) "
+ "and (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? "; */ + "and (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? "
+ "union "
sql = "select item_code, lot_no, lot_sl, (quantity - (alloc_qty + hold_qty)) as quantity from stock where loc_code in (?,?) " + "select d.item_code, d.lot_no, d.lot_sl, d.quantity, no_art from pallet_det d, pallet_hdr h where d.loc_code = ? "
+ "and (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? union "
+ "select d.item_code, d.lot_no, d.lot_sl, d.quantity 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.pallet_no = ? and h.confirmed = ? and d.site_code = ? and d.tran_id = ? "
+ "and d.tran_id = h.tran_id "; + "and d.tran_id = h.tran_id ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locationCode); pstmt.setString(1, locationCode);
pstmt.setString(2, palletNoSource); pstmt.setString(2, palletNoSource);
...@@ -964,11 +884,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -964,11 +884,12 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
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");
noArt = checkNullAndTrim(rs.getString("no_art"));
System.out.println("-------------- itemchanged Edit mode in Details 3 ----------------------"); System.out.println("-------------- itemchanged Edit mode in Details 3 ----------------------");
domId++; domId++;
if(isScanningDone(tranId, itemCode, loginSite, locationCode, lotNo, lotSl, palletNo, quantity, conn)) if(isScanningDone(tranId, itemCode, loginSite, locationCode, lotNo, lotSl, palletNo, conn))
{ {
valueXmlString.append("<Detail3 domID='"+domId+"' selected=\"Y\">\r\n"); valueXmlString.append("<Detail3 domID='"+domId+"' 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");
...@@ -987,7 +908,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -987,7 +908,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
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" );
valueXmlString.append( "<quantity><![CDATA[" ).append( quantity ).append( "]]></quantity>\r\n" ); valueXmlString.append( "<quantity><![CDATA[" ).append( quantity ).append( "]]></quantity>\r\n" );
valueXmlString.append( "<no_art><![CDATA[" ).append( "").append( "]]></no_art>\r\n" ); valueXmlString.append( "<no_art><![CDATA[" ).append( noArt ).append( "]]></no_art>\r\n" );
valueXmlString.append("</Detail3>\r\n"); valueXmlString.append("</Detail3>\r\n");
} }
} }
...@@ -1001,20 +922,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1001,20 +922,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
quantity = rs.getDouble("quantity"); quantity = rs.getDouble("quantity");
System.out.println("-------------- itemchanged Add mode in Details 3 ----------------------"); System.out.println("-------------- itemchanged Add mode in Details 3 ----------------------");
domId++; domId++;
/*if(isScanningDone(tranId, itemCode, loginSite, locationCode, lotNo, lotSl, palletNo, quantity, conn))
{
valueXmlString.append("<Detail3 domID='"+domId+"' selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"N\" pkNames=\"\" />\r\n");
}
else
{
valueXmlString.append("<Detail3 domID='"+domId+"' selected=\"N\">\r\n");
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
}*/
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");
...@@ -1027,7 +935,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1027,7 +935,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
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" );
valueXmlString.append( "<quantity><![CDATA[" ).append( quantity ).append( "]]></quantity>\r\n" ); valueXmlString.append( "<quantity><![CDATA[" ).append( quantity ).append( "]]></quantity>\r\n" );
valueXmlString.append( "<no_art><![CDATA[" ).append( "").append( "]]></no_art>\r\n" ); valueXmlString.append( "<no_art><![CDATA[" ).append( noArt ).append( "]]></no_art>\r\n" );
valueXmlString.append("</Detail3>\r\n"); valueXmlString.append("</Detail3>\r\n");
} }
} }
...@@ -1094,7 +1002,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1094,7 +1002,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, Double quantity, 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;
...@@ -1104,7 +1012,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1104,7 +1012,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("in isScanningDone--------->" + tranId); System.out.println("in isScanningDone--------->" + tranId);
sql = "select count(*) from pallet_det where tran_id = ? and item_code = ? and site_code = ? and loc_code = ? and lot_no = ? and lot_sl = ? " 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 = ? and quantity = ? "; + " and pallet_no = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId); pstmt.setString(1,tranId);
pstmt.setString(2,itemCode); pstmt.setString(2,itemCode);
...@@ -1113,7 +1021,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -1113,7 +1021,6 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
pstmt.setString(5,lotNo); pstmt.setString(5,lotNo);
pstmt.setString(6,lotSl); pstmt.setString(6,lotSl);
pstmt.setString(7,palletNo); pstmt.setString(7,palletNo);
pstmt.setDouble(8,quantity);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
......
...@@ -40,10 +40,7 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -40,10 +40,7 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
public String postSave( String domString, String tranId, String editFlag, String xtraParams, Connection conn ) throws RemoteException, ITMException public String postSave( String domString, String tranId, String editFlag, String xtraParams, Connection conn ) throws RemoteException, ITMException
{ {
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean(); InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
String errString = "", sql = "", siteCode = "", interfaceTranId = "", objName = "", lineNo = "", locCode = "", palletNo = "", String errString = "", siteCode = "",lineNo = "", locCode = "", itemCode = "", lotNo = "", lotSl = "", quantity = "";
PalletNoSource = "", itemCode = "", lotNo = "", lotSl = "", quantity = "";
PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null, rs1 = null;
double parseQuantity = 0; double parseQuantity = 0;
HashMap strAllocate = new HashMap(); HashMap strAllocate = new HashMap();
Connection conn1 = null; Connection conn1 = null;
...@@ -65,15 +62,17 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -65,15 +62,17 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
String currDateStr = sdf.format(currDate1); String currDateStr = sdf.format(currDate1);
java.sql.Timestamp tranDate = java.sql.Timestamp.valueOf(genericUtility.getValidDateString( currDateStr , applDateFormat, dbDateFormat ) + " 00:00:00.0") ; java.sql.Timestamp tranDate = java.sql.Timestamp.valueOf(genericUtility.getValidDateString( currDateStr , applDateFormat, dbDateFormat ) + " 00:00:00.0") ;
System.out.println("Calling Post Save ::::::::::::: " ); System.out.println("Calling Post Save for Palletization ::::::::::::: " );
System.out.println("domString ::::::::::::: " + domString); System.out.println("domString ::::::::::::: " + domString);
System.out.println("xtraParams ::::::::::::: " + xtraParams); System.out.println("xtraParams ::::::::::::: " + xtraParams);
System.out.println("tranId ::::::::::::: " + tranId); System.out.println("tranId ::::::::::::: " + tranId);
lineNo = checkNull(genericUtility.getColumnValue("line_no", dom, "3" )); lineNo = checkNullAndTrim(genericUtility.getColumnValue("line_no", dom, "3" ));
if( tranId != null && tranId.trim().length() > 0 && lineNo != null && lineNo.trim().length() > 0) if( tranId != null && tranId.trim().length() > 0 && lineNo != null && lineNo.trim().length() > 0)
{ {
System.out.println("Inside if for post save palletization ::::::::: " );
siteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" )); siteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" ));
itemCode = checkNull(genericUtility.getColumnValue("item_code", dom, "3" )); itemCode = checkNull(genericUtility.getColumnValue("item_code", dom, "3" ));
locCode = checkNull(genericUtility.getColumnValue("loc_code", dom, "3" )); locCode = checkNull(genericUtility.getColumnValue("loc_code", dom, "3" ));
...@@ -89,42 +88,30 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -89,42 +88,30 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
System.out.println("lotNo----------->>["+lotNo+"]"); System.out.println("lotNo----------->>["+lotNo+"]");
System.out.println("lotSl----------->>["+lotSl+"]"); System.out.println("lotSl----------->>["+lotSl+"]");
sql = "select * from INVALLOC_TRACE where ref_id = ? and ref_line = ? "; strAllocate.put("tran_date", tranDate);
pstmt = conn1.prepareStatement(sql); strAllocate.put("ref_ser","PZ");
pstmt.setString(1, tranId); strAllocate.put("ref_id", tranId);
pstmt.setString(2, lineNo); strAllocate.put("ref_line", lineNo);
rs = pstmt.executeQuery(); strAllocate.put("site_code", siteCode);
if(!rs.next()) strAllocate.put("item_code", itemCode);
{ strAllocate.put("loc_code", locCode);
System.out.println("Inside if for post save palletization ::::::::: " ); strAllocate.put("lot_no", lotNo);
strAllocate.put("lot_sl", lotSl);
strAllocate.put("tran_date", tranDate); strAllocate.put("alloc_qty", parseQuantity) ;
strAllocate.put("ref_ser","PZ"); strAllocate.put("chg_user", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("ref_id", tranId); strAllocate.put("chg_term", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("ref_line", lineNo); strAllocate.put("chg_win", "W_PALLETIZATION");
strAllocate.put("site_code", siteCode);
strAllocate.put("item_code", itemCode); errString = invAllocTrace.updateInvallocTrace(strAllocate, conn1);
strAllocate.put("loc_code", locCode);
strAllocate.put("lot_no", lotNo); System.out.println("errString ::: " + errString);
strAllocate.put("lot_sl", lotSl); if (errString != null && errString.trim().length() > 0 )
strAllocate.put("alloc_qty", parseQuantity) ; {
strAllocate.put("chg_user", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode")); return errString;
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 )
{
return errString;
}
strAllocate = null;
System.out.println("Allocated the quantity in stock::::::::::: ");
} }
if(pstmt1 != null){pstmt1.close();pstmt1 = null;} strAllocate = null;
if(rs1 != null){rs1.close();rs1 = null;} System.out.println("Allocated the quantity in stock::::::::::: ");
} }
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -144,26 +131,6 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -144,26 +131,6 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
{ {
try try
{ {
if( rs != null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if( rs1 != null )
{
rs1.close();
rs1 = null;
}
if( pstmt1 != null )
{
pstmt1.close();
pstmt1 = null;
}
if (conn1 != null) if (conn1 != null)
{ {
conn1.close(); conn1.close();
...@@ -200,82 +167,6 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -200,82 +167,6 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
} }
return inputVal; return inputVal;
} }
private String generateTranTd( String windowName, String tranDate, String siteCode, Connection conn1 )throws ITMException
{
System.out.println("inside generateTranTd@@.........");
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
String tranId = "";
String tranSer1 = "",keyString = "",keyCol = "";
CommonConstants commonConstants = new CommonConstants();
try
{
sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, windowName);
rs = pstmt.executeQuery();
System.out.println("keyString :"+sql);
if (rs.next())
{
keyString = rs.getString(1);
keyCol = rs.getString(2);
tranSer1 = rs.getString(3);
}
else
{
sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, "GENERAL");
rs = pstmt.executeQuery();
System.out.println("keyString :"+sql);
if (rs.next())
{
keyString = rs.getString(1);
keyCol = rs.getString(2);
tranSer1 = rs.getString(3);
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("keyString :"+keyString);
System.out.println("keyCol :"+keyCol);
System.out.println("tranSer1 :"+tranSer1);
String xmlValues = "";
xmlValues ="<?xml version=\"1.0\" encoding=\"utf-8\"?><Root>";
xmlValues = xmlValues + "<Header></Header>";
xmlValues = xmlValues + "<Detail1>";
xmlValues = xmlValues + "<tran_id></tran_id>";
xmlValues = xmlValues + "<site_code>" + siteCode + "</site_code>";
xmlValues = xmlValues + "<tran_date>"+ tranDate + "</tran_date>";
xmlValues = xmlValues + "<tran_type>"+"U"+"</tran_type>";
xmlValues = xmlValues + "</Detail1></Root>";
System.out.println("xmlValues :["+xmlValues+"]");
TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", commonConstants.DB_NAME);
tranId = tg.generateTranSeqID(tranSer1, keyCol, keyString, conn1);
System.out.println("tranId ::"+tranId);
}
catch (SQLException ex)
{
System.out.println("Exception ::" +sql+ ex.getMessage() + ":");
ex.printStackTrace();
throw new ITMException(ex);
}
catch (Exception e)
{
System.out.println("Exception ::" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
return tranId;
}
} }
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