Commit 266a3603 authored by caluka's avatar caluka

unconfirmed qc_order is exist then then quatity passed update as zero


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98055 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1459f7cd
......@@ -550,6 +550,13 @@ public class NearExpirySchedule implements Schedule
{
isError = true;
}
//Start Added by chandrashekar on 29-may-2015
retString=updateQcOrder(siteCode,stockExpList,xtraParams,conn);
if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") )
{
isError = true;
}
//End added by chandrashekar on 29-may-2015
System.out.println("going to insert in inv_hold EXPIRED");
retString = holdGen.generateHoldTrans( dataVal2, "EXPIRED","EXP", siteCode, stockExpList, "", conn );
......@@ -574,6 +581,13 @@ public class NearExpirySchedule implements Schedule
System.out.println("stockNexpList.size() ["+stockNexpList.size()+"] and count1 -> ["+count1+"]");
if ( stockNexpList.size() > 0 && count1 > 0 )
{
//Start Added by chandrashekar on 29-may-2015
retString=updateQcOrder(siteCode,stockNexpList,xtraParams,conn);
if ( retString != null && retString.trim().length() > 0 && retString.trim().equalsIgnoreCase("ERROR") )
{
isError = true;
}
//End added by chandrashekar on 29-may-2015
System.out.println("going to insert in inv_hold for NEAREXPIRY----> ");
//Changed by Rohan on 3/7/12
//retString = holdGen.generateHoldTrans( dataVal2, "NEAREXPIRY","NEXP", siteCode, stockNexpList, "", conn );
......@@ -686,6 +700,155 @@ public class NearExpirySchedule implements Schedule
System.out.println("retString........:: " + retString);
return retString;
}
private String updateQcOrder(String siteCode, ArrayList stockList, String xtraParams, Connection conn)
{
String errString = "", sql = "", reString = "";
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 from qc_order where site_code = ? "
+ " and item_code = ? and lot_no= ? and lot_sl= ? and status='U' and loc_code= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, listSiteCode);
pstmt.setString(2, itemCode);
pstmt.setString(3, lotNo);
pstmt.setString(4, lotSl);
pstmt.setString(5, 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");
System.out.println("qorderNo>>>>"+qorderNo);
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
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
{
String salesPerson = "";
......
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