Commit e8c5855b authored by jshinde's avatar jshinde

Request Id:W15JSUN001,Updating Storage Preference at Awms should be parameterized.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99837 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9ea82c61
/**
* PURPOSE : PalletizationConf component
* AUTHOR : Sneha Mestry
* DATE : 12-10-2015
*/
* PURPOSE : PalletizationConf component
* AUTHOR : Sneha Mestry
* DATE : 12-10-2015
*/
package ibase.webitm.ejb.wms;
......@@ -44,18 +44,19 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
Node parentNode = null;
Node childNode = null;
Connection conn1 = null;
String errString = "", siteCode = "", palletNo = "", sql = "", objName = "", childNodeName = "", userId = "", errorType = "", errCode = "",
tranIdDB = "";
tranIdDB = "";
int ctr = 0, childNodeListLength = 0, cnt = 0, tranIdScanCount = 0, tranIdCount = 0;
boolean isError = false;
ArrayList <String> errList = new ArrayList<String>();
ArrayList <String> errFields = new ArrayList <String> ();
DistCommon distComm = new DistCommon();
PreparedStatement pstmt = null;
ResultSet rs = null;
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
try
{
......@@ -67,35 +68,35 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
conn1.setAutoCommit(false);
connDriver = null;
Document dom = null;
dom = genericUtility.parseString(domString);
Document dom = null;
dom = genericUtility.parseString(domString);
siteCode = checkNull(genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginSiteCode" ));
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
palletNo = checkNull(genericUtility.getColumnValue("pallet_no", dom, "3" ));
objName = getObjNameFromDom( dom, "objName", "1" );
System.out.println("domString ::::::::::::: " + domString);
System.out.println("xtraParams ::::::::::::: " + xtraParams);
System.out.println("tranId----------->>["+tranId+"]");
System.out.println("siteCode ::::::::::::: " + siteCode);
System.out.println("userId ::::::::::::: " + userId);
System.out.println("palletNo ::::::::::::: " + palletNo);
System.out.println("objName ::::::::::::: " + objName);
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
System.out.println("childNodeListLength----------->>["+childNodeListLength+"]");
if("palletization".equalsIgnoreCase(objName))
{
if( tranId == null || tranId.trim().length() <= 0) // Add mode
{
System.out.println("tranId inside add mode ----------->>");
sql = "select tran_id from pallet_hdr where confirmed = ? and site_code = ? and pallet_no = ? ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, "N");
......@@ -107,10 +108,10 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
tranIdDB = checkNullAndTrim(rs.getString("tran_id"));
}
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
if(rs != null){rs.close();rs = null;}
System.out.println("tranIdDB----------->>["+tranIdDB+"]");
tranIdScanCount = getTranIdScanDet(tranIdDB, siteCode, conn1);
if(tranIdScanCount <= 0)
{
......@@ -124,7 +125,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
System.out.println("Calling confirm for palletization confirm menu :::::::::::::::::::: ");
confirm(tranIdDB, siteCode, conn1);
}
}
else // edit mode
{
......@@ -152,13 +153,13 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName ------->>["+childNodeName+"]");
if("tran_id".equalsIgnoreCase(childNodeName))
{
tranIdScanCount = getTranIdScanDet(tranId, siteCode, conn1);
tranIdCount = getTranId(tranId, siteCode, conn1);
if(tranId.length() <= 0)
{
System.out.println("Tran Id found blank :::::::::: ");
......@@ -188,8 +189,8 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
}
}
}
int errListSize = errList.size();
cnt =0;
String errFldName = null;
......@@ -231,7 +232,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
{
return getError(tranId, "VTTRANCONF", conn1);
}
}
errString = errStringXml.toString();
}
......@@ -278,7 +279,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
}
return errString;
}
private String checkNull( String input )
{
if ( input == null )
......@@ -287,7 +288,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
}
return input.trim();
}
private String checkNullAndTrim( String inputVal )
{
if ( inputVal == null )
......@@ -300,7 +301,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
}
return inputVal;
}
public String errorType( Connection conn , String errorCode )
{
String msgType = "";
......@@ -343,7 +344,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
}
return msgType;
}
public int getTranId(String tranId, String siteCode, Connection conn1) throws Exception
{
PreparedStatement pstmt = null ;
......@@ -385,7 +386,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
System.out.println("Return List from getTranId ------>>" + count);
return count;
}
public int getTranIdScanDet(String tranId, String siteCode, Connection conn1) throws Exception
{
PreparedStatement pstmt = null ;
......@@ -429,29 +430,37 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
return count;
}
public void confirm( String tranId, String siteCode, Connection conn1 ) throws ITMException, SQLException
public void confirm( String tranId, String siteCode, Connection conn1 ) throws Exception
{
String sql = "", tranDate = "", invStat = "", qcType = "",
expDate = "", mfgDate = "", palletStatus = "", qcReqd = "", procMth = "", lineNoInterface = "", familyGrp = "", stroPref = "";
expDate = "", mfgDate = "", palletStatus = "", qcReqd = "", procMth = "", lineNoInterface = "", familyGrp = "",
stroPref = "",stroPrefF="",stroPrefM="",stroPrefS="",stroPrefR="";
double holdQuantity = 0, quantityDB = 0, packSize = 0, interfaceQty = 0, interfaceQtyRem = 0, totQuantity = 0, qtyPerArt = 0, noArt = 0;
PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null, rs1 = null;
boolean isError = false;
DistCommon distComm = new DistCommon();
ResultSet rs = null, rs1 = null;
boolean isError = false;
DistCommon distComm = new DistCommon();
String nexpLoc = "", lockCode = "", expLoc = "";
ArrayList interfaceArrList = new ArrayList();
ConnDriver connDriver = new ConnDriver();
conn1 = connDriver.getConnectDB("DriverITM");
int interfaceQty1 = 0;
//Changed By Jagruti Shinde on 4/1/2016 Request Id:W15JSUN001[Start]
stroPrefF = distComm.getDisparams("999999", "AWMS_FAST_MOVING", conn1);
stroPrefM = distComm.getDisparams("999999", "AWMS_MEDIUM_MOVING", conn1);
stroPrefS = distComm.getDisparams("999999", "AWMS_SLOW_MOVING", conn1);
//Changed By Jagruti Shinde on 4/1/2016 Request Id:W15JSUN001[End]
try
{
{
System.out.println("::::::::::::::::: Inside confirm for palletization confirm :::::::::::::::: ");
System.out.println("tranId :::::::::::::::: " + tranId);
System.out.println("siteCode :::::::::::::::: " + siteCode);
CommonWmsUtil commonWmsUtility = CommonWmsUtil.getInstance();
GenericUtility genericUtility = GenericUtility.getInstance();
Date today = new Timestamp(System.currentTimeMillis());
sql = "update pallet_hdr set confirmed = ?, conf_date = ? where tran_id = ? ";
pstmt = conn1.prepareStatement(sql);
pstmt.setString(1, "Y");
......@@ -471,8 +480,8 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
while(rs.next())
{
System.out.println("qc_sample_type ::::::::::::: " + checkNullAndTrim(rs.getString("qc_sample_type")));
sql = "select hold_qty, qty_per_art, no_art from stock where quantity > 0 and site_code = ? and loc_code = ? and "
+ "item_code = ? and lot_no = ? and lot_sl = ? ";
pstmt1 = conn1.prepareStatement(sql);
......@@ -489,9 +498,9 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
noArt = rs1.getDouble("no_art");
}
if(pstmt1 != null){ pstmt1.close(); pstmt1 = null; }
if(rs1 != null){ rs1.close(); rs1 = null; }
System.out.println("holdQuantity ::::::::::::: " + holdQuantity);
if(rs1 != null){ rs1.close(); rs1 = null; }
System.out.println("holdQuantity ::::::::::::: " + holdQuantity);
System.out.println("qtyPerArt ::::::::::::: " + qtyPerArt);
System.out.println("noArt ::::::::::::: " + noArt);
// InvStat
......@@ -500,7 +509,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
//System.out.println("inside hold quantity greater than zero :::::::::::::::::: ");
nexpLoc = distComm.getDisparams("999999","NEAR_EXP_LOCK",conn1);
expLoc = distComm.getDisparams("999999","EXP_LOCK",conn1);
sql = "select i.lock_code from inv_hold i, inv_hold_det d where i.tran_id = d.tran_id and i.site_code = d.site_code and "
+ "d.item_code = ? and d.site_code = ? and d.loc_code = ? and d.lot_no = ? and d.lot_sl = ? and d.hold_status = ? ";
pstmt1 = conn1.prepareStatement(sql);
......@@ -516,9 +525,9 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
lockCode = checkNullAndTrim(rs1.getString("lock_code"));
}
if(pstmt1 != null){ pstmt1.close(); pstmt1 = null; }
if(rs1 != null){ rs1.close(); rs1 = null; }
System.out.println("lockCode ::::::::::::: " + lockCode);
if(rs1 != null){ rs1.close(); rs1 = null; }
System.out.println("lockCode ::::::::::::: " + lockCode);
if(lockCode.equalsIgnoreCase(nexpLoc))
{
invStat = "N";
......@@ -543,17 +552,17 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
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;
......@@ -563,10 +572,10 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
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);
......@@ -582,8 +591,8 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
mfgDate = rs1.getString("mfg_date");
}
if(pstmt1 != null){ pstmt1.close(); pstmt1 = null; }
if(rs1 != null){ rs1.close(); rs1 = null; }
if(rs1 != null){ rs1.close(); rs1 = null; }
/*//Pallet Status
if(interfaceQtyRem == 0)
{
......@@ -607,15 +616,34 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
}
if(pstmt1 != null){ pstmt1.close(); pstmt1 = null; }
if(rs1 != null){ rs1.close(); rs1 = null; } */
HashMap hm2 = new HashMap();
hm2 = commonWmsUtility.getPalletizedAttributes(rs.getString("item_code"), siteCode, conn1);
procMth = (String) hm2.get("PROC_MTH");
familyGrp = (String) hm2.get("LOC_ZONE__PREF");
stroPref = (String) hm2.get("ANALYSIS_CLASS");
procMth = (String) hm2.get("PROC_MTH");
familyGrp = (String) hm2.get("LOC_ZONE__PREF");
stroPref = (String) hm2.get("ANALYSIS_CLASS");
//Changed By Jagruti Shinde on 4/1/2016 Request Id:W15JSUN001[Start]
if(stroPref.equalsIgnoreCase(stroPrefF))
{
System.out.println("stroPrefF :"+stroPrefF);
stroPrefR = "F";
}
else if(stroPref.equalsIgnoreCase(stroPrefM))
{
System.out.println("stroPrefM :"+stroPrefM);
stroPrefR = "M";
}
else if(stroPref.equalsIgnoreCase(stroPrefS))
{
System.out.println("stroPrefS :"+stroPrefS);
stroPrefR = "S";
}
System.out.println("stroPref value inserted in AWMS :"+stroPrefR);
// Changed By Jagruti Shinde on 4/1/2016 Request Id:W15JSUN001[End]
/*
/*
if("".equalsIgnoreCase(procMth) && procMth.length() <= 0)
{
qcType = "N";
......@@ -631,13 +659,13 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
System.out.println("qcReqd ::::::::::::: " + qcReqd);
System.out.println("procMth ::::::::::::: " + procMth);
System.out.println("qcType ::::::::::::: " + qcType);
*/
/* lineNoInterface = " " + rs.getString("line_no");
*/
/* lineNoInterface = " " + rs.getString("line_no");
lineNoInterface = lineNoInterface.substring( lineNoInterface.length()-3 );*/
lineNoInterface = checkNullAndTrim(rs.getString("line_no"));
lineNoInterface = checkNullAndTrim(rs.getString("line_no"));
HashMap hm = new HashMap();
hm.put("TRAN_ID", "");
hm.put("ITEM_CODE", checkNullAndTrim(rs.getString("item_code")));
......@@ -662,7 +690,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
hm.put("QUANTITY", checkNullAndTrim((String.valueOf(interfaceQty))));
hm.put("QTY_PER_ART", checkNullAndTrim((String.valueOf(packSize))));
hm.put("TOTAL_QTY", checkNullAndTrim((String.valueOf(totQuantity))));
*/
*/
hm.put("EXP_DATE", checkNullAndTrim(expDate));
hm.put("MFG_DATE", checkNullAndTrim(mfgDate));
hm.put("PALLET_NO", checkNullAndTrim(rs.getString("pallet_no")));
......@@ -674,19 +702,23 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
hm.put("QC_TYPE", checkNullAndTrim(rs.getString("qc_sample_type")));
hm.put("TRANS_DT_ACK", "");
//hm.put("STRO_PREF", "");
hm.put("STRO_PREF", stroPref);
//Changed by Jagruti Shinde on 4/1/2016 Request Id:W15JSUN001[Start]
//hm.put("STRO_PREF", stroPref);
hm.put("STRO_PREF", stroPrefR);
//Changed by Jagruti Shinde on 4/1/2016 Request Id:W15JSUN001[End]
hm.put("LINE_NO", lineNoInterface);
interfaceArrList.add(hm);
}
commonWmsUtility.updateAwmsInterface(interfaceArrList, siteCode, conn1);
System.out.println("Inserted into interface2 table ::::::::::::: ");
if(pstmt != null){ pstmt.close(); pstmt = null; }
if(rs != null){ rs.close(); rs = null; }
}
if(rs != null){ rs.close(); rs = null; }
}
catch (SQLException ex)
{
isError = true;
......@@ -723,10 +755,10 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
pstmt.close();
pstmt = null;
}
}
}
public String getError(String tranId, String Code, Connection conn) throws ITMException, Exception
{
String mainStr ="";
......@@ -749,7 +781,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
}
return mainStr;
}
private String getObjNameFromDom( Document dom, String attribute, String objContext ) throws RemoteException,ITMException
{
NodeList detailList = null;
......
-----------------------------------------------------DISPARM-----------------------------------------------------------------
insert into disparm (prd_code,var_name,var_type,var_value,descr,var_subs,
chg_date,chg_user,chg_term)
values ('999999','AWMS_FAST_MOVING','S','M','AWMS FAST MOVING',0,SYSDATE,'BASE','BASE');
insert into disparm (prd_code,var_name,var_type,var_value,descr,var_subs,
chg_date,chg_user,chg_term)
values ('999999','AWMS_MEDIUM_MOVING','S','Q','AWMS MEDIUM MOVING',0,SYSDATE,'BASE','BASE');
insert into disparm (prd_code,var_name,var_type,var_value,descr,var_subs,
chg_date,chg_user,chg_term)
values ('999999','AWMS_SLOW_MOVING','S','H','AWMS SLOW MOVING',0,sysdate,'BASE','BASE');
\ No newline at end of file
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