Search in sources :

Example 1 with I_PP_Order

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");
    }
}
Also used : I_PP_Order(de.metas.handlingunits.model.I_PP_Order) AdempiereException(org.adempiere.exceptions.AdempiereException) PPOrderLineType(de.metas.ui.web.pporder.PPOrderLineType) I_PP_Order_BOMLine(org.eevolution.model.I_PP_Order_BOMLine)

Example 2 with I_PP_Order

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());
}
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 3 with I_PP_Order

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");
    }
}
Also used : I_PP_Order(de.metas.handlingunits.model.I_PP_Order) AdempiereException(org.adempiere.exceptions.AdempiereException) PPOrderLineType(de.metas.ui.web.pporder.PPOrderLineType) I_PP_Order_BOMLine(org.eevolution.model.I_PP_Order_BOMLine)

Aggregations

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