Commit 668299e7 authored by jshinde's avatar jshinde

request id:W16CSUN009


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103676 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2c500ab6
......@@ -64,7 +64,7 @@ public class StatusChangeRequest implements Schedule {
public String statusChange(String siteCode , String scheduleParamXML, String xtraParams) throws ITMException
{
String invStat="", sqlVariable="", qtyPerArt = "",unit="",mfgDate="",expiryDate="",quantity="",noArt="",refId="", lineNo="",
palletStatus="", palletNo="", locCode="", lotSl="", lotNo="", itemCode="", lockStat="", lockCode="" ;
palletStatus="", palletNo="", locCode="", lotSl="", lotNo="", itemCode="", lockStat="", lockCode="" ;
String damageLocations="", holdLocations="",rejectedLoc="";//Added by Jagruti Shinde
......@@ -76,6 +76,10 @@ public class StatusChangeRequest implements Schedule {
//Changed by Jagruti Shinde Request id:[W16CSUN009]
ArrayList<String> rejectedLocArryList = new ArrayList<String>();
//Added by Jagruti Shinde on 13/OCT/16 Req id:[W16CSUN009]
ArrayList<HashMap<String, String>> holdStockList = new ArrayList<HashMap<String,String>>();
ArrayList<HashMap<String, String>> holdStockListNew = new ArrayList<HashMap<String,String>>();
String sqlStr ="",sqlInvHold ="",tranId="",sqlCount ="",sqlGen= "",shDescr ="";
Connection conn = null;
PreparedStatement pstmt = null,pstmtHold = null ,pstmtCount = null ,pstmtGen =null;
......@@ -154,9 +158,9 @@ public class StatusChangeRequest implements Schedule {
}*/
sqlInvHold = " SELECT H.TRAN_ID,D.LOC_CODE,D.ITEM_CODE,D.LOT_NO,D.LOT_SL,H.LOCK_CODE ,D.LINE_NO FROM STOCK S, INV_HOLD H, INV_HOLD_DET D WHERE S.SITE_CODE = ? AND " +
" S.INV_STAT IN ("+invStat+") AND H.LOCK_CODE IN ("+sqlVariable+") " +
" AND H.TRAN_ID= D.TRAN_ID AND D.LOT_NO = S.LOT_NO AND D.LOT_SL=S.LOT_SL " +
" AND D.ITEM_CODE = S.ITEM_CODE AND D.LOC_CODE =S.LOC_CODE AND D.HOLD_STATUS='H' AND S.HOLD_QTY > 0 ";
" S.INV_STAT IN ("+invStat+") AND H.LOCK_CODE IN ("+sqlVariable+") " +
" AND H.TRAN_ID= D.TRAN_ID AND D.LOT_NO = S.LOT_NO AND D.LOT_SL=S.LOT_SL " +
" AND D.ITEM_CODE = S.ITEM_CODE AND D.LOC_CODE =S.LOC_CODE AND D.HOLD_STATUS='H' AND S.HOLD_QTY > 0 ";
pstmtHold = conn.prepareStatement(sqlInvHold);
pstmtHold.setString(1, siteCode);
......@@ -194,19 +198,19 @@ public class StatusChangeRequest implements Schedule {
System.out.println("Reference Series from gencodes["+shDescr+"]");
sqlCount = " SELECT COUNT(1) FROM SWMS_TO_AWMS WHERE IN_OUT = ? AND REF_SER = ? AND REF_ID = ?" +
" AND ITEM_CODE = ? AND LOT_NO = ? AND LOT_SL = ? AND TRIM(PALLET_NO) = (SUBSTR(TRIM( ? ),0,LENGTH(TRIM( ? ))-1 ) ) OR TRIM(PALLET_NO) = ? " +
" AND LINE_NO = ? ";
sqlCount = " SELECT COUNT(1) FROM SWMS_TO_AWMS WHERE IN_OUT = ? AND REF_SER = ? AND REF_ID = ? " +
" AND (TRIM(PALLET_NO) = (SUBSTR(TRIM( ? ),0,LENGTH(TRIM( ? ))-1 ) ) OR TRIM(PALLET_NO) = ? )" +
" AND ITEM_CODE = ? AND LOT_NO = ? AND LOT_SL = ? AND LINE_NO = ? ";
pstmtCount = conn.prepareStatement(sqlCount);
pstmtCount.setString(1, "S");
pstmtCount.setString(2, shDescr);
pstmtCount.setString(3, tranId);
pstmtCount.setString(4, itemCode);
pstmtCount.setString(5, lotNo);
pstmtCount.setString(6, lotSl);
pstmtCount.setString(7, locCode);
pstmtCount.setString(8, locCode);
pstmtCount.setString(9, locCode);
pstmtCount.setString(4, locCode);
pstmtCount.setString(5, locCode);
pstmtCount.setString(6, locCode);
pstmtCount.setString(7, itemCode);
pstmtCount.setString(8, lotNo);
pstmtCount.setString(9, lotSl);
pstmtCount.setString(10, lineNo);
rsCount = pstmtCount.executeQuery();
......@@ -234,12 +238,13 @@ public class StatusChangeRequest implements Schedule {
+ "AND H.TRAN_ID= D.TRAN_ID AND D.LOT_NO = S.LOT_NO AND D.LOT_SL=S.LOT_SL AND D.ITEM_CODE = S.ITEM_CODE AND D.LOC_CODE =S.LOC_CODE "
+ "AND D.HOLD_STATUS='H' AND S.HOLD_QTY > 0 AND FN_CHECK_SWMS_TO_AWMS(H.TRAN_ID,'"+refSerSwms+"','S')=0";*/
//Changed by Jagruti Shinde Request id:[W16CSUN009] on 13/OCT/16 [Start]
sqlStr = "SELECT S.QTY_PER_ART,S.UNIT,S.MFG_DATE,S.EXP_DATE,S.QUANTITY,S.NO_ART,S.LOC_CODE,S.LOT_SL,S.LOT_NO,S.ITEM_CODE,D.LINE_NO,"
+ "D.TRAN_ID,H.LOCK_CODE "
+ "FROM STOCK S, INV_HOLD H, INV_HOLD_DET D WHERE S.SITE_CODE = ? AND S.INV_STAT IN ("+invStat+") AND H.LOCK_CODE IN("+sqlVariable+") "
+ "AND H.TRAN_ID= D.TRAN_ID AND D.LOT_NO = S.LOT_NO AND D.LOT_SL=S.LOT_SL AND D.ITEM_CODE = S.ITEM_CODE AND D.LOC_CODE =S.LOC_CODE "
+ "AND D.HOLD_STATUS='H' AND S.HOLD_QTY > 0 AND D.TRAN_ID = ? ";
//Changed by Jagruti Shinde Request id:[W16CSUN009][End]
+ "D.TRAN_ID,H.LOCK_CODE "
+ "FROM STOCK S, INV_HOLD H, INV_HOLD_DET D WHERE S.SITE_CODE = ? AND S.INV_STAT IN ("+invStat+") AND H.LOCK_CODE IN("+sqlVariable+") "
+ "AND H.TRAN_ID= D.TRAN_ID AND D.LOT_NO = S.LOT_NO AND D.LOT_SL=S.LOT_SL AND D.ITEM_CODE = S.ITEM_CODE AND D.LOC_CODE =S.LOC_CODE "
+ "AND D.HOLD_STATUS='H' AND S.HOLD_QTY > 0 AND D.TRAN_ID = ? ";
pstmt = conn.prepareStatement(sqlStr);
pstmt.setString(1, siteCode);
......@@ -263,8 +268,6 @@ public class StatusChangeRequest implements Schedule {
refId = rs.getString("TRAN_ID");
lockCode = rs.getString("LOCK_CODE");
ArrayList<HashMap<String, String>> holdStockList = new ArrayList<HashMap<String,String>>();
HashMap<String, String> damageHoldStockLMap = new HashMap<String, String>();
damageHoldStockLMap.put("PALLET_NO", locCode);
......@@ -275,9 +278,54 @@ public class StatusChangeRequest implements Schedule {
damageHoldStockLMap.put("LOCK_CODE", lockCode);
holdStockList.add(damageHoldStockLMap);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
holdStockListNew.addAll(holdStockList);
System.out.println("holdStockListNew::::"+holdStockListNew);
//palletStatus = getPalletStatus(palletNo, siteCode, holdStockList,lockCode,conn);
palletStatus = getPalletStatus(palletNo, siteCode, holdStockListNew,lockCode,conn);
System.out.println("palletStatus for AWMS :"+palletStatus);
//Changed by Jagruti Shinde Request id:[W16CSUN009] on 13/OCT/16 [End]
sqlStr = "SELECT S.QTY_PER_ART,S.UNIT,S.MFG_DATE,S.EXP_DATE,S.QUANTITY,S.NO_ART,S.LOC_CODE,S.LOT_SL,S.LOT_NO,S.ITEM_CODE,D.LINE_NO,"
+ "D.TRAN_ID,H.LOCK_CODE "
+ "FROM STOCK S, INV_HOLD H, INV_HOLD_DET D WHERE S.SITE_CODE = ? AND S.INV_STAT IN ("+invStat+") AND H.LOCK_CODE IN("+sqlVariable+") "
+ "AND H.TRAN_ID= D.TRAN_ID AND D.LOT_NO = S.LOT_NO AND D.LOT_SL=S.LOT_SL AND D.ITEM_CODE = S.ITEM_CODE AND D.LOC_CODE =S.LOC_CODE "
+ "AND D.HOLD_STATUS='H' AND S.HOLD_QTY > 0 AND D.TRAN_ID = ? ";
pstmt = conn.prepareStatement(sqlStr);
pstmt.setString(1, siteCode);
pstmt.setString(2, tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
qtyPerArt = checkNullAndTrim(rs.getString("QTY_PER_ART"));
unit = rs.getString("UNIT");
mfgDate = checkNullAndTrim(rs.getString("MFG_DATE"));
expiryDate = checkNullAndTrim(rs.getString("EXP_DATE"));
quantity = rs.getString("QUANTITY");
noArt = checkNullAndTrim(rs.getString("NO_ART"));
locCode = rs.getString("LOC_CODE");
palletNo = checkNullAndTrim(rs.getString("LOC_CODE"));
lotSl = rs.getString("LOT_SL");
lotNo = rs.getString("LOT_NO");
itemCode = rs.getString("ITEM_CODE");
lineNo = checkNullAndTrim(rs.getString("LINE_NO"));
refId = rs.getString("TRAN_ID");
lockCode = rs.getString("LOCK_CODE");
palletStatus = getPalletStatus(palletNo, siteCode, holdStockList,lockCode,conn);
System.out.println("palletStatus for AWMS :"+palletStatus);
//Changed by wasim on 23-01-2016 to consider other suffix locations aprt from Q [START]
......@@ -285,63 +333,73 @@ public class StatusChangeRequest implements Schedule {
System.out.println("Pallet No After removing Q: "+palletNo);*/
palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') ||
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
(palletNo.charAt(palletNo.trim().length()-1)=='P') || (palletNo.charAt(palletNo.trim().length()-1)=='R') //Changed by wasim on 02-05-2016 to consider rejected location with suffix R
? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo);
//Changed by wasim on 23-01-2016 to consider other suffix locations aprt from Q [END]
HashMap<String, String> awmsMap = new HashMap<String, String>();
awmsMap.put("ITEM_CODE", itemCode);
awmsMap.put("REF_ID", refId);
//Changed by Jagruti Shinde Request id:[W16CSUN009]
//awmsMap.put("REF_SER", refSerSwms);
awmsMap.put("REF_SER", shDescr);
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("UNIT", unit);
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");
if(damageLocArryKList.contains(lockCode.trim())){
lockStat = "DAMAGE";
}
else if(holdLocArryKList.contains(lockCode.trim())){
lockStat = "HOLD";
}
//Changed by Jagruti Shinde Request id:[W16CSUN009][start]
else if(rejectedLocArryList.contains(lockCode.trim())){
lockStat = "REJ";
}
//Changed by Jagruti Shinde Request id:[W16CSUN009][End]
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);
if(awmsIntrArrList.size() > 0)
{
connUtil.updateAwmsInterface(awmsIntrArrList, siteCode, conn);
awmsIntrArrList.clear();
System.out.println("Record insert sucessfully::");
}
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
(palletNo.charAt(palletNo.trim().length()-1)=='P') || (palletNo.charAt(palletNo.trim().length()-1)=='R') //Changed by wasim on 02-05-2016 to consider rejected location with suffix R
? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo);
//Changed by wasim on 23-01-2016 to consider other suffix locations aprt from Q [END]
HashMap<String, String> awmsMap = new HashMap<String, String>();
awmsMap.put("ITEM_CODE", itemCode);
awmsMap.put("REF_ID", refId);
//Changed by Jagruti Shinde Request id:[W16CSUN009]
//awmsMap.put("REF_SER", refSerSwms);
awmsMap.put("REF_SER", shDescr);
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("UNIT", unit);
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");
if(damageLocArryKList.contains(lockCode.trim())){
lockStat = "DAMAGE";
}
else if(holdLocArryKList.contains(lockCode.trim())){
lockStat = "HOLD";
}
//Changed by Jagruti Shinde Request id:[W16CSUN009][start]
else if(rejectedLocArryList.contains(lockCode.trim())){
lockStat = "REJ";
}
//Changed by Jagruti Shinde Request id:[W16CSUN009][End]
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);
if(awmsIntrArrList.size() > 0)
{
connUtil.updateAwmsInterface(awmsIntrArrList, siteCode, conn);
awmsIntrArrList.clear();
System.out.println("Record insert sucessfully::");
}
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
System.out.println("AWMS Interface List:"+awmsIntrArrList);
}
......@@ -431,11 +489,15 @@ public class StatusChangeRequest implements Schedule {
private String getPalletStatus(String palletNo,String siteCode,ArrayList<HashMap<String, String>> damageStockList, String lockCode, Connection conn) throws SQLException
{
String invStat="", sqlStr = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
String invStat="", sqlStr = "" ,sqlStockQty ="" ,sqlHold = "";
PreparedStatement pstmt = null ,pstmtStock = null;
ResultSet rs = null,rsStock =null;
ArrayList<HashMap<String, String>> stockList = new ArrayList<HashMap<String,String>>();
String palletStatus = "F";
String lotSl="",lotNo="",itemCode="";//Added by Jagruti Shinde on 13/OCT/16 Req id:[W16CSUN009]
double quantity,holdQty;//Added by Jagruti Shinde on 13/OCT/16 Req id:[W16CSUN009]
int count =0,cntLoc =0;//Added by Jagruti Shinde on 13/OCT/16 Req id:[W16CSUN009]
DistCommon distComm = new DistCommon();
......@@ -449,7 +511,7 @@ public class StatusChangeRequest implements Schedule {
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 ("+invStat+")";
+"AND LOC_CODE = ? AND SITE_CODE = ? AND INV_STAT IN ("+invStat+")";
pstmt = conn.prepareStatement(sqlStr);
pstmt.setString(1, palletNo);
......@@ -469,15 +531,167 @@ public class StatusChangeRequest implements Schedule {
stockList.add(stockHashMap);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
System.out.println("AWMS Stock List:"+stockList);
ArrayList <HashMap<String, String>>tempList=new ArrayList<HashMap <String, String>>();
for(Iterator<HashMap<String, String>> iter = stockList.iterator();iter.hasNext();)
{
System.out.println("Checking...........");
HashMap<String, String> stock = iter.next();
System.out.println("stock before check::::::"+stock);
if(!damageStockList.contains(stock))
{
palletStatus = "P";
break;
//Changed by Jagruti Shinde on 13/OCT/16 Req id:[W16CSUN009][Start]
//palletStatus = "P";
//break;
tempList.add(stock);
System.out.println("tempList after removing damagelist::::: ["+tempList+"]");
}
}//END FOR
System.out.println("@V@ TempList size() :- ["+tempList.size()+"]");
if(tempList.size()>0)
{
Iterator<HashMap<String, String>> tempIterator=tempList.iterator();
while(tempIterator.hasNext())
{
HashMap<String, String> tempMap=new HashMap<String, String>();
tempMap=tempIterator.next();
System.out.println("@V@ tempMap size in while loop :- ["+tempMap.size()+"]");
palletNo=tempMap.get("PALLET_NO");
siteCode=tempMap.get("SITE_CODE");
lotSl=tempMap.get("LOT_SL");
lotNo=tempMap.get("LOT_NO");
itemCode=tempMap.get("ITEM_CODE");
lockCode=tempMap.get("LOCK_CODE");
System.out.println("@V@ PALLET_NO :- ["+palletNo+"]");
System.out.println("@V@ SITE_CODE :- ["+siteCode+"]");
System.out.println("@V@ LOT_SL :- ["+lotSl+"]");
System.out.println("@V@ LOT_NO :- ["+lotNo+"]");
System.out.println("@V@ ITEM_CODE :- ["+itemCode+"]");
System.out.println("@V@ LOCK_CODE :- ["+lockCode+"]");
sqlStockQty="SELECT QUANTITY,HOLD_QTY FROM STOCK WHERE LOC_CODE = ? AND SITE_CODE = ? AND LOT_SL = ? AND LOT_NO = ? AND ITEM_CODE = ? ";
pstmtStock = conn.prepareStatement(sqlStockQty);
pstmtStock.setString(1, palletNo);
pstmtStock.setString(2, siteCode);
pstmtStock.setString(3, lotSl);
pstmtStock.setString(4, lotNo);
pstmtStock.setString(5, itemCode);
rsStock = pstmtStock.executeQuery();
while(rsStock.next())
{
quantity = rsStock.getDouble("QUANTITY");
holdQty = rsStock.getDouble("HOLD_QTY");
if(quantity > 0 && holdQty > 0 && quantity == holdQty)
{
count++;
System.out.println("count::::"+count);
}
else if(holdQty ==0)
{
palletStatus = "P";
System.out.println("Pallet is partial:hold_qty is 0::::::");
}
}
if(pstmtStock != null)
{
pstmtStock.close();
pstmtStock = null;
}
if(rsStock != null)
{
rsStock.close();
rsStock = null;
}
}// FIRST ITERATOR
Iterator<HashMap<String, String>> secondIterator=tempList.iterator();
while(secondIterator.hasNext())
{
System.out.println("@v@ AT SECOND ITERATOR $$$$$$$$");
HashMap<String, String> tempMap=new HashMap<String, String>();
tempMap=secondIterator.next();
System.out.println("@V@ tempMap size in second iterator:- ["+tempMap.size()+"]");
palletNo=tempMap.get("PALLET_NO");
siteCode=tempMap.get("SITE_CODE");
lotSl=tempMap.get("LOT_SL");
lotNo=tempMap.get("LOT_NO");
itemCode=tempMap.get("ITEM_CODE");
lockCode=tempMap.get("LOCK_CODE");
System.out.println("tempList.size():::::::"+tempList.size()+"count:::::"+count);
if(tempList.size() > count)
{
palletStatus = "P";
System.out.println("Pallet is Partial:tempList.size() > count::::::");
}
else if(tempList.size() == count)
{
sqlHold ="SELECT COUNT(1) FROM INV_HOLD I,INV_HOLD_DET D WHERE I.TRAN_ID = D.TRAN_ID AND D.LOC_CODE = ? AND D.ITEM_CODE = ?" +
" AND D.SITE_CODE = ? AND D.LOT_NO = ? AND D.LOT_SL = ? AND I.LOCK_CODE = ? ";
pstmt = conn.prepareStatement(sqlHold);
pstmt.setString(1,palletNo);
pstmt.setString(2, itemCode);
pstmt.setString(3, siteCode);
pstmt.setString(4, lotNo);
pstmt.setString(5, lotSl);
pstmt.setString(6, lockCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cntLoc = rs.getInt(1);
System.out.println( "cntLoc:::"+cntLoc);
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(cntLoc > 0)
{
if(cntLoc == count)
{
System.out.println("count::::"+count);
palletStatus = "F";
System.out.println("Pallet is full:same lock is applied for remaining stock items::::::");
}
else
{
palletStatus = "P";
System.out.println("Pallet is partial::same lock is not applied for remaining stock items::::::");
}
}
else
{
palletStatus = "P";
System.out.println("Pallet is partial::lock is not applied to remaining items:::::");
}
}
//Changed by Jagruti Shinde on 13/OCT/16s Req id:[W16CSUN009][End]
}
}
} catch (SQLException e)
......@@ -506,8 +720,8 @@ public class StatusChangeRequest implements Schedule {
boolean isError = false;
String lineNo = "",itemDescr = "",itemCode = "",unit = "",itemType = "",familyGrp = "",
lotNo = "",lotSl = "",palletNo = "",palletStatus = "",lockStat = "",qcType = "",stroPref = "",analysisClass = "",
errString = "",sql = "",sqlPhyScan = "",tranId = "",invStat = "",sqlInterface = "";
lotNo = "",lotSl = "",palletNo = "",palletStatus = "",lockStat = "",qcType = "",stroPref = "",analysisClass = "",
errString = "",sql = "",sqlPhyScan = "",tranId = "",invStat = "",sqlInterface = "";
double quantity = 0, noArtQuot = 0,noArtRem = 0,notArt = 0,totalQuantity = 0, qtyPerArt = 0;
int count = 0;
......@@ -561,7 +775,7 @@ public class StatusChangeRequest implements Schedule {
//Changed by wasim on 25-04-2016 to not to consider tran_id which is requeted from metis [START]
//sql = " SELECT TRAN_ID FROM PHYSCAN WHERE SITE_CODE = ? AND TRAN_DATE = ?";
sql = "SELECT P.TRAN_ID FROM PHYSCAN P WHERE P.SITE_CODE = ? AND P.TRAN_DATE = ? "
+ "AND P.TRAN_ID NOT IN (SELECT REF_ID FROM SWMS_TO_AWMS WHERE REF_ID = P.TRAN_ID AND REF_SER = 'PSCAN')";
+ "AND P.TRAN_ID NOT IN (SELECT REF_ID FROM SWMS_TO_AWMS WHERE REF_ID = P.TRAN_ID AND REF_SER = 'PSCAN')";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSiteCode);
pstmt.setTimestamp(2, getCurrtDate());
......@@ -586,9 +800,9 @@ public class StatusChangeRequest implements Schedule {
+" AND S.LOC_CODE = D.LOC_CODE";*/
sqlPhyScan = " SELECT D.LINE_NO,D.ITEM_CODE,D.LOT_NO,D.LOT_SL,D.LOC_CODE,D.QUANTITY"
+" FROM PHYSCAN P,PHYSCANDET D,LOCATION L WHERE P.TRAN_ID = D.TRAN_ID AND P.TRAN_ID = ?"
+" AND P.TRAN_ID NOT IN (SELECT REF_ID FROM SWMS_TO_AWMS WHERE REF_ID = ? AND REF_SER = 'PSCAN')"
+" AND L.LOC_CODE = D.LOC_CODE AND L.INV_STAT IN ("+invStat+")";
+" FROM PHYSCAN P,PHYSCANDET D,LOCATION L WHERE P.TRAN_ID = D.TRAN_ID AND P.TRAN_ID = ?"
+" AND P.TRAN_ID NOT IN (SELECT REF_ID FROM SWMS_TO_AWMS WHERE REF_ID = ? AND REF_SER = 'PSCAN')"
+" AND L.LOC_CODE = D.LOC_CODE AND L.INV_STAT IN ("+invStat+")";
pstmtPhyscan = conn.prepareStatement(sqlPhyScan);
pstmtPhyscan.setString(1, tranId);
......@@ -612,43 +826,43 @@ public class StatusChangeRequest implements Schedule {
System.out.println("Pallet No before removing suffix: "+palletNo);
palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') ||
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
(palletNo.charAt(palletNo.trim().length()-1)=='P') || (palletNo.charAt(palletNo.trim().length()-1)=='R')//Changed by wasim on 02-05-016 to consider R location for considering damage location
? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo);
HashMap<String,String> interfaceHmap = new HashMap<String,String>();
interfaceHmap.put("TRAN_ID", "");
interfaceHmap.put("ITEM_CODE", itemCode);
interfaceHmap.put("DESCR", "");
interfaceHmap.put("UNIT", "");
interfaceHmap.put("ITEM_TYPE", "");
interfaceHmap.put("FAMILY_GRP", "");
interfaceHmap.put("IN_OUT", "B");
interfaceHmap.put("REF_SER", "PSCAN");
interfaceHmap.put("REF_ID", tranId);
interfaceHmap.put("TRAN_DATE", checkNullAndTrim(String.valueOf(getCurrtDate())));
interfaceHmap.put("LOT_NO", lotNo);
interfaceHmap.put("LOT_SL", lotSl);
interfaceHmap.put("QUANTITY", "");
interfaceHmap.put("QTY_PER_ART", "");
interfaceHmap.put("TOTAL_QTY", "");
interfaceHmap.put("EXP_DATE", "");
interfaceHmap.put("MFG_DATE", "");
interfaceHmap.put("PALLET_NO", palletNo);
interfaceHmap.put("MSG_STAT", "N");
interfaceHmap.put("PALLET_STATUS", "");
interfaceHmap.put("LOCK_STAT", "");
interfaceHmap.put("ERR_COD", "");
interfaceHmap.put("ERR_DESC", "");
interfaceHmap.put("QC_TYPE", "");
interfaceHmap.put("TRANS_DT_ACK", "");
interfaceHmap.put("STRO_PREF", "");
interfaceHmap.put("LINE_NO", lineNo);
interfaceArrList.add(interfaceHmap);
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
(palletNo.charAt(palletNo.trim().length()-1)=='P') || (palletNo.charAt(palletNo.trim().length()-1)=='R')//Changed by wasim on 02-05-016 to consider R location for considering damage location
? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo);
HashMap<String,String> interfaceHmap = new HashMap<String,String>();
interfaceHmap.put("TRAN_ID", "");
interfaceHmap.put("ITEM_CODE", itemCode);
interfaceHmap.put("DESCR", "");
interfaceHmap.put("UNIT", "");
interfaceHmap.put("ITEM_TYPE", "");
interfaceHmap.put("FAMILY_GRP", "");
interfaceHmap.put("IN_OUT", "B");
interfaceHmap.put("REF_SER", "PSCAN");
interfaceHmap.put("REF_ID", tranId);
interfaceHmap.put("TRAN_DATE", checkNullAndTrim(String.valueOf(getCurrtDate())));
interfaceHmap.put("LOT_NO", lotNo);
interfaceHmap.put("LOT_SL", lotSl);
interfaceHmap.put("QUANTITY", "");
interfaceHmap.put("QTY_PER_ART", "");
interfaceHmap.put("TOTAL_QTY", "");
interfaceHmap.put("EXP_DATE", "");
interfaceHmap.put("MFG_DATE", "");
interfaceHmap.put("PALLET_NO", palletNo);
interfaceHmap.put("MSG_STAT", "N");
interfaceHmap.put("PALLET_STATUS", "");
interfaceHmap.put("LOCK_STAT", "");
interfaceHmap.put("ERR_COD", "");
interfaceHmap.put("ERR_DESC", "");
interfaceHmap.put("QC_TYPE", "");
interfaceHmap.put("TRANS_DT_ACK", "");
interfaceHmap.put("STRO_PREF", "");
interfaceHmap.put("LINE_NO", lineNo);
interfaceArrList.add(interfaceHmap);
}
if(rsPhyscan != null)
{
......@@ -798,7 +1012,7 @@ public class StatusChangeRequest implements Schedule {
conn.setAutoCommit(false);*/
sql = "SELECT REF_ID,LINE_NO,TOTAL_QTY,QUANTITY FROM WMS_TO_HOST WHERE IN_OUT = 'B' AND REF_ID IN "
+ "(SELECT REF_ID FROM SWMS_TO_AWMS WHERE SCHEDULE_STATUS = 'N')";
+ "(SELECT REF_ID FROM SWMS_TO_AWMS WHERE SCHEDULE_STATUS = 'N')";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
......@@ -812,7 +1026,7 @@ public class StatusChangeRequest implements Schedule {
System.out.println("REF_ID["+refId+"]LINE_NO["+lineNo+"]QUANTITY["+phyInput+"]TOTAL_QTY["+qtyPhysical+"]TRANS_DT_ACK["+tranDateAck+"]");
sqlPhyscan = " SELECT D.ITEM_CODE,D.LOT_NO,D.LOT_SL,D.LOC_CODE,D.SITE_CODE FROM PHYSCAN P,PHYSCANDET D WHERE "
+ " P.TRAN_ID = D.TRAN_ID AND D.TRAN_ID = ? AND D.LINE_NO = ?";
+ " P.TRAN_ID = D.TRAN_ID AND D.TRAN_ID = ? AND D.LINE_NO = ?";
pstmtPhyscan = conn.prepareStatement(sqlPhyscan);
pstmtPhyscan.setString(1, refId);
pstmtPhyscan.setString(2, lineNo);
......
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