Commit be0ed026 authored by kshinde's avatar kshinde

bug fix independent demand gen process

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@181289 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 60b568e6
......@@ -121,7 +121,7 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
toDate = Timestamp.valueOf(genericUtility.getValidDateString(genericUtility.getColumnValue("to_date", Dom),
genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
sql = "Select site_code,item_code,due_date,sum(quantity),cust_code as quantity from PPPL_IND_DEMAND "
sql = "Select site_code,item_code,due_date,sum(quantity) as quantity,cust_code from PPPL_IND_DEMAND "
+ "where due_date <= ? and due_date >= ? group by site_code,item_code,due_date,cust_code";
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1, toDate);
......@@ -177,6 +177,11 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
}
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
Set<String> eachKey = indDemandrow.keySet();
System.out.println("custCodekeys[" + eachKey + "]");
for (String eachIndDemand : eachKey) {
......@@ -187,8 +192,8 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
pstmt1 = conn.prepareStatement(sql1);
pstmt1.setString(1, keyData[0]);
pstmt1.setString(2, keyData[1]);
Timestamp dueDateTimestmp = java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(keyData[2],
genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
Timestamp dueDateTimestmp = Timestamp.valueOf(genericUtility.getValidDateString(keyData[2],
genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");;
pstmt1.setTimestamp(3, dueDateTimestmp);
rs1 = pstmt1.executeQuery();
if (rs1.next()) {
......@@ -237,7 +242,7 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
xmlBuff.append("<due_date><![CDATA[" + keyData[2] + "]]></due_date>");
xmlBuff.append("<site_code><![CDATA[" + keyData[0] + "]]></site_code>");
xmlBuff.append("<item_code><![CDATA[" + keyData[1] + "]]></item_code>");
xmlBuff.append("<quantity><![CDATA[" + indDemandrow.get(eachKey) + "]]></quantity>");
xmlBuff.append("<quantity><![CDATA[" + indDemandrow.get(eachIndDemand) + "]]></quantity>");
xmlBuff.append("</Detail1>");
xmlBuff.append("</Header0>");
xmlBuff.append("</group0>");
......@@ -248,12 +253,12 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
retString = saveData(loginSite, xmlString, userId, conn);
} else {
qtyStdUom1 = distCommon.getConvQuantityFact(unit, unitStd, itemCode, quantity, convQtyStduom, conn);
qtyStdUom1 = distCommon.getConvQuantityFact(unit, unitStd, keyData[1], indDemandrow.get(eachIndDemand), convQtyStduom, conn);
qtyStdUom = Double.parseDouble((String) qtyStdUom1.get(1));
String sql2 = "Update independent_demand set quantity = ? , quantity__std_uom= ? where tran_id= ? ";
pstmt1 = conn.prepareStatement(sql2);
pstmt1.setDouble(1, quantity);
pstmt1.setDouble(1, indDemandrow.get(eachIndDemand));
pstmt1.setDouble(2, qtyStdUom);
pstmt1.setString(3, tranID);
updcnt = pstmt1.executeUpdate();
......@@ -261,7 +266,7 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
}
if (updcnt > 0 || retString.indexOf("Success") > -1) {
if (updcnt > 0 || retString.indexOf("Success") > -1 || retString==null) {
// conn.commit();
cntr++;
System.out.println("Connection Commited");
......@@ -276,7 +281,7 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
if (cntr > 0) {
conn.commit();
errString = itmDBAccessEJB.getErrorString("", "NODATAERR", "", "", conn);
errString = itmDBAccessEJB.getErrorString("", "VMSUCC", "", "", conn);
} else if (cnt <= 0) {
errString = itmDBAccessEJB.getErrorString("", "NODATAERR", "", "", conn);
......@@ -398,9 +403,7 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
if (!"C".equalsIgnoreCase(lstype)) {
sql = "select a.scheme_code from scheme_applicability a,scheme_applicability_det b"
+ " where a.scheme_code= b.scheme_code and a.item_code= ? and a.app_from<= ? and a.valid_upto>= ?"
+ " and (b.site_code= ? or b.state_code ? or b.count_code)";
sql = "select a.scheme_code from scheme_applicability a,scheme_applicability_det b where a.scheme_code= b.scheme_code and a.item_code= ? and a.app_from <= ? and a.valid_upto>= ? and (b.site_code= ? or b.state_code = ? or b.count_code= ?)";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, lsItemCodeOrd);
pstmt1.setTimestamp(2, tranDate);
......@@ -594,12 +597,14 @@ public class DemandGenPrc extends ProcessEJB implements DemandGenPrcLocal, Deman
minQty = rs1.getDouble("min_qty");
appMinQty = rs1.getDouble("app_min_qty");
appMaxQty = rs1.getDouble("app_max_qty");
DecimalFormat df = new DecimalFormat("################");
freeQty = Double.parseDouble(df.format(chrgQty / batchQty)) * qtyPer;
}
/*
* if(chrgQty >= appMinQty && chrgQty <= appMaxQty) {
*/
DecimalFormat df = new DecimalFormat("################");
freeQty = Double.parseDouble(df.format(chrgQty / batchQty)) * qtyPer;
/*
* } else { freeQty=0.0; }
......
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