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