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;
}
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);
}
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;
}
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;
}
Aggregations