Search in sources :

Example 21 with HUEditorRow

use of de.metas.ui.web.handlingunits.HUEditorRow 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)

Example 22 with HUEditorRow

use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_PickingSlotsClearingView_TakeOutTUAndAddToLU method doIt.

@Override
protected String doIt() throws Exception {
    final PickingSlotRow pickingSlotRow = getSingleSelectedPickingSlotRow();
    Check.assume(pickingSlotRow.isTU(), "Picking slot HU shall be a TU: {}", pickingSlotRow);
    final I_M_HU tuHU = InterfaceWrapperHelper.load(pickingSlotRow.getHuId(), I_M_HU.class);
    final HUEditorRow packingHURow = getSingleSelectedPackingHUsRow();
    Check.assume(packingHURow.isLU(), "Pack to HU shall be a LU: {}", packingHURow);
    final I_M_HU luHU = packingHURow.getM_HU();
    final BigDecimal qtyTU = BigDecimal.ONE;
    final List<Integer> huIdsDestroyedCollector = new ArrayList<>();
    HUTransformService.builder().emptyHUListener(EmptyHUListener.doBeforeDestroyed(hu -> huIdsDestroyedCollector.add(hu.getM_HU_ID()))).build().tuToExistingLU(tuHU, qtyTU, luHU);
    // Remove from picking slots all destroyed HUs
    pickingCandidateService.inactivateForHUIds(huIdsDestroyedCollector);
    return MSG_OK;
}
Also used : HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) EmptyHUListener(de.metas.handlingunits.storage.EmptyHUListener) Autowired(org.springframework.beans.factory.annotation.Autowired) HUTransformService(de.metas.handlingunits.allocation.transfer.HUTransformService) PickingCandidateService(de.metas.handlingunits.picking.PickingCandidateService) ArrayList(java.util.ArrayList) ProcessPreconditionsResolution(de.metas.process.ProcessPreconditionsResolution) BigDecimal(java.math.BigDecimal) List(java.util.List) InterfaceWrapperHelper(org.adempiere.model.InterfaceWrapperHelper) Check(org.adempiere.util.Check) I_M_HU(de.metas.handlingunits.model.I_M_HU) IProcessPrecondition(de.metas.process.IProcessPrecondition) PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) I_M_HU(de.metas.handlingunits.model.I_M_HU) ArrayList(java.util.ArrayList) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) BigDecimal(java.math.BigDecimal)

Example 23 with HUEditorRow

use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_PickingSlotsClearingView_TakeOutTUAndAddToLU method checkPreconditionsApplicable.

@Override
protected ProcessPreconditionsResolution checkPreconditionsApplicable() {
    // Validate the picking slots clearing selected row (left side)
    if (!isSingleSelectedPickingSlotRow()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("select one and only one picking slots HU");
    }
    final PickingSlotRow pickingSlotRow = getSingleSelectedPickingSlotRow();
    if (!pickingSlotRow.isTU()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("select a TU");
    }
    // Validate the packing HUs selected row (right side)
    if (!isSingleSelectedPackingHUsRow()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("select one and only one HU to pack to");
    }
    final HUEditorRow packingHURow = getSingleSelectedPackingHUsRow();
    if (!packingHURow.isLU()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("select a LU to pack too");
    }
    // 
    return ProcessPreconditionsResolution.accept();
}
Also used : PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 24 with HUEditorRow

use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_PP_Order_HUEditor_IssueTopLevelHUs method doIt.

@Override
protected String doIt() throws Exception {
    final Stream<HUEditorRow> selectedTopLevelHuRows = streamSelectedRows(HUEditorRowFilter.select(Select.ONLY_TOPLEVEL));
    final List<I_M_HU> selectedEligibleRows = retrieveEligibleHUEditorRows(selectedTopLevelHuRows).map(HUEditorRow::getM_HU).collect(ImmutableList.toImmutableList());
    final HUEditorView huEditorView = getView();
    if (selectedEligibleRows.isEmpty()) {
        throw new AdempiereException("@NoSelection@");
    }
    final PPOrderLinesView ppOrderView = getPPOrderView().get();
    final int ppOrderId = ppOrderView.getPP_Order_ID();
    Services.get(IHUPPOrderBL.class).createIssueProducer().setTargetOrderBOMLinesByPPOrderId(ppOrderId).createDraftIssues(selectedEligibleRows);
    huEditorView.removeHUsAndInvalidate(selectedEligibleRows);
    ppOrderView.invalidateAll();
    return MSG_OK;
}
Also used : IHUPPOrderBL(de.metas.handlingunits.pporder.api.IHUPPOrderBL) PPOrderLinesView(de.metas.ui.web.pporder.PPOrderLinesView) I_M_HU(de.metas.handlingunits.model.I_M_HU) AdempiereException(org.adempiere.exceptions.AdempiereException) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 25 with HUEditorRow

use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.

the class WEBUI_PickingSlotsClearingView_TakeOutCUsAndAddToTU method getTargetTU.

private I_M_HU getTargetTU() {
    final HUEditorRow huRow = getSingleSelectedPackingHUsRow();
    Check.assume(huRow.isTU(), "row {} shall be a TU", huRow);
    return huRow.getM_HU();
}
Also used : HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Aggregations

HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)28 I_M_HU (de.metas.handlingunits.model.I_M_HU)8 HUEditorView (de.metas.ui.web.handlingunits.HUEditorView)6 List (java.util.List)5 NonNull (lombok.NonNull)5 Services (org.adempiere.util.Services)5 IHandlingUnitsDAO (de.metas.handlingunits.IHandlingUnitsDAO)3 HUTransformService (de.metas.handlingunits.allocation.transfer.HUTransformService)3 IHUPPOrderBL (de.metas.handlingunits.pporder.api.IHUPPOrderBL)3 ITranslatableString (de.metas.i18n.ITranslatableString)3 Check (de.metas.printing.esb.base.util.Check)3 PickedHUEditorRow (de.metas.ui.web.picking.pickingslot.PickingHURowsRepository.PickedHUEditorRow)3 PickingSlotRow (de.metas.ui.web.picking.pickingslot.PickingSlotRow)3 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)3 SqlLookupDescriptor (de.metas.ui.web.window.descriptor.sql.SqlLookupDescriptor)3 LookupDataSource (de.metas.ui.web.window.model.lookup.LookupDataSource)3 LookupDataSourceFactory (de.metas.ui.web.window.model.lookup.LookupDataSourceFactory)3 Comparator (java.util.Comparator)3 HashSet (java.util.HashSet)3 Nullable (javax.annotation.Nullable)3