Search in sources :

Example 6 with BOMLineWrapper

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

the class ChangeASIAction method changeASI.

private void changeASI(DefaultMutableTreeNode node) {
    BOMLineWrapper line = (BOMLineWrapper) node.getUserObject();
    int selectedASI = selectASIID(line);
    if (selectedASI == -1) {
        setIgnoreChange(true);
        return;
    }
    MAttributeSetInstance asi = new MAttributeSetInstance(Env.getCtx(), selectedASI, null);
    MProduct p = new MProduct(Env.getCtx(), line.getM_Product_ID(), null);
    changeBOMLine(line, p, asi);
}
Also used : MProduct(org.compiere.model.MProduct) MAttributeSetInstance(org.compiere.model.MAttributeSetInstance) BOMLineWrapper(org.eevolution.model.wrapper.BOMLineWrapper)

Example 7 with BOMLineWrapper

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

the class ChangeASIAction method validateAction.

protected String validateAction() {
    String validate = null;
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getSelectionPath().getLastPathComponent();
    BOMLineWrapper line = null;
    if (!(node.getUserObject() instanceof BOMLineWrapper)) {
        validate = "'" + node.getUserObject().getClass().getName() + "' isn't a type of 'BOMLineWrapper'(ClassCastException)";
    } else {
        line = (BOMLineWrapper) node.getUserObject();
        MProduct p = new MProduct(Env.getCtx(), line.getM_Product_ID(), null);
        if (p.getM_AttributeSet_ID() == 0) {
            validate = Msg.getMsg(Env.getCtx(), "PAttributeNoAttributeSet");
        }
    }
    return validate;
}
Also used : MProduct(org.compiere.model.MProduct) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) BOMLineWrapper(org.eevolution.model.wrapper.BOMLineWrapper)

Example 8 with BOMLineWrapper

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

the class CreateRfQAction method createRfQLine.

private void createRfQLine(int rfqId, DefaultMutableTreeNode node) {
    BOMLineWrapper sourceLine = (BOMLineWrapper) node.getUserObject();
    BigDecimal qtyReq = reasoner.getSumQtyRequired(sourceLine);
    // No requirement qty
    if (qtyReq.compareTo(BigDecimal.ZERO) <= 0) {
        return;
    }
    MRfQ rfq = new MRfQ(Env.getCtx(), rfqId, null);
    MRfQLine targetLine = new MRfQLine(Env.getCtx(), 0, null);
    targetLine.setC_RfQ_ID(rfqId);
    targetLine.setLine(lineCount(rfqId) + 1);
    targetLine.setM_AttributeSetInstance_ID(sourceLine.getM_AttributeSetInstance_ID());
    targetLine.setM_Product_ID(sourceLine.getM_Product_ID());
    targetLine.setDateWorkStart(rfq.getDateWorkStart());
    targetLine.setDateWorkComplete(rfq.getDateWorkComplete());
    savePO(targetLine);
    if (!successful()) {
        return;
    }
    MRfQLineQty lineQty = new MRfQLineQty(Env.getCtx(), 0, null);
    //lineQty.setQty(reasoner.calculateRequiredProducts(sourceLine));
    lineQty.setQty(qtyReq);
    lineQty.setC_UOM_ID(sourceLine.getC_UOM_ID());
    lineQty.setC_RfQLine_ID(targetLine.get_ID());
    lineQty.setIsRfQQty(true);
    lineQty.setIsPurchaseQty(true);
    savePO(lineQty);
}
Also used : MRfQ(org.compiere.model.MRfQ) MRfQLine(org.compiere.model.MRfQLine) MRfQLineQty(org.compiere.model.MRfQLineQty) BigDecimal(java.math.BigDecimal) BOMLineWrapper(org.eevolution.model.wrapper.BOMLineWrapper)

Example 9 with BOMLineWrapper

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

the class DeleteBOMAction method delete.

private void delete(DefaultMutableTreeNode node) {
    if (node.getUserObject() instanceof BOMWrapper) {
        BOMWrapper bom = (BOMWrapper) node.getUserObject();
        for (int i = 0; i < node.getChildCount(); i++) {
            delete((DefaultMutableTreeNode) node.getChildAt(i));
            if (!successful()) {
                break;
            }
        }
        deletePO(bom.get());
    } else {
        BOMLineWrapper line = (BOMLineWrapper) node.getUserObject();
        deletePO(line.get());
    }
}
Also used : BOMWrapper(org.eevolution.model.wrapper.BOMWrapper) 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