use of de.metas.handlingunits.model.I_PP_Order_Qty in project metasfresh-webui-api by metasfresh.
the class WEBUI_PP_Order_ReverseCandidate method doIt.
@Override
protected String doIt() throws Exception {
final int ppOrderQtyId = getSingleSelectedRow().getPP_Order_Qty_ID();
final I_PP_Order_Qty candidate = huPPOrderQtyDAO.retrieveById(ppOrderQtyId);
huPPOrderQtyBL.reverseDraftCandidate(candidate);
return MSG_OK;
}
use of de.metas.handlingunits.model.I_PP_Order_Qty in project metasfresh-webui-api by metasfresh.
the class PPOrderLineRowTest method canBuildForIssuedOrReceivedHU.
@Test
public void canBuildForIssuedOrReceivedHU() {
final I_C_UOM uom = newInstance(I_C_UOM.class);
uom.setUOMSymbol("UOMSymbol");
final I_PP_Order_Qty ppOrderQty = newInstance(I_PP_Order_Qty.class);
ppOrderQty.setM_HU_ID(10);
final PPOrderLineRow result = PPOrderLineRow.builderForIssuedOrReceivedHU().attributesSupplier(() -> null).code("code").includedRows(ImmutableList.of()).packingInfo("packingInfo").ppOrderQty(ppOrderQty).processed(true).product(JSONLookupValue.of(35, "product")).quantity(new Quantity(BigDecimal.TEN, uom)).rowId(DocumentId.of(40)).type(PPOrderLineType.HU_TU).topLevelHU(true).huStatus(JSONLookupValue.of(X_M_HU.HUSTATUS_Active, "Active")).build();
assertThat(result.getPackingInfo()).isEqualTo("packingInfo");
assertThat(result.isTopLevelHU()).isTrue();
assertThat(result.isHUStatusActive()).isTrue();
}
use of de.metas.handlingunits.model.I_PP_Order_Qty 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_Qty in project metasfresh-webui-api by metasfresh.
the class PPOrderLinesLoader method createForHUViewRecordRecursively.
private PPOrderLineRow createForHUViewRecordRecursively(@NonNull final I_PP_Order_Qty ppOrderQty, @NonNull final HUEditorRow huEditorRow, @Nullable final HUEditorRow parentHUEditorRow, final boolean readonly) {
final Quantity quantity = computeQuantityForHuPPOrderLineRow(ppOrderQty, huEditorRow, parentHUEditorRow);
final ImmutableList<PPOrderLineRow> includedRows = huEditorRow.getIncludedRows().stream().map(includedHUEditorRow -> createForHUViewRecordRecursively(ppOrderQty, includedHUEditorRow, huEditorRow, readonly)).collect(ImmutableList.toImmutableList());
return PPOrderLineRow.builderForIssuedOrReceivedHU().rowId(huEditorRow.getId()).type(PPOrderLineType.ofHUEditorRowType(huEditorRow.getType())).ppOrderQty(ppOrderQty).processed(readonly || ppOrderQty.isProcessed()).attributesSupplier(huEditorRow.getAttributesSupplier()).code(huEditorRow.getValue()).product(huEditorRow.getProduct()).packingInfo(huEditorRow.getPackingInfo()).topLevelHU(huEditorRow.isTopLevel()).huStatus(huEditorRow.getHUStatus()).quantity(quantity).includedRows(includedRows).build();
}
Aggregations