Commit c8110f0c authored by spawar's avatar spawar

W15HSUN013 Updated source for integrate with AWMS interface.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99360 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b7b8ad28
......@@ -152,11 +152,17 @@ public class NearExpirySchedule implements Schedule
ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB();
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
//Changed By Samadhan on 20/11/2015 for transfer and lock both Start
//Changed By Samadhan on 20/11/2015 for transfer and lock both and AWMS interface Start
String nearExpLock = ""; //NEAR_EXP_LOCK
String expLock = ""; //EXP_LOCK
String lockSites = "";
//Changed By Samadhan on 20/11/2015 for transfer and lock both End
String invStat = "";
ArrayList<HashMap<String, String>> expPalletSiteList = new ArrayList<HashMap<String, String>>();
ArrayList<HashMap<String, String>> neExpPalletSiteList = new ArrayList<HashMap<String, String>>();
ArrayList<HashMap<String, String>> expireStockList = new ArrayList<HashMap<String,String>>();
ArrayList<HashMap<String, String>> nearExpStockList = new ArrayList<HashMap<String,String>>();
String projectName = "";
//Changed By Samadhan on 20/11/2015 for transfer and lock both AWMS interface End
try
{
ConnDriver connDriver = new ConnDriver();
......@@ -210,6 +216,7 @@ public class NearExpirySchedule implements Schedule
nearExpLock = distComm.getDisparams("999999","NEAR_EXP_LOCK",conn);
expLock = distComm.getDisparams("999999","EXP_LOCK",conn);
}
projectName = distComm.getDisparams("999999","PROJECT",conn);
//Changed By Samadhan on 20/11/2015 for transfer and lock both End
//Changed by sumit sarkar on 21/06/12 insert CHECK_PHYSCAN_VALUE function in sql start.
......@@ -333,7 +340,8 @@ public class NearExpirySchedule implements Schedule
noArt = rsStock.getDouble("NO_ART");
acctCodeInv = rsStock.getString("ACCT_CODE__INV");
cctrCodeInv = rsStock.getString("CCTR_CODE__INV");
//Changed By Samadhan on 03/12/2015 for AWMS interface full and partial
invStat = rsStock.getString("INV_STAT");
/*if ( currDate.compareTo(expDateStock) >= 0 )//Check for Expired stock
{
count++;
......@@ -530,6 +538,27 @@ public class NearExpirySchedule implements Schedule
}
}
//Changed By Samadhan on 20/11/2015 for transfer and lock both End
//Changed By Samadhan on 03/12/2015 for AWMS interface full and partial Start
if("AWMS".equals(projectName.trim()))
{
if( ("B".equalsIgnoreCase(lockORTransfer.trim()) && lockSites.indexOf(siteCode) != -1 )|| "L".equalsIgnoreCase(lockORTransfer.trim()) )//For Both)
{
if("AWMS".equalsIgnoreCase(checkNullAndTrim(invStat))||"AWMSQ".equalsIgnoreCase(checkNullAndTrim(invStat)))
{
HashMap<String, String> expStockLMap = new HashMap<String, String>();
expStockLMap.put("PALLET_NO", checkNullAndTrim(locCode));
expStockLMap.put("SITE_CODE", checkNullAndTrim(siteCode));
expStockLMap.put("LOT_SL", checkNullAndTrim(lotSl));
expStockLMap.put("LOT_NO", checkNullAndTrim(lotNo));
expStockLMap.put("ITEM_CODE", checkNullAndTrim(itemCode));
expireStockList.add(expStockLMap);
}
}
}
//Changed By Samadhan on 03/12/2015 for AWMS interface full and partial End
}
if ( rsStock != null)
{
......@@ -618,7 +647,8 @@ public class NearExpirySchedule implements Schedule
noArt = rsStock.getDouble("NO_ART");
acctCodeInv = rsStock.getString("ACCT_CODE__INV");
cctrCodeInv = rsStock.getString("CCTR_CODE__INV");
//Changed By Samadhan on 03/12/2015 for AWMS interface full and partial
invStat = rsStock.getString("INV_STAT");
sql1 = "select item_ser from item where item_code = ? ";
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, itemCode);
......@@ -694,6 +724,26 @@ public class NearExpirySchedule implements Schedule
}
System.out.println("stockNexpList **********************"+stockNexpList);
//Changed By Samadhan on 20/11/2015 for transfer and lock both End
//Changed By Samadhan on 03/12/2015 for AWMS interface full and partial Start
if("AWMS".equals(projectName.trim()))
{
if( ("B".equalsIgnoreCase(lockORTransfer.trim()) && lockSites.indexOf(siteCode) != -1 )|| "L".equalsIgnoreCase(lockORTransfer.trim()) )//For Both)
{
if("AWMS".equalsIgnoreCase(checkNullAndTrim(invStat))||"AWMSQ".equalsIgnoreCase(checkNullAndTrim(invStat)))
{
HashMap<String, String> neExpStockLMap = new HashMap<String, String>();
neExpStockLMap.put("PALLET_NO", checkNullAndTrim(locCode));
neExpStockLMap.put("SITE_CODE", checkNullAndTrim(siteCode));
neExpStockLMap.put("LOT_SL", checkNullAndTrim(lotSl));
neExpStockLMap.put("LOT_NO", checkNullAndTrim(lotNo));
neExpStockLMap.put("ITEM_CODE", checkNullAndTrim(itemCode));
nearExpStockList.add(neExpStockLMap);
}
}
}
//Changed By Samadhan on 03/12/2015 for AWMS interface full and partial End
}
if ( rsStock != null)
{
......@@ -878,6 +928,16 @@ public class NearExpirySchedule implements Schedule
//For Lock End
}
//Changed By Samadhan on 20/11/2015 for transfer and lock both End
//Changed By Samadhan on 03/12/2015 for AWMS interface full and partial Start
if("AWMS".equals(projectName.trim()))
{
if ( !isError )
{
insLockStockToAwms(expireStockList,"EXPIRED",conn);
insLockStockToAwms(nearExpStockList,"NEAREXPIRY",conn);
}
}
//Changed By Samadhan on 03/12/2015 for AWMS interface full and partial End
}
}
catch(SQLException se)
......@@ -2441,4 +2501,197 @@ private String checkNull(String input)
}
//Changed by sumit on 02/10/12 modified code as per process end
//Changed By Samadhan on 03/12/2015 for AWMS interface full and partial Start
private void insLockStockToAwms(ArrayList<HashMap<String, String>> expNeExpStockList, String lockStat,Connection conn) throws ITMException, SQLException
{
String sqlStr ="";
PreparedStatement pstmt = null;
ResultSet rs = null;
String siteCode = "",itemCode="",lotNo="",lotSl="",palletNo = "";
String qtyPerArt = "",itemDescr="",unit="",itemType="",mfgDate="",expiryDate="",quantity="",noArt="",refId="";
String palletStatus = "";
String lineNo = "";
Timestamp today = new Timestamp(System.currentTimeMillis());
CommonWmsUtil connUtil = new CommonWmsUtil();
ArrayList awmsIntrArrList = new ArrayList();
try
{
System.out.println("Expired Near Expired Lock List:"+expNeExpStockList);
for(Iterator<HashMap<String, String>> expNeExpStockIter = expNeExpStockList.iterator();expNeExpStockIter.hasNext();)
{
HashMap<String, String> expNeExpStockMap = expNeExpStockIter.next();
palletNo = expNeExpStockMap.get("PALLET_NO");
siteCode = expNeExpStockMap.get("SITE_CODE");
itemCode = expNeExpStockMap.get("ITEM_CODE");
lotNo = expNeExpStockMap.get("LOT_NO");
lotSl = expNeExpStockMap.get("LOT_SL");
sqlStr= "SELECT S.QTY_PER_ART,I.DESCR ,S.UNIT,I.ITEM_TYPE ,S.MFG_DATE,S.EXP_DATE,S.QUANTITY, " +
"S.NO_ART,D.LINE_NO,D.TRAN_ID " +
"FROM STOCK S, ITEM I, INV_HOLD H, INV_HOLD_DET D WHERE S.SITE_CODE=? AND S.LOC_CODE = ? " +
"AND S.ITEM_CODE= ? AND S.LOT_NO= ? " +
"AND S.LOT_SL= ? AND S.ITEM_CODE = I.ITEM_CODE " +
"AND H.TRAN_ID= D.TRAN_ID AND D.LOT_NO = S.LOT_NO AND D.LOT_SL=S.LOT_SL AND D.HOLD_STATUS='H' " +
"AND D.LOC_CODE=S.LOC_CODE AND D.SITE_CODE = S.SITE_CODE AND D.ITEM_CODE = S.ITEM_CODE ";
pstmt = conn.prepareStatement(sqlStr);
pstmt.setString(1, siteCode);
pstmt.setString(2, palletNo);
pstmt.setString(3, itemCode);
pstmt.setString(4, lotNo);
pstmt.setString(5, lotSl);
rs = pstmt.executeQuery();
if(rs.next())
{
qtyPerArt = checkNullAndTrim(rs.getString("QTY_PER_ART"));
itemDescr= checkNullAndTrim(rs.getString("DESCR"));
unit = checkNullAndTrim(rs.getString("UNIT"));
itemType = checkNullAndTrim(rs.getString("ITEM_TYPE"));
mfgDate = checkNullAndTrim(rs.getString("MFG_DATE"));
expiryDate = checkNullAndTrim(rs.getString("EXP_DATE"));
quantity = checkNullAndTrim(rs.getString("QUANTITY"));
noArt = checkNullAndTrim(rs.getString("NO_ART"));
refId = checkNullAndTrim(rs.getString("TRAN_ID"));
lineNo = checkNullAndTrim(rs.getString("LINE_NO"));
palletStatus=getPalletStatus(palletNo, siteCode, expNeExpStockList, conn);
System.out.println("palletStatus for AWMS :"+palletStatus);
rs = pstmt.executeQuery();
//lineNo++;
HashMap awmsMap = new HashMap();
awmsMap.put("ITEM_CODE", itemCode);
awmsMap.put("REF_ID", refId);
awmsMap.put("REF_SER", "XFRX");
awmsMap.put("TRAN_DATE", checkNullAndTrim(String.valueOf(today)));
awmsMap.put("QTY_PER_ART", qtyPerArt);
awmsMap.put("LOT_NO", lotNo);
awmsMap.put("LOT_SL", lotSl);
awmsMap.put("QUANTITY", noArt);
awmsMap.put("TOTAL_QTY", quantity);
awmsMap.put("PALLET_NO", palletNo);
awmsMap.put("LINE_NO", lineNo);
awmsMap.put("DESCR", itemDescr);
awmsMap.put("UNIT", unit);
awmsMap.put("ITEM_TYPE", itemType);
awmsMap.put("FAMILY_GRP", "");
awmsMap.put("TRAN_ID", "");
awmsMap.put("IN_OUT", "S");
awmsMap.put("EXP_DATE", expiryDate);
awmsMap.put("MFG_DATE", mfgDate);
awmsMap.put("PALLET_STATUS", palletStatus);
awmsMap.put("MSG_STAT", "N");
awmsMap.put("LOCK_STAT", lockStat);
awmsMap.put("ERR_COD", "");
awmsMap.put("ERR_DESC", "");
awmsMap.put("QC_TYPE", "");
awmsMap.put("TRANS_DT_ACK","");
awmsMap.put("STRO_PREF", "");
awmsIntrArrList.add(awmsMap);
System.out.println("AWMS HashMap:"+awmsMap);
}
pstmt.close();
rs.close();
}
System.out.println("AWMS Interface List:"+awmsIntrArrList);
connUtil.updateAwmsInterface(awmsIntrArrList, siteCode, conn);
} catch (SQLException e)
{
e.printStackTrace();
throw e;
}
}
private String getPalletStatus(String palletNo,String siteCode,ArrayList<HashMap<String, String>> expNeExpStockList,Connection conn) throws SQLException
{
String sqlStr = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
ArrayList<HashMap<String, String>> stockList = new ArrayList<HashMap<String,String>>();
String palletStatus = "F";
System.out.println("Inside getPalletStatus...........");
try
{
sqlStr = "SELECT LOC_CODE,ITEM_CODE,LOT_NO,LOT_SL,SITE_CODE FROM STOCK WHERE QUANTITY > 0 " +
"AND LOC_CODE = ? AND SITE_CODE = ? AND INV_STAT in ('AWMS','AWMSQ') ";
pstmt = conn.prepareStatement(sqlStr);
pstmt.setString(1, palletNo);
pstmt.setString(2, siteCode);
rs = pstmt.executeQuery();
while(rs.next())
{
HashMap<String,String> stockHashMap = new HashMap<String, String>();
stockHashMap.put("PALLET_NO", checkNullAndTrim(rs.getString("LOC_CODE")));
stockHashMap.put("SITE_CODE", checkNullAndTrim(rs.getString("SITE_CODE")));
stockHashMap.put("LOT_SL", checkNullAndTrim(rs.getString("LOT_SL")));
stockHashMap.put("LOT_NO", checkNullAndTrim(rs.getString("LOT_NO")));
stockHashMap.put("ITEM_CODE", checkNullAndTrim(rs.getString("ITEM_CODE")));
stockList.add(stockHashMap);
}
System.out.println("AWMS Stock List:"+stockList);
for(Iterator<HashMap<String, String>> iter = stockList.iterator();iter.hasNext();)
{
System.out.println("Checking...........");
HashMap<String, String> stock = iter.next();
if(!expNeExpStockList.contains(stock))
{
palletStatus = "P";
break;
}
}
} catch (SQLException e)
{
e.printStackTrace();
throw e;
}
return palletStatus;
}
private String getPalletStatusNew(ArrayList<HashMap<String, String>>stockList ,ArrayList<HashMap<String, String>> expNeExpStockList,Connection conn)
{
String sqlStr = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
String palletStatus = "F";
try
{
for(Iterator<HashMap<String, String>> iter = stockList.iterator();iter.hasNext();)
{
HashMap<String, String> stock = iter.next();
if(!expNeExpStockList.contains(stock))
{
palletStatus = "P";
break;
}
}
} catch (Exception e)
{
e.printStackTrace();
}
return palletStatus;
}
private String checkNullAndTrim(String str)
{
if(str == null)
{
str = "";
}
return str.trim();
}
//Changed By Samadhan on 03/12/2015 for AWMS interface full and partial Start
}
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