Commit 85a9e6fb authored by prane's avatar prane

to check validity of scheme by duedate

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@203118 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1c9c005b
......@@ -161,7 +161,8 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
bomCode = getBomCode(itemCode, custCode, quantity, tranDate, siteCode, stateCode, countCode, conn);
// calculate free quantity
frQty = getFreeQty(bomCode, quantity, conn);
//frQty = getFreeQty(bomCode, quantity, conn);
frQty = getFreeQty(bomCode, quantity,dueDate, conn);
System.out.println("CustCode [" + custCode + "]BomCode [" + bomCode + "] FreeQty [" + frQty + "]");
quantity = quantity + frQty;
......@@ -566,9 +567,10 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
return lsSchemeCode;
}
public double getFreeQty(String schemeCode, Double chrgQty, Connection conn) throws RemoteException, ITMException {
//public double getFreeQty(String schemeCode, Double chrgQty, Connection conn) throws RemoteException, ITMException {
public double getFreeQty(String schemeCode, Double chrgQty, Timestamp dueDate, Connection conn) throws RemoteException, ITMException {
Double freeQty = 0.0d, batchQty = 0.0d, qtyPer = 0.0d, minQty = 0.0d, appMinQty = 0.0d, appMaxQty = 0.0d;
int cnt = 0;
int cnt = 0, validCnt = 0;
String sql = null, sql1 = null;
PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null, rs1 = null;
......@@ -584,8 +586,26 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
cnt = rs.getInt(1);
}
rs.close(); rs = null;
pstmt.close(); pstmt = null;
if (cnt != 0) {
//Pavan R 9jul19 start[to check validity of scheme by duedate]
sql = "select count(*) from scheme_applicability where scheme_code = ? and ? between app_from and valid_upto ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, schemeCode);
pstmt1.setTimestamp(2, dueDate);
rs1 = pstmt1.executeQuery();
if (rs1.next()) {
validCnt = rs1.getInt(1);
}
rs1.close(); rs1 = null;
pstmt1.close(); pstmt1 = null;
if(validCnt == 0)
{
freeQty = 0.0;
}
else
{ //Pavan R 9jul19 end
sql = "select bom.batch_qty,bomdet.qty_per,bomdet.min_qty ,bomdet.app_min_qty,bomdet.app_max_qty "
+ "from bom, bomdet where bom.bom_code = bomdet.bom_code and bomdet.bom_code = ? and bomdet.nature = 'F' ";
pstmt1 = conn.prepareStatement(sql);
......@@ -601,6 +621,9 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
DecimalFormat df = new DecimalFormat("################");
freeQty = Double.parseDouble(df.format(chrgQty / batchQty)) * qtyPer;
}
rs1.close(); rs1 = null;
pstmt1.close(); pstmt1 = null;
}
/*
* if(chrgQty >= appMinQty && chrgQty <= appMaxQty) {
*/
......
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