use of de.metas.handlingunits.model.I_PP_Order in project metasfresh-webui-api by metasfresh.
the class WEBUI_PP_Order_Receipt method createDefaultLUTUConfigManager.
private IDocumentLUTUConfigurationManager createDefaultLUTUConfigManager(@NonNull final PPOrderLineRow row) {
final PPOrderLineType type = row.getType();
if (type == PPOrderLineType.MainProduct) {
final int ppOrderId = row.getPP_Order_ID();
final I_PP_Order ppOrder = load(ppOrderId, I_PP_Order.class);
return huPPOrderBL.createReceiptLUTUConfigurationManager(ppOrder);
} else if (type == PPOrderLineType.BOMLine_ByCoProduct) {
final int ppOrderBOMLineId = row.getPP_Order_BOMLine_ID();
final I_PP_Order_BOMLine ppOrderBOMLine = load(ppOrderBOMLineId, I_PP_Order_BOMLine.class);
return huPPOrderBL.createReceiptLUTUConfigurationManager(ppOrderBOMLine);
} else {
throw new AdempiereException("Receiving is not allowed");
}
}
use of de.metas.handlingunits.model.I_PP_Order in project metasfresh-webui-api by metasfresh.
the class PPOrderLinesLoader method retrieveData.
/**
* Loads {@link PPOrderLinesViewData}s.
*
* @param viewId viewId to be set to newly created {@link PPOrderLineRow}s.
*/
public PPOrderLinesViewData retrieveData(final int ppOrderId) {
final I_PP_Order ppOrder = loadOutOfTrx(ppOrderId, I_PP_Order.class);
final int mainProductBOMLineId = 0;
final ListMultimap<Integer, I_PP_Order_Qty> ppOrderQtysByBOMLineId = ppOrderQtyDAO.streamOrderQtys(ppOrderId).collect(GuavaCollectors.toImmutableListMultimap(ppOrderQty -> Util.firstGreaterThanZero(ppOrderQty.getPP_Order_BOMLine_ID(), mainProductBOMLineId)));
final ImmutableList.Builder<PPOrderLineRow> records = ImmutableList.builder();
// Main product
final PPOrderLineRow rowForMainProduct = createRowForMainProduct(ppOrder, ppOrderQtysByBOMLineId.get(mainProductBOMLineId));
records.add(rowForMainProduct);
// BOM lines
final List<PPOrderLineRow> bomLineRows = createRowsForBomLines(ppOrder, ppOrderQtysByBOMLineId);
records.addAll(bomLineRows);
// Source HUs
final List<PPOrderLineRow> sourceHuRowsForIssueProducts = createRowsForIssueProductSourceHUs(ppOrder.getM_Warehouse_ID(), bomLineRows);
records.addAll(sourceHuRowsForIssueProducts);
return new PPOrderLinesViewData(extractDescription(ppOrder), ppOrder.getPlanningStatus(), records.build());
}
use of de.metas.handlingunits.model.I_PP_Order in project metasfresh-webui-api by metasfresh.
the class WEBUI_PP_Order_Receipt method createReceiptCandidatesProducer.
private final IPPOrderReceiptHUProducer createReceiptCandidatesProducer(final PPOrderLineRow row) {
final PPOrderLineType type = row.getType();
if (type == PPOrderLineType.MainProduct) {
final int ppOrderId = row.getPP_Order_ID();
final I_PP_Order ppOrder = load(ppOrderId, I_PP_Order.class);
return IPPOrderReceiptHUProducer.receiveMainProduct(ppOrder);
} else if (type == PPOrderLineType.BOMLine_ByCoProduct) {
final int ppOrderBOMLineId = row.getPP_Order_BOMLine_ID();
final I_PP_Order_BOMLine ppOrderBOMLine = load(ppOrderBOMLineId, I_PP_Order_BOMLine.class);
return IPPOrderReceiptHUProducer.receiveByOrCoProduct(ppOrderBOMLine);
} else {
throw new AdempiereException("Receiving is not allowed");
}
}
Aggregations