Search in sources :

Example 21 with MPPOrder

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

the class MRPApproval method executeManufacturingOrderApproval.

private void executeManufacturingOrderApproval(MPPMRP mrp) {
    boolean createMO = false;
    if (getBOMFormulaId() > 0)
        createMO = true;
    if (getWorkflowId() > 0)
        createMO = true;
    MPPOrder currentMfgOrder = (MPPOrder) mrp.getPP_Order();
    MPPOrder newMfgOrder;
    if (createMO) {
        newMfgOrder = new MPPOrder(mrp.getCtx(), 0, get_TrxName());
        newMfgOrder.copyValues(currentMfgOrder, newMfgOrder);
        if (getBOMFormulaId() > 0)
            newMfgOrder.setPP_Product_BOM_ID(getBOMFormulaId());
        if (getWorkflowId() > 0)
            newMfgOrder.setAD_Workflow_ID(getWorkflowId());
        newMfgOrder.saveEx();
        currentMfgOrder.deleteEx(true);
        currentMfgOrder = newMfgOrder;
    }
    if (mrp.is_Changed()) {
        validateChanges(mrp, MPPMRP.COLUMNNAME_Priority, currentMfgOrder, MPPOrder.COLUMNNAME_PriorityRule);
        validateChanges(mrp, MPPMRP.COLUMNNAME_DateStartSchedule, currentMfgOrder, MPPOrder.COLUMNNAME_DateStartSchedule);
        validateChanges(mrp, MPPMRP.COLUMNNAME_DatePromised, currentMfgOrder, MPPOrder.COLUMNNAME_DatePromised);
        currentMfgOrder.setQty(getSelectionAsBigDecimal(mrp.getPP_MRP_ID(), "MRP_" + MPPMRP.COLUMNNAME_Qty));
        currentMfgOrder.saveEx();
    }
    currentMfgOrder.processIt(DocAction.ACTION_Prepare);
    currentMfgOrder.saveEx();
}
Also used : MPPOrder(org.eevolution.model.MPPOrder)

Example 22 with MPPOrder

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

the class BOMTreeFactory method buildStructure.

protected DefaultMutableTreeNode buildStructure(PO po, StorageReasoner reasoner) {
    mapping = new HashMap();
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(po);
    mapping.put(root, getTreeNodeRepresentation(root));
    BOMWrapper bom = null;
    String restriction = null;
    if (po instanceof MProduct) {
        restriction = MProduct.Table_Name + "_ID";
    } else if (po instanceof MPPOrder) {
        restriction = MPPOrder.Table_Name + "_ID";
    }
    int[] ids = reasoner.getPOIDs(BOMWrapper.tableName(type()), "IsActive = 'Y' AND " + restriction + " = " + po.get_ID(), null);
    for (int i = 0; i < ids.length; i++) {
        bom = new BOMWrapper(Env.getCtx(), ids[i], null, type());
        root.add(getNode(bom, null, mapping));
    }
    return root;
}
Also used : MProduct(org.compiere.model.MProduct) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) HashMap(java.util.HashMap) BOMWrapper(org.eevolution.model.wrapper.BOMWrapper) MPPOrder(org.eevolution.model.MPPOrder)

Example 23 with MPPOrder

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

the class DiagramTreeCellRenderer method getIcon.

protected ImageIcon getIcon(Object value) {
    ImageIcon icon = null;
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
    if (node.getUserObject() instanceof MResource) {
    } else if (node.getUserObject() instanceof Date) {
        icon = Env.getImageIcon("Calendar10.gif");
    } else if (node.getUserObject() instanceof MPPOrder) {
    } else if (node.getUserObject() instanceof MPPOrderNode) {
    }
    return icon;
}
Also used : MResource(org.compiere.model.MResource) ImageIcon(javax.swing.ImageIcon) MPPOrderNode(org.eevolution.model.MPPOrderNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Date(java.util.Date) MPPOrder(org.eevolution.model.MPPOrder)

Example 24 with MPPOrder

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

the class BOMTreeFactory method getTreeNodeRepresentation.

protected String getTreeNodeRepresentation(DefaultMutableTreeNode node) {
    String name = null;
    if (node.getUserObject() instanceof MProduct) {
        MProduct p = (MProduct) node.getUserObject();
        name = p.getName() + " (" + p.getValue() + ")";
    }
    if (node.getUserObject() instanceof MPPOrder) {
        MPPOrder o = (MPPOrder) node.getUserObject();
        MResource r = MResource.get(Env.getCtx(), o.getS_Resource_ID());
        name = o.getDocumentNo() + " (" + r.getName() + ")";
    } else if (node.getUserObject() instanceof BOMWrapper) {
        BOMWrapper pb = (BOMWrapper) node.getUserObject();
        MProduct p = new MProduct(Env.getCtx(), pb.getM_Product_ID(), null);
        name = pb.getName();
    } else if (node.getUserObject() instanceof BOMLineWrapper) {
        BOMLineWrapper mpbl = (BOMLineWrapper) node.getUserObject();
        MProduct p = new MProduct(Env.getCtx(), mpbl.getM_Product_ID(), null);
        name = p.getName();
    }
    return name;
}
Also used : MResource(org.compiere.model.MResource) MProduct(org.compiere.model.MProduct) BOMWrapper(org.eevolution.model.wrapper.BOMWrapper) MPPOrder(org.eevolution.model.MPPOrder) BOMLineWrapper(org.eevolution.model.wrapper.BOMLineWrapper)

Example 25 with MPPOrder

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

the class BOMMessenger method getToolTipText.

public String getToolTipText(TreePath path) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
    String tooltip = (String) cache.get(node);
    if (tooltip != null) {
        return tooltip;
    }
    if (node.getUserObject() instanceof MProduct) {
        tooltip = getProductInfo((MProduct) node.getUserObject());
    }
    if (node.getUserObject() instanceof MPPOrder) {
        tooltip = getMfcOrderInfo((MPPOrder) node.getUserObject());
    } else if (node.getUserObject() instanceof BOMWrapper) {
        tooltip = getBOMInfo((BOMWrapper) node.getUserObject());
    } else if (node.getUserObject() instanceof BOMLineWrapper) {
        tooltip = getBOMLineInfo((BOMLineWrapper) node.getUserObject());
    }
    cache.put(node, tooltip);
    return tooltip;
}
Also used : MProduct(org.compiere.model.MProduct) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) BOMWrapper(org.eevolution.model.wrapper.BOMWrapper) MPPOrder(org.eevolution.model.MPPOrder) BOMLineWrapper(org.eevolution.model.wrapper.BOMLineWrapper)

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