Search in sources :

Example 1 with I_M_Warehouse

use of org.compiere.model.I_M_Warehouse in project adempiere by adempiere.

the class MRPUtil method getPlanning.

/**
	 * Helper Method : Create Product Planning
	 */
public static I_PP_Product_Planning getPlanning(String productValue, String Order_Policy, int Order_Min, int Order_Max, int Order_Pack, int SafetyStock, int Order_Period, int LeadTime) {
    boolean isPurchased = true;
    int PlanningHorizon = 365;
    //
    Properties ctx = Env.getCtx();
    //		int AD_Client_ID = Env.getAD_Client_ID(ctx);
    int AD_Org_ID = MRPUtil.getFirst_Org_ID();
    I_M_Warehouse wh = MRPUtil.getCreateWarehouse(AD_Org_ID, productValue);
    I_S_Resource plant = MRPUtil.getCreatePlant(productValue, wh.getM_Warehouse_ID(), PlanningHorizon);
    I_M_Product product = MRPUtil.getCreateProduct(ctx, productValue, isPurchased);
    //
    MPPProductPlanning pp = new MPPProductPlanning(ctx, 0, null);
    pp.setIsCreatePlan(true);
    pp.setIsRequiredMRP(true);
    pp.setIsRequiredDRP(false);
    pp.setM_Product_ID(product.getM_Product_ID());
    pp.setAD_Org_ID(AD_Org_ID);
    pp.setM_Warehouse_ID(wh.getM_Warehouse_ID());
    pp.setS_Resource_ID(plant.getS_Resource_ID());
    //
    pp.setOrder_Policy(Order_Policy);
    pp.setOrder_Min(BigDecimal.valueOf(Order_Min));
    pp.setOrder_Max(BigDecimal.valueOf(Order_Max));
    pp.setOrder_Pack(BigDecimal.valueOf(Order_Pack));
    pp.setSafetyStock(BigDecimal.valueOf(SafetyStock));
    pp.setOrder_Period(BigDecimal.valueOf(Order_Period));
    pp.setDeliveryTime_Promised(BigDecimal.valueOf(LeadTime));
    //
    return pp;
}
Also used : I_S_Resource(org.compiere.model.I_S_Resource) I_M_Product(org.compiere.model.I_M_Product) MPPProductPlanning(org.eevolution.model.MPPProductPlanning) Properties(java.util.Properties) I_M_Warehouse(org.compiere.model.I_M_Warehouse)

Aggregations

Properties (java.util.Properties)1 I_M_Product (org.compiere.model.I_M_Product)1 I_M_Warehouse (org.compiere.model.I_M_Warehouse)1 I_S_Resource (org.compiere.model.I_S_Resource)1 MPPProductPlanning (org.eevolution.model.MPPProductPlanning)1