Commit ed11e308 authored by cpatil's avatar cpatil

modify and created for available to promise


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97288 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 94f13599
......@@ -6,10 +6,11 @@ import java.util.Map;
import java.util.Set;
//import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
//import java.sql.Timestamp;
import java.text.SimpleDateFormat;
class ADPElement
class ADPElement implements Cloneable
{
private String itemCode;
private String siteCode;
......@@ -57,6 +58,7 @@ class ADPElement
private double batchQty = 0;
private double purcRate = 0;
private double qtStk = 0;//Added by chandrashekar 0n 11-08-14
private double ordDemand = 0;
......@@ -98,8 +100,27 @@ class ADPElement
private String bomCodeParent="";
private HashMap bomSet = null;
private ArrayList<String> orderList=new ArrayList<String>();
private double soDemand=0;
private double grossWeight = 0;
private String altitemPerc;
public void setAltitemPerc(String altitemPerc)
{
this.altitemPerc=altitemPerc;
}
public String getAltitemPerc()
{
return this.altitemPerc;
}
public ArrayList<String> getOrderList()
{
return this.orderList;
}
public void setOrderList(ArrayList<String> orderList)
{
this.orderList=orderList;
}
public void setbomSet(HashMap bomCode) //aded by cpatil on 09/06/14
{
......@@ -247,19 +268,65 @@ class ADPElement
public double getQtStk() {
return qtStk;
}
public void setSoDemand(double soDemand) {
this.soDemand = soDemand;
}
public double getSoDemand() {
return soDemand;
}
public void setQtStk(double qtStk) {
this.qtStk = qtStk;
}
//changed method arguments by sabyasachi 29-03-2011
public void setDemand(java.sql.Timestamp dueDate, double demand, String saleOrder, String lineNo)
public void setDemand(java.sql.Timestamp dueDate, double demand, String saleOrder, String itemCode) throws ITMException, Exception
//public void setDemand(java.sql.Timestamp dueDate, double demand)
{
System.out.println("Calling setDemand() for saleOrder["+saleOrder+"]lineNo["+lineNo+"]this.refId["+this.refId+"]");
System.out.println("Calling setDemand() for saleOrder["+saleOrder+"]itemCode["+itemCode+"]this.refId["+this.refId+"]");
this.demand += demand;
//this.saleOrder = saleOrder;//Uncommented by manoj dtd 25/12/2014
//this.lineNo = lineNo;//Uncommented by manoj dtd 25/12/2014
System.out.println("this.refId---"+this.refId);
System.out.println("saleOrder---"+saleOrder);
System.out.println("demand---["+demand+"]");
//Commented by manoj dtd 25/12/2014
String dueDateStr="";
genericUtility = GenericUtility.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
if( dueDate != null)
{
dueDateStr = sdf.format(dueDate);
System.out.println("@@@@@ dueDateStr["+dueDateStr+"]");
}
if(saleOrder!=null && saleOrder.trim().length()>0)
{
if(this.refId==null ||this.refId.trim().length()==0)
this.refId=saleOrder+"@"+itemCode+"@"+demand+"@"+dueDateStr;
else
this.refId+="~"+saleOrder+"@"+itemCode+"@"+demand+"@"+dueDateStr;
}
//updateTimeMrp(dueDate, demand, 0, 0, 0,saleOrder,lineNo);
updateTimeMrp(dueDate, demand, 0, 0, 0);
}
public void setDemand(java.sql.Timestamp dueDate, double demand, String saleOrder, String lineNo,boolean isDetailReq)
//public void setDemand(java.sql.Timestamp dueDate, double demand)
{
System.out.println("Calling setDemand() for saleOrder["+saleOrder+"]lineNo["+lineNo+"]this.refId["+this.refId+"]");
if(isDetailReq)
{
this.demand+= demand;
this.ordDemand=demand;
}
//this.saleOrder = saleOrder;
//this.lineNo = lineNo;
System.out.println("this.refId---"+this.refId);
System.out.println("saleOrder---"+saleOrder);
System.out.println("demand---["+demand+"]");
if(saleOrder!=null && saleOrder.trim().length()>0)
{
if(this.refId==null ||this.refId.trim().length()==0)
......@@ -273,6 +340,8 @@ class ADPElement
//updateTimeMrp(dueDate, demand, 0, 0, 0,saleOrder,lineNo);
updateTimeMrp(dueDate, demand, 0, 0, 0);
}
//changed method arguments by sabyasachi 29-03-2011 end
public double getDemand()
{
......@@ -679,6 +748,16 @@ class ADPElement
}
//added by cpatil on 03/05/14 end
public void setGrossWeight(double grossWeight)
{
this.grossWeight = grossWeight;
}
public double getGrossWeight()
{
return this.grossWeight;
}
//private void updateTimeMrp(java.sql.Timestamp dueDate, double demand, double supply, double stockQty, double othSupply, String saleOrder, String lineNo)
private void updateTimeMrp(java.sql.Timestamp dueDate, double demand, double supply, double stockQty, double othSupply)
{
......@@ -698,6 +777,7 @@ class ADPElement
{
timeMRP = (TimeMRP)timeMRPArr.get(ctr);
//if (timeMRP.getDueDate() != null && timeMRP.getSaleOrder().equals(saleOrder) && timeMRP.getLineNo().equals(lineNo))
System.out.println("772--timeMRP.getDueDate()["+timeMRP.getDueDate()+"]");
if (timeMRP.getDueDate() != null)
{
if (timeMRP.getDueDate().equals(dueDate))
......@@ -715,6 +795,7 @@ class ADPElement
timeMRP.setDueDate(dueDate);
//added by sabyasachi 29.03.2011
//timeMRP.setDemand(demand,saleOrder,lineNo);
System.out.println("@@@@@@@@@@@ timeMRP -1 setdemand["+demand+"]");
timeMRP.setDemand(demand);
//end added by sabyasachi 29.03.2011
timeMRP.setSupply(supply);
......@@ -804,6 +885,10 @@ class ADPElement
errString = e.getMessage();
}
}
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
private void updateIndependentDemand(java.sql.Timestamp dueDate, double demand)
{
String errString = "";
......
This diff is collapsed.
......@@ -20,4 +20,5 @@ public interface RunMRPWizLocal extends ValidatorLocal
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String getBomCodeList( String itemCode , String siteCode, String dbID) throws RemoteException,ITMException;
public String getOthersDetails( String othersDetails , String currentSOrder ) throws RemoteException,ITMException;
}
......@@ -20,4 +20,5 @@ public interface RunMRPWizRemote extends ValidatorRemote
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String getBomCodeList( String itemCode ,String siteCode, String dbID) throws RemoteException,ITMException;
public String getOthersDetails( String othersDetails , String currentSOrder ) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.mfg;
import ibase.utility.*;
import ibase.system.config.*;
import ibase.webitm.ejb.*;
import ibase.webitm.ejb.mfg.RequirementICRemote;
import ibase.webitm.utility.*;
import javax.servlet.http.*;
import java.io.*;
import javax.naming.InitialContext;
public class RunMrpOthersDetails
{
private ibase.utility.UserInfoBean userInfo = null;
private HttpSession sessionCtx = null;
ITMWizardStatefulRemote itmWizardRemote = null;
private String objName = "";
private String user_lang ="en";
private String user_country = "US";
public RunMrpOthersDetails ( String objName, HttpSession sessionCtx ) throws ITMException
{
try
{
this.objName = objName;
this.sessionCtx = sessionCtx;
this.userInfo = ( ibase.utility.UserInfoBean ) this.sessionCtx.getAttribute("USER_INFO");
this.user_lang = this.userInfo.getUserLanguage();
this.user_country = this.userInfo.getUserCountry();
if( this.itmWizardRemote == null )
{
InitialContext ctx = new InitialContext( new AppConnectParm().getProperty() );
this.itmWizardRemote = (ibase.webitm.ejb.ITMWizardStatefulRemote)ctx.lookup("ibase/ITMWizardStatefulEJB/remote");
this.itmWizardRemote.setUserInfo( this.userInfo );
this.itmWizardRemote.loadFormsMetaData( this.objName, "1", this.objName+"21", this.userInfo.getEmpCode(), this.userInfo.getProfileId() );
}
}
catch (ITMException itme)
{
itmWizardRemote.remove();
itmWizardRemote = null;
throw itme;
}
catch (Exception e)
{
itmWizardRemote.remove();
itmWizardRemote = null;
throw new ITMException(e);
}
}
public RunMrpOthersDetails () throws ITMException
{
}
//get item code pop help
public String getOthersDetails( String othersDetails , String currentSorder) throws ITMException
{
String OthersDetailsData = "";
RunMRPWizRemote runMRPWizRemote = null;
try
{
InitialContext ctx = new InitialContext( new AppConnectParm().getProperty() );
runMRPWizRemote = (ibase.webitm.ejb.mfg.RunMRPWizRemote)ctx.lookup("ibase/RunMRPWiz/remote");
OthersDetailsData = runMRPWizRemote.getOthersDetails(othersDetails , currentSorder);
runMRPWizRemote = null;
System.out.println("OthersDetailsData=="+OthersDetailsData);
String xslFileName = getXSLFileName( "mrp_others_details_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" );
//String xslFileName = getXSLFileName( "requirement_item_code_wiz_en_US.xsl" );
OthersDetailsData = ( new ibase.webitm.utility.GenericUtility() ).transformToString( xslFileName, OthersDetailsData, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
System.out.println("OthersDetailsData==="+OthersDetailsData);
}
catch ( Exception e )
{
throw new ITMException(e);
}
finally
{
if ( runMRPWizRemote != null )
{
runMRPWizRemote = null;
}
}
return OthersDetailsData;
}
private String getXSLFileName( String xslFileName )throws ITMException
{
String retFileName = null;
try
{
String defaultPath = null;
if( CommonConstants.APPLICATION_CONTEXT != null )
{
defaultPath = CommonConstants.APPLICATION_CONTEXT + CommonConstants.ITM_CONTEXT + File.separator;
}
else
{
defaultPath = ".." + File.separator + "webapps" + File.separator + "ibase" + File.separator + CommonConstants.ITM_CONTEXT + File.separator;
}
File xslPath = new File( defaultPath + File.separator + "xsl" + File.separator + CommonConstants.THEME + File.separator + "WIZARD");
if ( !xslPath.exists() )
{
xslPath.mkdir();
}
System.out.println( " xslPath [" + xslPath +"] xslFileName ["+xslFileName +"]");
File xslFile = new File(xslPath , xslFileName);
if( xslFile.exists() )
{
retFileName = xslFile.getAbsolutePath();
}
else
{
throw new ITMException( new Exception( retFileName + " Wizard XSL file Not Found") );
}
}
catch (Exception e)
{
throw new ITMException(e);
}
return retFileName;
}
}
......@@ -33,6 +33,8 @@ public class TimeMRP
//end added by sabyasachi 17.03.2011
boolean createDemand = false;
String saleOrder="";
double orderDemand=0;
public TimeMRP()
{
......@@ -54,12 +56,21 @@ public class TimeMRP
//changed method arguments by sabyasachi 29-03-2011
//public void setDemand(double demand,String saleOrder, String lineNo)
public void setDemand(double demand)
{
this.demand += demand;
//this.saleOrder = saleOrder;
//this.lineNo = lineNo;
}
public void setOrderDemand(double orderDemand)
{
this.orderDemand=orderDemand;
}
public double setOrderDemand()
{
return this.orderDemand;
}
//changed method definition by sabyasachi 29-03-2011 end
public double getDemand()
......
select item_code, due_date, round(sum(demand),0) demand, sum(supply) supply , sum(stock_qty) stock_qty, sum(oth_supply) oth_supply, sum(pending_po) pending_po ,sum(pending_do) pending_do, sum(pending_indent) pending_indent, sum(pending_dr) pending_dr,tran_id,tran_ser ,site_code from
(
SELECT a.site_code||'@'||d.item_code||'@'||a.lot_no||'@'||a.lot_sl||'@'||a.loc_code||'@'||(case when c.alloc_pref is null then 'X' else c.alloc_pref end) as tran_id,
'Stock' as tran_ser, d.item_code__plan as item_code,
FN_MRP_DUEDATE(timestamp('@fromdate@-00.00.00')) as due_date,
0 as demand,
(a.quantity-a.alloc_qty) as supply,(a.quantity-a.alloc_qty) as stock_qty,
0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr , a.site_code
FROM STOCK a, INVSTAT b , LOCATION c,item d
WHERE a.loc_code = c.loc_code
AND b.inv_stat = c.inv_stat
AND NVL(b.stat_type, ' ') <> @ordtypes@
and ( a.site_code || d.item_code__plan ) IN ( '@itemcode@' )
AND NVL(b.plan_prod,'N') = 'Y'
AND a.item_code=d.item_code
) alias
group by item_code,due_date ,tran_id,tran_ser,site_code
having sum(supply) <> 0
select item_code, due_date, 0 demand, sum(supply) supply , sum(stock_qty) stock_qty, sum(oth_supply) oth_supply, sum(pending_po) pending_po ,sum(pending_do) pending_do, sum(pending_indent) pending_indent, sum(pending_dr) pending_dr,tran_id,tran_ser ,site_code from
(
SELECT a.site_code||'@'||d.item_code||'@'||a.lot_no||'@'||a.lot_sl||'@'||a.loc_code||'@'||(case when c.alloc_pref is null then 'X' else c.alloc_pref end) as tran_id,
'Stock' as tran_ser, d.item_code__plan as item_code,
FN_MRP_DUEDATE(to_date('@fromdate@')) as due_date,
0 as demand,
(a.quantity-a.alloc_qty) as supply,(a.quantity-a.alloc_qty) as stock_qty,
0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr , a.site_code
FROM STOCK a, INVSTAT b , LOCATION c,item d
WHERE a.loc_code = c.loc_code
AND b.inv_stat = c.inv_stat
AND NVL(b.stat_type, ' ') <> @ordtypes@
and ( a.site_code || d.item_code__plan ) IN ( '@itemcode@' )
AND NVL(b.plan_prod,'N') = 'Y'
AND a.item_code=d.item_code
) alias
group by item_code,due_date ,tran_id,tran_ser,site_code
having sum(supply) <> 0
This diff is collapsed.
......@@ -37,6 +37,21 @@
( sales_demand.due_date <= to_date('@todate@')) AND
( 0 = @madetostock@ )
Group By item.item_code__plan,sales_demand.due_date
UNION ALL
SELECT item.item_code__plan as item_code,invtrace.tran_date as due_date,
sum(invtrace.eff_qty) as demand,
0 as supply , 0 as stock_qty, 0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr
FROM invtrace, item, location, invstat
WHERE ( invtrace.item_code = item.item_code ) and
( location.loc_code = invtrace.loc_code) and
( invstat.inv_stat = location.inv_stat) and
( invstat.stat_type <> 'S' ) and
( invtrace.site_code in ('@sitecode@') ) AND
( item.item_code__plan = '@itemcode@') AND
( invtrace.tran_date >= to_date('@fromdate@')) and
( invtrace.tran_date <= to_date('@rundate@')) and
( invtrace.ref_ser in ('D-ISS','S-DSP') )
Group By item.item_code__plan,invtrace.tran_date
UNION ALL
SELECT item.item_code__plan as item_code,distorder_det.due_date as due_date,
sum(case when qty_confirm is null then 0 else qty_confirm end - case when qty_shipped is null then 0 else qty_shipped end) as demand,
......@@ -113,14 +128,37 @@ FROM indent,item
( porder.pord_type not in (@ordtypes@) ) and
( porddet.dlv_date <= to_date('@todate@'))
Group By item.item_code__plan,porddet.dlv_date
UNION ALL
SELECT item.item_code__plan as item_code,FN_MRP_DUEDATE(to_date('@fromdate@')) as due_date,
0 as demand ,
DDF_INV_CLSTK_MRP('@sitecode@',item.item_code,to_date(fn_sysdate())) as supply,
DDF_INV_CLSTK_MRP('@sitecode@',item.item_code,to_date(fn_sysdate())) as stock_qty, 0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr
FROM item
WHERE item.item_code__plan= '@itemcode@'
and DDF_INV_CLSTK_MRP('@sitecode@',item.item_code,to_date(fn_sysdate())) > 0
UNION ALL
select item_code,due_date,sum(demand) demand,sum(supply) supply,sum(stock_qty) stock_qty,
sum(oth_supply) oth_supply,sum(pending_po) pending_po,sum(pending_do) pending_do,sum(pending_indent) pending_indent,
sum(pending_dr) pending_dr from
( SELECT d.item_code__plan as item_code,FN_MRP_DUEDATE(to_date('@fromdate@')) as due_date,0 as demand,
(a.quantity-a.alloc_qty) as supply,(a.quantity-a.alloc_qty) as stock_qty,
0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr
FROM STOCK a, INVSTAT b , LOCATION c,item d
WHERE a.loc_code = c.loc_code
AND b.inv_stat = c.inv_stat
AND NVL(b.stat_type, ' ') <> 'S'
AND a.site_code = '@sitecode@'
AND a.item_code = '@itemcode@'
AND NVL(b.plan_prod,'N') = 'Y'
AND a.item_code=d.item_code
UNION ALL
SELECT d.item_code__plan as item_code,FN_MRP_DUEDATE(to_date('@fromdate@')) as due_date,0 as demand,
NVL((eff_qty * -1),0) as supply,NVL((eff_qty * -1),0) as stock_qty,
0 as oth_supply, 0 as pending_po, 0 as pending_do, 0 as pending_indent, 0 as pending_dr
FROM INVTRACE a, LOCATION b, INVSTAT c,item d
WHERE a.loc_code = b.loc_code
AND b.inv_stat = c.inv_stat
AND NVL(c.stat_type, ' ') <> 'S'
AND a.item_code = '@itemcode@'
AND a.site_code = '@sitecode@'
AND NVL(c.plan_prod,'N') = 'Y'
AND a.item_code=d.item_code
AND a.EFF_date > to_date(fn_sysdate())) group by item_code,due_date
UNION ALL
SELECT item.item_code__plan as item_code,to_date('@fromdate@') as due_date,
0 as demand,
......@@ -160,4 +198,4 @@ FROM indent,item
)
group by item_code,due_date
having sum(demand) <> 0 or sum(supply) <> 0
\ No newline at end of file
having sum(demand) <> 0 or sum(supply) <> 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