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