Commit a5a5cd65 authored by msharma's avatar msharma

Error Handling for Allocation,deallocation,stock transfer


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98498 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6c66ce05
...@@ -1034,6 +1034,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1034,6 +1034,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
mainStr =null; mainStr =null;
return errString; return errString;
} }
System.out.println("Printing errString["+errString+"]");
if((errString != null ) && (errString.indexOf("Success") > -1 || errString.indexOf("CONFSUCC") >-1)) if((errString != null ) && (errString.indexOf("Success") > -1 || errString.indexOf("CONFSUCC") >-1))
{ {
connOne.commit(); connOne.commit();
...@@ -1118,7 +1119,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1118,7 +1119,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
ResultSet rs = null; ResultSet rs = null;
GenericUtility genericUtility = null; GenericUtility genericUtility = null;
Timestamp currDate = null; Timestamp currDate = null;
String retString = null; String retString = "";
String empCode = ""; String empCode = "";
String xmlString = ""; String xmlString = "";
StringBuffer xmlBuff = null; StringBuffer xmlBuff = null;
...@@ -1198,7 +1199,10 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1198,7 +1199,10 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if(campNo != null && campNo.trim().length() > 0) if(campNo != null && campNo.trim().length() > 0)
{ {
campflag1 = true; campflag1 = true;
sql = "select SUM(QUANTITY) AS quantity ,item_code,ord_date,no_art " + /*sql = "select SUM(QUANTITY) AS quantity ,item_code,ord_date,no_art " +
" from workorder where work_order in ( SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? ) group by item_code, ord_date, no_art ";*/
//Changed by Manoj dtd 21/08/2015 group by not required
sql = "select SUM(QUANTITY) AS quantity " +
" from workorder where work_order in ( SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? ) group by item_code, ord_date, no_art "; " from workorder where work_order in ( SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? ) group by item_code, ord_date, no_art ";
pstmt = connOne.prepareStatement(sql); pstmt = connOne.prepareStatement(sql);
...@@ -1207,7 +1211,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1207,7 +1211,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if(rs.next()) if(rs.next())
{ {
totWoQty = Double.parseDouble(df.format(rs.getDouble("quantity"))); totWoQty = Double.parseDouble(df.format(rs.getDouble("quantity")));
orddate = rs.getDate("ord_date"); //orddate = rs.getDate("ord_date");
//noArt = rs.getString("no_art")==null?"0":rs.getString("no_art"); //noArt = rs.getString("no_art")==null?"0":rs.getString("no_art");
} }
if(rs != null) if(rs != null)
...@@ -1325,10 +1329,10 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1325,10 +1329,10 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
xmlBuff.append("<tran_id/>"); xmlBuff.append("<tran_id/>");
xmlBuff.append("<tran_date><![CDATA["+ sdf.format(currDate).toString()+"]]></tran_date>"); xmlBuff.append("<tran_date><![CDATA["+ sdf.format(currDate).toString()+"]]></tran_date>");
if(orddate != null) /*if(orddate != null)
{ {
xmlBuff.append("<ref_date><![CDATA[" + sdf.format(orddate).toString() +"]]></ref_date>"); xmlBuff.append("<ref_date><![CDATA[" + sdf.format(orddate).toString() +"]]></ref_date>");
} }*/
xmlBuff.append("<tran_type><![CDATA["+ tranType +"]]></tran_type>"); xmlBuff.append("<tran_type><![CDATA["+ tranType +"]]></tran_type>");
xmlBuff.append("<site_code><![CDATA["+ siteCode +"]]></site_code>"); xmlBuff.append("<site_code><![CDATA["+ siteCode +"]]></site_code>");
...@@ -1417,13 +1421,17 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1417,13 +1421,17 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
" from inv_alloc_det where tran_id IN (SELECT TRAN_ID FROM INV_ALLOCATE "+ " from inv_alloc_det where tran_id IN (SELECT TRAN_ID FROM INV_ALLOCATE "+
" WHERE WORK_ORDER IN (SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? AND STATUS = 'R')) "+ " WHERE WORK_ORDER IN (SELECT WORK_ORDER FROM WORKORDER WHERE CAMPGN_NO = ? AND STATUS = 'R')) "+
" and loc_code in(select loc_code from location where inv_stat = ? ) and site_code = ? and item_code= ? " " and loc_code in(select loc_code from location where inv_stat = ? ) and site_code = ? and item_code= ? "
+ "and case when deallocated is null then 'N' else deallocated end = 'N' "; + "and case when deallocated is null then 'N' else deallocated end = 'N' and lot_no=? and lot_sl=? and loc_code=? ";
pstmt = connOne.prepareStatement(sql); pstmt = connOne.prepareStatement(sql);
pstmt.setString(1,campNo); pstmt.setString(1,campNo);
pstmt.setString(2,invstat1); pstmt.setString(2,invstat1);
pstmt.setString(3,siteCode); pstmt.setString(3,siteCode);
pstmt.setString(4,itemCode); pstmt.setString(4,itemCode);
pstmt.setString(5,lotno);
pstmt.setString(6,lotsl);
pstmt.setString(7,locCodeFr);
//pstmt.setString(8,explev);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
...@@ -1449,6 +1457,12 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1449,6 +1457,12 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if (distStkUpd.updAllocTrace(hashMap, connOne) > 0) if (distStkUpd.updAllocTrace(hashMap, connOne) > 0)
{ {
System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!"); System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!");
}
else
{
retString="DEALLOCERR";
break;
} }
hashMapList.add(hashMap); hashMapList.add(hashMap);
System.out.println("1393--Printing hashMap--["+hashMap+"]"); System.out.println("1393--Printing hashMap--["+hashMap+"]");
...@@ -1488,6 +1502,11 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1488,6 +1502,11 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
{ {
System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!"); System.out.println("distStkUpd.UpdAllocTrace(HashMap, Connection) : Sucessuful!");
} }
else
{
retString="DEALLOCERR";
}
hashMapList.add(hashMap); hashMapList.add(hashMap);
System.out.println("1426--Printing hashMap--["+hashMap+"]"); System.out.println("1426--Printing hashMap--["+hashMap+"]");
hashMap=null; hashMap=null;
...@@ -1495,6 +1514,8 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1495,6 +1514,8 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
System.out.println("...............just before savdata() "); System.out.println("...............just before savdata() ");
siteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"); siteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("== site code == @"+siteCode); System.out.println("== site code == @"+siteCode);
if(retString.trim().length()==0)
{
retString = saveData(siteCode,xmlString,connOne); retString = saveData(siteCode,xmlString,connOne);
System.out.println("@@@@@2: retString: @"+retString); System.out.println("@@@@@2: retString: @"+retString);
System.out.println("--retString finished--"); System.out.println("--retString finished--");
...@@ -1541,6 +1562,10 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1541,6 +1562,10 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
pstmt.close(); pstmt.close();
pstmt=null;*/ pstmt=null;*/
} }
else
{
retString="ALLOCERR";
}
} }
// code for by cpatil for supreme on 16/04/15 for multiple issue start // code for by cpatil for supreme on 16/04/15 for multiple issue start
...@@ -1589,7 +1614,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1589,7 +1614,7 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if(count == 0) if(count == 0)
{ {
if( (batchQuantity == totWoQty) || campflag1) if(campflag1)
{ {
sql = " update inv_alloc_det set loc_code = ? where tran_id = ? and item_code = ? and lot_no = ? and lot_sl = ? and loc_code = ? and site_code = ? and exp_lev=? and case when deallocated is null then 'N' else deallocated end <> 'Y'"; sql = " update inv_alloc_det set loc_code = ? where tran_id = ? and item_code = ? and lot_no = ? and lot_sl = ? and loc_code = ? and site_code = ? and exp_lev=? and case when deallocated is null then 'N' else deallocated end <> 'Y'";
pstmt = connOne.prepareStatement(sql); pstmt = connOne.prepareStatement(sql);
...@@ -1605,7 +1630,25 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1605,7 +1630,25 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
if(pstmt != null) if(pstmt != null)
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
}else }
else if((batchQuantity == totWoQty))
{
sql = " update inv_alloc_det set loc_code = ? where tran_id = ? and item_code = ? and lot_no = ? and lot_sl = ? and loc_code = ? and site_code = ? and exp_lev=? and case when deallocated is null then 'N' else deallocated end <> 'Y'";
pstmt = connOne.prepareStatement(sql);
pstmt.setString(1,locCodeTo);
pstmt.setString(2,tranId);
pstmt.setString(3,itemCode);
pstmt.setString(4,lotno);
pstmt.setString(5,lotsl);
pstmt.setString(6,locCodeFr);
pstmt.setString(7,siteCode);
pstmt.setString(8,explev);
pstmt.executeUpdate();
if(pstmt != null)
pstmt.close();
pstmt = null;
}
else
{ {
int maxlineNo = 0; int maxlineNo = 0;
...@@ -1745,6 +1788,10 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -1745,6 +1788,10 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
} }
}
else
{
retString="STKTRFCONFERR";
} }
/*if(retString.indexOf("CONFSUCC") > -1) /*if(retString.indexOf("CONFSUCC") > -1)
{ {
...@@ -2069,6 +2116,12 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr ...@@ -2069,6 +2116,12 @@ public class WoTransferPrc extends ProcessEJB implements WoTransferPrcLocal,WoTr
} }
}*/ }*/
} }
else
{
retString="STKTRFERR";
}
}
// if((retString != null ) && retString.indexOf("Success") > -1 || retString.indexOf("CONFSUCC") >-1) // if((retString != null ) && retString.indexOf("Success") > -1 || retString.indexOf("CONFSUCC") >-1)
......
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