Search in sources :

Example 1 with I_PP_Order_Qty

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;
}
Also used : I_PP_Order_Qty(de.metas.handlingunits.model.I_PP_Order_Qty)

Example 2 with I_PP_Order_Qty

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();
}
Also used : I_PP_Order_Qty(de.metas.handlingunits.model.I_PP_Order_Qty) Quantity(de.metas.quantity.Quantity) I_C_UOM(org.compiere.model.I_C_UOM) Test(org.junit.Test)

Example 3 with I_PP_Order_Qty

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());
}
Also used : I_M_HU_LUTU_Configuration(de.metas.handlingunits.model.I_M_HU_LUTU_Configuration) X_PP_Order_BOMLine(org.eevolution.model.X_PP_Order_BOMLine) GuavaCollectors(org.adempiere.util.GuavaCollectors) ListMultimap(com.google.common.collect.ListMultimap) IHUPPOrderBL(de.metas.handlingunits.pporder.api.IHUPPOrderBL) InterfaceWrapperHelper.loadOutOfTrx(org.adempiere.model.InterfaceWrapperHelper.loadOutOfTrx) I_PP_Order_Qty(de.metas.handlingunits.model.I_PP_Order_Qty) Function(java.util.function.Function) IPPOrderBOMDAO(de.metas.material.planning.pporder.IPPOrderBOMDAO) BigDecimal(java.math.BigDecimal) SqlHUEditorViewRepository(de.metas.ui.web.handlingunits.SqlHUEditorViewRepository) InterfaceWrapperHelper(org.adempiere.model.InterfaceWrapperHelper) ImmutableList(com.google.common.collect.ImmutableList) Quantity(de.metas.quantity.Quantity) I_PP_Order(de.metas.handlingunits.model.I_PP_Order) HUPackingInfos(de.metas.ui.web.handlingunits.util.HUPackingInfos) Nullable(javax.annotation.Nullable) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) IHUPPOrderQtyDAO(de.metas.handlingunits.pporder.api.IHUPPOrderQtyDAO) MatchingSourceHusQuery(de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery) Util(org.compiere.util.Util) IPPOrderBOMBL(de.metas.material.planning.pporder.IPPOrderBOMBL) ImmutableSet(com.google.common.collect.ImmutableSet) HUPackingInfoFormatter(de.metas.ui.web.handlingunits.util.HUPackingInfoFormatter) ITranslatableString(de.metas.i18n.ITranslatableString) NonNull(lombok.NonNull) HUEditorViewRepository(de.metas.ui.web.handlingunits.HUEditorViewRepository) SourceHUsService(de.metas.handlingunits.sourcehu.SourceHUsService) IModelTranslationMap(de.metas.i18n.IModelTranslationMap) SqlViewBinding(de.metas.ui.web.view.descriptor.SqlViewBinding) WindowId(de.metas.ui.web.window.datatypes.WindowId) IHUPackingInfo(de.metas.ui.web.handlingunits.util.IHUPackingInfo) I_PP_Order_BOMLine(de.metas.handlingunits.model.I_PP_Order_BOMLine) ASIViewRowAttributesProvider(de.metas.ui.web.view.ASIViewRowAttributesProvider) Services(org.adempiere.util.Services) List(java.util.List) Builder(lombok.Builder) I_C_DocType(org.compiere.model.I_C_DocType) X_PP_Order(org.eevolution.model.X_PP_Order) Comparator(java.util.Comparator) HUEditorRowAttributesProvider(de.metas.ui.web.handlingunits.HUEditorRowAttributesProvider) ImmutableTranslatableString(de.metas.i18n.ImmutableTranslatableString) I_PP_Order(de.metas.handlingunits.model.I_PP_Order) I_PP_Order_Qty(de.metas.handlingunits.model.I_PP_Order_Qty) ImmutableList(com.google.common.collect.ImmutableList)

