Search in sources :

Example 6 with HUEditorView

use of de.metas.ui.web.handlingunits.HUEditorView 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);
}
Also used : HUEditorView(de.metas.ui.web.handlingunits.HUEditorView) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 7 with HUEditorView

use of de.metas.ui.web.handlingunits.HUEditorView in project metasfresh-webui-api by metasfresh.

the class WEBUI_Add_Batch_SerialNo_To_CUs method removeHUsIfDestroyed.

/**
 * @return true if at least one HU was removed
 */
private boolean removeHUsIfDestroyed(final Collection<Integer> huIds) {
    final ImmutableSet<Integer> destroyedHUIds = huIds.stream().distinct().map(huId -> load(huId, I_M_HU.class)).filter(Services.get(IHandlingUnitsBL.class)::isDestroyed).map(I_M_HU::getM_HU_ID).collect(ImmutableSet.toImmutableSet());
    if (destroyedHUIds.isEmpty()) {
        return false;
    }
    final HUEditorView view = getView();
    final boolean changes = view.removeHUIds(destroyedHUIds);
    return changes;
}
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) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView)

Example 8 with HUEditorView

use of de.metas.ui.web.handlingunits.HUEditorView in project metasfresh-webui-api by metasfresh.

the class WEBUI_M_HU_Transform method removeHUsIfDestroyed.

/**
 * @return true if at least one HU was removed
 */
private boolean removeHUsIfDestroyed(final Collection<Integer> huIds) {
    final ImmutableSet<Integer> destroyedHUIds = huIds.stream().distinct().map(huId -> load(huId, I_M_HU.class)).filter(Services.get(IHandlingUnitsBL.class)::isDestroyed).map(I_M_HU::getM_HU_ID).collect(ImmutableSet.toImmutableSet());
    if (destroyedHUIds.isEmpty()) {
        return false;
    }
    final HUEditorView view = getView();
    final boolean changes = view.removeHUIds(destroyedHUIds);
    return changes;
}
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) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView)

Example 9 with HUEditorView

use of de.metas.ui.web.handlingunits.HUEditorView 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<HuId> selectedHUIds = view.streamByIds(selectedRowIds).map(HUEditorRow::getHuId).filter(Objects::nonNull).collect(ImmutableSet.toImmutableSet());
    return removeHUsIfDestroyed(selectedHUIds);
}
Also used : DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) HuId(de.metas.handlingunits.HuId) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 10 with HUEditorView

use of de.metas.ui.web.handlingunits.HUEditorView in project metasfresh-webui-api by metasfresh.

the class WEBUI_Add_Batch_SerialNo_To_CUs method updateViewFromResult.

private final void updateViewFromResult(final WebuiHUTransformCommandResult result) {
    final HUEditorView view = getView();
    view.addHUIds(result.getHuIdsToAddToView());
    view.removeHUIds(result.getHuIdsToRemoveFromView());
    if (!result.getHuIdsChanged().isEmpty()) {
        removeHUsIfDestroyed(result.getHuIdsChanged());
    }
}
Also used : HUEditorView(de.metas.ui.web.handlingunits.HUEditorView)

Aggregations

HUEditorView (de.metas.ui.web.handlingunits.HUEditorView)17 HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)7 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)6 I_M_HU (de.metas.handlingunits.model.I_M_HU)5 HuId (de.metas.handlingunits.HuId)4 IHandlingUnitsBL (de.metas.handlingunits.IHandlingUnitsBL)4 IProcessPrecondition (de.metas.process.IProcessPrecondition)3 ProcessPreconditionsResolution (de.metas.process.ProcessPreconditionsResolution)3 DocumentCollection (de.metas.ui.web.window.model.DocumentCollection)3 ImmutableSet (com.google.common.collect.ImmutableSet)2 Param (de.metas.process.Param)2 HUEditorProcessTemplate (de.metas.ui.web.handlingunits.HUEditorProcessTemplate)2 PickingSlotView (de.metas.ui.web.picking.pickingslot.PickingSlotView)2 ViewId (de.metas.ui.web.view.ViewId)2 Collection (java.util.Collection)2 List (java.util.List)2 InterfaceWrapperHelper.load (org.adempiere.model.InterfaceWrapperHelper.load)2 Services (org.adempiere.util.Services)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 Splitter (com.google.common.base.Splitter)1