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
......@@ -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;
......@@ -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]
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);
palletStatus = getPalletStatus(palletNo, siteCode, holdStockList,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");
//Changed by wasim on 23-01-2016 to consider other suffix locations aprt from Q [START]
......@@ -343,6 +391,16 @@ public class StatusChangeRequest implements Schedule {
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();
......@@ -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))
{
//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";
break;
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)
......
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