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
if(pstmt != null){pstmt.close();pstmt=null;}
if(interfacePstmt != null){interfacePstmt.close();interfacePstmt=null;}
if(rs != null){rs.close();rs=null;}
if(rsInf != null){rsInf.close();rsInf=null;}
}
catch(Exception se)
{
......@@ -393,14 +394,29 @@ public class ScheduleAWMSInOutTasks implements Schedule
{
System.out.println("Going for Distribution issue");
//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);
System.out.println("Return from dist issue"+errString);
}
else if("S-ORD".equalsIgnoreCase(refSer))
{
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)
......@@ -409,10 +425,17 @@ public class ScheduleAWMSInOutTasks implements Schedule
}
finally
{
if(pstmt != null){pstmt.close();pstmt = null;}
if(pstmtHdr != null){pstmtHdr.close();pstmtHdr = null;}
if(pstmtDet != null){pstmtDet.close();pstmtDet = null;}
if(rs != null){rs.close();rs = null;}
try
{
if(pstmt != null){pstmt.close();pstmt = null;}
if(pstmtHdr != null){pstmtHdr.close();pstmtHdr = null;}
if(pstmtDet != null){pstmtDet.close();pstmtDet = null;}
if(rs != null){rs.close();rs = null;}
}
catch(Exception ex)
{
throw new ITMException(ex);
}
}
return errString;
}
......@@ -450,6 +473,35 @@ public class ScheduleAWMSInOutTasks implements Schedule
refId = checkNullAndTrim((String) interfaceMap.get("REF_ID"));
//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'";
pstmtInterface = conn.prepareStatement(sqlInterface);
pstmtInterface.setString(1, refId);
......@@ -483,31 +535,6 @@ public class ScheduleAWMSInOutTasks implements Schedule
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(2, lineNoInterface);
rs = pstmt.executeQuery();
......@@ -524,10 +551,6 @@ public class ScheduleAWMSInOutTasks implements Schedule
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.setInt( 2, lineNo );
pstmtHolddet.setString( 3, itemCode );
......@@ -563,6 +586,10 @@ public class ScheduleAWMSInOutTasks implements Schedule
caseCount = pstmt.executeUpdate();
System.out.println("Updated ="+caseCount);
}
else
{
throw new Exception(errString);
}
}
catch(Exception e)
{
......@@ -570,10 +597,17 @@ public class ScheduleAWMSInOutTasks implements Schedule
}
finally
{
if(pstmtHold != null){pstmtHold.close();pstmtHold = null;}
if(pstmtHolddet != null){pstmtHolddet.close();pstmtHolddet = null;}
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
try
{
if(pstmtHold != null){pstmtHold.close();pstmtHold = null;}
if(pstmtHolddet != null){pstmtHolddet.close();pstmtHolddet = null;}
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
}
catch(Exception ex)
{
throw new ITMException(ex);
}
}
return errString;
}
......@@ -746,8 +780,15 @@ public class ScheduleAWMSInOutTasks implements Schedule
}
finally
{
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
try
{
if(pstmt != null){pstmt.close();pstmt = null;}
if(rs != null){rs.close();rs = null;}
}
catch(Exception ex)
{
throw new ITMException(ex);
}
}
return result;
}
......@@ -1571,20 +1612,36 @@ public class ScheduleAWMSInOutTasks implements Schedule
}
catch(Exception e)
{
isError = true;
throw new ITMException(e);
}
finally
{
if(despDetPstmt != null){despDetPstmt.close();despDetPstmt = null;}
if(rs != null){rs.close();rs = null;}
if(pstmtSordItem != null){pstmtSordItem.close();pstmtSordItem = null;}
if(rsSordDet != null){rsSordDet.close();rsSordDet = null;}
if(rsSordItem != null){rsSordItem.close();rsSordItem = null;}
if(pstmtSord != null){pstmtSord.close();pstmtSord = null;}
if(rsItem != null){rsItem.close();rsItem = null;}
if(pstmtSordDet != null){pstmtSordDet.close();pstmtSordDet = null;}
if(rsStock != null){rsStock.close();rsStock = null;}
if(pstmtHdr != null){pstmtHdr.close();pstmtHdr = null;}
try
{
if(isError)
{
resultStr = "VTTNSVD";
}
else
{
resultStr = "VTCONPARM";
}
if(despDetPstmt != null){despDetPstmt.close();despDetPstmt = null;}
if(rs != null){rs.close();rs = null;}
if(pstmtSordItem != null){pstmtSordItem.close();pstmtSordItem = null;}
if(rsSordDet != null){rsSordDet.close();rsSordDet = null;}
if(rsSordItem != null){rsSordItem.close();rsSordItem = null;}
if(pstmtSord != null){pstmtSord.close();pstmtSord = null;}
if(rsItem != null){rsItem.close();rsItem = null;}
if(pstmtSordDet != null){pstmtSordDet.close();pstmtSordDet = null;}
if(rsStock != null){rsStock.close();rsStock = null;}
if(pstmtHdr != null){pstmtHdr.close();pstmtHdr = null;}
}
catch(Exception ex)
{
throw new ITMException(ex);
}
}
return resultStr;
}
......
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