Search in sources :

Example 6 with HUEditorRow

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

the class WEBUI_PP_Order_HUEditor_ProcessBase method retrieveSelectedAndEligibleHUEditorRows.

protected final Stream<HUEditorRow> retrieveSelectedAndEligibleHUEditorRows() {
    final HUEditorView huEditorView = HUEditorView.cast(super.getView());
    final Stream<HUEditorRow> huEditorRows = huEditorView.streamByIds(getSelectedRowIds());
    return retrieveEligibleHUEditorRows(huEditorRows);
}
Also used : HUEditorView(de.metas.ui.web.handlingunits.HUEditorView) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 7 with HUEditorRow

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

the class HUsToPickViewBasedProcess method checkPreconditionsApplicable.

@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable() {
    final Optional<HUEditorRow> anyHU = retrieveEligibleHUEditorRows().findAny();
    if (anyHU.isPresent()) {
        return ProcessPreconditionsResolution.accept();
    }
    final ITranslatableString reason = Services.get(IMsgBL.class).getTranslatableMsgText(MSG_WEBUI_SELECT_ACTIVE_UNSELECTED_HU);
    return ProcessPreconditionsResolution.reject(reason);
}
Also used : IMsgBL(de.metas.i18n.IMsgBL) ITranslatableString(de.metas.i18n.ITranslatableString) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 8 with HUEditorRow

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

the class WEBUIHUCreationWithSerialNumberService method action_CreateCUs_With_SerialNumbers.

public final WebuiHUTransformCommandResult action_CreateCUs_With_SerialNumbers(final HUEditorRow.HUEditorRowHierarchy huEditorRowHierarchy, final List<String> availableSerialNumbers) {
    final HUEditorRow selectedCuRow = huEditorRowHierarchy.getCuRow();
    final int qtyCU = selectedCuRow.getQtyCU().intValueExact();
    if (qtyCU == 1) {
        final String serialNo = availableSerialNumbers.remove(0);
        assignSerialNumberToCU(selectedCuRow.getM_HU_ID(), serialNo);
        huIDsChanged.add(selectedCuRow.getM_HU_ID());
    } else {
        final int serialNoCount = availableSerialNumbers.size();
        final int cusToCreateCount = qtyCU < serialNoCount ? qtyCU : serialNoCount;
        final Set<Integer> splittedCUIDs = splitIntoCUs(huEditorRowHierarchy, cusToCreateCount);
        assignSerialNumbersToCUs(splittedCUIDs, availableSerialNumbers);
        huIDsAdded.addAll(splittedCUIDs);
    }
    return WebuiHUTransformCommandResult.builder().huIdsChanged(huIDsChanged).huIdsToRemoveFromView(huIDsToRemove).huIdsToAddToView(huIDsAdded).build();
}
Also used : HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 9 with HUEditorRow

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

the class WEBUI_M_HU_Transform method newParametersFiller.

protected WebuiHUTransformParametersFiller newParametersFiller() {
    final HUEditorView view = getView();
    final HUEditorRow selectedRow = getSingleSelectedRow();
    return WebuiHUTransformParametersFiller.builder().view(view).selectedRow(selectedRow).actionType(p_Action == null ? null : ActionType.valueOf(p_Action)).checkExistingHUsInsideView(view.getParameterAsBoolean(PARAM_CheckExistingHUsInsideView, false)).build();
}
Also used : HUEditorView(de.metas.ui.web.handlingunits.HUEditorView) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 10 with HUEditorRow

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

the class PickingHUsRepositoryTests method test_retrieveSourceHUs_empty_shipmentScheduleIds.

@Test
public void test_retrieveSourceHUs_empty_shipmentScheduleIds() {
    final HUEditorViewRepository huEditorViewRepository = new MockedHUEditorViewRepository();
    final PickingHURowsRepository pickingHUsRepository = new PickingHURowsRepository(huEditorViewRepository);
    final List<HUEditorRow> sourceHUs = pickingHUsRepository.retrieveSourceHUs(PickingSlotRepoQuery.builder().build());
    assertThat(sourceHUs).isEmpty();
}
Also used : HUEditorViewRepository(de.metas.ui.web.handlingunits.HUEditorViewRepository) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) PickedHUEditorRow(de.metas.ui.web.picking.pickingslot.PickingHURowsRepository.PickedHUEditorRow) Test(org.junit.Test)

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