[ 1999230 ] Add Safety Stock in Create Planning Data

http://sourceforge.net/tracker/index.php?func=detail&aid=1999230&group_id=176962&atid=879335
This commit is contained in:
vpj-cd 2008-06-25 03:00:34 +00:00
parent cfd9fd4484
commit b647cd38cb
1 changed files with 25 additions and 7 deletions

View File

@ -56,6 +56,7 @@ public class CreateProductPlanning extends SvrProcess
private BigDecimal p_WorkingTime = Env.ZERO; private BigDecimal p_WorkingTime = Env.ZERO;
private int p_Yield = 0; private int p_Yield = 0;
private int m_AD_Org_ID = 0; private int m_AD_Org_ID = 0;
private int m_AD_Client_ID = 0;
@ -66,6 +67,8 @@ public class CreateProductPlanning extends SvrProcess
*/ */
protected void prepare() protected void prepare()
{ {
m_AD_Client_ID = Env.getAD_Client_ID(getCtx());
ProcessInfoParameter[] para = getParameter(); ProcessInfoParameter[] para = getParameter();
@ -182,13 +185,24 @@ public class CreateProductPlanning extends SvrProcess
*/ */
protected String doIt() throws Exception protected String doIt() throws Exception
{ {
String sql = "SELECT p.M_Product_ID , p.M_Product_Category_ID FROM M_Product p WHERE p.M_Product_Category_ID = ? "; String sql = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
if (p_M_Product_Category_ID > 0 )
sql = "SELECT p.M_Product_ID FROM M_Product p WHERE p.AD_Client_ID= ? AND p.M_Product_Category_ID = ? ";
else
sql = "SELECT p.M_Product_ID FROM M_Product p WHERE p.AD_Client_ID= ? ";
try try
{ {
pstmt = DB.prepareStatement (sql,get_TrxName()); pstmt = DB.prepareStatement (sql,get_TrxName());
pstmt.setInt(1, p_M_Product_Category_ID); if (p_M_Product_Category_ID > 0 )
{
pstmt.setInt(1, m_AD_Client_ID);
pstmt.setInt(2, p_M_Product_Category_ID);
}
else
pstmt.setInt(1, m_AD_Client_ID);
ResultSet rs = pstmt.executeQuery (); ResultSet rs = pstmt.executeQuery ();
while (rs.next()) while (rs.next())
{ {
@ -198,6 +212,7 @@ public class CreateProductPlanning extends SvrProcess
if (pp==null && ( p_S_Resource_ID == 0 || p_M_Warehouse_ID == 0 )) if (pp==null && ( p_S_Resource_ID == 0 || p_M_Warehouse_ID == 0 ))
{ {
pp = new MPPProductPlanning(getCtx(),0,get_TrxName()); pp = new MPPProductPlanning(getCtx(),0,get_TrxName());
pp.setAD_Org_ID(0);
pp.setM_Product_ID(rs.getInt(1)); pp.setM_Product_ID(rs.getInt(1));
pp.setDD_NetworkDistribution_ID (p_DD_NetworkDistribution_ID); pp.setDD_NetworkDistribution_ID (p_DD_NetworkDistribution_ID);
pp.setAD_Workflow_ID(p_AD_Workflow_ID); pp.setAD_Workflow_ID(p_AD_Workflow_ID);
@ -206,6 +221,7 @@ public class CreateProductPlanning extends SvrProcess
pp.setIsMPS(p_MPS); pp.setIsMPS(p_MPS);
pp.setIsPhantom(false); pp.setIsPhantom(false);
pp.setIsRequiredMRP(true); pp.setIsRequiredMRP(true);
pp.setIsRequiredDRP(true);
pp.setM_Warehouse_ID(p_M_Warehouse_ID); pp.setM_Warehouse_ID(p_M_Warehouse_ID);
pp.setS_Resource_ID(p_S_Resource_ID); pp.setS_Resource_ID(p_S_Resource_ID);
pp.setDeliveryTime_Promised(p_DeliveryTime_Promised); pp.setDeliveryTime_Promised(p_DeliveryTime_Promised);
@ -229,6 +245,8 @@ public class CreateProductPlanning extends SvrProcess
pp.setAD_Workflow_ID(p_AD_Workflow_ID); pp.setAD_Workflow_ID(p_AD_Workflow_ID);
pp.setIsCreatePlan(p_CreatePlan); pp.setIsCreatePlan(p_CreatePlan);
pp.setIsMPS(p_MPS); pp.setIsMPS(p_MPS);
pp.setIsRequiredMRP(true);
pp.setIsRequiredDRP(true);
pp.setDeliveryTime_Promised(p_DeliveryTime_Promised); pp.setDeliveryTime_Promised(p_DeliveryTime_Promised);
pp.setOrder_Period(p_OrderPeriod); pp.setOrder_Period(p_OrderPeriod);
pp.setPlanner_ID(p_Planner); pp.setPlanner_ID(p_Planner);