Commit 50508a1c authored by prane's avatar prane

Changes merged to head

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@182739 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2742a752
package ibase.webitm.ejb.mfg;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
......@@ -450,9 +451,11 @@ class ADPElement implements Cloneable
public void setPlanSupply(java.sql.Timestamp dueDate, double supply)
{
System.out.println("Before SetPlanSupply itemCode["+itemCode+"] dueDate:["+dueDate+"] supply["+supply+"] planSupply["+planSupply+"]");
this.planSupply += supply;
//updateTimeMrp(dueDate, 0, supply, 0, 0," "," ");
updateTimeMrp(dueDate, 0, supply, 0, 0);
System.out.println("After SetPlanSupply itemCode["+itemCode+"] dueDate:["+dueDate+"] supply["+supply+"] planSupply["+planSupply+"]");
}
public double getPlanSupply()
{
......@@ -1033,6 +1036,10 @@ class ADPElement implements Cloneable
TimeMRP timeMRP = null;
try
{
//Added By Pavan Rane on 28MAR18[To Sort the TimeMRPList][Start]
System.out.println("Collections.sorting...."+dueDate);
Collections.sort(timeMRPArr, TimeMRP.timeMRPComparator);
//Added By Pavan Rane on 28MAR18[To Sort the TimeMRPList][End]
for (int ctr = 0; ctr < timeMRPArr.size(); ctr++)
{
timeMRP = (TimeMRP)timeMRPArr.get(ctr);
......@@ -1061,6 +1068,7 @@ class ADPElement implements Cloneable
System.out.println("@@@@@@1055 planSupply["+planSupply+"]");
runningPlanSupply = runningPlanSupply + planSupply;
timeMRP.setRunningPlanSupply(runningPlanSupply);
System.out.println("1069 runningPlanSupply ["+runningPlanSupply+"]");
// end 10-04-2006 manoharan
timeMRPArr.set(ctr, timeMRP);
}
......
......@@ -61,7 +61,7 @@ import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
//import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
......@@ -693,7 +693,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
else
{
//System.out.println("BASEElse 12/06/14 itemCodeTo [" + itemCodeTo + "] itemCodeMap [" + itemCodeMap +"]");
System.out.println("BASEElse 12/06/14 itemCodeTo [" + itemCodeTo + "] itemCodeMap [" + itemCodeMap +"]");
itemCodeMap.put(itemCodeTo, new Integer(itemCodeMap.size() + 1));
}
endTime = System.currentTimeMillis();
......@@ -6559,6 +6559,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
adpElement = mrpOptimize(adpElement);
adpeList.set(adpeCtr, adpElement);
System.out.println("~~~~adpeList~~~~["+adpeList+"]");
/*if(!isDetailReq)
{
......@@ -6660,17 +6661,34 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
if ((( supply - demand ) < reorderLevel && reorderLevel>0) || ((demand - supply)>0 && reorderLevel==0) )
{
ArrayList timeMRParr = adpElement.getTimeMrpList();
System.out.println(" 3323----timeMRParr.size()---"+timeMRParr.size());
//Added By Pavan R on 29/DEC/17 Start for sorting the timeMRParr by dueDate for madeToOrder item
Collections.sort(timeMRParr, TimeMRP.timeMRPComparator);
//Added By Pavan R on 29/DEC/17 End
System.out.println(" 6665----timeMRParr.size()---"+timeMRParr.size());
System.out.println(" 6666----timeMRParr---"+timeMRParr);
//Added By Pavan R on 27/DEC/17 End
//Added By Pavan R on 27/DEC/17 Start for sorting the timeMRParr by dueDate for madeToOrder item
//if(madeToOrder.equalsIgnoreCase("0") && (mfgType1.trim().equalsIgnoreCase("O") || mfgType1.trim().equalsIgnoreCase("D")))
//{
/*Commented By Pavan R on 28MAR18
* commented as and addded in updateRunningDemandSupply in AdpElement per manoharan sir
*
*/
//Collections.sort(timeMRParr, TimeMRP.timeMRPComparator);
//}
System.out.println("~~~~~~~~~~~~~~~before Sort~~~~~~~~~~~~~~~");
for (Object obj : timeMRParr)
{
TimeMRP timemrp =(TimeMRP)obj;
System.out.println("**** itemCode:["+itemCode+"] Demand:["+timemrp.getDemand()+"] Supply:["+timemrp.getSupply()+"] DueDate:["+timemrp.getDueDate()+"] PlanSupply["+timemrp.getPlanSupply()+"] RunningDemand:["+timemrp.getRunningDemand()+"] RunningSupply:["+timemrp.getRunningSupply()+"] RunningPlanSupply:["+timemrp.getRunningPlanSupply()+"]");
}
//Added By Pavan R on 27/DEC/17 End
for (int timeCtr = 0; timeCtr < timeMRParr.size(); timeCtr++)
{
TimeMRP timeMrp = (TimeMRP) timeMRParr.get(timeCtr);
runningDemand = timeMrp.getRunningDemand();
runningSupply = timeMrp.getRunningSupply();
runningPlanSupply = timeMrp.getRunningPlanSupply();
System.out.println("3337---runningDemand---"+runningDemand+"---runningSupply---"+runningSupply+"---runningPlanSupply---"+runningPlanSupply);
System.out.println("3337---itemCode--"+itemCode+"runningDemand---"+runningDemand+"---runningSupply---"+runningSupply+"---runningPlanSupply---"+runningPlanSupply);
if ((suppSour.equals("M")) || (suppSour.equals("C"))) // &&
// orderOpt.equals("B")
// )
......@@ -6781,7 +6799,9 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// System.out.println("Actual " +
// decFormat(runningDemand - runningSupply -
// runningPlanSupply) + " cal "+ decFormat(quantity) );
System.out.println("Before setPlanSupply --[1]-- DueDate:["+timeMrp.getDueDate()+"] itemCode:["+itemCode+"] Demand:["+timeMrp.getDemand()+"] Supply:["+timeMrp.getSupply()+"] PlanSupply["+timeMrp.getPlanSupply()+"] RunningDemand:["+timeMrp.getRunningDemand()+"] RunningSupply:["+timeMrp.getRunningSupply()+"] RunningPlanSupply:["+timeMrp.getRunningPlanSupply()+"]");
timeMrp.setPlanSupply(quantity);
System.out.println("After setPlanSupply --[1]-- DueDate:["+timeMrp.getDueDate()+"] itemCode:["+itemCode+"] Demand:["+timeMrp.getDemand()+"] Supply:["+timeMrp.getSupply()+"] PlanSupply["+timeMrp.getPlanSupply()+"] RunningDemand:["+timeMrp.getRunningDemand()+"] RunningSupply:["+timeMrp.getRunningSupply()+"] RunningPlanSupply:["+timeMrp.getRunningPlanSupply()+"]");
adpElement.setSupply(dueDate, 0); // for the sake of
// updating running
// demand, supplu &
......@@ -6937,7 +6957,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
return adpElement;// errString;
}
private ADPElement mrpOptimize(ADPElement adpElement,int cycle) throws RemoteException, ITMException
//commented By Pavan on 28MAR2018 as per manoharan Sir[Start]
/* private ADPElement mrpOptimize(ADPElement adpElement,int cycle) throws RemoteException, ITMException
{
String errString = "";
java.sql.Timestamp dueDate = null;
......@@ -7042,32 +7063,34 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
System.out.println("5963----quantity----["+quantity+"]");
}
/*
* else { System.out.println("Optimize site " + siteCode +
* " Item " + itemCode + " runDem " +
* decFormat(runningDemand) + " runSup " +
* decFormat(runningSupply) + " runPlanSup " +
* decFormat(runningPlanSupply) + " cal "+
* decFormat(quantity) ); }
*/
if (quantity > 0)
{
/*********************
*//*********************
* if((suppSour.equals("M")) || (suppSour.equals("C")))
* //&& orderOpt.equals("B") ) { quantity =
* Math.round((quantity * 100) / yieldPerc); } //
* 10-04-2006 manoharan
**********/
/*if (itemCode.trim().equalsIgnoreCase("BD0783"))
**********//*
if (itemCode.trim().equalsIgnoreCase("BD0783"))
{
System.out.println("Mrpoptimize site " + siteCode + " Item " + itemCode + " runDem " + decFormat(runningDemand) + " runSup " + decFormat(runningSupply) + " runPlanSup " + decFormat(runningPlanSupply) + " cal " + decFormat(quantity) + " Actual " + decFormat(runningDemand - runningSupply - runningPlanSupply));
}*/
}
// System.out.println("Actual " +
// decFormat(runningDemand - runningSupply -
// runningPlanSupply) + " cal "+ decFormat(quantity) );
System.out.println("Before setPlanSupply --[2]-- itemCode:["+itemCode+"] Demand:["+timeMrp.getDemand()+"] Supply:["+timeMrp.getSupply()+"] DueDate:["+timeMrp.getDueDate()+"] PlanSupply["+timeMrp.getPlanSupply()+"] RunningDemand:["+timeMrp.getRunningDemand()+"] RunningSupply:["+timeMrp.getRunningSupply()+"] RunningPlanSupply:["+timeMrp.getRunningPlanSupply()+"]");
timeMrp.setPlanSupply(quantity);
System.out.println("After setPlanSupply --[2]-- itemCode:["+itemCode+"] Demand:["+timeMrp.getDemand()+"] Supply:["+timeMrp.getSupply()+"] DueDate:["+timeMrp.getDueDate()+"] PlanSupply["+timeMrp.getPlanSupply()+"] RunningDemand:["+timeMrp.getRunningDemand()+"] RunningSupply:["+timeMrp.getRunningSupply()+"] RunningPlanSupply:["+timeMrp.getRunningPlanSupply()+"]");
adpElement.setSupply(dueDate, 0); // for the sake of
// updating running
// demand, supplu &
......@@ -7149,10 +7172,10 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// conn).toString();//Commented by Jiiten as per
// Kandarp Sir 13/11/06 -
//System.out.println("xmlString--------"+xmlString);//commented By Pavan R on 26/OCT/17
/*if (isBomReplace)
if (isBomReplace)
{
System.out.println("12/06/14 manohar xmlString [" + xmlString + "]");
}*/
}
retXMLStr = explodeBomObj.explodeBom(xmlString.toString()).toString(); // Added
// by
......@@ -7161,7 +7184,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
// -
//Added by Manoj dtd 30/04/2014 to set Alternate items in xml
/*String tmpAltitemlist="";
String tmpAltitemlist="";
for(int ctr=0;ctr<adpeList.size();ctr++)
{
ADPElement tmpADPElement=(ADPElement) adpeList.get(ctr);
......@@ -7171,15 +7194,15 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
}
}
retXMLStr=retXMLStr.substring(0, retXMLStr.length()-7);
retXMLStr=retXMLStr+tmpAltitemlist+"</Root>";*/
retXMLStr=retXMLStr+tmpAltitemlist+"</Root>";
//"<Detail><site_code>PL001</site_code><bom_code>M070400G.1</bom_code><item_code>US15012UVG</item_code><item_Ref>US15012UVG </item_Ref><quantity_Ref>825.0</quantity_Ref><quantity>528.0</quantity><due_date>2014-01-05</due_date><exp_lev>1.10.</exp_lev><operation>1</operation><crit_Item>Y</crit_Item><line_type>I</line_type></Detail>";
/*if (itemCode.trim().equals("BF21135"))
if (itemCode.trim().equals("BF21135"))
{
System.out.println("14012009 itemCode [" + itemCode + "] explodeBomObj retXMLStr [" + retXMLStr + "]");
}*/
}
if (xmlString == null || xmlString.toString().trim().length() == 0)
{
......@@ -7192,7 +7215,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
//System.out.println("BASE3474---adpElement.getMfgType()----"+adpElement.getMfgType());
if(isDetailReq)
{
/*ArrayList<String> orderList=new ArrayList<String>();
ArrayList<String> orderList=new ArrayList<String>();
orderList=adpElement.getOrderList();
if(orderList.size()>0)
{
......@@ -7209,7 +7232,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
System.out.println("adpElement.getSaleOrder() ["+adpElement.getSaleOrder()+"]");
System.out.println("adpElement.getLineNo() ["+adpElement.getLineNo()+"]");
updateDemand(retXMLStr, adpElement.getSaleOrder(), adpElement.getLineNo());
}*/
}
updateDemand(retXMLStr, adpElement.getSaleOrder(), adpElement.getLineNo());
}
else
......@@ -7236,7 +7259,8 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
throw new ITMException(e);
}
return adpElement;// errString;
}
}*/
//Pavan R Commented [END]
private void updateSupplySite(String siteCode, String itemCode, double quantity, java.sql.Timestamp dueDate) throws ITMException, Exception
{
ADPElement adpElement;
......@@ -7800,10 +7824,11 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{
dueDate = java.sql.Timestamp.valueOf(nodeValue + " 00:00:00");
sdate = nodeValue;
}
}
valueNode = valueNode.getNextSibling();
}
//Pavan R on 2k18-JAN-29 to check where dueDate is less than stockDate[End]
System.out.println("7825>>>DueDate["+dueDate+"]----stockDate:["+stockDate+"]---quantity["+quantity+"]");
......@@ -7846,7 +7871,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
{
index = indexOfADPElement(siteCode, itemCode, " ", " ");
}
System.out.println("oct-oct-17----index---after ["+index +"]");
System.out.println("oct-17----index---after ["+index +"]");
//Added by Pavan R on 2K18-Feb-08 [Start] demand is not set for some item
if (index == -1)
{
......@@ -12803,19 +12828,19 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
cell.setCellValue(HSSFDateUtil.getExcelDate(dueDate));
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy"));
cell.setCellStyle(cellStyle);*/
if(demand != 0 && dueDate.before(dateFrom))
/*if(demand != 0 && dueDate.before(dateFrom))
{
cell = row.getCell(13);
cell.setCellValue(HSSFDateUtil.getExcelDate(dueDate));
styleDateClr.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy"));
cell.setCellStyle(styleDateClr);
}else
{
{*/
cell = row.getCell(13);
cell.setCellValue(HSSFDateUtil.getExcelDate(dueDate));
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy"));
cell.setCellStyle(cellStyle);
}
//}
//Changed by Pavan R on 19/JAN/2K18[End]
row.getCell(14).setCellValue(planSupply);
......@@ -13831,14 +13856,13 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
pendPOQty = rs.getDouble(7);
tranId=rs.getString("tran_id");
tranSer=rs.getString("tran_ser");
//Commented by Pavan R on 19/JAN/2K18[Start]do not changes the dueDate from dateFrom
/*if (dueDate.compareTo(dateFrom) < 0)
{
dueDate = dateFrom;
}*/
//[End]Pavan R on 19/JAN/2K18
//commented by Pavan R on 19/JAN/2018[End]
ADPElement detADPElement=new ADPElement();
detADPElement.setSupply(dueDate, supply);
......@@ -14211,6 +14235,7 @@ public class RunMRPPrc extends ProcessEJB implements RunMRPPrcLocal, RunMRPPrcRe
rsItemCode = rs.getString(1);
rsSiteCode = rs.getString(13);
dueDate=rs.getTimestamp(2);
//Commented by Pavan R on 19/JAN/2K18[Start]do not changes the dueDate from dateFrom
/*if(dueDate.compareTo(today)<0)
{
......
......@@ -4,9 +4,10 @@ import ibase.webitm.ejb.mfg.TimeMRP;
//import java.util.ArrayList;
//import java.sql.Timestamp;
import ibase.webitm.utility.ITMException;
import java.text.SimpleDateFormat;
import java.util.Comparator;
public class TimeMRP
{
private java.sql.Timestamp dueDate;
......@@ -124,9 +125,17 @@ public class TimeMRP
{
return this.runningSupply;
}
public void setPlanSupply(double supply)
public void setPlanSupply(double supply) throws ITMException
{
this.planSupply += supply;
//Pavan R on Marcch2018 added below chnages
System.out.println("runningDemand:["+this.runningDemand+"]planSupply["+this.planSupply+"]");
if(this.runningDemand <= 0 ) //this.planSupply)
{
throw new ITMException(new Exception("runningDemand is less than planSupply"));
}
//end
}
public double getPlanSupply()
{
......@@ -202,20 +211,20 @@ public class TimeMRP
//{
// return this.lineNo;
//}
//end added by sabyasachi 17.03.2011
//end added by sabyasachi 17.03.2011
//Added By Pavan R on 29/DEC/17 Start for sorting the timeMRParr by dueDate for madeToOrder item
public static Comparator<TimeMRP> timeMRPComparator = new Comparator<TimeMRP>() {
public static Comparator<TimeMRP> timeMRPComparator = new Comparator<TimeMRP>() {
public int compare(TimeMRP s1, TimeMRP s2)
{
System.out.println("inside comparator["+s1.getDueDate()+"]["+s2.getDueDate()+"]");
//ascending order
return s1.getDueDate().compareTo(s2.getDueDate());
//descending order
//return KeyMRPBean2.compareTo(KeyMRPBean1);
}
};
//Collections.sort(timeMRPArr, TimeMRP.timeMRPComparator);
//Added By Pavan R on 29/DEC/17 End
public int compare(TimeMRP s1, TimeMRP s2)
{
System.out.println("inside comparator["+s1.getDueDate()+"]["+s2.getDueDate()+"]");
//ascending order
return s1.getDueDate().compareTo(s2.getDueDate());
//descending order
//return KeyMRPBean2.compareTo(KeyMRPBean1);
}
};
//Collections.sort(timeMRPArr, TimeMRP.timeMRPComparator);
//Added By Pavan R on 29/DEC/17 End
}
\ No newline at end of file
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