Search in sources :

Example 1 with BOMLineWrapper

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

the class MergeBOMAction method createBOMLine.

private void createBOMLine(int bomId, DefaultMutableTreeNode node) {
    BOMLineWrapper sourceLine = (BOMLineWrapper) node.getUserObject();
    MPPProductBOMLine targetLine = new MPPProductBOMLine(Env.getCtx(), 0, null);
    targetLine.setPP_Product_BOM_ID(bomId);
    targetLine.setHelp(sourceLine.getHelp());
    targetLine.setM_ChangeNotice_ID(sourceLine.getM_ChangeNotice_ID());
    targetLine.setAssay(sourceLine.getAssay());
    targetLine.setQtyBatch(sourceLine.getQtyBatch());
    targetLine.setQtyBOM(sourceLine.getQtyBOM());
    targetLine.setIsQtyPercentage(sourceLine.isQtyPercentage());
    targetLine.setComponentType(sourceLine.getComponentType());
    targetLine.setC_UOM_ID(sourceLine.getC_UOM_ID());
    targetLine.setForecast(sourceLine.getForecast());
    targetLine.setIsCritical(sourceLine.isCritical());
    targetLine.setIssueMethod(sourceLine.getIssueMethod());
    targetLine.setLine(sourceLine.getLine());
    targetLine.setLeadTimeOffset(sourceLine.getLeadTimeOffset());
    targetLine.setM_AttributeSetInstance_ID(sourceLine.getM_AttributeSetInstance_ID());
    targetLine.setM_Product_ID(sourceLine.getM_Product_ID());
    targetLine.setScrap(sourceLine.getScrap());
    targetLine.setValidFrom(sourceLine.getValidFrom());
    targetLine.setValidTo(sourceLine.getValidTo());
    actionResult = targetLine.save();
}
Also used : MPPProductBOMLine(org.eevolution.model.MPPProductBOMLine) BOMLineWrapper(org.eevolution.model.wrapper.BOMLineWrapper)

Example 2 with BOMLineWrapper

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

the class BOMTreeFactory method getNode.

protected DefaultMutableTreeNode getNode(BOMWrapper bom, BigDecimal qty, HashMap map) {
    MProduct product = new MProduct(Env.getCtx(), bom.getM_Product_ID(), MProduct.Table_Name);
    DefaultMutableTreeNode parent = new DefaultMutableTreeNode(bom);
    ;
    map.put(parent, getTreeNodeRepresentation(parent));
    DefaultMutableTreeNode node = null;
    DefaultMutableTreeNode leaf = null;
    int[] ids = getStorageReasoner().getPOIDs(BOMLineWrapper.tableName(type()), BOMWrapper.idColumn(type()) + " = " + bom.getID(), null);
    BOMLineWrapper bomline = null;
    MProduct p = null;
    for (int i = 0; i < ids.length; i++) {
        bomline = new BOMLineWrapper(Env.getCtx(), ids[i], null, type());
        bomline.setQtyBOM(qty != null ? qty.multiply(bomline.getQtyBOM()) : bomline.getQtyBOM());
        p = new MProduct(Env.getCtx(), bomline.getM_Product_ID(), null);
        node = addLeafs(p, qty, map);
        leaf = new DefaultMutableTreeNode(bomline);
        map.put(leaf, getTreeNodeRepresentation(leaf));
        parent.add((node == null) ? leaf : node);
    }
    return parent;
}
Also used : MProduct(org.compiere.model.MProduct) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) BOMLineWrapper(org.eevolution.model.wrapper.BOMLineWrapper)

Example 3 with BOMLineWrapper

use of org.eevolution.model.wrapper.BOMLineWrapper 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 4 with BOMLineWrapper

use of org.eevolution.model.wrapper.BOMLineWrapper 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 5 with BOMLineWrapper

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

BOMLineWrapper (org.eevolution.model.wrapper.BOMLineWrapper)9 MProduct (org.compiere.model.MProduct)6 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)4 BOMWrapper (org.eevolution.model.wrapper.BOMWrapper)4 MPPOrder (org.eevolution.model.MPPOrder)3 BigDecimal (java.math.BigDecimal)1 MAttributeSetInstance (org.compiere.model.MAttributeSetInstance)1 MResource (org.compiere.model.MResource)1 MRfQ (org.compiere.model.MRfQ)1 MRfQLine (org.compiere.model.MRfQLine)1 MRfQLineQty (org.compiere.model.MRfQLineQty)1 MPPProductBOMLine (org.eevolution.model.MPPProductBOMLine)1