Search in sources :

Example 6 with DocumentIdsSelection

use of de.metas.ui.web.window.datatypes.DocumentIdsSelection in project metasfresh-webui-api by metasfresh.

the class WEBUI_PickingSlotsClearingView_TakeOutHU method checkPreconditionsApplicable.

@Override
protected ProcessPreconditionsResolution checkPreconditionsApplicable() {
    final DocumentIdsSelection selectedRowIds = getSelectedRowIds();
    if (selectedRowIds.isEmpty()) {
        return ProcessPreconditionsResolution.rejectBecauseNoSelection();
    }
    if (!selectedRowIds.isSingleDocumentId()) {
        return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
    }
    final PickingSlotRow row = getSingleSelectedPickingSlotRow();
    if (!row.isTopLevelHU()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("select a top level HU");
    }
    return ProcessPreconditionsResolution.accept();
}
Also used : PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection)

Example 7 with DocumentIdsSelection

use of de.metas.ui.web.window.datatypes.DocumentIdsSelection in project metasfresh-webui-api by metasfresh.

the class WEBUI_Picking_Launcher method verifySelectedDocuments.

private ProcessPreconditionsResolution verifySelectedDocuments() {
    final DocumentIdsSelection selectedRowIds = getSelectedRootDocumentIds();
    if (selectedRowIds.isEmpty()) {
        return ProcessPreconditionsResolution.rejectBecauseNoSelection();
    }
    final long selectionSize = getSelectionSize(selectedRowIds);
    if (selectionSize > MAX_ROWS_ALLOWED) {
        return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_TOO_MANY_PACKAGEABLES_1P, MAX_ROWS_ALLOWED));
    }
    // Make sure that they all have the same C_BPartner and location.
    if (selectionSize > 1) {
        final Set<Integer> bpartnerLocationIds = getView().streamByIds(selectedRowIds).flatMap(selectedRow -> selectedRow.getIncludedRows().stream()).map(this::getBPartnerLocationId).collect(Collectors.toSet());
        if (bpartnerLocationIds.size() > 1) {
            return ProcessPreconditionsResolution.reject(msgBL.getTranslatableMsgText(MSG_WEBUI_PICKING_DIVERGING_LOCATIONS));
        }
    }
    return ProcessPreconditionsResolution.accept();
}
Also used : DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection)

Example 8 with DocumentIdsSelection

use of de.metas.ui.web.window.datatypes.DocumentIdsSelection in project metasfresh-webui-api by metasfresh.

the class ViewBasedProcessTemplate method getChildViewSingleSelectedRow.

protected IViewRow getChildViewSingleSelectedRow() {
    final DocumentIdsSelection selectedRowIds = getChildViewSelectedRowIds();
    final DocumentId rowId = selectedRowIds.getSingleDocumentId();
    return getChildView(IView.class).getById(rowId);
}
Also used : IView(de.metas.ui.web.view.IView) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 9 with DocumentIdsSelection

use of de.metas.ui.web.window.datatypes.DocumentIdsSelection in project metasfresh-webui-api by metasfresh.

the class WEBUI_M_HU_Transform method removeSelectedRowsIfHUDestoyed.

/**
 * @return true if view was changed and needs invalidation
 */
private final boolean removeSelectedRowsIfHUDestoyed() {
    final DocumentIdsSelection selectedRowIds = getSelectedRowIds();
    if (selectedRowIds.isEmpty()) {
        return false;
    } else if (selectedRowIds.isAll()) {
        return false;
    }
    final HUEditorView view = getView();
    final ImmutableSet<Integer> selectedHUIds = view.streamByIds(selectedRowIds).map(row -> row.getM_HU_ID()).collect(ImmutableSet.toImmutableSet());
    return removeHUsIfDestroyed(selectedHUIds);
}
Also used : IHandlingUnitsBL(de.metas.handlingunits.IHandlingUnitsBL) GuavaCollectors(org.adempiere.util.GuavaCollectors) Autowired(org.springframework.beans.factory.annotation.Autowired) DocumentCollection(de.metas.ui.web.window.model.DocumentCollection) BigDecimal(java.math.BigDecimal) LookupValuesList(de.metas.ui.web.window.datatypes.LookupValuesList) I_M_HU_PI_Item(de.metas.handlingunits.model.I_M_HU_PI_Item) I_M_HU(de.metas.handlingunits.model.I_M_HU) TableRecordReference(org.adempiere.util.lang.impl.TableRecordReference) IProcessDefaultParameter(de.metas.process.IProcessDefaultParameter) IProcessPrecondition(de.metas.process.IProcessPrecondition) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) ImmutableSet(com.google.common.collect.ImmutableSet) LookupSource(de.metas.ui.web.window.descriptor.DocumentLayoutElementFieldDescriptor.LookupSource) LookupDataSourceContext(de.metas.ui.web.window.model.lookup.LookupDataSourceContext) Collection(java.util.Collection) HUEditorProcessTemplate(de.metas.ui.web.handlingunits.HUEditorProcessTemplate) I_M_HU_PI_Item_Product(de.metas.handlingunits.model.I_M_HU_PI_Item_Product) Profile(org.springframework.context.annotation.Profile) ProcessPreconditionsResolution(de.metas.process.ProcessPreconditionsResolution) Services(org.adempiere.util.Services) List(java.util.List) Param(de.metas.process.Param) Profiles(de.metas.Profiles) IProcessDefaultParametersProvider(de.metas.process.IProcessDefaultParametersProvider) RunOutOfTrx(de.metas.process.RunOutOfTrx) InterfaceWrapperHelper.load(org.adempiere.model.InterfaceWrapperHelper.load) ActionType(de.metas.ui.web.handlingunits.process.WebuiHUTransformCommand.ActionType) ProcessParamLookupValuesProvider(de.metas.ui.web.process.descriptor.ProcessParamLookupValuesProvider) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView)