Example 4 with I_PP_Order_Qty

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();
}
Also used : I_M_HU_LUTU_Configuration(de.metas.handlingunits.model.I_M_HU_LUTU_Configuration) X_PP_Order_BOMLine(org.eevolution.model.X_PP_Order_BOMLine) GuavaCollectors(org.adempiere.util.GuavaCollectors) ListMultimap(com.google.common.collect.ListMultimap) IHUPPOrderBL(de.metas.handlingunits.pporder.api.IHUPPOrderBL) InterfaceWrapperHelper.loadOutOfTrx(org.adempiere.model.InterfaceWrapperHelper.loadOutOfTrx) I_PP_Order_Qty(de.metas.handlingunits.model.I_PP_Order_Qty) Function(java.util.function.Function) IPPOrderBOMDAO(de.metas.material.planning.pporder.IPPOrderBOMDAO) BigDecimal(java.math.BigDecimal) SqlHUEditorViewRepository(de.metas.ui.web.handlingunits.SqlHUEditorViewRepository) InterfaceWrapperHelper(org.adempiere.model.InterfaceWrapperHelper) ImmutableList(com.google.common.collect.ImmutableList) Quantity(de.metas.quantity.Quantity) I_PP_Order(de.metas.handlingunits.model.I_PP_Order) HUPackingInfos(de.metas.ui.web.handlingunits.util.HUPackingInfos) Nullable(javax.annotation.Nullable) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) IHUPPOrderQtyDAO(de.metas.handlingunits.pporder.api.IHUPPOrderQtyDAO) MatchingSourceHusQuery(de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery) Util(org.compiere.util.Util) IPPOrderBOMBL(de.metas.material.planning.pporder.IPPOrderBOMBL) ImmutableSet(com.google.common.collect.ImmutableSet) HUPackingInfoFormatter(de.metas.ui.web.handlingunits.util.HUPackingInfoFormatter) ITranslatableString(de.metas.i18n.ITranslatableString) NonNull(lombok.NonNull) HUEditorViewRepository(de.metas.ui.web.handlingunits.HUEditorViewRepository) SourceHUsService(de.metas.handlingunits.sourcehu.SourceHUsService) IModelTranslationMap(de.metas.i18n.IModelTranslationMap) SqlViewBinding(de.metas.ui.web.view.descriptor.SqlViewBinding) WindowId(de.metas.ui.web.window.datatypes.WindowId) IHUPackingInfo(de.metas.ui.web.handlingunits.util.IHUPackingInfo) I_PP_Order_BOMLine(de.metas.handlingunits.model.I_PP_Order_BOMLine) ASIViewRowAttributesProvider(de.metas.ui.web.view.ASIViewRowAttributesProvider) Services(org.adempiere.util.Services) List(java.util.List) Builder(lombok.Builder) I_C_DocType(org.compiere.model.I_C_DocType) X_PP_Order(org.eevolution.model.X_PP_Order) Comparator(java.util.Comparator) HUEditorRowAttributesProvider(de.metas.ui.web.handlingunits.HUEditorRowAttributesProvider) ImmutableTranslatableString(de.metas.i18n.ImmutableTranslatableString) Quantity(de.metas.quantity.Quantity)

Aggregations

I_PP_Order_Qty (de.metas.handlingunits.model.I_PP_Order_Qty)4 Quantity (de.metas.quantity.Quantity)3 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 ListMultimap (com.google.common.collect.ListMultimap)2 I_M_HU_LUTU_Configuration (de.metas.handlingunits.model.I_M_HU_LUTU_Configuration)2 I_PP_Order (de.metas.handlingunits.model.I_PP_Order)2 I_PP_Order_BOMLine (de.metas.handlingunits.model.I_PP_Order_BOMLine)2 IHUPPOrderBL (de.metas.handlingunits.pporder.api.IHUPPOrderBL)2 IHUPPOrderQtyDAO (de.metas.handlingunits.pporder.api.IHUPPOrderQtyDAO)2 SourceHUsService (de.metas.handlingunits.sourcehu.SourceHUsService)2 MatchingSourceHusQuery (de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery)2 IModelTranslationMap (de.metas.i18n.IModelTranslationMap)2 ITranslatableString (de.metas.i18n.ITranslatableString)2 ImmutableTranslatableString (de.metas.i18n.ImmutableTranslatableString)2 IPPOrderBOMBL (de.metas.material.planning.pporder.IPPOrderBOMBL)2 IPPOrderBOMDAO (de.metas.material.planning.pporder.IPPOrderBOMDAO)2 HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)2 HUEditorRowAttributesProvider (de.metas.ui.web.handlingunits.HUEditorRowAttributesProvider)2 HUEditorViewRepository (de.metas.ui.web.handlingunits.HUEditorViewRepository)2