Refactory do not is necessary send ad parameter the AD_CLient_ID, this can take of context.

This commit is contained in:
vpj-cd 2008-09-04 02:41:54 +00:00
parent 1fceea050d
commit 23b4715fe9
5 changed files with 10 additions and 9 deletions

View File

@ -25,6 +25,7 @@ import org.compiere.model.Query;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
/**
* Product Data Planning
@ -140,7 +141,7 @@ public class MPPProductPlanning extends X_PP_Product_Planning
* @param trxName Transaction Name
* @return MPPProductPlanning Planning Data
**/
public static MPPProductPlanning find (Properties ctx, int AD_Client_ID, int AD_Org_ID,
public static MPPProductPlanning find (Properties ctx, int AD_Org_ID,
int M_Warehouse_ID, int S_Resource_ID, int M_Product_ID,
String trxName)
{
@ -149,7 +150,7 @@ public class MPPProductPlanning extends X_PP_Product_Planning
+ " AND (M_Warehouse_ID IN (0,?) OR M_Warehouse_ID IS NULL)"
+ " AND (S_Resource_ID IN (0,?) OR S_Resource_ID IS NULL)";
return new Query(ctx, Table_Name, whereClause, trxName)
.setParameters(new Object[]{AD_Client_ID, M_Product_ID, AD_Org_ID, M_Warehouse_ID, S_Resource_ID})
.setParameters(new Object[]{Env.getAD_Client_ID(ctx), M_Product_ID, AD_Org_ID, M_Warehouse_ID, S_Resource_ID})
.setOrderBy("AD_Org_ID DESC NULLS LAST, M_Warehouse_ID DESC NULLS LAST, S_Resource_ID DESC NULLS LAST")
.first();
}

View File

@ -445,7 +445,7 @@ public class MRP extends SvrProcess
private void setProduct(int AD_Client_ID , int AD_Org_ID, int S_Resource_ID , int M_Warehouse_ID, MProduct product)
{
//find data product planning demand
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(), AD_Client_ID ,AD_Org_ID , M_Warehouse_ID, S_Resource_ID , product.getM_Product_ID(), get_TrxName());
MPPProductPlanning pp = MPPProductPlanning.find(getCtx() ,AD_Org_ID , M_Warehouse_ID, S_Resource_ID , product.getM_Product_ID(), get_TrxName());
DatePromisedTo = null;
DatePromisedFrom = null;
if (pp != null)
@ -513,7 +513,7 @@ public class MRP extends SvrProcess
}
}
QtyProjectOnHand = MPPMRP.getQtyOnHand(AD_Client_ID , m_product_planning.getM_Warehouse_ID() , m_product_planning.getM_Product_ID(), get_TrxName());
QtyProjectOnHand = MPPMRP.getQtyOnHand(getCtx(), m_product_planning.getM_Warehouse_ID() , m_product_planning.getM_Product_ID(), get_TrxName());
if(m_product_planning.getSafetyStock().signum() > 0
&& m_product_planning.getSafetyStock().compareTo(QtyProjectOnHand) > 0)
{
@ -738,7 +738,7 @@ public class MRP extends SvrProcess
M_Shipper_ID = network_line.getM_Shipper_ID();
}
BigDecimal QtyOrdered = QtyPlanned; //.multiply(network_line.getPercent()).divide(Env.ONEHUNDRED);
BigDecimal QtyOrdered = QtyPlanned.multiply(network_line.getPercent()).divide(Env.ONEHUNDRED);
MDDOrderLine oline = new MDDOrderLine(getCtx(), 0 , get_TrxName());
oline.setDD_Order_ID(order.getDD_Order_ID());
@ -749,6 +749,7 @@ public class MRP extends SvrProcess
oline.setDatePromised(DemandDateStartSchedule);
oline.setQtyEntered(QtyOrdered);
oline.setQtyOrdered(QtyOrdered);
oline.setTargetQty(MPPMRP.getQtyReserved(getCtx(), target.getM_Warehouse_ID(), m_product_planning.getM_Product_ID(), DemandDateStartSchedule, get_TrxName()));
oline.setIsInvoiced(false);
oline.saveEx();

View File

@ -167,8 +167,7 @@ public class RollupBillOfMaterial extends SvrProcess
{
log.info("ElementType: "+CostElementType);
BigDecimal costPriceLL = Env.ZERO;
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(),
getAD_Client_ID(), AD_Org_ID,
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(), AD_Org_ID,
0, // M_Warehouse_ID
0, // S_Resource_ID
product.getM_Product_ID(),

View File

@ -138,7 +138,7 @@ public class RollupWorkflow extends SvrProcess
private BigDecimal getCost(String CostElementType ,int AD_Client_ID , int AD_Org_ID , MProduct product , int M_CostType_ID , int C_AcctSchema_ID)
{
BigDecimal cost = Env.ZERO;
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(), AD_Client_ID, AD_Org_ID , 0 , 0 , product.getM_Product_ID(), get_TrxName());
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(), AD_Org_ID , 0 , 0 , product.getM_Product_ID(), get_TrxName());
int AD_Workflow_ID = 0;
if(pp != null )
AD_Workflow_ID = pp.getAD_Workflow_ID();

View File

@ -772,7 +772,7 @@ public class VMRPDetailed
*/
private void fillHead()
{
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(), AD_Client_ID,
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(),
getAD_Org_ID(), getM_Warehouse_ID(), getS_Resource_ID(), getM_Product_ID(), null);
if (pp == null)
pp = new MPPProductPlanning(getCtx(), 0, null);