Search in sources :

Example 6 with MPPMRP

use of org.eevolution.model.MPPMRP in project adempiere by adempiere.

the class MRPSchedule method doIt.

// prepare
/**
	 * Perform process.
	 * @return Message (clear text)
	 * @throws Exception if not successful
	 */
protected String doIt() throws Exception {
    getSelectionKeys().stream().filter(mrpId -> mrpId > 0).forEach(mrpId -> {
        MPPMRP mrp = new MPPMRP(getCtx(), mrpId, get_TrxName());
        if (MPPMRP.TYPEMRP_Demand.equals(mrp.getTypeMRP()))
            saveBrowseValues(mrp, DEMAND);
        else if (MPPMRP.TYPEMRP_Supply.equals(mrp.getTypeMRP()))
            saveBrowseValues(mrp, SUPPLY);
        if (getPriority() != null)
            mrp.setPriority(getPriority());
        if (getPlannerId() > 0)
            mrp.setPlanner_ID(getPlannerId());
        schedule(mrp);
    });
    return "@DocProcessed@ " + processRecords;
}
Also used : LinkedHashMap(java.util.LinkedHashMap) MRequisition(org.compiere.model.MRequisition) MOrderLine(org.compiere.model.MOrderLine) MPPOrder(org.eevolution.model.MPPOrder) MOrder(org.compiere.model.MOrder) MDDOrder(org.eevolution.model.MDDOrder) MPPMRP(org.eevolution.model.MPPMRP) Entry(java.util.Map.Entry) PO(org.compiere.model.PO) MDDOrderLine(org.eevolution.model.MDDOrderLine) MForecastLine(org.compiere.model.MForecastLine) MPPMRP(org.eevolution.model.MPPMRP)

Example 7 with MPPMRP

use of org.eevolution.model.MPPMRP in project adempiere by adempiere.

the class MRPDetailed method zoom.

/**
	 * Zoom for any Document
	 */
public void zoom() {
    log.info("InfoMRPDetailed.zoom");
    Integer PP_MPR_ID = getSelectedRowKey();
    AD_Window_ID = 0;
    if (PP_MPR_ID == null)
        return;
    query = null;
    MPPMRP mrp = new MPPMRP(getCtx(), PP_MPR_ID.intValue(), null);
    String ordertype = mrp.getOrderType();
    if (X_PP_MRP.ORDERTYPE_PurchaseOrder.equals(ordertype)) {
        AD_Window_ID = MTable.get(getCtx(), I_C_Order.Table_ID).getPO_Window_ID();
        query = new MQuery(I_C_Order.Table_Name);
        query.addRestriction(I_C_Order.COLUMNNAME_C_Order_ID, MQuery.EQUAL, mrp.getC_Order_ID());
    } else if (X_PP_MRP.ORDERTYPE_SalesOrder.equals(ordertype)) {
        AD_Window_ID = MTable.get(getCtx(), I_C_Order.Table_ID).getAD_Window_ID();
        query = new MQuery(I_C_Order.Table_Name);
        query.addRestriction(I_C_Order.COLUMNNAME_C_Order_ID, MQuery.EQUAL, mrp.getC_Order_ID());
    } else if (X_PP_MRP.ORDERTYPE_ManufacturingOrder.equals(ordertype)) {
        AD_Window_ID = MTable.get(getCtx(), I_PP_Order.Table_ID).getAD_Window_ID();
        query = new MQuery(I_PP_Order.Table_Name);
        query.addRestriction(I_PP_Order.COLUMNNAME_PP_Order_ID, MQuery.EQUAL, mrp.getPP_Order_ID());
    } else if (X_PP_MRP.ORDERTYPE_MaterialRequisition.equals(ordertype)) {
        AD_Window_ID = MTable.get(getCtx(), I_M_Requisition.Table_ID).getAD_Window_ID();
        ;
        query = new MQuery(I_M_Requisition.Table_Name);
        query.addRestriction(I_M_Requisition.COLUMNNAME_M_Requisition_ID, MQuery.EQUAL, mrp.getM_Requisition_ID());
    } else if (X_PP_MRP.ORDERTYPE_Forecast.equals(ordertype)) {
        AD_Window_ID = MTable.get(getCtx(), I_M_Forecast.Table_ID).getAD_Window_ID();
        ;
        query = new MQuery(I_M_Forecast.Table_Name);
        query.addRestriction(I_M_Forecast.COLUMNNAME_M_Forecast_ID, MQuery.EQUAL, mrp.getM_Forecast_ID());
    }
    if (X_PP_MRP.ORDERTYPE_DistributionOrder.equals(ordertype)) {
        AD_Window_ID = MTable.get(getCtx(), I_DD_Order.Table_ID).getAD_Window_ID();
        query = new MQuery(MDDOrder.Table_Name);
        query.addRestriction(MDDOrder.COLUMNNAME_DD_Order_ID, MQuery.EQUAL, mrp.getDD_Order_ID());
    }
    if (AD_Window_ID == 0)
        return;
    log.info("AD_WindowNo " + AD_Window_ID);
    zoom(AD_Window_ID, query);
}
Also used : MQuery(org.compiere.model.MQuery) MPPMRP(org.eevolution.model.MPPMRP)

