Search in sources :

Example 1 with MWMInOutBound

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

the class GenerateInOutBound method createOutBoundOrder.

private MWMInOutBound createOutBoundOrder() {
    MLocator locator = MLocator.get(getCtx(), getLocatorId());
    MWMInOutBound outBoundOrder = new MWMInOutBound(getCtx(), 0, get_TrxName());
    outBoundOrder.setShipDate(getShipDate());
    outBoundOrder.setPickDate(getPickDate());
    if (getOrderReference() != null)
        outBoundOrder.setPOReference(getOrderReference());
    if (getDeliveryRule() != null)
        outBoundOrder.setDeliveryRule(getDeliveryRule());
    if (getDeliveryVia() != null)
        outBoundOrder.setDeliveryViaRule(getDeliveryVia());
    if (getDocumentTypeId() > 0)
        outBoundOrder.setC_DocType_ID(getDocumentTypeId());
    else {
        int docTypeId = MDocType.getDocType(MDocType.DOCBASETYPE_WarehouseManagementOrder);
        if (docTypeId <= 0)
            throw new DocTypeNotFoundException(MDocType.DOCBASETYPE_WarehouseManagementOrder, "");
        else
            outBoundOrder.setC_DocType_ID(docTypeId);
    }
    if (getDocumentAction() != null)
        outBoundOrder.setDocAction(getDocumentAction());
    else
        outBoundOrder.setDocAction(MWMInOutBound.ACTION_Prepare);
    outBoundOrder.setDocStatus(MWMInOutBound.DOCSTATUS_Drafted);
    outBoundOrder.setM_Warehouse_ID(locator.getM_Warehouse_ID());
    outBoundOrder.setIsSOTrx(true);
    outBoundOrder.saveEx();
    return outBoundOrder;
}
Also used : MWMInOutBound(org.eevolution.model.MWMInOutBound) MLocator(org.compiere.model.MLocator) DocTypeNotFoundException(org.adempiere.exceptions.DocTypeNotFoundException)

Example 2 with MWMInOutBound

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

the class GenerateInOutBound method doIt.

/**
     * Process - Generate Export Format
     * @return info
     */
protected String doIt() throws Exception {
    // Create Outbound Order
    MWMInOutBound outBoundOrder = null;
    // Based on Sales Order Line
    if ("ol".equals(getAliasForTableSelection())) {
        outBoundOrder = createOutBoundOrder();
        createBasedOnSalesOrders(outBoundOrder, (List<MOrderLine>) getInstancesForSelection(get_TrxName()));
    }
    // Based on MRP
    if ("demand".equals(getAliasForTableSelection())) {
        getProcessInfo().setTableSelectionId(MPPMRP.Table_ID);
        outBoundOrder = createOutBoundOrder();
        createBasedOnDemand(outBoundOrder, (List<MPPMRP>) getInstancesForSelection(get_TrxName()));
    }
    return "@DocumentNo@ " + outBoundOrder.getDocumentNo();
}
Also used : MWMInOutBound(org.eevolution.model.MWMInOutBound) MOrderLine(org.compiere.model.MOrderLine) MPPMRP(org.eevolution.model.MPPMRP)

Example 3 with MWMInOutBound

use of org.eevolution.model.MWMInOutBound 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 4 with MWMInOutBound

use of org.eevolution.model.MWMInOutBound 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 5 with MWMInOutBound

use of org.eevolution.model.MWMInOutBound 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

MWMInOutBound (org.eevolution.model.MWMInOutBound)5 MWMInOutBoundLine (org.eevolution.model.MWMInOutBoundLine)3 Arrays (java.util.Arrays)2 List (java.util.List)2 Optional (java.util.Optional)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 DocTypeNotFoundException (org.adempiere.exceptions.DocTypeNotFoundException)1 MInvoice (org.compiere.model.MInvoice)1 MLocator (org.compiere.model.MLocator)1 MOrder (org.compiere.model.MOrder)1 MOrderLine (org.compiere.model.MOrderLine)1 Login (org.compiere.util.Login)1 MPPMRP (org.eevolution.model.MPPMRP)1