Commit 1599bdd3 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@98803 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ca9ef54b
...@@ -35,7 +35,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -35,7 +35,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
{ {
return ""; return "";
} }
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 conn123 ) throws RemoteException, ITMException
{ {
String errString = "", siteCode = ""; String errString = "", siteCode = "";
...@@ -46,7 +46,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -46,7 +46,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
String childNodeName = "" ; String childNodeName = "" ;
int ctr = 0, childNodeListLength = 0, cnt = 0; int ctr = 0, childNodeListLength = 0, cnt = 0;
boolean isError = false; boolean isError = false;
Connection conn1 = null;
String userId = "", errorType = "", errCode = ""; String userId = "", errorType = "", errCode = "";
ArrayList <String> errList = new ArrayList<String>(); ArrayList <String> errList = new ArrayList<String>();
ArrayList <String> errFields = new ArrayList <String> (); ArrayList <String> errFields = new ArrayList <String> ();
...@@ -56,14 +56,14 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -56,14 +56,14 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
try try
{ {
System.out.println("::::::::::::::::: Inside postSave for palletization confirm :::::::::::::::: "); System.out.println("::::::::::::::::: Inside postSave for palletization confirm :::::::::::::::: ");
GenericUtility genericUtility = GenericUtility.getInstance();
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); conn1 = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false); conn1.setAutoCommit(false);
connDriver = null; connDriver = null;
//CommonWmsUtil commonWmsUtility = CommonWmsUtil.getInstance(); //CommonWmsUtil commonWmsUtility = CommonWmsUtil.getInstance();
GenericUtility genericUtility = GenericUtility.getInstance();
Document dom = null; Document dom = null;
dom = genericUtility.parseString(domString); dom = genericUtility.parseString(domString);
...@@ -83,7 +83,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -83,7 +83,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
System.out.println("childNodeListLength----------->>["+childNodeListLength+"]"); System.out.println("childNodeListLength----------->>["+childNodeListLength+"]");
tranIdList = getTranId(conn, siteCode); tranIdList = getTranId(siteCode, conn1);
for (ctr = 0; ctr < childNodeListLength; ctr++) for (ctr = 0; ctr < childNodeListLength; ctr++)
{ {
...@@ -94,7 +94,6 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -94,7 +94,6 @@ 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 :::::::::: ");
...@@ -113,7 +112,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -113,7 +112,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
if(tranIdList.contains(tranId)) if(tranIdList.contains(tranId))
{ {
System.out.println("Calling confirm :::::::::::::::::::: "); System.out.println("Calling confirm :::::::::::::::::::: ");
confirm(tranId, siteCode, conn); confirm(tranId, siteCode, conn1);
} }
} }
} }
...@@ -129,7 +128,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -129,7 +128,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
errFldName = errFields.get(cnt); errFldName = errFields.get(cnt);
System.out.println("errCode .........." + errCode); System.out.println("errCode .........." + errCode);
errString = getErrorString( errFldName, errCode, userId ); errString = getErrorString( errFldName, errCode, userId );
errorType = errorType( conn, errCode ); errorType = errorType( conn1, errCode );
if ( errString.length() > 0) if ( errString.length() > 0)
{ {
String bifurErrString = errString.substring( errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>")); String bifurErrString = errString.substring( errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>"));
...@@ -176,17 +175,17 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -176,17 +175,17 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
if( !isError ) if( !isError )
{ {
System.out.println("commmit"); System.out.println("commmit");
conn.commit(); conn1.commit();
} }
else if ( isError ) else if ( isError )
{ {
System.out.println("rollback"); System.out.println("rollback");
conn.rollback(); conn1.rollback();
} }
if (conn != null) if (conn1 != null)
{ {
conn.close(); conn1.close();
conn = null; conn1 = null;
} }
} }
catch(Exception e) catch(Exception e)
...@@ -227,7 +226,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -227,7 +226,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();
...@@ -263,7 +262,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -263,7 +262,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
return msgType; return msgType;
} }
private ArrayList<String> getTranId(Connection conn, String siteCode) throws Exception private ArrayList<String> getTranId( String siteCode, Connection conn ) throws Exception
{ {
ArrayList<String> colVal = new ArrayList<String>(); ArrayList<String> colVal = new ArrayList<String>();
PreparedStatement pstmt = null ; PreparedStatement pstmt = null ;
...@@ -271,9 +270,10 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -271,9 +270,10 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
String sql = ""; String sql = "";
try try
{ {
sql = "SELECT TRAN_ID FROM PALLET_HDR WHERE CONFIRMED = 'N' 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, siteCode); pstmt.setString(1, "N");
pstmt.setString(2, siteCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
...@@ -284,7 +284,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -284,7 +284,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception in locCode " + e); System.out.println("Exception in getTranId ::::::::::: " + e);
e.printStackTrace(); e.printStackTrace();
throw new Exception(e); throw new Exception(e);
} }
...@@ -305,7 +305,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -305,7 +305,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
return colVal; return colVal;
} }
private String generateTranTd( String windowName, String tranDate, String siteCode, Connection conn )throws ITMException, SQLException private String generateTranTd( String windowName, String tranDate, String siteCode, Connection conn1 )throws ITMException, SQLException
{ {
System.out.println("inside generateTranTd@@........."); System.out.println("inside generateTranTd@@.........");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
...@@ -317,7 +317,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -317,7 +317,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
try try
{ {
sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? "; sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, windowName); pstmt.setString(1, windowName);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("keyString :"+sql); System.out.println("keyString :"+sql);
...@@ -331,7 +331,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -331,7 +331,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
else else
{ {
sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? "; sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, "GENERAL"); pstmt.setString(1, "GENERAL");
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("keyString :"+sql); System.out.println("keyString :"+sql);
...@@ -361,7 +361,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -361,7 +361,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
xmlValues = xmlValues + "</Detail1></Root>"; xmlValues = xmlValues + "</Detail1></Root>";
System.out.println("xmlValues :["+xmlValues+"]"); System.out.println("xmlValues :["+xmlValues+"]");
TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", commonConstants.DB_NAME); TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", commonConstants.DB_NAME);
tranId = tg.generateTranSeqID(tranSer1, keyCol, keyString, conn); tranId = tg.generateTranSeqID(tranSer1, keyCol, keyString, conn1);
System.out.println("tranId ::"+tranId); System.out.println("tranId ::"+tranId);
} }
...@@ -394,81 +394,13 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -394,81 +394,13 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
return tranId; return tranId;
} }
/* private void confirm( String tranId, String siteCode, Connection conn1 ) throws ITMException, SQLException
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;
}
*/
private void confirm( String tranId, String siteCode, Connection conn ) 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 = "";
double quantity = 0, holdQuantity = 0; double quantity = 0, holdQuantity = 0;
PreparedStatement pstmt = null, pstmt1 = null, pstmt2 = null, pstmt3 = null; PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null, rs1 = null, rs2 = null, rs3 = null; ResultSet rs = null, rs1 = null;
DistCommon distComm = new DistCommon(); DistCommon distComm = new DistCommon();
String nexpLoc = "", lockCode = "", expLoc = ""; String nexpLoc = "", lockCode = "", expLoc = "";
...@@ -478,13 +410,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -478,13 +410,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
System.out.println("::::::::::::::::: Inside confirm :::::::::::::::: "); System.out.println("::::::::::::::::: Inside confirm :::::::::::::::: ");
System.out.println("tranId :::::::::::::::: " + tranId); System.out.println("tranId :::::::::::::::: " + tranId);
System.out.println("siteCode :::::::::::::::: " + siteCode); System.out.println("siteCode :::::::::::::::: " + siteCode);
if(conn == null)
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
}
CommonWmsUtil commonWmsUtility = CommonWmsUtil.getInstance(); CommonWmsUtil commonWmsUtility = CommonWmsUtil.getInstance();
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
...@@ -494,7 +420,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -494,7 +420,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
System.out.println("tranDate ::::::::::::: " + tranDate); System.out.println("tranDate ::::::::::::: " + tranDate);
sql = "update pallet_hdr set confirmed = ?, conf_date = ? where tran_id = ? "; sql = "update pallet_hdr set confirmed = ?, conf_date = ? where tran_id = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, "Y"); pstmt.setString(1, "Y");
pstmt.setTimestamp(2, new Timestamp(System.currentTimeMillis())); pstmt.setTimestamp(2, new Timestamp(System.currentTimeMillis()));
pstmt.setString(3, tranId); pstmt.setString(3, tranId);
...@@ -505,14 +431,14 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -505,14 +431,14 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
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 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, "
+ "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 as INV_STAT, det.site_code as SITE_CODE, det.loc_code as LOC_CODE, hdr.tran_date as TRAN_DATE "
+ "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 = conn.prepareStatement(sql); pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
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 = conn.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"));
...@@ -533,14 +459,12 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -533,14 +459,12 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
{ {
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",conn); nexpLoc = distComm.getDisparams("999999","NEAR_EXP_LOCK",conn1);
expLoc = distComm.getDisparams("999999","EXP_LOCK",conn); expLoc = distComm.getDisparams("999999","EXP_LOCK",conn1);
System.out.println("nexpLoc :::::::::::::::::: " + nexpLoc);
System.out.println("expLoc :::::::::::::::::: " + expLoc);
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 = conn.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"));
...@@ -561,28 +485,23 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -561,28 +485,23 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
if(lockCode.equalsIgnoreCase(nexpLoc)) if(lockCode.equalsIgnoreCase(nexpLoc))
{ {
invStat = "N"; invStat = "N";
System.out.println("invStat in 1st if::::::::::::: " + invStat);
} }
else if(lockCode.equalsIgnoreCase(expLoc)) else if(lockCode.equalsIgnoreCase(expLoc))
{ {
invStat = "E"; invStat = "E";
System.out.println("invStat in 2nd if::::::::::::: " + invStat);
} }
else else
{ {
invStat = "H"; invStat = "H";
System.out.println("invStat in 3rd if::::::::::::: " + invStat);
} }
} }
else else
{ {
invStat = "A"; invStat = "A";
System.out.println("inside else :::::::::::::::::: ");
} }
System.out.println("invStat final ::::::::::::: " + invStat); System.out.println("invStat final ::::::::::::: " + invStat);
interfaceTranId = generateTranTd("w_interface2", tranDate, siteCode, conn); interfaceTranId = generateTranTd("w_interface2", tranDate, siteCode, conn1);
System.out.println("interface2TranId ::::::::::::: " + interfaceTranId); System.out.println("interface2TranId ::::::::::::: " + interfaceTranId);
HashMap hm = new HashMap(); HashMap hm = new HashMap();
...@@ -622,7 +541,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf ...@@ -622,7 +541,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
interfaceArrList.add(hm); interfaceArrList.add(hm);
} }
commonWmsUtility.updateAwmsInterface(interfaceArrList, conn); commonWmsUtility.updateAwmsInterface(interfaceArrList, conn1);
System.out.println("Inserted into interface2 table ::::::::::::: "); System.out.println("Inserted into interface2 table ::::::::::::: ");
pstmt.close(); pstmt.close();
......
...@@ -100,8 +100,7 @@ public class PalletizationConfIC extends ValidatorEJB implements PalletizationIC ...@@ -100,8 +100,7 @@ public class PalletizationConfIC extends ValidatorEJB implements PalletizationIC
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
try try
{ {
System.out.println("::::::::::::::::: Inside wfValData :::::::::::::::: ");
genericUtility = GenericUtility.getInstance(); genericUtility = GenericUtility.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()+"]");
...@@ -198,8 +197,6 @@ public class PalletizationConfIC extends ValidatorEJB implements PalletizationIC ...@@ -198,8 +197,6 @@ public class PalletizationConfIC extends ValidatorEJB implements PalletizationIC
return msgType; return msgType;
} }
/** /**
* The public method is defined without any parameters and returns blank string * The public method is defined without any parameters and returns blank string
*/ */
...@@ -228,6 +225,7 @@ public class PalletizationConfIC extends ValidatorEJB implements PalletizationIC ...@@ -228,6 +225,7 @@ public class PalletizationConfIC extends ValidatorEJB implements PalletizationIC
Document hdrDataDom = null; Document hdrDataDom = null;
Document allFormDataDom = null; Document allFormDataDom = null;
String errString = null; String errString = null;
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
System.out.println("xmlString ["+xmlString+"]"); System.out.println("xmlString ["+xmlString+"]");
System.out.println("xmlString1 ["+xmlString1+"]"); System.out.println("xmlString1 ["+xmlString1+"]");
...@@ -279,7 +277,6 @@ public class PalletizationConfIC extends ValidatorEJB implements PalletizationIC ...@@ -279,7 +277,6 @@ public class PalletizationConfIC extends ValidatorEJB implements PalletizationIC
int currentFormNo = 0; int currentFormNo = 0;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
try try
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
...@@ -325,7 +322,6 @@ public class PalletizationConfIC extends ValidatorEJB implements PalletizationIC ...@@ -325,7 +322,6 @@ public class PalletizationConfIC extends ValidatorEJB implements PalletizationIC
conn = null; conn = null;
} }
} }
} }
catch(Exception d) catch(Exception d)
{ {
......
...@@ -936,12 +936,24 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca ...@@ -936,12 +936,24 @@ 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 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 = ? "; */
sql = "select item_code, lot_no, lot_sl, (quantity - (alloc_qty + hold_qty)) as quantity from stock where loc_code in (?,?) "
+ "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.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);
pstmt.setString(3, loginSite); pstmt.setString(3, loginSite);
pstmt.setString(4, locationCode);
pstmt.setString(5, palletNo);
pstmt.setString(6, "N");
pstmt.setString(7, loginSite);
pstmt.setString(8, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if( tranId != null && tranId.trim().length() > 0 ) if( tranId != null && tranId.trim().length() > 0 )
......
...@@ -37,61 +37,82 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -37,61 +37,82 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
{ {
return ""; return "";
} }
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 = "", tranDate = "", objName = ""; String errString = "", sql = "", siteCode = "", interfaceTranId = "", objName = "", lineNo = "", locCode = "", palletNo = "",
PreparedStatement pstmt = null, pstmt1 = null, pstmt2 = null, pstmt3 = null; PalletNoSource = "", itemCode = "", lotNo = "", lotSl = "", quantity = "";
ResultSet rs = null, rs1 = null, rs2 = null, rs3 = null; PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null, rs1 = null;
double parseQuantity = 0;
HashMap strAllocate = new HashMap(); HashMap strAllocate = new HashMap();
Connection conn1 = null;
try try
{ {
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); conn1 = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false); conn1.setAutoCommit(false);
connDriver = null; connDriver = null;
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
Document dom = null;
dom = genericUtility.parseString(domString);
String dbDateFormat = genericUtility.getDBDateFormat();
String applDateFormat = genericUtility.getApplDateFormat();
java.util.Date currDate1 = new java.util.Date();
SimpleDateFormat sdf = new SimpleDateFormat(applDateFormat);
String currDateStr = sdf.format(currDate1);
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 ::::::::::::: " );
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);
Document dom = null; lineNo = checkNull(genericUtility.getColumnValue("line_no", dom, "3" ));
dom = genericUtility.parseString(domString);
String lineNo = checkNull(genericUtility.getColumnValue("line_no", dom, "3" ));
System.out.println("line no----------->>["+lineNo+"]");
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("tranId for post save ::::::::::::: " + tranId); siteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" ));
itemCode = checkNull(genericUtility.getColumnValue("item_code", dom, "3" ));
sql = "select site_code, item_code, loc_code, lot_no, lot_sl, quantity from pallet_det where tran_id = ? " locCode = checkNull(genericUtility.getColumnValue("loc_code", dom, "3" ));
+ "and line_no = ? "; lotNo = checkNull(genericUtility.getColumnValue("lot_no", dom, "3" ));
pstmt = conn.prepareStatement(sql); lotSl = checkNull(genericUtility.getColumnValue("lot_sl", dom, "3" ));
quantity = checkNull(genericUtility.getColumnValue("quantity", dom, "3" ));
parseQuantity = Double.parseDouble(quantity);
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+"]");
sql = "select * from INVALLOC_TRACE where ref_id = ? and ref_line = ? ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
pstmt.setString(2, lineNo); pstmt.setString(2, lineNo);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(!rs.next())
{ {
System.out.println("Inside while loop::::::::::: "); System.out.println("Inside if for post save palletization ::::::::: " );
//strAllocate.put("tran_date", new Timestamp(System.currentTimeMillis())); strAllocate.put("tran_date", tranDate);
strAllocate.put("ref_ser","PZ"); strAllocate.put("ref_ser","PZ");
strAllocate.put("ref_id", tranId); strAllocate.put("ref_id", tranId);
strAllocate.put("ref_line", lineNo); strAllocate.put("ref_line", lineNo);
strAllocate.put("site_code", checkNullAndTrim(rs.getString("site_code"))); strAllocate.put("site_code", siteCode);
strAllocate.put("item_code", checkNullAndTrim(rs.getString("item_code"))); strAllocate.put("item_code", itemCode);
strAllocate.put("loc_code",checkNullAndTrim(rs.getString("loc_code"))); strAllocate.put("loc_code", locCode);
strAllocate.put("lot_no", checkNullAndTrim(rs.getString("lot_no"))); strAllocate.put("lot_no", lotNo);
strAllocate.put("lot_sl", checkNullAndTrim(rs.getString("lot_sl"))); strAllocate.put("lot_sl", lotSl);
strAllocate.put("alloc_qty", rs.getDouble("quantity")) ; strAllocate.put("alloc_qty", parseQuantity) ;
strAllocate.put("chg_user", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode")); strAllocate.put("chg_user", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
strAllocate.put("chg_term", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId")); strAllocate.put("chg_term", GenericUtility.getInstance().getValueFromXTRA_PARAMS(xtraParams,"termId"));
strAllocate.put("chg_win", "W_PALLETIZATION"); strAllocate.put("chg_win", "W_PALLETIZATION");
errString = invAllocTrace.updateInvallocTrace(strAllocate, conn); errString = invAllocTrace.updateInvallocTrace(strAllocate, conn1);
System.out.println("errString ::: " + errString); System.out.println("errString ::: " + errString);
if (errString != null && errString.trim().length() > 0 ) if (errString != null && errString.trim().length() > 0 )
...@@ -101,7 +122,9 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -101,7 +122,9 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
strAllocate = null; strAllocate = null;
System.out.println("Allocated the quantity in stock::::::::::: "); System.out.println("Allocated the quantity in stock::::::::::: ");
} }
} if(pstmt1 != null){pstmt1.close();pstmt1 = null;}
if(rs1 != null){rs1.close();rs1 = null;}
}
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -131,10 +154,20 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -131,10 +154,20 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (conn != null) if( rs1 != null )
{
rs1.close();
rs1 = null;
}
if( pstmt1 != null )
{
pstmt1.close();
pstmt1 = null;
}
if (conn1 != null)
{ {
conn.close(); conn1.close();
conn = null; conn1 = null;
} }
} }
catch(Exception e) catch(Exception e)
...@@ -168,7 +201,7 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -168,7 +201,7 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
return inputVal; return inputVal;
} }
private String generateTranTd( String windowName, String tranDate, String siteCode, Connection conn )throws ITMException private String generateTranTd( String windowName, String tranDate, String siteCode, Connection conn1 )throws ITMException
{ {
System.out.println("inside generateTranTd@@........."); System.out.println("inside generateTranTd@@.........");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
...@@ -180,7 +213,7 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -180,7 +213,7 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
try try
{ {
sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? "; sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, windowName); pstmt.setString(1, windowName);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("keyString :"+sql); System.out.println("keyString :"+sql);
...@@ -194,7 +227,7 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -194,7 +227,7 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
else else
{ {
sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? "; sql = "SELECT KEY_STRING, TRAN_ID_COL, REF_SER FROM TRANSETUP WHERE TRAN_WINDOW = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, "GENERAL"); pstmt.setString(1, "GENERAL");
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println("keyString :"+sql); System.out.println("keyString :"+sql);
...@@ -224,7 +257,7 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -224,7 +257,7 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo
xmlValues = xmlValues + "</Detail1></Root>"; xmlValues = xmlValues + "</Detail1></Root>";
System.out.println("xmlValues :["+xmlValues+"]"); System.out.println("xmlValues :["+xmlValues+"]");
TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", commonConstants.DB_NAME); TransIDGenerator tg = new TransIDGenerator(xmlValues, "BASE", commonConstants.DB_NAME);
tranId = tg.generateTranSeqID(tranSer1, keyCol, keyString, conn); tranId = tg.generateTranSeqID(tranSer1, keyCol, keyString, conn1);
System.out.println("tranId ::"+tranId); System.out.println("tranId ::"+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