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);
}
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;
}
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);
}
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());
}
}
Aggregations