Commit 1027f182 authored by wansari's avatar wansari

W15GSUN003 updated exception handling and error code response


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98845 ce508802-f39f-4f6c-b175-0d175dae99d5
parent bb499f8d
...@@ -200,6 +200,7 @@ public class ScheduleAWMSInOutTasks implements Schedule ...@@ -200,6 +200,7 @@ public class ScheduleAWMSInOutTasks implements Schedule
if(pstmt != null){pstmt.close();pstmt=null;} if(pstmt != null){pstmt.close();pstmt=null;}
if(interfacePstmt != null){interfacePstmt.close();interfacePstmt=null;} if(interfacePstmt != null){interfacePstmt.close();interfacePstmt=null;}
if(rs != null){rs.close();rs=null;} if(rs != null){rs.close();rs=null;}
if(rsInf != null){rsInf.close();rsInf=null;}
} }
catch(Exception se) catch(Exception se)
{ {
...@@ -393,14 +394,29 @@ public class ScheduleAWMSInOutTasks implements Schedule ...@@ -393,14 +394,29 @@ public class ScheduleAWMSInOutTasks implements Schedule
{ {
System.out.println("Going for Distribution issue"); System.out.println("Going for Distribution issue");
//errString = callDistIssue(refId,xtraParams,conn);//Using club //errString = callDistIssue(refId,xtraParams,conn);//Using club
CreateDistIssue disIssue = new CreateDistIssue(); CreateDistIssue disIssue = new CreateDistIssue();//VTCONPARM
errString = disIssue.createDistIssue(loginSiteCode, "<Root><TranID>" + refId + "</TranID></Root>", xtraParams, conn); errString = disIssue.createDistIssue(loginSiteCode, "<Root><TranID>" + refId + "</TranID></Root>", xtraParams, conn);
System.out.println("Return from dist issue"+errString);
} }
else if("S-ORD".equalsIgnoreCase(refSer)) else if("S-ORD".equalsIgnoreCase(refSer))
{ {
System.out.println("Going for Despatch"); System.out.println("Going for Despatch");
errString = createDespatch(refId,conn); errString = createDespatch(refId,conn);//VTCONPARM
System.out.println("Return from despatch"+errString);
} }
if( errString != null && errString.indexOf( "VTCONPARM" ) > -1)
{
System.out.println("Despatch/Dist issue created successfully");
}
else
{
throw new Exception (errString);
}
}
else
{
throw new Exception (errString);
} }
} }
catch(Exception e) catch(Exception e)
...@@ -408,12 +424,19 @@ public class ScheduleAWMSInOutTasks implements Schedule ...@@ -408,12 +424,19 @@ public class ScheduleAWMSInOutTasks implements Schedule
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
{
try
{ {
if(pstmt != null){pstmt.close();pstmt = null;} if(pstmt != null){pstmt.close();pstmt = null;}
if(pstmtHdr != null){pstmtHdr.close();pstmtHdr = null;} if(pstmtHdr != null){pstmtHdr.close();pstmtHdr = null;}
if(pstmtDet != null){pstmtDet.close();pstmtDet = null;} if(pstmtDet != null){pstmtDet.close();pstmtDet = null;}
if(rs != null){rs.close();rs = null;} if(rs != null){rs.close();rs = null;}
} }
catch(Exception ex)
{
throw new ITMException(ex);
}
}
return errString; 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
...@@ -450,6 +473,35 @@ public class ScheduleAWMSInOutTasks implements Schedule ...@@ -450,6 +473,35 @@ public class ScheduleAWMSInOutTasks implements Schedule
refId = checkNullAndTrim((String) interfaceMap.get("REF_ID")); refId = checkNullAndTrim((String) interfaceMap.get("REF_ID"));
//locCode = checkNullAndTrim((String) interfaceMap.get("PALLET_NO")); //locCode = checkNullAndTrim((String) interfaceMap.get("PALLET_NO"));
holddetInsertSql = "INSERT INTO INV_HOLD_DET(TRAN_ID,LINE_NO,ITEM_CODE,SITE_CODE,LOC_CODE,LOT_NO,LOT_SL,HOLD_STATUS,SCH_REL_DATE)"
+ " VALUES(?,?,?,?,?,?,?,?,?)";
pstmtHolddet = conn.prepareStatement(holddetInsertSql);
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 = ? 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 = ? 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 = ? 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";
}
else if("PR".equalsIgnoreCase(refSer))
{
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.LINE_NO = ?";
}
pstmt = conn.prepareStatement(sql);
sqlInterface = "SELECT LINE_NO FROM INTERFACE WHERE REF_ID = ? AND MSG_STAT = 'E'"; sqlInterface = "SELECT LINE_NO FROM INTERFACE WHERE REF_ID = ? AND MSG_STAT = 'E'";
pstmtInterface = conn.prepareStatement(sqlInterface); pstmtInterface = conn.prepareStatement(sqlInterface);
pstmtInterface.setString(1, refId); pstmtInterface.setString(1, refId);
...@@ -483,31 +535,6 @@ public class ScheduleAWMSInOutTasks implements Schedule ...@@ -483,31 +535,6 @@ public class ScheduleAWMSInOutTasks implements Schedule
pstmtHold.clearParameters(); 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 = ? 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 = ? 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 = ? 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";
}
else if("PR".equalsIgnoreCase(refSer))
{
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.LINE_NO = ?";
}
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refId); pstmt.setString(1, refId);
pstmt.setString(2, lineNoInterface); pstmt.setString(2, lineNoInterface);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -524,10 +551,6 @@ public class ScheduleAWMSInOutTasks implements Schedule ...@@ -524,10 +551,6 @@ public class ScheduleAWMSInOutTasks implements Schedule
lineNo++; lineNo++;
holddetInsertSql = "INSERT INTO INV_HOLD_DET(TRAN_ID,LINE_NO,ITEM_CODE,SITE_CODE,LOC_CODE,LOT_NO,LOT_SL,HOLD_STATUS,SCH_REL_DATE)"
+ " VALUES(?,?,?,?,?,?,?,?,?)";
pstmtHolddet = conn.prepareStatement(holddetInsertSql);
pstmtHolddet.setString( 1, invtranId ); pstmtHolddet.setString( 1, invtranId );
pstmtHolddet.setInt( 2, lineNo ); pstmtHolddet.setInt( 2, lineNo );
pstmtHolddet.setString( 3, itemCode ); pstmtHolddet.setString( 3, itemCode );
...@@ -563,18 +586,29 @@ public class ScheduleAWMSInOutTasks implements Schedule ...@@ -563,18 +586,29 @@ public class ScheduleAWMSInOutTasks implements Schedule
caseCount = pstmt.executeUpdate(); caseCount = pstmt.executeUpdate();
System.out.println("Updated ="+caseCount); System.out.println("Updated ="+caseCount);
} }
else
{
throw new Exception(errString);
}
} }
catch(Exception e) catch(Exception e)
{ {
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
{
try
{ {
if(pstmtHold != null){pstmtHold.close();pstmtHold = null;} if(pstmtHold != null){pstmtHold.close();pstmtHold = null;}
if(pstmtHolddet != null){pstmtHolddet.close();pstmtHolddet = null;} if(pstmtHolddet != null){pstmtHolddet.close();pstmtHolddet = null;}
if(pstmt != null){pstmt.close();pstmt = null;} if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;} if(rs != null){rs.close();rs = null;}
} }
catch(Exception ex)
{
throw new ITMException(ex);
}
}
return errString; return errString;
} }
private String generateTranTd(String windowName,String tranDate,String siteCode, Connection conn )throws ITMException private String generateTranTd(String windowName,String tranDate,String siteCode, Connection conn )throws ITMException
...@@ -745,10 +779,17 @@ public class ScheduleAWMSInOutTasks implements Schedule ...@@ -745,10 +779,17 @@ public class ScheduleAWMSInOutTasks implements Schedule
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
{
try
{ {
if(pstmt != null){pstmt.close();pstmt = null;} if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;} if(rs != null){rs.close();rs = null;}
} }
catch(Exception ex)
{
throw new ITMException(ex);
}
}
return result; return result;
} }
/*private String callDistIssue(String tranID,String xtraParams,Connection conn) throws ITMException, Exception /*private String callDistIssue(String tranID,String xtraParams,Connection conn) throws ITMException, Exception
...@@ -1571,10 +1612,21 @@ public class ScheduleAWMSInOutTasks implements Schedule ...@@ -1571,10 +1612,21 @@ public class ScheduleAWMSInOutTasks implements Schedule
} }
catch(Exception e) catch(Exception e)
{ {
isError = true;
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
{ {
try
{
if(isError)
{
resultStr = "VTTNSVD";
}
else
{
resultStr = "VTCONPARM";
}
if(despDetPstmt != null){despDetPstmt.close();despDetPstmt = null;} if(despDetPstmt != null){despDetPstmt.close();despDetPstmt = null;}
if(rs != null){rs.close();rs = null;} if(rs != null){rs.close();rs = null;}
if(pstmtSordItem != null){pstmtSordItem.close();pstmtSordItem = null;} if(pstmtSordItem != null){pstmtSordItem.close();pstmtSordItem = null;}
...@@ -1586,6 +1638,11 @@ public class ScheduleAWMSInOutTasks implements Schedule ...@@ -1586,6 +1638,11 @@ public class ScheduleAWMSInOutTasks implements Schedule
if(rsStock != null){rsStock.close();rsStock = null;} if(rsStock != null){rsStock.close();rsStock = null;}
if(pstmtHdr != null){pstmtHdr.close();pstmtHdr = null;} if(pstmtHdr != null){pstmtHdr.close();pstmtHdr = null;}
} }
catch(Exception ex)
{
throw new ITMException(ex);
}
}
return resultStr; return resultStr;
} }
private String getError(String saleOrder,String Code,Connection conn) throws ITMException, Exception private String getError(String saleOrder,String Code,Connection conn) throws ITMException, Exception
......
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