Commit b48e4107 authored by prane's avatar prane

to update demand and supply in inv_dem_supp table for mrp summary data by calling common component.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@215348 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 02b958f2
......@@ -105,7 +105,13 @@ public class WorkorderRelease extends ProcessEJB implements WorkorderReleaseLoca
int count = 0,mfgLeadTime = 0;
java.sql.Timestamp dueDate = null, mfgDate = null, expDate = null, today = null, mfgDateWO = null, expDateWO = null, completionDate = null;
//oracle.jdbc.OracleConnection oracleConnection = null; change done by kunal on 12/Sep/13
/**Added by Pavan Rane 24dec19 start[to update demand/supply in summary table(RunMRP process) related changes]*/
String sqlWo = "", sqlWoBil = "", sqlSitm = "", tranSer = "", itemCodeBil = "";
PreparedStatement pstmtWo = null, pstmtWoBil = null, pstmtSitm = null;
ResultSet rsWo = null, rsWoBil = null, rsSitm = null;
double supply = 0.0;
double quantityBil = 0.0;//, allocQtyBil = 0.0, issQtyBil = 0.0, qtySub = 0.0;;
/**Added by Pavan Rane 24dec19 end[to update demand/supply in summary table(RunMRP process) related changes]*/
try
{
......@@ -208,6 +214,18 @@ public class WorkorderRelease extends ProcessEJB implements WorkorderReleaseLoca
}
/**Added by Pavan Rane 24dec19 start[to update demand/supply in summary table(RunMRP process) related changes]*/
InvDemSuppTraceBean invDemSupTrcBean = new InvDemSuppTraceBean();
HashMap demandSupplyMap = new HashMap();
sqlWo = " SELECT ((case when current_batch_qty is null then 0 else current_batch_qty end * case when yield_perc is null then 100 else yield_perc end / 100 ) - case when quantity__rcvd is null then 0 else quantity__rcvd end ) as supply "
+ " FROM workorder WHERE work_order = ? ";
pstmtWo = conn.prepareStatement( sqlWo );
sqlWoBil = "select item_code, quantity from workorder_bill where work_order = ? and line_type <> 'B' ";
pstmtWoBil = conn.prepareStatement( sqlWoBil );
sqlSitm = "select case when rtrim(supp_sour) = 'M' then 'W-BIL' when rtrim(supp_sour) = 'P' then 'Indend' else '???' end as tran_ser "
+ " from siteitem where site_code = ? and item_code = ?";
pstmtSitm = conn.prepareStatement( sqlSitm );
/**Added by Pavan Rane 24dec19 end[to update demand/supply in summary table(RunMRP process) related changes]*/
for(int i =0;i<workOrderList.size();i++)
{
workOrder=(String) workOrderList.get(i);
......@@ -512,13 +530,94 @@ public class WorkorderRelease extends ProcessEJB implements WorkorderReleaseLoca
{
System.out.println(">>>>>>>>>>>>>>>>Count from update:"+count);
updateFlag=true;
/**Added by Pavan Rane 24dec19 start[to update demand/supply in summary table(RunMRP process) related changes]*/
pstmtWo.setString(1,workOrder);
rsWo = pstmtWo.executeQuery();
if( rsWo.next() )
{
supply = rsWo.getDouble("supply");
}
rsWo.close(); rsWo = null;
pstmtWo.clearParameters();
demandSupplyMap.put("site_code", siteCode);
demandSupplyMap.put("item_code", itemCode);
demandSupplyMap.put("ref_ser", "W-ORD");
demandSupplyMap.put("ref_id", workOrder);
demandSupplyMap.put("ref_line", "NA");
demandSupplyMap.put("due_date", dueDate);
demandSupplyMap.put("demand_qty", 0.0);
demandSupplyMap.put("supply_qty", supply);
demandSupplyMap.put("change_type", "A");
demandSupplyMap.put("chg_process", "T");
demandSupplyMap.put("chg_user", genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
demandSupplyMap.put("chg_term", genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
errString = invDemSupTrcBean.updateDemandSupply(demandSupplyMap, conn);
if(errString != null && errString.trim().length() > 0)
{
System.out.println("errString["+errString+"]");
return errString;
}
pstmtWoBil.setString(1,workOrder);
rsWoBil = pstmtWoBil.executeQuery();
while( rsWoBil.next() )
{
itemCodeBil = rsWoBil.getString("item_code");
quantityBil = rsWoBil.getDouble("quantity");
pstmtSitm.setString(1,siteCode);
pstmtSitm.setString(2,itemCodeBil);
rsSitm = pstmtSitm.executeQuery();
if( rsSitm.next() )
{
tranSer = rsSitm.getString("tran_ser");
}
rsSitm.close(); rsSitm = null;
pstmtSitm.clearParameters();
if(quantityBil > 0)
{
demandSupplyMap.put("site_code", siteCode);
demandSupplyMap.put("item_code", itemCodeBil);
demandSupplyMap.put("ref_ser", tranSer);
demandSupplyMap.put("ref_id", workOrder);
demandSupplyMap.put("ref_line", "NA");
demandSupplyMap.put("due_date", dueDate);
demandSupplyMap.put("demand_qty", quantityBil);
demandSupplyMap.put("supply_qty", 0.0);
demandSupplyMap.put("change_type", "A");
demandSupplyMap.put("chg_process", "T");
demandSupplyMap.put("chg_user", genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"));
demandSupplyMap.put("chg_term", genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termId"));
errString = invDemSupTrcBean.updateDemandSupply(demandSupplyMap, conn);
if(errString != null && errString.trim().length() > 0)
{
System.out.println("errString["+errString+"]");
return errString;
}
}
}
rsWoBil.close(); rsWoBil = null;
pstmtWoBil.clearParameters();
/**Added by Pavan Rane 24dec19 end[to update with demand/supply in summary table(RunMRP process) related changes]*/
}
pstmtInsert.close();
pstmtInsert =null;
}
}
/**Added by Pavan Rane 24dec19 start[to update demand/supply in summary table(RunMRP process) related changes]*/
if (pstmtWo != null) {
pstmtWo.close(); pstmtWo = null;
}
if (pstmtWoBil != null) {
pstmtWoBil.close(); pstmtWoBil = null;
}
if (pstmtSitm != null) {
pstmtSitm.close(); pstmtSitm = null;
}
/**Added by Pavan Rane 24dec19 end[to update demand/supply in summary table(RunMRP process) related changes]*/
}
catch(SQLException ex)
{
......@@ -543,6 +642,26 @@ public class WorkorderRelease extends ProcessEJB implements WorkorderReleaseLoca
pstmtInsert.close();
pstmtInsert =null;
}
/**Added by Pavan Rane 24dec19 start[to update demand/supply in summary table(RunMRP process) related changes]*/
if (rsSitm != null) {
rsSitm.close(); rsSitm = null;
}
if (rsWoBil != null) {
rsWoBil.close(); rsWoBil = null;
}
if (rsWo != null) {
rsWo.close(); rsWo = null;
}
if (pstmtSitm != null) {
pstmtSitm.close(); pstmtSitm = null;
}
if (pstmtWo != null) {
pstmtWo.close(); pstmtWo = null;
}
if (pstmtWoBil != null) {
pstmtWoBil.close(); pstmtWoBil = null;
}
/**Added by Pavan Rane 24dec19 end[to update demand/supply in summary table(RunMRP process) related changes]*/
/* if(oracleConnection != null)
{
oracleConnection.close();
......
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