Search in sources :

Example 1 with BOMWrapper

use of org.eevolution.model.wrapper.BOMWrapper in project adempiere by adempiere.

the class CAbstractBOMTree method handleTreeEvent.

private void handleTreeEvent(MouseEvent e) {
    String text = model.getBOMMessenger().getToolTipText(e);
    if (text != null) {
        nodeDescription.setText(text);
    }
    if (e.getButton() == MouseEvent.BUTTON3) {
        model.getTree().setSelectionPath(model.getTree().getPathForLocation(e.getX(), e.getY()));
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) model.getTree().getSelectionPath().getLastPathComponent();
        if (node.getUserObject() instanceof BOMLineWrapper) {
            popupBOMLine.show(e.getComponent(), e.getX(), e.getY());
        } else if (node.getUserObject() instanceof BOMWrapper) {
            popupBOM.show(e.getComponent(), e.getX(), e.getY());
        } else if (node.getUserObject() instanceof MProduct) {
            popupRoot.show(e.getComponent(), e.getX(), e.getY());
        } else if (node.getUserObject() instanceof MPPOrder) {
            popupRoot.show(e.getComponent(), e.getX(), e.getY());
        }
    }
    SwingTool.setCursorsFromChild(e.getComponent(), false);
}
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)

Example 2 with BOMWrapper

use of org.eevolution.model.wrapper.BOMWrapper in project adempiere by adempiere.

the class MergeBOMAction method mergeBOMFrom.

private void mergeBOMFrom(DefaultMutableTreeNode node) {
    BOMWrapper sourceBOM = (BOMWrapper) node.getUserObject();
    MPPProductBOM targetBOM = new MPPProductBOM(Env.getCtx(), 0, null);
    targetBOM.setBOMType(sourceBOM.getBOMType());
    targetBOM.setDescription(sourceBOM.getDescription());
    targetBOM.setM_AttributeSetInstance_ID(sourceBOM.getM_AttributeSetInstance_ID());
    targetBOM.setM_Product_ID(sourceBOM.getM_Product_ID());
    targetBOM.setName(sourceBOM.getName());
    targetBOM.setRevision(sourceBOM.getRevision());
    targetBOM.setValidFrom(sourceBOM.getValidFrom());
    targetBOM.setValidTo(sourceBOM.getValidTo());
    targetBOM.setValue(sourceBOM.getValue());
    targetBOM.setDocumentNo(sourceBOM.getDocumentNo());
    targetBOM.setC_UOM_ID(sourceBOM.getC_UOM_ID());
    actionResult = targetBOM.save();
    if (successful()) {
        mergeInDepth(targetBOM.get_ID(), node);
    }
}
Also used : BOMWrapper(org.eevolution.model.wrapper.BOMWrapper) MPPProductBOM(org.eevolution.model.MPPProductBOM)

Example 3 with BOMWrapper

use of org.eevolution.model.wrapper.BOMWrapper in project adempiere by adempiere.

the class CreateRfQAction method createRfQ.

private void createRfQ(DefaultMutableTreeNode node) {
    BOMWrapper bom = (BOMWrapper) node.getUserObject();
    MPPOrder mo = new MPPOrder(Env.getCtx(), bom.getPP_Order_ID(), null);
    MResource r = MResource.get(Env.getCtx(), mo.getS_Resource_ID());
    Calendar cal = Calendar.getInstance();
    MRfQ rfq = new MRfQ(Env.getCtx(), 0, null);
    rfq.setName(Msg.translate(Env.getCtx(), "C_RFQ_ID") + ": " + mo.getDocumentNo() + "_" + r.getName() + " (" + bom.getName() + ")");
    rfq.setC_Currency_ID(Env.getContextAsInt(Env.getCtx(), "$C_Currency_ID"));
    rfq.setQuoteType(MRfQ.QUOTETYPE_QuoteSelectedLines);
    rfq.setDateWorkStart(mo.getDateStartSchedule());
    rfq.setDateWorkComplete(mo.getDateFinishSchedule());
    // process parameters
    rfq.setC_RfQ_Topic_ID(((BigDecimal) getParameterValue("C_RFQ_Topic_ID")).intValue());
    rfq.setSalesRep_ID(((BigDecimal) getParameterValue("SalesRep_ID")).intValue());
    savePO(rfq);
    if (successful()) {
        createRfQLines(rfq.get_ID(), node);
    }
}
Also used : MResource(org.compiere.model.MResource) MRfQ(org.compiere.model.MRfQ) Calendar(java.util.Calendar) BOMWrapper(org.eevolution.model.wrapper.BOMWrapper) MPPOrder(org.eevolution.model.MPPOrder)

Example 4 with BOMWrapper

use of org.eevolution.model.wrapper.BOMWrapper in project adempiere by adempiere.

the class BOMTreeFactory method addLeafs.

protected DefaultMutableTreeNode addLeafs(MProduct M_Product, BigDecimal qty, HashMap map) {
    int[] ids = getStorageReasoner().getPOIDs(BOMWrapper.tableName(type()), "Value = '" + M_Product.getValue() + "'", null);
    BOMWrapper bom = null;
    for (int i = 0; i < ids.length; i++) {
        bom = new BOMWrapper(Env.getCtx(), ids[i], null, type());
        return getNode(bom, qty, map);
    }
    return null;
}
Also used : BOMWrapper(org.eevolution.model.wrapper.BOMWrapper)

Example 5 with BOMWrapper

use of org.eevolution.model.wrapper.BOMWrapper 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)

Aggregations

BOMWrapper (org.eevolution.model.wrapper.BOMWrapper)8 MPPOrder (org.eevolution.model.MPPOrder)5 MProduct (org.compiere.model.MProduct)4 BOMLineWrapper (org.eevolution.model.wrapper.BOMLineWrapper)4 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3 MResource (org.compiere.model.MResource)2 Calendar (java.util.Calendar)1 HashMap (java.util.HashMap)1 MRfQ (org.compiere.model.MRfQ)1 MPPProductBOM (org.eevolution.model.MPPProductBOM)1