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