Commit 61d6c84a authored by caluka's avatar caluka

After confirm stock transfer then update qc order


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98094 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8072fb1d
...@@ -629,13 +629,6 @@ public class NearExpirySchedule implements Schedule ...@@ -629,13 +629,6 @@ public class NearExpirySchedule implements Schedule
{ {
//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, conn );//Change by chandrashekar 0n 28-05-2015
//Start Added by chandrashekar on 29-may-2015
if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") )
{
isError = true;
}
retString=updateQcOrder(siteCode,stockExpList,xtraParams,conn);
//End added by chandrashekar on 29-may-2015
} }
if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") ) if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") )
...@@ -649,13 +642,7 @@ public class NearExpirySchedule implements Schedule ...@@ -649,13 +642,7 @@ public class NearExpirySchedule implements Schedule
//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, conn );//Change by chandrashekar 0n 28-05-2015
//Start Added by chandrashekar on 29-may-2015
if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") )
{
isError = true;
}
retString=updateQcOrder(siteCode,stockNexpList,xtraParams,conn);
//End added by chandrashekar on 29-may-2015
} }
if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") ) if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") )
{ {
...@@ -742,209 +729,7 @@ public class NearExpirySchedule implements Schedule ...@@ -742,209 +729,7 @@ public class NearExpirySchedule implements Schedule
System.out.println("retString........:: " + retString); System.out.println("retString........:: " + retString);
return retString; return retString;
} }
private String updateQcOrder(String siteCode, ArrayList stockList, String xtraParams, Connection conn)
{
String errString = "", sql = "", reString = "",qcLotsl="";
String listSiteCode = "", itemCode = "", lotNo = "", lotSl = "",qorderNo="",locCode="";
double quantity = 0d,qtyPassed=0d,qtyRejected=0d,qtySample=0d,updateQty=0d;
ResultSet rs = null;
PreparedStatement pstmt = null;
try
{
HashMap dataMap1 = new HashMap();
System.out.println("stockList IN QC>>>>"+stockList);
for (int ctr = 0; ctr < stockList.size(); ctr++)
{
dataMap1 = (HashMap) stockList.get(ctr);
itemCode = "";
listSiteCode = "";
lotNo = "";
lotSl = "";
int updCnt=0,updCnt1=0,cnt=0,cnt1=0;
if (dataMap1.get("item_code") != null)
{
itemCode = (String) dataMap1.get("item_code");
}
if (dataMap1.get("site_code") != null)
{
listSiteCode = (String) dataMap1.get("site_code");
}
if (dataMap1.get("lot_no") != null)
{
lotNo = (String) dataMap1.get("lot_no");
}
if (dataMap1.get("lot_sl") != null)
{
lotSl = (String) dataMap1.get("lot_sl");
}
if (dataMap1.get("loc_code") != null)
{
locCode = (String) dataMap1.get("loc_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' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, listSiteCode);
pstmt.setString(2, itemCode);
pstmt.setString(3, lotNo);
//pstmt.setString(4, lotSl);
//pstmt.setString(4, locCode);
rs = pstmt.executeQuery();
if (rs.next())
{
qorderNo = rs.getString("qorder_no");
quantity = rs.getDouble("quantity");
qtyPassed = rs.getDouble("qty_passed");
qtyRejected = rs.getDouble("qty_rejected");
qtySample = rs.getDouble("qty_sample");
qcLotsl = checkNull(rs.getString("lot_sl"));
System.out.println("qorderNo>>>>"+qorderNo);
System.out.println("qcLotsl>>>>"+qcLotsl);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if(qcLotsl.trim().length()>0)
{
if (!qcLotsl.equalsIgnoreCase(lotSl))
{
System.out.println("lot sl mismatch");
} else
{
if (qtyPassed > 0)
{
updateQty = quantity - qtyPassed;
System.out.println("updateQty for qcLotsl>>>>>" + updateQty);
sql = "update qc_order set test_stat = 'X',quantity= ?,qty_passed=0 where qorder_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, updateQty);
pstmt.setString(2, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
sql = "select count(*) as count from qc_order_lots where qc_order=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, qorderNo);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt1 = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
System.out.println("qc_order_lots qcLotsl count>>>>>>>>>[" + cnt1 + "]");
if (cnt1 > 0)
{
sql = "update qc_order_lots set quantity=0 where qc_order = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, qorderNo);
updCnt1 = pstmt.executeUpdate();
System.out.println("updCnt1 qcLotsl>>>>>>" + updCnt1);
pstmt.close();
pstmt = null;
}
}
}
}else
{
if (qtyPassed > 0)
{
updateQty = quantity - qtyPassed;
System.out.println("updateQty>>>>>" + updateQty);
sql = "update qc_order set test_stat = 'X',quantity= ?,qty_passed=0 where qorder_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, updateQty);
pstmt.setString(2, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
sql = "select count(*) as count from qc_order_lots where qc_order=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, qorderNo);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt1 = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
System.out.println("qc_order_lots count>>>>>>>>>[" + cnt1 + "]");
if (cnt1 > 0)
{
sql = "update qc_order_lots set quantity=0 where qc_order = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, qorderNo);
updCnt1 = pstmt.executeUpdate();
System.out.println("updCnt1>>>>>>" + updCnt1);
pstmt.close();
pstmt = null;
}
}
}
}
} catch (Exception e)
{
e.printStackTrace();
try
{
conn.rollback();
} catch (Exception ee)
{
}
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
} finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
} catch (Exception e)
{
System.out.println("Exception" + e.getMessage());
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
return errString;
}
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, Connection conn ) throws RemoteException,ITMException
{ {
String salesPerson = ""; String salesPerson = "";
...@@ -1097,6 +882,7 @@ public class NearExpirySchedule implements Schedule ...@@ -1097,6 +882,7 @@ public class NearExpirySchedule implements Schedule
if (dataMap.get("item_code") != null) if (dataMap.get("item_code") != null)
{ {
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)
...@@ -1105,6 +891,7 @@ public class NearExpirySchedule implements Schedule ...@@ -1105,6 +891,7 @@ public class NearExpirySchedule implements Schedule
} }
if (dataMap.get("loc_code") != null) if (dataMap.get("loc_code") != null)
{ {
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)
...@@ -1113,11 +900,13 @@ public class NearExpirySchedule implements Schedule ...@@ -1113,11 +900,13 @@ public class NearExpirySchedule implements Schedule
} }
if (dataMap.get("lot_no") != null) if (dataMap.get("lot_no") != null)
{ {
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");
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>");
} }
...@@ -1167,6 +956,10 @@ public class NearExpirySchedule implements Schedule ...@@ -1167,6 +956,10 @@ public class NearExpirySchedule implements Schedule
retString = stockTranConf.confirm(tranIdForIssue, xtraParams, "", conn,false); retString = stockTranConf.confirm(tranIdForIssue, xtraParams, "", conn,false);
System.out.println("=====Its Confirmed====="); System.out.println("=====Its Confirmed=====");
System.out.println("retString from conf ::" + retString); System.out.println("retString from conf ::" + retString);
if (retString.indexOf("CONFSUCC") > -1)
{
retString=updateQcOrder(siteCode,itemCode,lotNo,locCode,lotSl,conn);
}
} }
} }
...@@ -1206,6 +999,180 @@ public class NearExpirySchedule implements Schedule ...@@ -1206,6 +999,180 @@ 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)
{
String errString = "", sql = "", reString = "",qcLotsl="";
String listSiteCode = "",qorderNo="";
double quantity = 0d,qtyPassed=0d,qtyRejected=0d,qtySample=0d,updateQty=0d;
ResultSet rs = null;
PreparedStatement pstmt = null;
int updCnt1=0,updCnt=0,cnt1=0;
try
{
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' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
pstmt.setString(2, itemCode);
pstmt.setString(3, lotNo);
//pstmt.setString(4, lotSl);
//pstmt.setString(4, locCode);
rs = pstmt.executeQuery();
if (rs.next())
{
qorderNo = rs.getString("qorder_no");
quantity = rs.getDouble("quantity");
qtyPassed = rs.getDouble("qty_passed");
qtyRejected = rs.getDouble("qty_rejected");
qtySample = rs.getDouble("qty_sample");
qcLotsl = checkNull(rs.getString("lot_sl"));
System.out.println("qorderNo>>>>"+qorderNo);
System.out.println("qcLotsl>>>>"+qcLotsl);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if(qcLotsl.trim().length()>0)
{
if (!qcLotsl.equalsIgnoreCase(lotSl))
{
System.out.println("lot sl mismatch");
} else
{
if (qtyPassed > 0)
{
updateQty = quantity - qtyPassed;
System.out.println("updateQty for qcLotsl>>>>>" + updateQty);
sql = "update qc_order set test_stat = 'X',quantity= ?,qty_passed=0 where qorder_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, updateQty);
pstmt.setString(2, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
sql = "select count(*) as count from qc_order_lots where qc_order=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, qorderNo);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt1 = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
System.out.println("qc_order_lots qcLotsl count>>>>>>>>>[" + cnt1 + "]");
if (cnt1 > 0)
{
sql = "update qc_order_lots set quantity=0 where qc_order = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, qorderNo);
updCnt1 = pstmt.executeUpdate();
System.out.println("updCnt1 qcLotsl>>>>>>" + updCnt1);
pstmt.close();
pstmt = null;
}
}
}
}else
{
if (qtyPassed > 0)
{
updateQty = quantity - qtyPassed;
System.out.println("updateQty>>>>>" + updateQty);
sql = "update qc_order set test_stat = 'X',quantity= ?,qty_passed=0 where qorder_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDouble(1, updateQty);
pstmt.setString(2, qorderNo);
updCnt = pstmt.executeUpdate();
pstmt.close();
pstmt = null;
sql = "select count(*) as count from qc_order_lots where qc_order=? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, qorderNo);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt1 = rs.getInt(1);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
System.out.println("qc_order_lots count>>>>>>>>>[" + cnt1 + "]");
if (cnt1 > 0)
{
sql = "update qc_order_lots set quantity=0 where qc_order = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, qorderNo);
updCnt1 = pstmt.executeUpdate();
System.out.println("updCnt1>>>>>>" + updCnt1);
pstmt.close();
pstmt = null;
}
}
}
} catch (Exception e)
{
e.printStackTrace();
try
{
conn.rollback();
} catch (Exception ee)
{
}
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
} finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
} catch (Exception e)
{
System.out.println("Exception" + e.getMessage());
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
return errString;
}
/*public String inventoryTransfer( ArrayList stockList, String windowName,String xtraParams, Connection conn ) throws RemoteException,ITMException /*public String inventoryTransfer( ArrayList stockList, String windowName,String xtraParams, Connection conn ) throws RemoteException,ITMException
{ {
......
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