Search in sources :

Example 1 with MPPOrder

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();
        }
    }
}
Also used : MProduct(org.compiere.model.MProduct) AdempiereException(org.adempiere.exceptions.AdempiereException) ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent) Event(org.zkoss.zk.ui.event.Event) WTableModelEvent(org.adempiere.webui.event.WTableModelEvent) MPPOrder(org.eevolution.model.MPPOrder) AdempiereException(org.adempiere.exceptions.AdempiereException)

Example 2 with MPPOrder

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;
}
Also used : MPPOrderNode(org.eevolution.model.MPPOrderNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) HashMap(java.util.HashMap) MPPOrder(org.eevolution.model.MPPOrder)

Example 3 with MPPOrder

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);
    }
}
Also used : MResource(org.compiere.model.MResource) MRfQ(org.compiere.model.MRfQ) Calendar(java.util.Calendar) BOMWrapper(org.eevolution.model.wrapper.BOMWrapper) MPPOrder(org.eevolution.model.MPPOrder)

Example 4 with MPPOrder

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;
}
Also used : MResource(org.compiere.model.MResource) MPPOrderNode(org.eevolution.model.MPPOrderNode) MProduct(org.compiere.model.MProduct) MPPOrderWorkflow(org.eevolution.model.MPPOrderWorkflow) Timestamp(java.sql.Timestamp) SimpleDateFormat(java.text.SimpleDateFormat) MPPOrder(org.eevolution.model.MPPOrder) MResourceType(org.compiere.model.MResourceType)

Example 5 with MPPOrder

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);
}
Also used : I_PP_Order(org.eevolution.model.I_PP_Order) AdempiereException(org.adempiere.exceptions.AdempiereException) MBPartner(org.compiere.model.MBPartner) MPPProductBOM(org.eevolution.model.MPPProductBOM) BigDecimal(java.math.BigDecimal) MPPOrder(org.eevolution.model.MPPOrder)

Aggregations

MPPOrder (org.eevolution.model.MPPOrder)26 AdempiereException (org.adempiere.exceptions.AdempiereException)8 MProduct (org.compiere.model.MProduct)8 BigDecimal (java.math.BigDecimal)5 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)5 MPPProductBOM (org.eevolution.model.MPPProductBOM)5 BOMWrapper (org.eevolution.model.wrapper.BOMWrapper)5 MBPartner (org.compiere.model.MBPartner)4 MResource (org.compiere.model.MResource)4 I_PP_Order (org.eevolution.model.I_PP_Order)4 MPPOrderNode (org.eevolution.model.MPPOrderNode)4 MWorkflow (org.compiere.wf.MWorkflow)3 BOMLineWrapper (org.eevolution.model.wrapper.BOMLineWrapper)3 HashMap (java.util.HashMap)2 MOrderLine (org.compiere.model.MOrderLine)2 MRequisition (org.compiere.model.MRequisition)2 MResourceType (org.compiere.model.MResourceType)2 PO (org.compiere.model.PO)2 MDDOrder (org.eevolution.model.MDDOrder)2 Timestamp (java.sql.Timestamp)1