use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class AbstractMakeToOrder method createPPOrder.
public MPPOrder createPPOrder() {
MPPOrder expected = new MPPOrder(getCtx(), 0, trxName);
expected.setAD_Org_ID(AD_Org_ID);
expected.setM_Product_ID(product.getM_Product_ID());
expected.setDateOrdered(today);
expected.setDatePromised(promisedDeta);
expected.setDateFinish(promisedDeta);
expected.setPP_Product_BOM_ID(PP_Product_BOM_ID);
expected.setAD_Workflow_ID(AD_Workflow_ID);
expected.setS_Resource_ID(S_Resource_ID);
expected.setM_Warehouse_ID(M_Warehouse_ID);
expected.setDocStatus(MPPOrder.DOCSTATUS_InProgress);
expected.setQty(Qty);
return expected;
}
use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class VOrderPlanning method actionPerformed.
public void actionPerformed(ActionEvent e) {
// Confirm Panel
String cmd = e.getActionCommand();
if (cmd.equals(ConfirmPanel.A_OK)) {
m_frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
//System.out.println("Row ...ID " + row);
int[] rows = p_table.getSelectedRows();
for (int r = 0; r < rows.length; r++) {
IDColumn id = (IDColumn) p_table.getValueAt(rows[r], 0);
if (id != null && id.isSelected()) {
Integer PP_Order_ID = id.getRecord_ID();
MPPOrder order = new MPPOrder(Env.getCtx(), PP_Order_ID.intValue(), null);
order.setDocStatus(order.prepareIt());
order.setDocAction(MPPOrder.DOCACTION_Complete);
order.save();
}
}
if (rows.length != 0) {
ADialog.info(m_WindowNo, this, "ProcessOK");
executeQuery();
m_frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
executeQuery();
}
m_frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
if (cmd.equals(ConfirmPanel.A_CANCEL)) {
dispose();
}
dispose();
}
use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class VOrderReceiptIssue method vetoableChange.
public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException {
String name = e.getPropertyName();
Object value = e.getNewValue();
log.fine("VOrderReceip.vetoableChange - " + name + "=" + value);
if (value == null)
return;
// PP_Order_ID
if (name.equals("PP_Order_ID")) {
orderField.setValue(value);
MPPOrder pp_order = getPP_Order();
if (pp_order != null) {
setS_Resource_ID(pp_order.getS_Resource_ID());
setM_Warehouse_ID(pp_order.getM_Warehouse_ID());
setDeliveredQty(pp_order.getQtyDelivered());
setOrderedQty(pp_order.getQtyOrdered());
// m_PP_order.getQtyOrdered().subtract(m_PP_order.getQtyDelivered());
setQtyBatchs(pp_order.getQtyBatchs());
setQtyBatchSize(pp_order.getQtyBatchSize());
setOpenQty(pp_order.getQtyOrdered().subtract(pp_order.getQtyDelivered()));
setToDeliverQty(getOpenQty());
setM_Product_ID(pp_order.getM_Product_ID());
MProduct m_product = MProduct.get(Env.getCtx(), pp_order.getM_Product_ID());
setC_UOM_ID(m_product.getC_UOM_ID());
setOrder_UOM_ID(pp_order.getC_UOM_ID());
// Default ASI defined from the Parent BOM Order
setM_AttributeSetInstance_ID(pp_order.getMPPOrderBOM().getM_AttributeSetInstance_ID());
// default to first entry -
pickcombo.setSelectedIndex(0);
// isBackflush
}
}
// PP_Order_ID
}
use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class MRP method createPPOrder.
protected void createPPOrder(int AD_Org_ID, int PP_MRP_ID, MProduct product, BigDecimal QtyPlanned, Timestamp DemandDateStartSchedule, String trxName) throws AdempiereException, SQLException {
log.info("PP_Product_BOM_ID:" + m_product_planning.getPP_Product_BOM_ID() + ", AD_Workflow_ID:" + m_product_planning.getAD_Workflow_ID());
if (m_product_planning.getPP_Product_BOM_ID() == 0 || m_product_planning.getAD_Workflow_ID() == 0) {
throw new AdempiereException("@FillMandatory@ @PP_Product_BOM_ID@, @AD_Workflow_ID@ ( @M_Product_ID@=" + product.getValue() + ")");
}
int duration = MPPMRP.getDurationDays(QtyPlanned, m_product_planning);
MPPOrder order = new MPPOrder(getCtx(), 0, trxName);
order.setAD_Org_ID(AD_Org_ID);
order.setLine(10);
if (MPPProductBOM.BOMTYPE_Maintenance.equals(getBOMType(trxName))) {
log.info("Maintenance Order Created");
order.setC_DocTypeTarget_ID(docTypeMF_ID);
order.setC_DocType_ID(docTypeMF_ID);
} else {
log.info("Manufacturing Order Created");
order.setC_DocTypeTarget_ID(docTypeMO_ID);
order.setC_DocType_ID(docTypeMO_ID);
}
order.setS_Resource_ID(m_product_planning.getS_Resource_ID());
order.setM_Warehouse_ID(m_product_planning.getM_Warehouse_ID());
order.setM_Product_ID(m_product_planning.getM_Product_ID());
order.setM_AttributeSetInstance_ID(0);
order.setPP_Product_BOM_ID(m_product_planning.getPP_Product_BOM_ID());
order.setAD_Workflow_ID(m_product_planning.getAD_Workflow_ID());
order.setPlanner_ID(m_product_planning.getPlanner_ID());
order.setDateOrdered(getToday());
order.setDatePromised(DemandDateStartSchedule);
order.setDateStartSchedule(TimeUtil.addDays(DemandDateStartSchedule, 0 - duration));
order.setDateFinishSchedule(DemandDateStartSchedule);
order.setQty(QtyPlanned);
// QtyBatchSize : do not set it, let the MO to take it from workflow
order.setC_UOM_ID(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.addDescription(Msg.parseTranslation(getCtx(), "@PP_Order_ID@ @DocumentNo@ " + order.getDocumentNo() + " @Generate@ @from@ " + getName()));
order.saveEx();
MPPMRP mrp = getSupply(MPPOrder.COLUMNNAME_PP_Order_ID, order.get_ID(), null, null, trxName);
supplies.put(mrp.get_ID(), mrp.getQty());
count_MO += 1;
}
use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class WOrderReceiptIssue method valueChange.
// executeQuery
@Override
public void valueChange(ValueChangeEvent e) {
String name = e.getPropertyName();
Object value = e.getNewValue();
if (value == null)
return;
// PP_Order_ID
if (name.equals("PP_Order_ID")) {
orderField.setValue(value);
MPPOrder pp_order = getPP_Order();
if (pp_order != null) {
setS_Resource_ID(pp_order.getS_Resource_ID());
setM_Warehouse_ID(pp_order.getM_Warehouse_ID());
setDeliveredQty(pp_order.getQtyDelivered());
setOrderedQty(pp_order.getQtyOrdered());
//m_PP_order.getQtyOrdered().subtract(m_PP_order.getQtyDelivered());
setQtyBatchs(pp_order.getQtyBatchs());
setQtyBatchSize(pp_order.getQtyBatchSize());
setOpenQty(pp_order.getQtyOrdered().subtract(pp_order.getQtyDelivered()));
setToDeliverQty(getOpenQty());
setM_Product_ID(pp_order.getM_Product_ID());
MProduct m_product = MProduct.get(Env.getCtx(), pp_order.getM_Product_ID());
setC_UOM_ID(m_product.getC_UOM_ID());
setOrder_UOM_ID(pp_order.getC_UOM_ID());
//Default ASI defined from the Parent BOM Order
setM_AttributeSetInstance_ID(pp_order.getMPPOrderBOM().getM_AttributeSetInstance_ID());
//default to first entry - isBackflush
pickcombo.setSelectedIndex(0);
Event ev = new Event(Events.ON_CHANGE, pickcombo);
try {
onEvent(ev);
} catch (Exception e1) {
throw new AdempiereException(e1);
}
}
}
if (name.equals(toDeliverQty.getColumnName()) || name.equals(scrapQtyField.getColumnName())) {
if (getPP_Order_ID() > 0 && isBackflush()) {
executeQuery();
}
}
}
Aggregations