use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.
the class WEBUI_PickingSlotsClearingView_TakeOutCUsAndAddToTU method checkPreconditionsApplicable.
@Override
protected ProcessPreconditionsResolution checkPreconditionsApplicable() {
//
// Validate the picking slots clearing selected row (left side)
// i.e. the ones which we will Take Out
final List<PickingSlotRow> pickingSlotRows = getSelectedPickingSlotRows();
if (pickingSlotRows.isEmpty()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("select some picking slots CUs");
}
for (final PickingSlotRow pickingSlotRow : pickingSlotRows) {
if (!pickingSlotRow.isCU()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("select a CU");
}
}
// i.e. the HU where we will pack to
if (!isSingleSelectedPackingHUsRow()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("select one and only one TU to pack to");
}
final HUEditorRow packingHURow = getSingleSelectedPackingHUsRow();
if (!packingHURow.isTU()) {
return ProcessPreconditionsResolution.rejectWithInternalReason("select a TU to pack too");
}
//
return ProcessPreconditionsResolution.accept();
}
use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.
the class PickingHURowsRepository method retrievePickedHUsIndexedByPickingSlotId.
private ListMultimap<Integer, PickedHUEditorRow> retrievePickedHUsIndexedByPickingSlotId(@NonNull final List<I_M_Picking_Candidate> pickingCandidates) {
final Map<Integer, PickedHUEditorRow> huId2huRow = new HashMap<>();
final Builder<Integer, PickedHUEditorRow> builder = ImmutableListMultimap.builder();
for (final I_M_Picking_Candidate pickingCandidate : pickingCandidates) {
final int huId = pickingCandidate.getM_HU_ID();
if (huId2huRow.containsKey(huId)) {
continue;
}
final HUEditorRow huEditorRow = huEditorRepo.retrieveForHUId(huId);
final boolean pickingCandidateProcessed = isPickingCandidateProcessed(pickingCandidate);
final PickedHUEditorRow row = new PickedHUEditorRow(huEditorRow, pickingCandidateProcessed);
huId2huRow.put(huId, row);
builder.put(pickingCandidate.getM_PickingSlot_ID(), row);
}
return builder.build();
}
use of de.metas.ui.web.handlingunits.HUEditorRow in project metasfresh-webui-api by metasfresh.
the class WEBUI_HUsToPick_PickCU method checkPreconditionsApplicable.
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable() {
final DocumentIdsSelection selectedRowIds = getSelectedRowIds();
if (selectedRowIds.isEmpty()) {
return ProcessPreconditionsResolution.rejectBecauseNoSelection();
} else if (selectedRowIds.isMoreThanOneDocumentId()) {
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
final HUEditorRow huRow = getSingleSelectedRow();
if (!isEligible(huRow)) {
final ITranslatableString reason = Services.get(IMsgBL.class).getTranslatableMsgText(MSG_WEBUI_SELECT_ACTIVE_UNSELECTED_HU);
return ProcessPreconditionsResolution.reject(reason);
}
return ProcessPreconditionsResolution.accept();
}
Aggregations