Search in sources :

Example 6 with MPPOrder

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;
}
Also used : MPPOrder(org.eevolution.model.MPPOrder)

Example 7 with MPPOrder

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();
}
Also used : IDColumn(org.compiere.minigrid.IDColumn) MPPOrder(org.eevolution.model.MPPOrder)

Example 8 with MPPOrder

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
}
Also used : MProduct(org.compiere.model.MProduct) MPPOrder(org.eevolution.model.MPPOrder)

Example 9 with MPPOrder

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;
}
Also used : AdempiereException(org.adempiere.exceptions.AdempiereException) MPPMRP(org.eevolution.model.MPPMRP) MPPOrder(org.eevolution.model.MPPOrder)

Example 10 with MPPOrder

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();
        }
    }
}
Also used : MProduct(org.compiere.model.MProduct) AdempiereException(org.adempiere.exceptions.AdempiereException) ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent) Event(org.zkoss.zk.ui.event.Event) WTableModelEvent(org.adempiere.webui.event.WTableModelEvent) MPPOrder(org.eevolution.model.MPPOrder) AdempiereException(org.adempiere.exceptions.AdempiereException)

Aggregations

MPPOrder (org.eevolution.model.MPPOrder)26 AdempiereException (org.adempiere.exceptions.AdempiereException)8 MProduct (org.compiere.model.MProduct)8 BigDecimal (java.math.BigDecimal)5 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)5 MPPProductBOM (org.eevolution.model.MPPProductBOM)5 BOMWrapper (org.eevolution.model.wrapper.BOMWrapper)5 MBPartner (org.compiere.model.MBPartner)4 MResource (org.compiere.model.MResource)4 I_PP_Order (org.eevolution.model.I_PP_Order)4 MPPOrderNode (org.eevolution.model.MPPOrderNode)4 MWorkflow (org.compiere.wf.MWorkflow)3 BOMLineWrapper (org.eevolution.model.wrapper.BOMLineWrapper)3 HashMap (java.util.HashMap)2 MOrderLine (org.compiere.model.MOrderLine)2 MRequisition (org.compiere.model.MRequisition)2 MResourceType (org.compiere.model.MResourceType)2 PO (org.compiere.model.PO)2 MDDOrder (org.eevolution.model.MDDOrder)2 Timestamp (java.sql.Timestamp)1