Commit 32fc5fc9 authored by wansari's avatar wansari

W15GSUN003 updated for inventory hold code


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98841 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 34304dbe
......@@ -81,10 +81,12 @@ public class ScheduleAWMSInOutTasks implements Schedule
public String scheduleStockTransfer(String siteCode , String scheduleParamXML, String xtraParams) throws RemoteException,ITMException
{
Connection conn = null;
ResultSet rs = null;
ResultSet rs = null,rsInf = null;
PreparedStatement pstmt = null, interfacePstmt = null;
String errString = "", sql = "",inOut = "",refSer = "",refId = "",palletRej = "";
boolean contPllt = false;
String errString = "", sql = "",inOut = "",refSer = "",refId = "",palletRej = "",sqlInf = "";
boolean isCountPllt = false;
int flag,countError;
String lineNo = "";
try
{
......@@ -100,26 +102,52 @@ public class ScheduleAWMSInOutTasks implements Schedule
+ "PALLET_REJ_DESC,REF_LINE_NO FROM INTERFACE "
+ "WHERE SYSDATE > TRANS_DT_ACK";*/
sql = "SELECT DISTINCT REF_ID,REF_SER,IN_OUT,MSG_STAT FROM INTERFACE WHERE SYSDATE > TRANS_DT_ACK";
//sql = "SELECT DISTINCT REF_ID,REF_SER,IN_OUT,MSG_STAT FROM INTERFACE WHERE SYSDATE > TRANS_DT_ACK";
sql = "SELECT DISTINCT REF_ID,REF_SER FROM INTERFACE WHERE REF_ID IN "
+ "(SELECT REF_ID FROM INTERFACE2 WHERE SCHEDULE_STATUS IS NULL)";
pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery();
while(rs.next())
{
HashMap interfaceHmap = new HashMap();
refSer = checkNullAndTrim(rs.getString("REF_SER"));
refId = checkNullAndTrim(rs.getString("REF_ID"));
inOut = checkNullAndTrim(rs.getString("IN_OUT"));
palletRej = checkNullAndTrim(rs.getString("MSG_STAT"));
isCountPllt = checkCountPalletReq(refId,conn);
if(isCountPllt)
{
HashMap interfaceHmap = new HashMap();
interfaceHmap.put("REF_ID", refId);
interfaceHmap.put("REF_SER", refSer);
contPllt = checkCountPalletReq(refId,conn);
countError = 0;
flag = 0;
sqlInf = "SELECT COUNT(*) AS COUNT FROM INTERFACE WHERE REF_ID = ? AND MSG_STAT = 'E' ";
interfacePstmt = conn.prepareStatement(sqlInf);
interfacePstmt.setString(1, refId);
rsInf = interfacePstmt.executeQuery();
if(rsInf.next())
{
countError = rsInf.getInt("COUNT");
}
rsInf.close();rsInf = null;
interfacePstmt.close();interfacePstmt = null;
if(countError > 0)
{
System.out.println("Going for inventory hold");
errString = inventoryHold(interfaceHmap, siteCode, xtraParams, conn);
flag = 1;
}
if(contPllt)
if(flag == 0)
{
if("E".equalsIgnoreCase(palletRej))
System.out.println("Going for stock transfer refId["+refId+"]refSer["+refSer+"]inOut["+inOut+"]");
errString = stockTransfer(interfaceHmap,xtraParams,conn);
}
/*if("E".equalsIgnoreCase(palletRej))
{
System.out.println("Go on inventory hold");
errString = inventoryHold(interfaceHmap, siteCode,xtraParams, conn);
......@@ -128,7 +156,7 @@ public class ScheduleAWMSInOutTasks implements Schedule
{
System.out.println("Going for stock transfer refId["+refId+"]refSer["+refSer+"]inOut["+inOut+"]");
errString = stockTransfer(interfaceHmap,xtraParams,conn);
/*if("I".equalsIgnoreCase(inOut))
if("I".equalsIgnoreCase(inOut))
{
errString = stockTransfer(interfaceHmap,xtraParams,conn);
}
......@@ -141,8 +169,8 @@ public class ScheduleAWMSInOutTasks implements Schedule
errString = stockTransfer(interfaceHmap,xtraParams,conn);
}
}
}*/
}
}*/
}//End checkCountPalletReq check
}
rs.close();rs = null;
......@@ -360,7 +388,6 @@ public class ScheduleAWMSInOutTasks implements Schedule
pstmt.setString(1, refId);
int caseCount = pstmt.executeUpdate();
System.out.println("Updated ="+caseCount);
}
if("D-SO".equalsIgnoreCase(refSer))
{
......@@ -375,6 +402,7 @@ public class ScheduleAWMSInOutTasks implements Schedule
errString = createDespatch(refId,conn);
}
}
}
catch(Exception e)
{
throw new ITMException(e);
......@@ -388,12 +416,12 @@ public class ScheduleAWMSInOutTasks implements Schedule
}
return errString;
}
private String inventoryHold(HashMap interfaceMap,String siteCode,String xtraParams,Connection conn) throws SQLException, ITMException
private String inventoryHold(HashMap interfaceMap,String siteCode, String xtraParams,Connection conn) throws SQLException, ITMException
{
PreparedStatement pstmt= null,pstmtHold = null,pstmtHolddet = null;
ResultSet rs = null;
PreparedStatement pstmt= null,pstmtHold = null,pstmtHolddet = null,pstmtInterface= null;
ResultSet rs = null,rsInterface = null;
String sql = "",loginSiteCode = "",userId = "";
String sql = "",loginSiteCode = "",userId = "",sqlInterface = "";
int updCnt = 0,lineNo = 0,caseCount = 0;
String holdInsertSql = "",holddetInsertSql = "",invtranId = "",invLockDetsql = "",errString = "";
......@@ -406,7 +434,8 @@ public class ScheduleAWMSInOutTasks implements Schedule
userId = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "loginCode" );
chgTerm = genericUtility.getValueFromXTRA_PARAMS( xtraParams, "chgTerm" );
String lockCodeName = "AWMS_LOCK",lockCode = "";
String lockCodeName = "AWMS_LOCK",lockCode = "",lineNoInterface = "";
boolean headerFlag = true;
try
{
System.out.println("Inside inventory hold");
......@@ -421,6 +450,19 @@ public class ScheduleAWMSInOutTasks implements Schedule
refId = checkNullAndTrim((String) interfaceMap.get("REF_ID"));
//locCode = checkNullAndTrim((String) interfaceMap.get("PALLET_NO"));
sqlInterface = "SELECT LINE_NO FROM INTERFACE WHERE REF_ID = ? AND MSG_STAT = 'E'";
pstmtInterface = conn.prepareStatement(sqlInterface);
pstmtInterface.setString(1, refId);
rsInterface = pstmtInterface.executeQuery();
while(rsInterface.next())
{
lineNoInterface = checkNullAndTrim(rsInterface.getString("LINE_NO"));
lineNoInterface = " " + lineNoInterface;
lineNoInterface = lineNoInterface.substring( lineNoInterface.length()-3 );
if(headerFlag)
{
holdInsertSql = "INSERT INTO INV_HOLD(TRAN_ID,TRAN_DATE,SITE_CODE,CONFIRMED,REF_ID,REF_SER,CHG_USER,CHG_DATE,CHG_TERM, LOCK_CODE,REF_NO) "
+ "VALUES(?,?,?,?,?,?,?,?,?,?,?)";
pstmtHold = conn.prepareStatement(holdInsertSql);
......@@ -439,21 +481,22 @@ public class ScheduleAWMSInOutTasks implements Schedule
pstmtHold.setString( 11, "" );
updCnt = pstmtHold.executeUpdate();
pstmtHold.clearParameters();
}
if("D-SO".equalsIgnoreCase(refSer))
{
sql = "SELECT ITEM_CODE,LINE_NO,QUANTITY,LOT_NO,LOT_SL,LOC_CODE,SITE_CODE__MFG AS SITE_CODE"
+ " FROM DISTORDER_ALLOC WHERE DIST_ORDER = ? ";
+ " FROM DISTORDER_ALLOC WHERE DIST_ORDER = ? AND LINE_NO = ?";
}
else if("S-ORD".equalsIgnoreCase(refSer))
{
sql = "SELECT ITEM_CODE,LINE_NO,QUANTITY,LOT_NO,LOT_SL,LOC_CODE,"
+ "SITE_CODE FROM SORDALLOC WHERE SALE_ORDER = ?";
+ "SITE_CODE FROM SORDALLOC WHERE SALE_ORDER = ? AND LINE_NO = ?";
}
else if("PZ".equalsIgnoreCase(refSer))
{
sql = "SELECT P.ITEM_CODE,P.LOT_NO,P.LOT_SL,"
+ " P.LOC_CODE,P.SITE_CODE,P.PALLET_NO FROM PALLET_DET P,STOCK S WHERE TRAN_ID = ? "
+ " P.LOC_CODE,P.SITE_CODE,P.PALLET_NO FROM PALLET_DET P,STOCK S WHERE TRAN_ID = ? AND P.LINE_NO = ?"
+ " AND P.ITEM_CODE = S.ITEM_CODE AND P.SITE_CODE = S.SITE_CODE"
+ " AND P.LOC_CODE = S.LOC_CODE AND P.LOT_NO = S.LOT_NO AND P.LOT_SL = S.LOT_SL";
}
......@@ -461,11 +504,12 @@ public class ScheduleAWMSInOutTasks implements Schedule
{
sql = "SELECT S.ITEM_CODE,S.LOT_NO,S.LOT_SL,S.LOC_CODE,"+
" S.SITE_CODE FROM STOCK S,PALLET_REQ_DET P WHERE S.LOC_CODE = P.PALLET_NO AND S.INV_STAT = 'AWMS'" +
" AND P.TRAN_ID = ?";
" AND P.TRAN_ID = ? AND P.LINE_NO = ?";
}
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refId);
pstmt.setString(2, lineNoInterface);
rs = pstmt.executeQuery();
while(rs.next())
{
......@@ -502,6 +546,11 @@ public class ScheduleAWMSInOutTasks implements Schedule
rs.close();rs = null;
pstmt.close();pstmt = null;
headerFlag = false;
}
rsInterface.close();rsInterface = null;
pstmtInterface.close();pstmtInterface = null;
InvHoldConf invHoldConf = new InvHoldConf();
errString = invHoldConf.confirm( invtranId, xtraParams, "" , conn ,false);//VTCNFSUCC
......@@ -614,7 +663,38 @@ public class ScheduleAWMSInOutTasks implements Schedule
String sql = "",scheduleStatus = "";
try
{
sql = "SELECT SCHEDULE_STATUS FROM INTERFACE2 WHERE REF_ID = ?";
sql = "SELECT COUNT(*) AS COUNT FROM INTERFACE2 WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refId);
rs = pstmt.executeQuery();
if(rs.next())
{
countWms = rs.getInt("COUNT");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
sql = "SELECT COUNT(*) AS COUNT FROM INTERFACE WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refId);
rs = pstmt.executeQuery();
if(rs.next())
{
countAWms = rs.getInt("COUNT");
}
rs.close();rs = null;
pstmt.close();pstmt = null;
System.out.println("Count WMS is="+countWms);
System.out.println("Count AWMS is="+countAWms);
if(countWms == countAWms)
{
return true;
}
/*sql = "SELECT SCHEDULE_STATUS FROM INTERFACE2 WHERE REF_ID = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refId);
rs = pstmt.executeQuery();
......@@ -657,7 +737,7 @@ public class ScheduleAWMSInOutTasks implements Schedule
{
return true;
}
}
}*/
}
catch(Exception 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