Commit b7d122e5 authored by wansari's avatar wansari

W15JSUN015 updated source for counting from swms_to_awms to check weather schedular is runn today


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@100067 ce508802-f39f-4f6c-b175-0d175dae99d5
parent bb4eadf3
......@@ -336,15 +336,16 @@ public class StatusChangeRequest implements Schedule {
public String StockCountActivty(String loginSiteCode) throws RemoteException,ITMException
{
Connection conn = null;
ResultSet rs = null,rsPhyscan = null;
PreparedStatement pstmt = null, pstmtPhyscan = null;
ResultSet rs = null,rsPhyscan = null,rsInterface = null;
PreparedStatement pstmt = null, pstmtPhyscan = null,pstmtInterface = null;
boolean isError = false;
String lineNo = "",itemDescr = "",itemCode = "",unit = "",itemType = "",familyGrp = "",
lotNo = "",lotSl = "",palletNo = "",palletStatus = "",lockStat = "",qcType = "",stroPref = "",analysisClass = "",
errString = "",sql = "",sqlPhyScan = "",tranId = "",invStat = "";
errString = "",sql = "",sqlPhyScan = "",tranId = "",invStat = "",sqlInterface = "";
double quantity = 0, noArtQuot = 0,noArtRem = 0,notArt = 0,totalQuantity = 0, qtyPerArt = 0;
int count = 0;
Timestamp today = new Timestamp(System.currentTimeMillis());
Timestamp expDate = null;
......@@ -364,107 +365,127 @@ public class StatusChangeRequest implements Schedule {
invStat = "'"+invStat+"'";
System.out.println("AWMS INVSTAT for Physical count: "+invStat);
sql = " SELECT TRAN_ID FROM PHYSCAN WHERE SITE_CODE = ? AND TRAN_DATE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSiteCode);
pstmt.setTimestamp(2, getCurrtDate());
rs = pstmt.executeQuery();
while(rs.next())
sqlInterface = " SELECT COUNT(1) FROM SWMS_TO_AWMS WHERE IN_OUT = ? AND TRAN_DATE = ?";
pstmtInterface = conn.prepareStatement(sqlInterface);
pstmtInterface.setString(1, "B");
pstmtInterface.setTimestamp(2, getCurrtDate());
rsInterface = pstmtInterface.executeQuery();
if(rsInterface.next())
{
tranId = checkNullAndTrim(rs.getString("TRAN_ID"));
System.out.println("Physical Scan Tran Id["+tranId+"]");
if(tranId != null && tranId.length() > 0)
count = rsInterface.getInt(1);
}
rsInterface.close();rsInterface = null;
pstmtInterface.close();pstmtInterface = null;
System.out.println("Count from swms_to_amws for in_out B="+count);
if(count == 0)
{
sql = " SELECT TRAN_ID FROM PHYSCAN WHERE SITE_CODE = ? AND TRAN_DATE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginSiteCode);
pstmt.setTimestamp(2, getCurrtDate());
rs = pstmt.executeQuery();
while(rs.next())
{
/*sqlPhyScan = " SELECT D.LINE_NO,S.ITEM_CODE,I.DESCR,I.UNIT,I.ITEM_TYPE,S.LOT_NO,S.LOT_SL,S.LOC_CODE,P.SITE_CODE,S.QUANTITY,S.NO_ART,S.QTY_PER_ART "
+" FROM PHYSCAN P,PHYSCANDET D,STOCK S,ITEM I"
+" WHERE P.TRAN_ID = D.TRAN_ID AND P.TRAN_ID = ?"
+" AND S.ITEM_CODE = D.ITEM_CODE"
+" AND I.ITEM_CODE = S.ITEM_CODE"
+" AND S.LOT_NO = D.LOT_NO"
+" AND S.LOT_SL = D.LOT_SL"
+" AND S.SITE_CODE = D.SITE_CODE"
+" AND S.LOC_CODE = D.LOC_CODE";*/
tranId = checkNullAndTrim(rs.getString("TRAN_ID"));
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 L.LOC_CODE = D.LOC_CODE AND L.INV_STAT IN ("+invStat+")";
System.out.println("Physical Scan Tran Id["+tranId+"]");
pstmtPhyscan = conn.prepareStatement(sqlPhyScan);
pstmtPhyscan.setString(1, tranId);
pstmtPhyscan.setString(2, tranId);
rsPhyscan = pstmtPhyscan.executeQuery();
while(rsPhyscan.next())
if(tranId != null && tranId.length() > 0)
{
lineNo = checkNullAndTrim(rsPhyscan.getString("LINE_NO"));
itemCode = checkNullAndTrim(rsPhyscan.getString("ITEM_CODE"));
//itemDescr = checkNullAndTrim(rs.getString("DESCR"));
//unit = checkNullAndTrim(rs.getString("UNIT"));
//itemType = checkNullAndTrim(rs.getString("ITEM_TYPE"));
lotNo = checkNullAndTrim(rsPhyscan.getString("LOT_NO"));
lotSl = checkNullAndTrim(rsPhyscan.getString("LOT_SL"));
palletNo = checkNullAndTrim(rsPhyscan.getString("LOC_CODE"));
//quantity = rs.getDouble("QUANTITY");
//notArt = rs.getDouble("NO_ART");
//qtyPerArt = rs.getDouble("QTY_PER_ART");
//analysisClass = checkNullAndTrim(rs.getString("ANALYSIS_CLASS"));
/*sqlPhyScan = " SELECT D.LINE_NO,S.ITEM_CODE,I.DESCR,I.UNIT,I.ITEM_TYPE,S.LOT_NO,S.LOT_SL,S.LOC_CODE,P.SITE_CODE,S.QUANTITY,S.NO_ART,S.QTY_PER_ART "
+" FROM PHYSCAN P,PHYSCANDET D,STOCK S,ITEM I"
+" WHERE P.TRAN_ID = D.TRAN_ID AND P.TRAN_ID = ?"
+" AND S.ITEM_CODE = D.ITEM_CODE"
+" AND I.ITEM_CODE = S.ITEM_CODE"
+" AND S.LOT_NO = D.LOT_NO"
+" AND S.LOT_SL = D.LOT_SL"
+" AND S.SITE_CODE = D.SITE_CODE"
+" AND S.LOC_CODE = D.LOC_CODE";*/
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.substring(0,palletNo.trim().length()-1):palletNo;
System.out.println("Pallet No After removing suffix: "+palletNo);
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 L.LOC_CODE = D.LOC_CODE AND L.INV_STAT IN ("+invStat+")";
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(today)));
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);
pstmtPhyscan = conn.prepareStatement(sqlPhyScan);
pstmtPhyscan.setString(1, tranId);
pstmtPhyscan.setString(2, tranId);
rsPhyscan = pstmtPhyscan.executeQuery();
while(rsPhyscan.next())
{
lineNo = checkNullAndTrim(rsPhyscan.getString("LINE_NO"));
itemCode = checkNullAndTrim(rsPhyscan.getString("ITEM_CODE"));
//itemDescr = checkNullAndTrim(rs.getString("DESCR"));
//unit = checkNullAndTrim(rs.getString("UNIT"));
//itemType = checkNullAndTrim(rs.getString("ITEM_TYPE"));
lotNo = checkNullAndTrim(rsPhyscan.getString("LOT_NO"));
lotSl = checkNullAndTrim(rsPhyscan.getString("LOT_SL"));
palletNo = checkNullAndTrim(rsPhyscan.getString("LOC_CODE"));
//quantity = rs.getDouble("QUANTITY");
//notArt = rs.getDouble("NO_ART");
//qtyPerArt = rs.getDouble("QTY_PER_ART");
//analysisClass = checkNullAndTrim(rs.getString("ANALYSIS_CLASS"));
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.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);
}
pstmtPhyscan.close();pstmtPhyscan = null;
rsPhyscan.close();rsPhyscan = null;
}
pstmtPhyscan.close();pstmtPhyscan = null;
rsPhyscan.close();rsPhyscan = null;
}
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println("Going to insert in host_to_wms and swms_to_awms");
System.out.println("ArrayList size="+interfaceArrList.size());
if(interfaceArrList.size() > 0)
{
commonWmsUtility.updateAwmsInterface(interfaceArrList,loginSiteCode,conn);
}
}
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println("Going to insert in host_to_wms and swms_to_awms");
System.out.println("ArrayList size="+interfaceArrList.size());
if(interfaceArrList.size() > 0)
{
commonWmsUtility.updateAwmsInterface(interfaceArrList,loginSiteCode,conn);
}
else
{
System.out.println("***************Stock Count Activty is already already runn today************");
}
}
catch(Exception e)
{
......@@ -493,6 +514,8 @@ public class StatusChangeRequest implements Schedule {
if(rs != null){rs.close();rs=null;}
if(pstmtPhyscan != null){pstmtPhyscan.close();pstmtPhyscan=null;}
if(rsPhyscan != null){rsPhyscan.close();rsPhyscan=null;}
if(pstmtInterface != null){pstmtInterface.close();pstmtInterface=null;}
if(rsInterface != null){rsInterface.close();rsInterface=null;}
}
catch(Exception se)
{
......
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