use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class CAbstractBOMTree method handleActionEvent.
private void handleActionEvent() {
Integer value = (Integer) lookup.getValue();
if (value == null || value.intValue() == 0) {
return;
} else {
nodeDescription.setText("");
}
int poID = value.intValue();
PO po = null;
if (BOMWrapper.BOM_TYPE_PRODUCT.equals(type())) {
po = new MProduct(Env.getCtx(), poID, MProduct.Table_Name);
} else if (BOMWrapper.BOM_TYPE_ORDER.equals(type())) {
po = new MPPOrder(Env.getCtx(), poID, null);
}
model = BOMTreeFactory.get(type(), po, reasoner);
configureTree();
contentPane.add(new JScrollPane(model.getTree()), JSplitPane.LEFT);
contentPane.setDividerLocation(0.25d);
}
use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class MakeToOrderStandardBOMandWF method test01.
public void test01() throws Exception {
Qty = new BigDecimal(10);
//Define Product
product = MProduct.get(getCtx(), M_Product_ID);
//Define Business Partner
BPartner = new MBPartner(getCtx(), C_BPartner_ID, trxName);
//Setting the BOM
int PP_Product_BOM_ID = MPPProductBOM.getBOMSearchKey(product);
if (PP_Product_BOM_ID > 0)
bom = new MPPProductBOM(getCtx(), PP_Product_BOM_ID, trxName);
else
throw new AdempiereException("@NotFound@ @PP_ProductBOM_ID@");
if (bom != null) {
bom.setValue(product.getValue());
bom.setBOMType(MPPProductBOM.BOMTYPE_Make_To_Order);
bom.setBOMUse(MPPProductBOM.BOMUSE_Manufacturing);
bom.saveEx();
}
//force Workflow as standard
workflow = new MWorkflow(getCtx(), AD_Workflow_ID, trxName);
workflow.setValue(product.getValue());
workflow.saveEx();
if (AD_Workflow_ID > 0)
workflow = MWorkflow.get(getCtx(), AD_Workflow_ID);
else
throw new AdempiereException("@NotFound@ @AD_Workflow_ID@");
/* Validate Exception if a Planning data is no defined
MPPProductPlanning pp = MPPProductPlanning.find(getCtx(), AD_Org_ID, M_Warehouse_ID , S_Resource_ID , M_Product_ID, trxName);
pp.setS_Resource_ID(50000);
pp.saveEx();*/
createOrder();
MPPOrder expected = createPPOrder();
I_PP_Order actual = MPPOrder.forC_OrderLine_ID(getCtx(), oline.get_ID(), oline.getM_Product_ID(), trxName);
if (actual == null) {
throw new AdempiereException("@NotFound@ @PP_Order_ID@ not was generate");
}
assertEquals("Confirming Manufacturing Order", expected, actual);
}
use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class MRPSchedule method schedule.
// doIt
private void schedule(MPPMRP mrp) {
if (!mrp.is_Changed())
return;
processRecords++;
if (MPPMRP.ORDERTYPE_Forecast.equals(mrp.getOrderType())) {
MForecastLine forecastLine = (MForecastLine) mrp.getM_ForecastLine();
if (forecastLine != null) {
forecastLine.setDatePromised(mrp.getDatePromised());
forecastLine.setSalesRep_ID(mrp.getPlanner_ID());
forecastLine.saveEx();
}
} else if (MPPMRP.ORDERTYPE_MaterialRequisition.equals(mrp.getOrderType())) {
MRequisition requisition = (MRequisition) mrp.getM_Requisition();
if (requisition != null) {
requisition.setDateDoc(mrp.getDateStartSchedule());
requisition.setDateRequired(mrp.getDatePromised());
requisition.setAD_User_ID(mrp.getPlanner_ID());
requisition.setPriorityRule(mrp.getPriority());
requisition.saveEx();
}
} else if (MPPMRP.ORDERTYPE_ManufacturingOrder.equals(mrp.getOrderType())) {
MPPOrder order = (MPPOrder) mrp.getPP_Order();
if (order != null) {
order.setDateStartSchedule(mrp.getDateStartSchedule());
order.setDateFinishSchedule(mrp.getDateFinishSchedule());
order.setDatePromised(mrp.getDatePromised());
order.setPlanner_ID(mrp.getPlanner_ID());
if (mrp.getPriority() != null)
order.setPriorityRule(mrp.getPriority());
order.setLine(lineNo);
order.saveEx();
}
} else if (MPPMRP.ORDERTYPE_DistributionOrder.equals(mrp.getOrderType())) {
MDDOrderLine orderLine = (MDDOrderLine) mrp.getDD_OrderLine();
if (orderLine != null) {
orderLine.setDateOrdered(mrp.getDateStartSchedule());
orderLine.setDatePromised(mrp.getDatePromised());
orderLine.saveEx();
MDDOrder order = orderLine.getParent();
order.setSalesRep_ID(mrp.getPlanner_ID());
order.setPriorityRule(mrp.getPriority());
order.saveEx();
}
} else if (MPPMRP.ORDERTYPE_SalesOrder.equals(mrp.getOrderType())) {
MOrderLine orderLine = (MOrderLine) mrp.getC_OrderLine();
if (orderLine != null) {
orderLine.setDateOrdered(mrp.getDateStartSchedule());
orderLine.setDatePromised(mrp.getDatePromised());
orderLine.saveEx();
MOrder order = orderLine.getParent();
order.setSalesRep_ID(mrp.getPlanner_ID());
order.setPriorityRule(mrp.getPriority());
order.saveEx();
}
} else if (MPPMRP.ORDERTYPE_PurchaseOrder.equals(mrp.getOrderType())) {
MOrderLine orderLine = (MOrderLine) mrp.getC_OrderLine();
if (orderLine != null) {
orderLine.setDateOrdered(mrp.getDateStartSchedule());
orderLine.setDatePromised(mrp.getDatePromised());
orderLine.saveEx();
MOrder order = orderLine.getParent();
order.setSalesRep_ID(mrp.getPlanner_ID());
order.setPriorityRule(mrp.getPriority());
order.saveEx();
}
}
}
use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class MRPApproval method createSupply.
// doIt
private void createSupply(MPPMRP mrp, String orderType) {
PO document = null;
if (MPPMRP.ORDERTYPE_MaterialRequisition.equals(orderType)) {
if (getBusinessPartnerId() <= 0)
throw new AdempiereException("@BPartnerNotFound@");
document = createRequisition(mrp);
}
if (MPPMRP.ORDERTYPE_ManufacturingOrder.equals(orderType) && getResourcePlantId() > 0 && getBOMFormulaId() > 0 && getWorkflowId() > 0) {
document = createManufacturingOrder(mrp);
}
if (MPPMRP.ORDERTYPE_DistributionOrder.equals(orderType) && getWarehouseinTransitId() > 0 && getShipperId() > 0 && getLocatorId() > 0 && getLocatorToId() > 0 && getBusinessPartnerId() > 0) {
document = createDistributionOrder(mrp);
}
if (MPPMRP.ORDERTYPE_MaterialRequisition.equals(mrp.getOrderType()) && document != null && document.get_ID() > 0) {
MRequisition requisition = (MRequisition) mrp.getM_Requisition();
requisition.deleteEx(true);
}
if (MPPMRP.ORDERTYPE_ManufacturingOrder.equals(mrp.getOrderType()) && document != null && document.get_ID() > 0) {
MPPOrder order = (MPPOrder) mrp.getPP_Order();
order.deleteEx(true);
}
if (MPPMRP.ORDERTYPE_DistributionOrder.equals(mrp.getOrderType()) && document != null && document.get_ID() > 0) {
MDDOrder order = (MDDOrder) mrp.getDD_Order();
order.deleteEx(true);
}
}
use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class MRPApproval method createManufacturingOrder.
private MPPOrder createManufacturingOrder(MPPMRP mrp) {
int docTypeId = MPPMRP.getDocType(getCtx(), MDocType.DOCBASETYPE_ManufacturingOrder, mrp.getAD_Org_ID(), mrp.getPlanner_ID(), get_TrxName());
MPPOrder order = new MPPOrder(getCtx(), 0, get_TrxName());
if (getReferenceNo() != null)
order.addDescription(getReferenceNo());
order.setAD_Org_ID(mrp.getAD_Org_ID());
order.setLine(10);
order.setC_DocTypeTarget_ID(docTypeId);
order.setC_DocType_ID(docTypeId);
if (getPriority() != null)
order.setPriorityRule(getPriority());
order.setS_Resource_ID(getResourcePlantId());
order.setM_Warehouse_ID(mrp.getM_Warehouse_ID());
order.setM_Product_ID(mrp.getM_Product_ID());
order.setM_AttributeSetInstance_ID(0);
order.setPP_Product_BOM_ID(getBOMFormulaId());
order.setAD_Workflow_ID(getWorkflowId());
order.setPlanner_ID(mrp.getPlanner_ID());
order.setDateOrdered(mrp.getDateOrdered());
order.setDatePromised(mrp.getDatePromised());
order.setDateStartSchedule(mrp.getDateStartSchedule());
order.setDateFinishSchedule(mrp.getDateFinishSchedule());
order.setQty(getSelectionAsBigDecimal(mrp.getPP_MRP_ID(), "MRP_" + MPPMRP.COLUMNNAME_Qty));
order.setC_UOM_ID(mrp.getM_Product().getC_UOM_ID());
order.setYield(Env.ZERO);
order.setScheduleType(MPPMRP.TYPEMRP_Demand);
order.setPriorityRule(MPPOrder.PRIORITYRULE_Medium);
order.setDocAction(MPPOrder.DOCACTION_Complete);
order.saveEx();
order.processIt(DocAction.ACTION_Prepare);
order.saveEx();
return order;
}
Aggregations