Search in sources :

Example 1 with MWMInOutBoundLine

use of org.eevolution.model.MWMInOutBoundLine in project adempiere by adempiere.

the class ReleaseInOutBound method doIt.

/**
	 * 	Process - Generate Export Format
	 *	@return info
	 */
@Override
protected String doIt() throws Exception {
    List<MWMInOutBoundLine> outBoundLines = (List<MWMInOutBoundLine>) getInstancesForSelection(get_TrxName());
    outBoundLines.stream().forEach(outBoundLine -> {
        if (outBoundLine.getDD_OrderLine_ID() > 0) {
            MDDOrderLine orderDistributionLine = (MDDOrderLine) outBoundLine.getDD_OrderLine();
            if (orderDistributionLine.getWM_InOutBoundLine_ID() <= 0) {
                orderDistributionLine.setWM_InOutBoundLine_ID(orderDistributionLine.getWM_InOutBoundLine_ID());
                orderDistributionLine.saveEx();
            }
            if (orderDistributionLine.getM_LocatorTo_ID() == outBoundLocator.getM_Locator_ID())
                return;
        }
        BigDecimal qtySupply = createDistributionOrder(outBoundLine);
        if (isCreateSupply() && qtySupply.signum() > 0) {
            Env.setContext(outBoundLine.getCtx(), IsCreateSupply, "Y");
            createSupply(outBoundLine, qtySupply);
        }
    });
    if (orderDistribution != null && getDocumentAction() != null) {
        orderDistribution.setDocAction(getDocumentAction());
        orderDistribution.setDocStatus(org.compiere.process.DocAction.STATUS_InProgress);
        orderDistribution.completeIt();
        orderDistribution.save();
    }
    if (isPrintPickList() && orderDistribution != null) {
        // Get Format & Data
        ReportEngine reportEngine = getReportEngine("DistributionOrder_Header  ** TEMPLATE **", "DD_Order_Header_v", orderDistribution.getDD_Order_ID());
        if (reportEngine == null)
            throw new AdempiereException("@NotFound@ @AD_PrintFormat_ID@");
        ReportCtl.preview(reportEngine);
        // prints only original
        reportEngine.print();
    }
    //@DocumentNo@ " + order.getDocumentNo();
    return "";
}
Also used : MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine) MDDOrderLine(org.eevolution.model.MDDOrderLine) ReportEngine(org.compiere.print.ReportEngine) AdempiereException(org.adempiere.exceptions.AdempiereException) List(java.util.List) BigDecimal(java.math.BigDecimal)

Example 2 with MWMInOutBoundLine

use of org.eevolution.model.MWMInOutBoundLine in project adempiere by adempiere.

the class GenerateInOutBound method createBasedOnDemand.

private void createBasedOnDemand(MWMInOutBound outBoundOrder, List<MPPMRP> demands) {
    demands.stream().forEach(demand -> {
        MWMInOutBoundLine outBoundOrderLine = new MWMInOutBoundLine(outBoundOrder);
        outBoundOrderLine.setLine(getLineNo(outBoundOrder));
        outBoundOrderLine.setMovementQty(demand.getQty());
        outBoundOrderLine.setDescription(demand.getDescription());
        outBoundOrderLine.setPP_MRP_ID(demand.getPP_MRP_ID());
        outBoundOrderLine.setM_Product_ID(demand.getM_Product_ID());
        if (MPPMRP.ORDERTYPE_SalesOrder.equals(demand.getOrderType())) {
            I_C_OrderLine orderLine = demand.getC_OrderLine();
            outBoundOrderLine.setC_OrderLine_ID(demand.getC_OrderLine_ID());
            outBoundOrderLine.setC_Order_ID(demand.getC_Order_ID());
            outBoundOrderLine.setC_UOM_ID(orderLine.getC_UOM_ID());
            outBoundOrderLine.setM_AttributeSetInstance_ID(orderLine.getM_AttributeSetInstance_ID());
        }
        if (MPPMRP.ORDERTYPE_DistributionOrder.equals(demand.getOrderType())) {
            I_DD_OrderLine orderLine = demand.getDD_OrderLine();
            outBoundOrderLine.setDD_Order_ID(demand.getDD_Order_ID());
            outBoundOrderLine.setDD_OrderLine_ID(demand.getDD_OrderLine_ID());
            outBoundOrderLine.setC_UOM_ID(orderLine.getC_UOM_ID());
            outBoundOrderLine.setM_AttributeSetInstance_ID(orderLine.getM_AttributeSetInstance_ID());
        }
        if (MPPMRP.ORDERTYPE_ManufacturingOrder.equals(demand.getOrderType())) {
            I_PP_Order_BOMLine orderBomLine = demand.getPP_Order_BOMLine();
            outBoundOrderLine.setPP_Order_ID(demand.getPP_Order_ID());
            outBoundOrderLine.setPP_Order_BOMLine_ID(demand.getPP_Order_BOMLine_ID());
            outBoundOrderLine.setC_UOM_ID(orderBomLine.getC_UOM_ID());
            outBoundOrderLine.setM_AttributeSetInstance_ID(orderBomLine.getM_AttributeSetInstance_ID());
        }
        outBoundOrderLine.setPickDate(outBoundOrder.getPickDate());
        outBoundOrderLine.setShipDate(outBoundOrder.getShipDate());
        outBoundOrderLine.saveEx();
    });
}
Also used : MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine) I_C_OrderLine(org.compiere.model.I_C_OrderLine) I_DD_OrderLine(org.eevolution.model.I_DD_OrderLine) I_PP_Order_BOMLine(org.eevolution.model.I_PP_Order_BOMLine)

