Commit 6b481ecb authored by caluka's avatar caluka

change message when scheduler execution fails


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98102 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8f3c1ccb
...@@ -53,6 +53,7 @@ public class NearExpirySchedule implements Schedule ...@@ -53,6 +53,7 @@ public class NearExpirySchedule implements Schedule
String chgTerm = null; String chgTerm = null;
static long count_records=0; static long count_records=0;
boolean isError = false; boolean isError = false;
boolean isInsert = false;
public String schedulePriority( String wrkflwPriority )throws Exception public String schedulePriority( String wrkflwPriority )throws Exception
{ {
...@@ -121,7 +122,7 @@ public class NearExpirySchedule implements Schedule ...@@ -121,7 +122,7 @@ public class NearExpirySchedule implements Schedule
int count1 = 0; int count1 = 0;
//Changed by sumit sarkar on 24/06/12 END //Changed by sumit sarkar on 24/06/12 END
//Changed by sumit sarkar on 02/10/12 //Changed by sumit sarkar on 02/10/12
String holdStatus="",sql="",sql1="",itemSer="",siteItemSer=""; String holdStatus="",sql="",sql1="",itemSer="",siteItemSer="",remarksFlag="";
int count = 0; int count = 0;
int updCnt = 0; int updCnt = 0;
int lineNo = 0; int lineNo = 0;
...@@ -571,6 +572,7 @@ public class NearExpirySchedule implements Schedule ...@@ -571,6 +572,7 @@ public class NearExpirySchedule implements Schedule
if ( stockExpList.size() > 0 && count > 0) if ( stockExpList.size() > 0 && count > 0)
{ {
System.out.println("Calling EXPIRED-------------------->"); System.out.println("Calling EXPIRED-------------------->");
isInsert=true;
//Changed by Rohan on 3/7/12 //Changed by Rohan on 3/7/12
//retString = holdGen.generateHoldTrans( dataVal1, "EXPIRED","EXP", siteCode, stockExpList, "", conn ); //retString = holdGen.generateHoldTrans( dataVal1, "EXPIRED","EXP", siteCode, stockExpList, "", conn );
...@@ -613,6 +615,7 @@ public class NearExpirySchedule implements Schedule ...@@ -613,6 +615,7 @@ public class NearExpirySchedule implements Schedule
if ( stockNexpList.size() > 0 && count1 > 0 ) if ( stockNexpList.size() > 0 && count1 > 0 )
{ {
System.out.println("going to insert in inv_hold for NEAREXPIRY----> "); System.out.println("going to insert in inv_hold for NEAREXPIRY----> ");
isInsert=true;
//Changed by Rohan on 3/7/12 //Changed by Rohan on 3/7/12
//retString = holdGen.generateHoldTrans( dataVal2, "NEAREXPIRY","NEXP", siteCode, stockNexpList, "", conn ); //retString = holdGen.generateHoldTrans( dataVal2, "NEAREXPIRY","NEXP", siteCode, stockNexpList, "", conn );
retString = holdGen.generateHoldTrans( dataVal1, "NEAREXPIRY","NEXP", siteCode, stockNexpList, "", conn ); retString = holdGen.generateHoldTrans( dataVal1, "NEAREXPIRY","NEXP", siteCode, stockNexpList, "", conn );
...@@ -627,8 +630,9 @@ public class NearExpirySchedule implements Schedule ...@@ -627,8 +630,9 @@ public class NearExpirySchedule implements Schedule
{ {
if ( stockExpList.size() > 0 && count > 0 ) if ( stockExpList.size() > 0 && count > 0 )
{ {
remarksFlag="EXPR";
//retString = inventoryTransfer( stockExpList, "w_stock_transfer", xtraParams, conn ); //retString = inventoryTransfer( stockExpList, "w_stock_transfer", xtraParams, conn );
retString = inventoryTransfer( siteCodeExpeMap, "w_stock_transfer", xtraParams, conn );//Change by chandrashekar 0n 28-05-2015 retString = inventoryTransfer( siteCodeExpeMap, "w_stock_transfer", xtraParams, remarksFlag,conn );//Change by chandrashekar 0n 28-05-2015
} }
if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") ) if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") )
...@@ -639,9 +643,9 @@ public class NearExpirySchedule implements Schedule ...@@ -639,9 +643,9 @@ public class NearExpirySchedule implements Schedule
if ( stockNexpList.size() > 0 && count1 > 0) if ( stockNexpList.size() > 0 && count1 > 0)
{ {
remarksFlag="NEXP";
//retString = inventoryTransfer( stockNexpList, "w_stock_transfer", xtraParams, conn ); //retString = inventoryTransfer( stockNexpList, "w_stock_transfer", xtraParams, conn );
retString = inventoryTransfer( siteCodeNeExpeMap, "w_stock_transfer", xtraParams, conn );//Change by chandrashekar 0n 28-05-2015 retString = inventoryTransfer( siteCodeNeExpeMap, "w_stock_transfer", xtraParams,remarksFlag, conn );//Change by chandrashekar 0n 28-05-2015
} }
if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") ) if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") )
...@@ -682,11 +686,13 @@ public class NearExpirySchedule implements Schedule ...@@ -682,11 +686,13 @@ public class NearExpirySchedule implements Schedule
invAllocTrace = null; invAllocTrace = null;
//Changed by sumit on 05/07/12 change the condition. //Changed by sumit on 05/07/12 change the condition.
//if ( count == 0 ) //if ( count == 0 )
System.out.println("isInsert flag>>>>>"+isInsert);
if ( count == 0 && count1 == 0) if ( count == 0 && count1 == 0)
{ {
retString = itmDBAccess.getErrorString("","NODATAERR",""); retString = itmDBAccess.getErrorString("","NODATAERR","");
} }
else if ( !isError ) else if ( !isError && isInsert )
{ {
System.out.println("COMMITING the changes......"); System.out.println("COMMITING the changes......");
conn.commit(); conn.commit();
...@@ -730,7 +736,7 @@ public class NearExpirySchedule implements Schedule ...@@ -730,7 +736,7 @@ public class NearExpirySchedule implements Schedule
return retString; return retString;
} }
public String inventoryTransfer( HashMap<String , ArrayList<String>> siteCodeNeExpeMap, String windowName,String xtraParams, Connection conn ) throws RemoteException,ITMException public String inventoryTransfer( HashMap<String , ArrayList<String>> siteCodeNeExpeMap, String windowName,String xtraParams,String remarksFlag, Connection conn ) throws RemoteException,ITMException
{ {
String salesPerson = ""; String salesPerson = "";
String itemCode = ""; String itemCode = "";
...@@ -859,7 +865,7 @@ public class NearExpirySchedule implements Schedule ...@@ -859,7 +865,7 @@ public class NearExpirySchedule implements Schedule
for ( int ctr = 0; ctr < stockList.size(); ctr++ ) for ( int ctr = 0; ctr < stockList.size(); ctr++ )
{ {
lineNo++; //lineNo++;
HashMap dataMap = null; HashMap dataMap = null;
dataMap = (HashMap) stockList.get(ctr); dataMap = (HashMap) stockList.get(ctr);
itemCode = ""; itemCode = "";
...@@ -874,7 +880,17 @@ public class NearExpirySchedule implements Schedule ...@@ -874,7 +880,17 @@ public class NearExpirySchedule implements Schedule
quantity = 0d; quantity = 0d;
allocQty = 0d; allocQty = 0d;
noArt = 0d; noArt = 0d;
System.out.println("lineNo>>>>>>"+lineNo); if (dataMap.get("quantity") != null)
{
quantity = Double.parseDouble(dataMap.get("quantity").toString());
}
if (dataMap.get("alloc_qty") != null)
{
allocQty = Double.parseDouble(dataMap.get("alloc_qty").toString());
}
if((quantity - allocQty)>0)
{
lineNo++;
xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"stock_transfer\" objContext=\"2\">"); xmlBuff.append("<Detail2 dbID='' domID=\"1\" objName=\"stock_transfer\" objContext=\"2\">");
xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />"); xmlBuff.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />");
xmlBuff.append("<tran_id/>"); xmlBuff.append("<tran_id/>");
...@@ -882,8 +898,8 @@ public class NearExpirySchedule implements Schedule ...@@ -882,8 +898,8 @@ public class NearExpirySchedule implements Schedule
if (dataMap.get("item_code") != null) if (dataMap.get("item_code") != null)
{ {
itemCode=(String) dataMap.get("item_code"); itemCode = (String) dataMap.get("item_code");
xmlBuff.append("<item_code><![CDATA["+ (String)dataMap.get("item_code") +"]]></item_code>"); xmlBuff.append("<item_code><![CDATA[" + (String) dataMap.get("item_code") + "]]></item_code>");
} }
if (dataMap.get("site_code") != null) if (dataMap.get("site_code") != null)
{ {
...@@ -891,52 +907,47 @@ public class NearExpirySchedule implements Schedule ...@@ -891,52 +907,47 @@ public class NearExpirySchedule implements Schedule
} }
if (dataMap.get("loc_code") != null) if (dataMap.get("loc_code") != null)
{ {
locCode=(String)dataMap.get("loc_code"); locCode = (String) dataMap.get("loc_code");
xmlBuff.append("<loc_code__fr><![CDATA["+ (String)dataMap.get("loc_code") +"]]></loc_code__fr>"); xmlBuff.append("<loc_code__fr><![CDATA[" + (String) dataMap.get("loc_code") + "]]></loc_code__fr>");
} }
if (dataMap.get("loc_code__to") != null) if (dataMap.get("loc_code__to") != null)
{ {
xmlBuff.append("<loc_code__to><![CDATA["+ (String)dataMap.get("loc_code__to") +"]]></loc_code__to>"); locCodeTo = (String) dataMap.get("loc_code__to");
xmlBuff.append("<loc_code__to><![CDATA[" + (String) dataMap.get("loc_code__to") + "]]></loc_code__to>");
} }
if (dataMap.get("lot_no") != null) if (dataMap.get("lot_no") != null)
{ {
lotNo=(String)dataMap.get("lot_no"); lotNo = (String) dataMap.get("lot_no");
xmlBuff.append("<lot_no__fr><![CDATA["+ (String)dataMap.get("lot_no") +"]]></lot_no__fr>"); xmlBuff.append("<lot_no__fr><![CDATA[" + (String) dataMap.get("lot_no") + "]]></lot_no__fr>");
xmlBuff.append("<lot_no__to><![CDATA["+ (String)dataMap.get("lot_no") +"]]></lot_no__to>"); xmlBuff.append("<lot_no__to><![CDATA[" + (String) dataMap.get("lot_no") + "]]></lot_no__to>");
} }
if (dataMap.get("lot_sl") != null) if (dataMap.get("lot_sl") != null)
{ {
lotSl=(String)dataMap.get("lot_sl"); lotSl = (String) dataMap.get("lot_sl");
xmlBuff.append("<lot_sl__fr><![CDATA["+ (String)dataMap.get("lot_sl") +"]]></lot_sl__fr>"); xmlBuff.append("<lot_sl__fr><![CDATA[" + (String) dataMap.get("lot_sl") + "]]></lot_sl__fr>");
xmlBuff.append("<lot_sl__to><![CDATA["+ (String)dataMap.get("lot_sl") +"]]></lot_sl__to>"); xmlBuff.append("<lot_sl__to><![CDATA[" + (String) dataMap.get("lot_sl") + "]]></lot_sl__to>");
} }
if (dataMap.get("quantity") != null)
{ xmlBuff.append("<quantity><![CDATA[" + (quantity - allocQty) + "]]></quantity>");
quantity = Double.parseDouble(dataMap.get("quantity").toString());
}
if (dataMap.get("alloc_qty") != null)
{
allocQty = Double.parseDouble(dataMap.get("alloc_qty").toString());
}
xmlBuff.append("<quantity><![CDATA["+ (quantity - allocQty) +"]]></quantity>");
if (dataMap.get("no_art") != null) if (dataMap.get("no_art") != null)
{ {
noArt = Double.parseDouble(dataMap.get("no_art").toString()); noArt = Double.parseDouble(dataMap.get("no_art").toString());
xmlBuff.append("<no_art><![CDATA["+ noArt +"]]></no_art>"); xmlBuff.append("<no_art><![CDATA[" + noArt + "]]></no_art>");
} }
if (dataMap.get("acct_code__inv") != null) if (dataMap.get("acct_code__inv") != null)
{ {
xmlBuff.append("<acct_code__cr><![CDATA["+ (String)dataMap.get("acct_code__inv") +"]]></acct_code__cr>"); xmlBuff.append("<acct_code__cr><![CDATA[" + (String) dataMap.get("acct_code__inv") + "]]></acct_code__cr>");
xmlBuff.append("<acct_code__dr><![CDATA["+ (String)dataMap.get("acct_code__inv") +"]]></acct_code__dr>"); xmlBuff.append("<acct_code__dr><![CDATA[" + (String) dataMap.get("acct_code__inv") + "]]></acct_code__dr>");
} }
if (dataMap.get("cctr_code__inv") != null) if (dataMap.get("cctr_code__inv") != null)
{ {
xmlBuff.append("<cctr_code__dr><![CDATA["+ (String)dataMap.get("cctr_code__inv") +"]]></cctr_code__dr>"); xmlBuff.append("<cctr_code__dr><![CDATA[" + (String) dataMap.get("cctr_code__inv") + "]]></cctr_code__dr>");
xmlBuff.append("<cctr_code__cr><![CDATA["+ (String)dataMap.get("cctr_code__inv") +"]]></cctr_code__cr>"); xmlBuff.append("<cctr_code__cr><![CDATA[" + (String) dataMap.get("cctr_code__inv") + "]]></cctr_code__cr>");
} }
xmlBuff.append("</Detail2>"); xmlBuff.append("</Detail2>");
} }
}
xmlBuff.append("</Header0>"); xmlBuff.append("</Header0>");
xmlBuff.append("</group0>"); xmlBuff.append("</group0>");
xmlBuff.append("</DocumentRoot>"); xmlBuff.append("</DocumentRoot>");
...@@ -958,7 +969,8 @@ public class NearExpirySchedule implements Schedule ...@@ -958,7 +969,8 @@ public class NearExpirySchedule implements Schedule
System.out.println("retString from conf ::" + retString); System.out.println("retString from conf ::" + retString);
if (retString.indexOf("CONFSUCC") > -1) if (retString.indexOf("CONFSUCC") > -1)
{ {
retString=updateQcOrder(siteCode,itemCode,lotNo,locCode,lotSl,conn); isInsert =true;
retString=updateQcOrder(stockList,siteCode,itemCode,lotNo,locCode,lotSl,remarksFlag,locCodeTo,conn);
} }
} }
...@@ -999,25 +1011,52 @@ public class NearExpirySchedule implements Schedule ...@@ -999,25 +1011,52 @@ public class NearExpirySchedule implements Schedule
System.out.println("retString........:: " + retString); System.out.println("retString........:: " + retString);
return retString; return retString;
} }
private String updateQcOrder(String siteCode, String itemCode,String lotNo, String locCode,String lotSl,Connection conn) private String updateQcOrder( ArrayList stockList,String siteCode, String itemCode,String lotNo, String locCode,String lotSl,String remarksFlag,String locCodeTo,Connection conn)
{ {
String errString = "", sql = "", reString = "",qcLotsl=""; String errString = "", sql = "", reString = "",qcLotsl="";
String listSiteCode = "",qorderNo=""; String listSiteCode = "",qorderNo="",remarks="";
double quantity = 0d,qtyPassed=0d,qtyRejected=0d,qtySample=0d,updateQty=0d; double quantity = 0d,qtyPassed=0d,qtyRejected=0d,qtySample=0d,updateQty=0d;
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
int updCnt1=0,updCnt=0,cnt1=0; int updCnt1=0,updCnt=0,cnt1=0;
DistCommon distComm = new DistCommon();
try try
{ {
for ( int ctr = 0; ctr < stockList.size(); ctr++ )
{
HashMap dataMap2 = null;
dataMap2 = (HashMap) stockList.get(ctr);
itemCode = "";
siteCode = "";
locCode = "";
lotNo = "";
lotSl = "";
locCodeTo = "";
remarks="";
quantity = 0d;
qtyPassed=0d;
if (dataMap2.get("item_code") != null)
{
itemCode = (String) dataMap2.get("item_code");
}
if (dataMap2.get("site_code") != null)
{
siteCode = (String) dataMap2.get("site_code");
}
if (dataMap2.get("lot_no") != null)
{
lotNo = (String) dataMap2.get("lot_no");
}
if (dataMap2.get("loc_code__to") != null)
{
locCodeTo=(String)dataMap2.get("loc_code__to");
}
sql = "select qorder_no,quantity,qty_passed,qty_rejected,qty_sample,lot_sl from qc_order where site_code = ? " sql = "select qorder_no,quantity,qty_passed,qty_rejected,qty_sample,lot_sl from qc_order where site_code = ? "
//+ " and item_code = ? and lot_no= ? and status='U' and loc_code= ? ";
+ " and item_code = ? and lot_no= ? and status='U' "; + " and item_code = ? and lot_no= ? and status='U' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
pstmt.setString(2, itemCode); pstmt.setString(2, itemCode);
pstmt.setString(3, lotNo); pstmt.setString(3, lotNo);
//pstmt.setString(4, lotSl);
//pstmt.setString(4, locCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
...@@ -1028,14 +1067,14 @@ public class NearExpirySchedule implements Schedule ...@@ -1028,14 +1067,14 @@ public class NearExpirySchedule implements Schedule
qtySample = rs.getDouble("qty_sample"); qtySample = rs.getDouble("qty_sample");
qcLotsl = checkNull(rs.getString("lot_sl")); qcLotsl = checkNull(rs.getString("lot_sl"));
System.out.println("qorderNo>>>>"+qorderNo); System.out.println("qorderNo>>>>" + qorderNo);
System.out.println("qcLotsl>>>>"+qcLotsl); System.out.println("qcLotsl>>>>" + qcLotsl);
} }
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
rs.close(); rs.close();
rs = null; rs = null;
if(qcLotsl.trim().length()>0) if (qcLotsl.trim().length() > 0)
{ {
if (!qcLotsl.equalsIgnoreCase(lotSl)) if (!qcLotsl.equalsIgnoreCase(lotSl))
{ {
...@@ -1045,11 +1084,18 @@ public class NearExpirySchedule implements Schedule ...@@ -1045,11 +1084,18 @@ public class NearExpirySchedule implements Schedule
if (qtyPassed > 0) if (qtyPassed > 0)
{ {
updateQty = quantity - qtyPassed; updateQty = quantity - qtyPassed;
System.out.println("updateQty for qcLotsl>>>>>" + updateQty); if ("EXPR".equalsIgnoreCase(remarksFlag))
sql = "update qc_order set test_stat = 'X',quantity= ?,qty_passed=0 where qorder_no = ? "; {
remarks = "Expired material transferred to " + locCodeTo + " location";
} else
{
remarks = "Near expired material transferred to " + locCodeTo + " location";
}
sql = "update qc_order set test_stat = 'X',quantity= ?,qty_passed=0 ,remarks=? where qorder_no = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, updateQty); pstmt.setDouble(1, updateQty);
pstmt.setString(2, qorderNo); pstmt.setString(2, remarks);
pstmt.setString(3, qorderNo);
updCnt = pstmt.executeUpdate(); updCnt = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -1081,17 +1127,24 @@ public class NearExpirySchedule implements Schedule ...@@ -1081,17 +1127,24 @@ public class NearExpirySchedule implements Schedule
} }
} }
} }
}else } else
{ {
if (qtyPassed > 0) if (qtyPassed > 0)
{ {
updateQty = quantity - qtyPassed; updateQty = quantity - qtyPassed;
System.out.println("updateQty>>>>>" + updateQty); if ("EXPR".equalsIgnoreCase(remarksFlag))
sql = "update qc_order set test_stat = 'X',quantity= ?,qty_passed=0 where qorder_no = ? "; {
remarks = "Expired material transferred to " + locCodeTo + " location";
} else
{
remarks = "Near expired material transferred to " + locCodeTo + " location";
}
sql = "update qc_order set test_stat = 'X',quantity= ?,qty_passed=0,remarks=? where qorder_no = ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, updateQty); pstmt.setDouble(1, updateQty);
pstmt.setString(2, qorderNo); pstmt.setString(2, remarks);
pstmt.setString(3, qorderNo);
updCnt = pstmt.executeUpdate(); updCnt = pstmt.executeUpdate();
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -1109,7 +1162,6 @@ public class NearExpirySchedule implements Schedule ...@@ -1109,7 +1162,6 @@ public class NearExpirySchedule implements Schedule
rs.close(); rs.close();
rs = null; rs = null;
System.out.println("qc_order_lots count>>>>>>>>>[" + cnt1 + "]");
if (cnt1 > 0) if (cnt1 > 0)
{ {
...@@ -1123,6 +1175,7 @@ public class NearExpirySchedule implements Schedule ...@@ -1123,6 +1175,7 @@ public class NearExpirySchedule implements Schedule
} }
} }
} }
}
} catch (Exception e) } 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