use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class WOrderReceiptIssue method valueChange.
// executeQuery
@Override
public void valueChange(ValueChangeEvent e) {
String name = e.getPropertyName();
Object value = e.getNewValue();
if (value == null)
return;
// PP_Order_ID
if (name.equals("PP_Order_ID")) {
orderField.setValue(value);
MPPOrder pp_order = getPP_Order();
if (pp_order != null) {
setS_Resource_ID(pp_order.getS_Resource_ID());
setM_Warehouse_ID(pp_order.getM_Warehouse_ID());
setDeliveredQty(pp_order.getQtyDelivered());
setOrderedQty(pp_order.getQtyOrdered());
//m_PP_order.getQtyOrdered().subtract(m_PP_order.getQtyDelivered());
setQtyBatchs(pp_order.getQtyBatchs());
setQtyBatchSize(pp_order.getQtyBatchSize());
setOpenQty(pp_order.getQtyOrdered().subtract(pp_order.getQtyDelivered()));
setToDeliverQty(getOpenQty());
setM_Product_ID(pp_order.getM_Product_ID());
MProduct m_product = MProduct.get(Env.getCtx(), pp_order.getM_Product_ID());
setC_UOM_ID(m_product.getC_UOM_ID());
setOrder_UOM_ID(pp_order.getC_UOM_ID());
//Default ASI defined from the Parent BOM Order
setM_AttributeSetInstance_ID(pp_order.getMPPOrderBOM().getM_AttributeSetInstance_ID());
//default to first entry - isBackflush
pickcombo.setSelectedIndex(0);
Event ev = new Event(Events.ON_CHANGE, pickcombo);
try {
onEvent(ev);
} catch (Exception e1) {
throw new AdempiereException(e1);
}
}
}
if (name.equals(toDeliverQty.getColumnName()) || name.equals(scrapQtyField.getColumnName())) {
if (getPP_Order_ID() > 0 && isBackflush()) {
executeQuery();
}
}
}
use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class CRPDatasetFactory method addTreeNodes.
/**
* Generates following tree:
* <pre>
* (dateTime)
* \-------(root)
* \-------(PP Order)
* \---------(PP Order Node)
* </pre>
* @param dateTime
* @param root
* @param r
* @return
*/
private HashMap<DefaultMutableTreeNode, String> addTreeNodes(Timestamp dateTime, DefaultMutableTreeNode root, MResource r) {
HashMap<DefaultMutableTreeNode, String> names = new HashMap<DefaultMutableTreeNode, String>();
DefaultMutableTreeNode parent = new DefaultMutableTreeNode(dateTime);
names.put(parent, getTreeNodeRepresentation(null, parent, r));
root.add(parent);
for (MPPOrder order : getPPOrders(dateTime, r)) {
DefaultMutableTreeNode childOrder = new DefaultMutableTreeNode(order);
parent.add(childOrder);
names.put(childOrder, getTreeNodeRepresentation(dateTime, childOrder, r));
for (MPPOrderNode node : getPPOrderNodes(dateTime, r)) {
DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(node);
childOrder.add(childNode);
names.put(childNode, getTreeNodeRepresentation(dateTime, childNode, r));
}
}
return names;
}
use of org.eevolution.model.MPPOrder 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.MPPOrder in project adempiere by adempiere.
the class CRPDatasetFactory method getTreeNodeRepresentation.
private String getTreeNodeRepresentation(Timestamp dateTime, DefaultMutableTreeNode node, MResource r) {
String name = null;
if (node.getUserObject() instanceof MResource) {
MResource res = (MResource) node.getUserObject();
name = res.getName();
} else if (node.getUserObject() instanceof Timestamp) {
Timestamp d = (Timestamp) node.getUserObject();
SimpleDateFormat df = Env.getLanguage(Env.getCtx()).getDateFormat();
name = df.format(d);
if (!isAvailable(r, d)) {
name = "{" + name + "}";
}
} else if (node.getUserObject() instanceof MPPOrder) {
MPPOrder o = (MPPOrder) node.getUserObject();
MProduct p = MProduct.get(Env.getCtx(), o.getM_Product_ID());
name = o.getDocumentNo() + " (" + p.getName() + ")";
} else if (node.getUserObject() instanceof MPPOrderNode) {
MPPOrderNode on = (MPPOrderNode) node.getUserObject();
MPPOrderWorkflow owf = on.getMPPOrderWorkflow();
MResourceType rt = MResourceType.get(Env.getCtx(), r.getS_ResourceType_ID());
// no function
//Env.getLanguage(Env.getCtx()).getTimeFormat();
SimpleDateFormat df = new SimpleDateFormat("HH:mm");
Timestamp[] interval = getDayBorders(dateTime, on, rt);
name = df.format(interval[0]) + " - " + df.format(interval[1]) + " " + on.getName() + " (" + owf.getName() + ")";
}
return name;
}
use of org.eevolution.model.MPPOrder in project adempiere by adempiere.
the class MakeToOrderNotStandardBOMandWF method test01.
public void test01() throws Exception {
Qty = new BigDecimal(10);
//Define Product
product = MProduct.get(getCtx(), M_Product_ID);
//Define Business Partner
BPartner = new MBPartner(getCtx(), C_BPartner_ID, trxName);
//force not BOM Standard
bom = new MPPProductBOM(getCtx(), PP_Product_BOM_ID, trxName);
if (bom != null) {
bom.setValue(product.getValue() + "-Alternate");
bom.setBOMType(MPPProductBOM.BOMTYPE_Make_To_Order);
bom.setBOMUse(MPPProductBOM.BOMUSE_Manufacturing);
bom.saveEx();
}
createOrder();
MPPOrder expected = createPPOrder();
I_PP_Order actual = MPPOrder.forC_OrderLine_ID(getCtx(), oline.get_ID(), oline.getM_Product_ID(), trxName);
if (actual == null) {
throw new AdempiereException("@NotFound@ @PP_Order_ID@ not was generate");
}
assertEquals("Confirming Manufacturing Order", expected, actual);
}
Aggregations