Example 3 with MWMInOutBoundLine

use of org.eevolution.model.MWMInOutBoundLine in project adempiere by adempiere.

the class GenerateInOutBound method createBasedOnSalesOrders.

private void createBasedOnSalesOrders(MWMInOutBound outBoundOrder, List<MOrderLine> orderLines) {
    orderLines.stream().forEach(orderLine -> {
        MWMInOutBoundLine outBoundOrderLine = new MWMInOutBoundLine(outBoundOrder);
        outBoundOrderLine.setLine(getLineNo(outBoundOrder));
        outBoundOrderLine.setM_Product_ID(orderLine.getM_Product_ID());
        outBoundOrderLine.setM_AttributeSetInstance_ID(orderLine.getM_AttributeSetInstance_ID());
        outBoundOrderLine.setMovementQty(orderLine.getQtyOrdered().subtract(orderLine.getQtyDelivered()));
        outBoundOrderLine.setC_UOM_ID(orderLine.getC_UOM_ID());
        outBoundOrderLine.setDescription(orderLine.getDescription());
        outBoundOrderLine.setC_Order_ID(orderLine.getC_Order_ID());
        outBoundOrderLine.setC_OrderLine_ID(orderLine.getC_OrderLine_ID());
        outBoundOrderLine.setPickDate(outBoundOrder.getPickDate());
        outBoundOrderLine.setShipDate(outBoundOrder.getShipDate());
        outBoundOrderLine.saveEx();
    });
}
Also used : MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine)

Example 4 with MWMInOutBoundLine

use of org.eevolution.model.MWMInOutBoundLine in project adempiere by adempiere.

the class ExpressReceiptScanBar method getSource.

protected LinkedHashMap<Integer, ArrayList<Object>> getSource() {
    if (source != null)
        return source;
    List<MWMInOutBoundLine> InOutBoundLines = new Query(Env.getCtx(), I_WM_InOutBoundLine.Table_Name, "WM_InOutBound_ID=?", null).setClient_ID().setParameters(getRecord_ID()).list();
    source = new LinkedHashMap<Integer, ArrayList<Object>>();
    for (MWMInOutBoundLine line : InOutBoundLines) {
        ArrayList<Object> parameters = new ArrayList<Object>();
        parameters.add(ID, line.getC_OrderLine_ID());
        parameters.add(PRODUCT_ID, line.getM_Product_ID());
        parameters.add(QTY_ORDERED, line.getPickedQty());
        parameters.add(QTY_PICKED, line.getPickedQty());
        parameters.add(QTY_DELIVERED, BigDecimal.ZERO);
        source.put(line.get_ID(), parameters);
    }
    return source;
}
Also used : MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine) Query(org.compiere.model.Query) ArrayList(java.util.ArrayList)

Example 5 with MWMInOutBoundLine