Example 8 with MPPMRP

use of org.eevolution.model.MPPMRP in project adempiere by adempiere.

the class MRPUtil method createMRP.

public static I_PP_MRP createMRP(I_PP_Product_Planning planning, String TypeMRP, String DocStatus, BigDecimal Qty, Timestamp DatePromised, Timestamp DateStartSchedule) {
    Properties ctx = Env.getCtx();
    //
    MPPMRP mrp = new MPPMRP(ctx, 0, null);
    mrp.setAD_Org_ID(planning.getAD_Org_ID());
    mrp.setName("MRP");
    mrp.setTypeMRP(TypeMRP);
    mrp.setDocStatus(DocStatus);
    mrp.setQty(Qty);
    mrp.setDatePromised(DatePromised);
    mrp.setDateStartSchedule(DateStartSchedule);
    mrp.setDateFinishSchedule(DatePromised);
    mrp.setDateOrdered(DatePromised);
    mrp.setM_Product_ID(planning.getM_Product_ID());
    mrp.setM_Warehouse_ID(planning.getM_Warehouse_ID());
    return mrp;
}
Also used : Properties(java.util.Properties) MPPMRP(org.eevolution.model.MPPMRP)

Example 9 with MPPMRP

use of org.eevolution.model.MPPMRP in project adempiere by adempiere.

the class MRPApproval method doIt.

// prepare
/**
     * Perform process.
     *
     * @return Message (clear text)
     * @throws Exception if not successful
     */
protected String doIt() throws Exception {
    getSelectionKeys().stream().filter(mrpId -> mrpId > 0).forEach(mrpId -> {
        MPPMRP mrp = new MPPMRP(getCtx(), mrpId, get_TrxName());
        saveBrowseValues(mrp, "MRP");
        if (getPriority() != null)
            mrp.setPriority(getPriority());
        if (getOrderType() != null && !mrp.getOrderType().equals(getOrderType())) {
            createSupply(mrp, getOrderType());
        } else {
            if (EXECUTION_MODE.equals(MPPMRP.ORDERTYPE_ManufacturingOrder))
                executeManufacturingOrderApproval(mrp);
            if (EXECUTION_MODE.equals(MPPMRP.ORDERTYPE_DistributionOrder))
                executeDistributionOrderApproval(mrp);
            if (EXECUTION_MODE.equals(MPPMRP.ORDERTYPE_MaterialRequisition)) {
                if (getBusinessPartnerId() > 0)
                    mrp.setC_BPartner_ID(getBusinessPartnerId());
                executeRequisitionApproval(mrp);
            }
        }
    });
    return null;
}
Also used : X_C_BP_Group(org.compiere.model.X_C_BP_Group) MPPOrder(org.eevolution.model.MPPOrder) MDDOrder(org.eevolution.model.MDDOrder) Timestamp(java.sql.Timestamp) MDocType(org.compiere.model.MDocType) Env(org.compiere.util.Env) MDDOrderLine(org.eevolution.model.MDDOrderLine) LinkedHashMap(java.util.LinkedHashMap) MRequisition(org.compiere.model.MRequisition) MRequisitionLine(org.compiere.model.MRequisitionLine) DB(org.compiere.util.DB) AdempiereException(org.adempiere.exceptions.AdempiereException) MBPartner(org.compiere.model.MBPartner) MPPMRP(org.eevolution.model.MPPMRP) Entry(java.util.Map.Entry) MLocator(org.compiere.model.MLocator) DocAction(org.compiere.process.DocAction) PO(org.compiere.model.PO) MPPMRP(org.eevolution.model.MPPMRP)

Aggregations

MPPMRP (org.eevolution.model.MPPMRP)9 MRequisition (org.compiere.model.MRequisition)3 Query (org.compiere.model.Query)3 MDDOrder (org.eevolution.model.MDDOrder)3 MDDOrderLine (org.eevolution.model.MDDOrderLine)3 MPPOrder (org.eevolution.model.MPPOrder)3 BigDecimal (java.math.BigDecimal)2 LinkedHashMap (java.util.LinkedHashMap)2 Entry (java.util.Map.Entry)2 AdempiereException (org.adempiere.exceptions.AdempiereException)2 MBPartner (org.compiere.model.MBPartner)2 MLocator (org.compiere.model.MLocator)2 MOrderLine (org.compiere.model.MOrderLine)2 MRequisitionLine (org.compiere.model.MRequisitionLine)2 PO (org.compiere.model.PO)2 Timestamp (java.sql.Timestamp)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 MDocType (org.compiere.model.MDocType)1 MForecastLine (org.compiere.model.MForecastLine)1