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;
}
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();
}
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);
}
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);
}
});
}
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);
}
});
}
Aggregations