use of org.eevolution.model.MWMInOutBoundLine in project adempiere by adempiere.

the class ExpressReceiptScanBar method loadData.

protected void loadData() {
    data = new LinkedHashMap<String, Vector>();
    for (MWMInOutBoundLine inBoundline : getInOutBoundLines()) {
        inBoundline.setMovementQty(Env.ZERO);
        inBoundline.saveEx();
    }
    for (MWMInOutBoundLineMA inBoundlineMA : getDocumentLines()) {
        MProduct product = null;
        MAttributeSetInstance asi = null;
        String lotNo = null;
        String serNo = null;
        Integer referenceId = null;
        BigDecimal qty = null;
        boolean reset = false;
        MWMInOutBoundLine inBoundline = (MWMInOutBoundLine) inBoundlineMA.getWM_InOutBoundLine();
        // inBoundline.setMovementQty(Env.ZERO);
        // inBoundline.saveEx();
        int M_Product_ID = inBoundline.getM_Product_ID();
        int M_AttributeSetInstance_ID = inBoundlineMA.getM_AttributeSetInstance_ID();
        if (M_Product_ID > 0)
            product = MProduct.get(Env.getCtx(), M_Product_ID);
        else
            continue;
        if (M_AttributeSetInstance_ID > 0) {
            asi = new MAttributeSetInstance(Env.getCtx(), M_AttributeSetInstance_ID, null);
            lotNo = asi.getLot();
            serNo = asi.getSerNo();
        } else {
            M_AttributeSetInstance_ID = 0;
            reset = true;
        }
        //referenceId = inBoundline.getC_OrderLine_ID();
        qty = inBoundlineMA.getMovementQty();
        ArrayList<Object> values = null;
        while (qty.signum() != 0) {
            if (getSource() != null && source.size() > 0) {
                values = checkProduct(product, qty, reset);
                if (values == null)
                    throw new AdempiereException("@M_Product_ID@ ; " + product.getName() + " @InValid@");
            }
            referenceId = (Integer) values.get(ID);
            String key = product.getValue();
            if (lotNo != null && lotNo.length() > 0)
                key = key + lotNo;
            if (serNo != null && serNo.length() > 0)
                key = key + serNo;
            if (serNo == null)
                key = key + "#" + referenceId;
            Vector<Object> line = new Vector<Object>(6);
            line.add(product.getValue());
            line.add(product.getName());
            line.add(lotNo);
            line.add(serNo);
            BigDecimal qtyDelivered = (BigDecimal) values.get(QTY_DELIVERED);
            qty = qty.subtract(qtyDelivered);
            line.add(qtyDelivered);
            line.add(inBoundline.get_ID());
            line.add(referenceId != null ? referenceId.intValue() : 0);
            data.put(key, line);
        }
    }
}
Also used : MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine) MProduct(org.compiere.model.MProduct) MAttributeSetInstance(org.compiere.model.MAttributeSetInstance) MWMInOutBoundLineMA(org.eevolution.model.MWMInOutBoundLineMA) BigDecimal(java.math.BigDecimal) AdempiereException(org.adempiere.exceptions.AdempiereException) Vector(java.util.Vector)

Aggregations

MWMInOutBoundLine (org.eevolution.model.MWMInOutBoundLine)9 BigDecimal (java.math.BigDecimal)3 List (java.util.List)3 MWMInOutBound (org.eevolution.model.MWMInOutBound)3 Arrays (java.util.Arrays)2 Optional (java.util.Optional)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 AdempiereException (org.adempiere.exceptions.AdempiereException)2 MAttributeSetInstance (org.compiere.model.MAttributeSetInstance)2 MProduct (org.compiere.model.MProduct)2 Query (org.compiere.model.Query)2 MWMInOutBoundLineMA (org.eevolution.model.MWMInOutBoundLineMA)2 ArrayList (java.util.ArrayList)1 Vector (java.util.Vector)1 I_C_OrderLine (org.compiere.model.I_C_OrderLine)1 MInvoice (org.compiere.model.MInvoice)1 MOrder (org.compiere.model.MOrder)1 ReportEngine (org.compiere.print.ReportEngine)1 Login (org.compiere.util.Login)1 I_DD_OrderLine (org.eevolution.model.I_DD_OrderLine)1