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
...@@ -100,7 +100,6 @@ public class PalletizationConfIC extends ValidatorEJB implements PalletizationIC ...@@ -100,7 +100,6 @@ 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+"]");
...@@ -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 (?,?) "
+ "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 (?,?) " 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 = ? 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" ));
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);
sql = "select site_code, item_code, loc_code, lot_no, lot_sl, quantity from pallet_det where tran_id = ? " System.out.println("lineNo----------->>["+lineNo+"]");
+ "and line_no = ? "; System.out.println("siteCode----------->>["+siteCode+"]");
pstmt = conn.prepareStatement(sql); 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,6 +122,8 @@ public class PalletizationPos extends ValidatorEJB implements PalletizationPosLo ...@@ -101,6 +122,8 @@ 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