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 { ...@@ -336,15 +336,16 @@ public class StatusChangeRequest implements Schedule {
public String StockCountActivty(String loginSiteCode) throws RemoteException,ITMException public String StockCountActivty(String loginSiteCode) throws RemoteException,ITMException
{ {
Connection conn = null; Connection conn = null;
ResultSet rs = null,rsPhyscan = null; ResultSet rs = null,rsPhyscan = null,rsInterface = null;
PreparedStatement pstmt = null, pstmtPhyscan = null; PreparedStatement pstmt = null, pstmtPhyscan = null,pstmtInterface = null;
boolean isError = false; boolean isError = false;
String lineNo = "",itemDescr = "",itemCode = "",unit = "",itemType = "",familyGrp = "", String lineNo = "",itemDescr = "",itemCode = "",unit = "",itemType = "",familyGrp = "",
lotNo = "",lotSl = "",palletNo = "",palletStatus = "",lockStat = "",qcType = "",stroPref = "",analysisClass = "", 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; double quantity = 0, noArtQuot = 0,noArtRem = 0,notArt = 0,totalQuantity = 0, qtyPerArt = 0;
int count = 0;
Timestamp today = new Timestamp(System.currentTimeMillis()); Timestamp today = new Timestamp(System.currentTimeMillis());
Timestamp expDate = null; Timestamp expDate = null;
...@@ -364,107 +365,127 @@ public class StatusChangeRequest implements Schedule { ...@@ -364,107 +365,127 @@ public class StatusChangeRequest implements Schedule {
invStat = "'"+invStat+"'"; invStat = "'"+invStat+"'";
System.out.println("AWMS INVSTAT for Physical count: "+invStat); System.out.println("AWMS INVSTAT for Physical count: "+invStat);
sql = " SELECT TRAN_ID FROM PHYSCAN WHERE SITE_CODE = ? AND TRAN_DATE = ?"; sqlInterface = " SELECT COUNT(1) FROM SWMS_TO_AWMS WHERE IN_OUT = ? AND TRAN_DATE = ?";
pstmt = conn.prepareStatement(sql); pstmtInterface = conn.prepareStatement(sqlInterface);
pstmt.setString(1, loginSiteCode); pstmtInterface.setString(1, "B");
pstmt.setTimestamp(2, getCurrtDate()); pstmtInterface.setTimestamp(2, getCurrtDate());
rs = pstmt.executeQuery(); rsInterface = pstmtInterface.executeQuery();
while(rs.next()) if(rsInterface.next())
{ {
tranId = checkNullAndTrim(rs.getString("TRAN_ID")); count = rsInterface.getInt(1);
}
System.out.println("Physical Scan Tran Id["+tranId+"]"); rsInterface.close();rsInterface = null;
pstmtInterface.close();pstmtInterface = null;
if(tranId != null && tranId.length() > 0)
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 " tranId = checkNullAndTrim(rs.getString("TRAN_ID"));
+" 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";*/
sqlPhyScan = " SELECT D.LINE_NO,D.ITEM_CODE,D.LOT_NO,D.LOT_SL,D.LOC_CODE,D.QUANTITY" System.out.println("Physical Scan Tran Id["+tranId+"]");
+" 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+")";
pstmtPhyscan = conn.prepareStatement(sqlPhyScan); if(tranId != null && tranId.length() > 0)
pstmtPhyscan.setString(1, tranId);
pstmtPhyscan.setString(2, tranId);
rsPhyscan = pstmtPhyscan.executeQuery();
while(rsPhyscan.next())
{ {
lineNo = checkNullAndTrim(rsPhyscan.getString("LINE_NO")); /*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 "
itemCode = checkNullAndTrim(rsPhyscan.getString("ITEM_CODE")); +" FROM PHYSCAN P,PHYSCANDET D,STOCK S,ITEM I"
//itemDescr = checkNullAndTrim(rs.getString("DESCR")); +" WHERE P.TRAN_ID = D.TRAN_ID AND P.TRAN_ID = ?"
//unit = checkNullAndTrim(rs.getString("UNIT")); +" AND S.ITEM_CODE = D.ITEM_CODE"
//itemType = checkNullAndTrim(rs.getString("ITEM_TYPE")); +" AND I.ITEM_CODE = S.ITEM_CODE"
lotNo = checkNullAndTrim(rsPhyscan.getString("LOT_NO")); +" AND S.LOT_NO = D.LOT_NO"
lotSl = checkNullAndTrim(rsPhyscan.getString("LOT_SL")); +" AND S.LOT_SL = D.LOT_SL"
palletNo = checkNullAndTrim(rsPhyscan.getString("LOC_CODE")); +" AND S.SITE_CODE = D.SITE_CODE"
//quantity = rs.getDouble("QUANTITY"); +" AND S.LOC_CODE = D.LOC_CODE";*/
//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); sqlPhyScan = " SELECT D.LINE_NO,D.ITEM_CODE,D.LOT_NO,D.LOT_SL,D.LOC_CODE,D.QUANTITY"
palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') || +" FROM PHYSCAN P,PHYSCANDET D,LOCATION L WHERE P.TRAN_ID = D.TRAN_ID AND P.TRAN_ID = ?"
(palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') || +" AND P.TRAN_ID NOT IN (SELECT REF_ID FROM SWMS_TO_AWMS WHERE REF_ID = ?)"
(palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') || +" AND L.LOC_CODE = D.LOC_CODE AND L.INV_STAT IN ("+invStat+")";
(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>(); pstmtPhyscan = conn.prepareStatement(sqlPhyScan);
pstmtPhyscan.setString(1, tranId);
interfaceHmap.put("TRAN_ID", ""); pstmtPhyscan.setString(2, tranId);
interfaceHmap.put("ITEM_CODE", itemCode); rsPhyscan = pstmtPhyscan.executeQuery();
interfaceHmap.put("DESCR", ""); while(rsPhyscan.next())
interfaceHmap.put("UNIT", ""); {
interfaceHmap.put("ITEM_TYPE", ""); lineNo = checkNullAndTrim(rsPhyscan.getString("LINE_NO"));
interfaceHmap.put("FAMILY_GRP", ""); itemCode = checkNullAndTrim(rsPhyscan.getString("ITEM_CODE"));
interfaceHmap.put("IN_OUT", "B"); //itemDescr = checkNullAndTrim(rs.getString("DESCR"));
interfaceHmap.put("REF_SER", "PSCAN"); //unit = checkNullAndTrim(rs.getString("UNIT"));
interfaceHmap.put("REF_ID", tranId); //itemType = checkNullAndTrim(rs.getString("ITEM_TYPE"));
interfaceHmap.put("TRAN_DATE", checkNullAndTrim(String.valueOf(today))); lotNo = checkNullAndTrim(rsPhyscan.getString("LOT_NO"));
interfaceHmap.put("LOT_NO", lotNo); lotSl = checkNullAndTrim(rsPhyscan.getString("LOT_SL"));
interfaceHmap.put("LOT_SL", lotSl); palletNo = checkNullAndTrim(rsPhyscan.getString("LOC_CODE"));
interfaceHmap.put("QUANTITY", ""); //quantity = rs.getDouble("QUANTITY");
interfaceHmap.put("QTY_PER_ART", ""); //notArt = rs.getDouble("NO_ART");
interfaceHmap.put("TOTAL_QTY", ""); //qtyPerArt = rs.getDouble("QTY_PER_ART");
interfaceHmap.put("EXP_DATE", ""); //analysisClass = checkNullAndTrim(rs.getString("ANALYSIS_CLASS"));
interfaceHmap.put("MFG_DATE", "");
interfaceHmap.put("PALLET_NO", palletNo); System.out.println("Pallet No before removing suffix: "+palletNo);
interfaceHmap.put("MSG_STAT", "N"); palletNo = (palletNo.charAt(palletNo.trim().length()-1)=='Q') || (palletNo.charAt(palletNo.trim().length()-1)=='M') ||
interfaceHmap.put("PALLET_STATUS", ""); (palletNo.charAt(palletNo.trim().length()-1)=='S') || (palletNo.charAt(palletNo.trim().length()-1)=='B') ||
interfaceHmap.put("LOCK_STAT", ""); (palletNo.charAt(palletNo.trim().length()-1)=='X') || (palletNo.charAt(palletNo.trim().length()-1)=='U') ||
interfaceHmap.put("ERR_COD", ""); (palletNo.charAt(palletNo.trim().length()-1)=='P') ? palletNo.substring(0,palletNo.trim().length()-1):palletNo;
interfaceHmap.put("ERR_DESC", ""); System.out.println("Pallet No After removing suffix: "+palletNo);
interfaceHmap.put("QC_TYPE", "");
interfaceHmap.put("TRANS_DT_ACK", ""); HashMap<String,String> interfaceHmap = new HashMap<String,String>();
interfaceHmap.put("STRO_PREF", "");
interfaceHmap.put("LINE_NO", lineNo); interfaceHmap.put("TRAN_ID", "");
interfaceHmap.put("ITEM_CODE", itemCode);
interfaceArrList.add(interfaceHmap); 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; else
pstmt.close();pstmt = null; {
System.out.println("***************Stock Count Activty is already already runn today************");
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);
}
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -493,6 +514,8 @@ public class StatusChangeRequest implements Schedule { ...@@ -493,6 +514,8 @@ public class StatusChangeRequest implements Schedule {
if(rs != null){rs.close();rs=null;} if(rs != null){rs.close();rs=null;}
if(pstmtPhyscan != null){pstmtPhyscan.close();pstmtPhyscan=null;} if(pstmtPhyscan != null){pstmtPhyscan.close();pstmtPhyscan=null;}
if(rsPhyscan != null){rsPhyscan.close();rsPhyscan=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) 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