Search in sources :

Example 26 with HUEditorRow

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();
}
Also used : PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 27 with HUEditorRow

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();
}
Also used : HashMap(java.util.HashMap) I_M_Picking_Candidate(de.metas.handlingunits.model.I_M_Picking_Candidate) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 28 with HUEditorRow

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();
}
Also used : IMsgBL(de.metas.i18n.IMsgBL) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) ITranslatableString(de.metas.i18n.ITranslatableString) 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