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);
}
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);
}
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();
}
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();
}
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();
}
Aggregations