Search in sources :

Example 6 with MWMInOutBoundLine

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

the class WMRuleEngine method main.

public static void main(String[] args) {
    Adempiere.startup(true);
    Ini.setProperty(Ini.P_UID, "SuperUser");
    Ini.setProperty(Ini.P_PWD, "System");
    Ini.setProperty(Ini.P_ROLE, "GardenWorld Admin");
    Ini.setProperty(Ini.P_CLIENT, "GardenWorld");
    Ini.setProperty(Ini.P_ORG, "HQ");
    Ini.setProperty(Ini.P_WAREHOUSE, "HQ Warehouse");
    Ini.setProperty(Ini.P_LANGUAGE, "English");
    // Ini.setProperty(Ini.P_PRINTER,"MyPrinter");
    Login login = new Login(Env.getCtx());
    login.batchLogin();
    MWMInOutBoundLine line = new MWMInOutBoundLine(Env.getCtx(), 1000006, null);
    WMRuleEngine engine = WMRuleEngine.get();
    MWMInOutBound order = line.getParent();
    engine.getLocator(line, 0, 0);
}
Also used : MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine) MWMInOutBound(org.eevolution.model.MWMInOutBound) Login(org.compiere.util.Login)

Example 7 with MWMInOutBoundLine

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

the class ExpressReceiptScanBar method createLines.

public void createLines() {
    for (Vector<Object> line : getData().values()) {
        int id = (Integer) line.get(5);
        MWMInOutBoundLine ioBoundLine = new MWMInOutBoundLine(Env.getCtx(), id, null);
        for (MWMInOutBoundLineMA ioBoundLineMA : getLinesMA(ioBoundLine)) {
            ioBoundLineMA.deleteEx(true);
        }
    }
    for (Vector<Object> line : getData().values()) {
        String value = (String) line.get(0);
        String lotNo = (String) line.get(2);
        String serNo = (String) line.get(3);
        Boolean isASI = (lotNo != null && lotNo.length() > 0) || (serNo != null && serNo.length() > 0) ? true : false;
        BigDecimal qty = (BigDecimal) line.get(4);
        int id = (Integer) line.get(5);
        Integer referenceId = (Integer) line.get(6);
        MWMInOutBoundLine boundLine = null;
        MAttributeSetInstance asi = null;
        MProduct product = new Query(Env.getCtx(), I_M_Product.Table_Name, "Value = ? ", null).setClient_ID().setParameters(value).firstOnly();
        String desc = null;
        if (referenceId > 0)
            boundLine = getMWMInOutBoundLine(referenceId, product.get_ID());
        if (product.getM_AttributeSet_ID() > 0 && isASI) {
            asi = getASI(product, lotNo, serNo);
            if (asi == null)
                asi = getAttributeSetInstance(product, lotNo, serNo, getM_Locater_ID(), null);
        }
        MWMInOutBoundLineMA boundLineMA = new MWMInOutBoundLineMA(Env.getCtx(), 0, null);
        if (asi == null && isASI) {
            asi = new MAttributeSetInstance(Env.getCtx(), 0, product.getM_AttributeSet_ID(), null);
            if (lotNo != null) {
                asi.setLot(lotNo);
                desc = lotNo;
            }
            if (serNo != null) {
                asi.setSerNo(serNo);
                if (desc != null)
                    desc = desc + " - " + serNo;
                else
                    desc = serNo;
            }
            asi.setDescription(desc);
            asi.saveEx();
        }
        boundLineMA.setWM_InOutBoundLine_ID(boundLine.get_ID());
        boundLineMA.setM_AttributeSetInstance_ID(asi == null ? 0 : asi.getM_AttributeSetInstance_ID());
        boundLineMA.setMovementQty(qty);
        boundLineMA.saveEx();
        boundLine.setMovementQty(boundLine.getMovementQty().add(qty));
        boundLine.saveEx();
    }
}
Also used : MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine) MProduct(org.compiere.model.MProduct) Query(org.compiere.model.Query) MAttributeSetInstance(org.compiere.model.MAttributeSetInstance) MWMInOutBoundLineMA(org.eevolution.model.MWMInOutBoundLineMA) BigDecimal(java.math.BigDecimal)

Example 8 with MWMInOutBoundLine

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

the class ProcessingInvoiceSelection method createInboundLineFrom.

/**
     * Create inboud lines from invoice
     * @param invoices
     */
private void createInboundLineFrom(List<MInvoice> invoices) {
    MWMInOutBound inOutBound = (MWMInOutBound) getInstance(get_TrxName());
    AtomicInteger lineNo = new AtomicInteger(10);
    invoices.stream().filter(invoice -> invoice != null).flatMap(invoice -> Arrays.stream(invoice.getLines(true))).forEach(invoiceLine -> {
        MWMInOutBoundLine outBoundLine = MWMInOutBoundLine.getByInvoiceLine(invoiceLine);
        if (outBoundLine == null) {
            outBoundLine = new MWMInOutBoundLine(inOutBound, invoiceLine);
            outBoundLine.setLine(lineNo.get());
            outBoundLine.saveEx();
            lineNo.updateAndGet(line -> line + 10);
        }
    });
}
Also used : MInvoice(org.compiere.model.MInvoice) Arrays(java.util.Arrays) List(java.util.List) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Optional(java.util.Optional) MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine) MWMInOutBound(org.eevolution.model.MWMInOutBound) MWMInOutBound(org.eevolution.model.MWMInOutBound) MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine) AtomicInteger(java.util.concurrent.atomic.AtomicInteger)

Example 9 with MWMInOutBoundLine

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

the class ProcessingOrderSelection method createInboundLineFrom.

/**
	 * Create Inboud line form Order
	 * @param orders
	 */
private void createInboundLineFrom(List<MOrder> orders) {
    MWMInOutBound inOutBound = (MWMInOutBound) getInstance(get_TrxName());
    AtomicInteger lineNo = new AtomicInteger(10);
    orders.stream().filter(order -> order != null).flatMap(order -> Arrays.stream(order.getLines())).forEach(orderLine -> {
        MWMInOutBoundLine outBoundLine = MWMInOutBoundLine.getByOrderLine(orderLine);
        if (outBoundLine == null) {
            outBoundLine = new MWMInOutBoundLine(inOutBound, orderLine);
            outBoundLine.setLine(lineNo.get());
            outBoundLine.saveEx();
            lineNo.updateAndGet(line -> line + 10);
        }
    });
}
Also used : Arrays(java.util.Arrays) List(java.util.List) MOrder(org.compiere.model.MOrder) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Optional(java.util.Optional) MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine) MWMInOutBound(org.eevolution.model.MWMInOutBound) MWMInOutBound(org.eevolution.model.MWMInOutBound) MWMInOutBoundLine(org.eevolution.model.MWMInOutBoundLine) AtomicInteger(java.util.concurrent.atomic.AtomicInteger)

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