Example 10 with DocumentIdsSelection

use of de.metas.ui.web.window.datatypes.DocumentIdsSelection in project metasfresh-webui-api by metasfresh.

the class WEBUI_Add_Batch_SerialNo_To_CUs method removeSelectedRowsIfHUDestoyed.

/**
 * @return true if view was changed and needs invalidation
 */
private final boolean removeSelectedRowsIfHUDestoyed() {
    final DocumentIdsSelection selectedRowIds = getSelectedRowIds();
    if (selectedRowIds.isEmpty()) {
        return false;
    } else if (selectedRowIds.isAll()) {
        return false;
    }
    final HUEditorView view = getView();
    final ImmutableSet<Integer> selectedHUIds = view.streamByIds(selectedRowIds).map(row -> row.getM_HU_ID()).collect(ImmutableSet.toImmutableSet());
    return removeHUsIfDestroyed(selectedHUIds);
}
Also used : IHandlingUnitsBL(de.metas.handlingunits.IHandlingUnitsBL) Autowired(org.springframework.beans.factory.annotation.Autowired) HUEditorRowFilter(de.metas.ui.web.handlingunits.HUEditorRowFilter) DocumentCollection(de.metas.ui.web.window.model.DocumentCollection) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Select(de.metas.ui.web.handlingunits.HUEditorRowFilter.Select) ImmutableList(com.google.common.collect.ImmutableList) I_M_HU(de.metas.handlingunits.model.I_M_HU) Splitter(com.google.common.base.Splitter) IProcessPrecondition(de.metas.process.IProcessPrecondition) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) ImmutableSet(com.google.common.collect.ImmutableSet) Collection(java.util.Collection) Set(java.util.Set) HUEditorProcessTemplate(de.metas.ui.web.handlingunits.HUEditorProcessTemplate) ProcessPreconditionsResolution(de.metas.process.ProcessPreconditionsResolution) Services(org.adempiere.util.Services) List(java.util.List) Param(de.metas.process.Param) IUOMDAO(org.adempiere.uom.api.IUOMDAO) InterfaceWrapperHelper.load(org.adempiere.model.InterfaceWrapperHelper.load) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView) Comparator(java.util.Comparator) WEBUI_HU_Constants(de.metas.ui.web.handlingunits.WEBUI_HU_Constants) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView)

Aggregations

DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)25 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)8 HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)6 IProcessPrecondition (de.metas.process.IProcessPrecondition)5 ProcessPreconditionsResolution (de.metas.process.ProcessPreconditionsResolution)5 List (java.util.List)5 TableRecordReference (org.adempiere.util.lang.impl.TableRecordReference)5 ImmutableList (com.google.common.collect.ImmutableList)4 HUEditorView (de.metas.ui.web.handlingunits.HUEditorView)4 IView (de.metas.ui.web.view.IView)4 AdempiereException (org.adempiere.exceptions.AdempiereException)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 ViewBasedProcessTemplate (de.metas.ui.web.process.adprocess.ViewBasedProcessTemplate)3 Collection (java.util.Collection)3 Set (java.util.Set)3 NonNull (lombok.NonNull)3 Services (org.adempiere.util.Services)3 IHandlingUnitsBL (de.metas.handlingunits.IHandlingUnitsBL)2 I_M_HU (de.metas.handlingunits.model.I_M_HU)2 Param (de.metas.process.Param)2