Refactory do not is necessary send ad parameter the AD_CLient_ID, this can take of context.
This commit is contained in:
parent
1fceea050d
commit
23b4715fe9
|
@ -25,6 +25,7 @@ import org.compiere.model.Query;
|
||||||
import org.compiere.util.CLogMgt;
|
import org.compiere.util.CLogMgt;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product Data Planning
|
* Product Data Planning
|
||||||
|
@ -140,7 +141,7 @@ public class MPPProductPlanning extends X_PP_Product_Planning
|
||||||
* @param trxName Transaction Name
|
* @param trxName Transaction Name
|
||||||
* @return MPPProductPlanning Planning Data
|
* @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,
|
int M_Warehouse_ID, int S_Resource_ID, int M_Product_ID,
|
||||||
String trxName)
|
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 (M_Warehouse_ID IN (0,?) OR M_Warehouse_ID IS NULL)"
|
||||||
+ " AND (S_Resource_ID IN (0,?) OR S_Resource_ID IS NULL)";
|
+ " AND (S_Resource_ID IN (0,?) OR S_Resource_ID IS NULL)";
|
||||||
return new Query(ctx, Table_Name, whereClause, trxName)
|
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")
|
.setOrderBy("AD_Org_ID DESC NULLS LAST, M_Warehouse_ID DESC NULLS LAST, S_Resource_ID DESC NULLS LAST")
|
||||||
.first();
|
.first();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
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
|
//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;
|
DatePromisedTo = null;
|
||||||
DatePromisedFrom = null;
|
DatePromisedFrom = null;
|
||||||
if (pp != 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
|
if(m_product_planning.getSafetyStock().signum() > 0
|
||||||
&& m_product_planning.getSafetyStock().compareTo(QtyProjectOnHand) > 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();
|
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());
|
MDDOrderLine oline = new MDDOrderLine(getCtx(), 0 , get_TrxName());
|
||||||
oline.setDD_Order_ID(order.getDD_Order_ID());
|
oline.setDD_Order_ID(order.getDD_Order_ID());
|
||||||
|
@ -749,6 +749,7 @@ public class MRP extends SvrProcess
|
||||||
oline.setDatePromised(DemandDateStartSchedule);
|
oline.setDatePromised(DemandDateStartSchedule);
|
||||||
oline.setQtyEntered(QtyOrdered);
|
oline.setQtyEntered(QtyOrdered);
|
||||||
oline.setQtyOrdered(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.setIsInvoiced(false);
|
||||||
oline.saveEx();
|
oline.saveEx();
|
||||||
|
|
||||||
|
|
|
@ -167,8 +167,7 @@ public class RollupBillOfMaterial extends SvrProcess
|
||||||
{
|
{
|
||||||
log.info("ElementType: "+CostElementType);
|
log.info("ElementType: "+CostElementType);
|
||||||
BigDecimal costPriceLL = Env.ZERO;
|
BigDecimal costPriceLL = Env.ZERO;
|
||||||
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(),
|
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(), AD_Org_ID,
|
||||||
getAD_Client_ID(), AD_Org_ID,
|
|
||||||
0, // M_Warehouse_ID
|
0, // M_Warehouse_ID
|
||||||
0, // S_Resource_ID
|
0, // S_Resource_ID
|
||||||
product.getM_Product_ID(),
|
product.getM_Product_ID(),
|
||||||
|
|
|
@ -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)
|
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;
|
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;
|
int AD_Workflow_ID = 0;
|
||||||
if(pp != null )
|
if(pp != null )
|
||||||
AD_Workflow_ID = pp.getAD_Workflow_ID();
|
AD_Workflow_ID = pp.getAD_Workflow_ID();
|
||||||
|
|
|
@ -772,7 +772,7 @@ public class VMRPDetailed
|
||||||
*/
|
*/
|
||||||
private void fillHead()
|
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);
|
getAD_Org_ID(), getM_Warehouse_ID(), getS_Resource_ID(), getM_Product_ID(), null);
|
||||||
if (pp == null)
|
if (pp == null)
|
||||||
pp = new MPPProductPlanning(getCtx(), 0, null);
|
pp = new MPPProductPlanning(getCtx(), 0, null);
|
||||||
|
|
Loading…
Reference in New Issue