Search in sources :

Example 1 with HUReservationService

use of de.metas.handlingunits.reservation.HUReservationService in project metasfresh-webui-api by metasfresh.

the class HUEditorViewFactoryTemplate method createView.

@Override
public final HUEditorView createView(final CreateViewRequest request) {
    final ViewId viewId = request.getViewId();
    // 
    // Referencing documentPaths and tableName (i.e. from where are we coming, e.g. receipt schedule)
    final Set<DocumentPath> referencingDocumentPaths = request.getReferencingDocumentPaths();
    final String referencingTableName = extractReferencingTablename(referencingDocumentPaths);
    final SqlViewBinding sqlViewBinding = getSqlViewBinding();
    // 
    // HUEditorView rows repository
    final HUEditorViewRepository huEditorViewRepository;
    {
        final WindowId windowId = viewId.getWindowId();
        final boolean attributesAlwaysReadonly = rowAttributesAlwaysReadonlyByReferencingTableName.getOrDefault(referencingTableName, Boolean.TRUE);
        final SqlHUEditorViewRepositoryBuilder huEditorViewRepositoryBuilder = SqlHUEditorViewRepository.builder().windowId(windowId).rowProcessedPredicate(getRowProcessedPredicate(referencingTableName)).attributesProvider(HUEditorRowAttributesProvider.builder().readonly(attributesAlwaysReadonly).build()).sqlViewBinding(sqlViewBinding).huReservationService(huReservationService);
        customizeHUEditorViewRepository(huEditorViewRepositoryBuilder);
        huEditorViewRepository = huEditorViewRepositoryBuilder.build();
    }
    // 
    // HUEditorView
    {
        // Filters
        // as long as the deprecated getFilterOnlyIds() is around we can't ignore it
        @SuppressWarnings("deprecation") final DocumentFilterList stickyFilters = extractStickyFilters(request.getStickyFilters(), request.getFilterOnlyIds());
        final DocumentFilterDescriptorsProvider filterDescriptors = getViewFilterDescriptors();
        final DocumentFilterList userFilters = request.getFiltersUnwrapped(filterDescriptors);
        // Start building the HUEditorView
        final HUEditorViewBuilder huViewBuilder = HUEditorView.builder().setParentViewId(request.getParentViewId()).setParentRowId(request.getParentRowId()).setViewId(viewId).setViewType(request.getViewType()).setStickyFilters(stickyFilters).setFilters(userFilters).setFilterDescriptors(filterDescriptors).setReferencingDocumentPaths(referencingTableName, referencingDocumentPaths).orderBys(sqlViewBinding.getDefaultOrderBys()).setActions(request.getActions()).addAdditionalRelatedProcessDescriptors(request.getAdditionalRelatedProcessDescriptors()).setHUEditorViewRepository(huEditorViewRepository).setUseAutoFilters(request.isUseAutoFilters()).setParameters(request.getParameters());
        // 
        // Call view customizers
        getViewCustomizers(referencingTableName).forEach(viewCustomizer -> viewCustomizer.beforeCreate(huViewBuilder));
        customizeHUEditorView(huViewBuilder);
        return huViewBuilder.build();
    }
}
Also used : SqlViewRowFieldBinding(de.metas.ui.web.view.descriptor.SqlViewRowFieldBinding) Autowired(org.springframework.beans.factory.annotation.Autowired) ImmutableDocumentFilterDescriptorsProvider(de.metas.ui.web.document.filter.provider.ImmutableDocumentFilterDescriptorsProvider) ISysConfigBL(org.adempiere.service.ISysConfigBL) DocumentFilterList(de.metas.ui.web.document.filter.DocumentFilterList) GuavaCollectors(de.metas.util.GuavaCollectors) ViewLayout(de.metas.ui.web.view.descriptor.ViewLayout) PanelLayoutType(de.metas.ui.web.window.datatypes.PanelLayoutType) ConstantQueryFilter(org.adempiere.ad.dao.ConstantQueryFilter) IViewFactory(de.metas.ui.web.view.IViewFactory) OverridingMethodsMustInvokeSuper(javax.annotation.OverridingMethodsMustInvokeSuper) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) ITranslatableString(de.metas.i18n.ITranslatableString) NonNull(lombok.NonNull) Collection(java.util.Collection) DocumentFilterParamDescriptor(de.metas.ui.web.document.filter.DocumentFilterParamDescriptor) Set(java.util.Set) IQueryBuilder(org.adempiere.ad.dao.IQueryBuilder) SqlViewBinding(de.metas.ui.web.view.descriptor.SqlViewBinding) ISqlQueryFilter(org.adempiere.ad.dao.ISqlQueryFilter) Objects(java.util.Objects) HUAttributeConstants(de.metas.handlingunits.attribute.HUAttributeConstants) List(java.util.List) ImmutableListMultimap(com.google.common.collect.ImmutableListMultimap) SqlHUEditorViewRepositoryBuilder(de.metas.ui.web.handlingunits.SqlHUEditorViewRepository.SqlHUEditorViewRepositoryBuilder) DocumentFieldWidgetType(de.metas.ui.web.window.descriptor.DocumentFieldWidgetType) IMsgBL(de.metas.i18n.IMsgBL) LogManager(de.metas.logging.LogManager) IHandlingUnitsBL(de.metas.handlingunits.IHandlingUnitsBL) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) SqlOptions(de.metas.ui.web.window.model.sql.SqlOptions) JSONViewDataType(de.metas.ui.web.view.json.JSONViewDataType) PlainContextAware(org.adempiere.model.PlainContextAware) DocumentFilterDescriptor(de.metas.ui.web.document.filter.DocumentFilterDescriptor) SqlViewBindingFactory(de.metas.ui.web.view.descriptor.SqlViewBindingFactory) Value(lombok.Value) IADWindowDAO(org.adempiere.ad.window.api.IADWindowDAO) ImmutableList(com.google.common.collect.ImmutableList) I_AD_Tab(org.compiere.model.I_AD_Tab) SqlDocumentEntityDataBindingDescriptor(de.metas.ui.web.window.descriptor.sql.SqlDocumentEntityDataBindingDescriptor) SqlSelectValue(de.metas.ui.web.window.descriptor.sql.SqlSelectValue) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor) DocumentFilter(de.metas.ui.web.document.filter.DocumentFilter) I_M_HU(de.metas.handlingunits.model.I_M_HU) BarcodeScannerType(de.metas.process.BarcodeScannerType) Nullable(javax.annotation.Nullable) Check(de.metas.util.Check) SqlDocumentFilterConverterContext(de.metas.ui.web.document.filter.sql.SqlDocumentFilterConverterContext) Logger(org.slf4j.Logger) DocumentDescriptorFactory(de.metas.ui.web.window.descriptor.factory.DocumentDescriptorFactory) InArrayQueryFilter(org.adempiere.ad.dao.impl.InArrayQueryFilter) ViewProfileId(de.metas.ui.web.view.ViewProfileId) DocumentFilterDescriptorsProvider(de.metas.ui.web.document.filter.provider.DocumentFilterDescriptorsProvider) WindowId(de.metas.ui.web.window.datatypes.WindowId) IHandlingUnitsDAO(de.metas.handlingunits.IHandlingUnitsDAO) CCache(de.metas.cache.CCache) Services(de.metas.util.Services) SqlDocumentFilterConverter(de.metas.ui.web.document.filter.sql.SqlDocumentFilterConverter) HuId(de.metas.handlingunits.HuId) HUReservationService(de.metas.handlingunits.reservation.HUReservationService) SqlViewFactory(de.metas.ui.web.view.SqlViewFactory) CreateViewRequest(de.metas.ui.web.view.CreateViewRequest) LayoutFactory(de.metas.ui.web.window.descriptor.factory.standard.LayoutFactory) SqlParamsCollector(de.metas.ui.web.document.filter.sql.SqlParamsCollector) ViewId(de.metas.ui.web.view.ViewId) WindowId(de.metas.ui.web.window.datatypes.WindowId) SqlViewBinding(de.metas.ui.web.view.descriptor.SqlViewBinding) ViewId(de.metas.ui.web.view.ViewId) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) SqlHUEditorViewRepositoryBuilder(de.metas.ui.web.handlingunits.SqlHUEditorViewRepository.SqlHUEditorViewRepositoryBuilder) ITranslatableString(de.metas.i18n.ITranslatableString) DocumentFilterList(de.metas.ui.web.document.filter.DocumentFilterList) ImmutableDocumentFilterDescriptorsProvider(de.metas.ui.web.document.filter.provider.ImmutableDocumentFilterDescriptorsProvider) DocumentFilterDescriptorsProvider(de.metas.ui.web.document.filter.provider.DocumentFilterDescriptorsProvider)

Example 2 with HUReservationService

use of de.metas.handlingunits.reservation.HUReservationService in project metasfresh-webui-api by metasfresh.

the class PickingV2TestHelper method createProductsToPickRowsDataFactory.

public ProductsToPickRowsDataFactory createProductsToPickRowsDataFactory() {
    final IBPartnerBL bpartnersService = createAndRegisterBPartnerBL();
    final HUReservationRepository huReservationRepository = new HUReservationRepository();
    final HUReservationService huReservationService = new HUReservationService(huReservationRepository);
    final PickingCandidateRepository pickingCandidateRepository = new PickingCandidateRepository();
    final HUTraceRepository huTraceRepository = new HUTraceRepository();
    final HuId2SourceHUsService sourceHUsRepository = new HuId2SourceHUsService(huTraceRepository);
    final PickingCandidateService pickingCandidateService = new PickingCandidateService(new PickingConfigRepository(), pickingCandidateRepository, sourceHUsRepository);
    return ProductsToPickRowsDataFactory.builder().bpartnersService(bpartnersService).huReservationService(huReservationService).pickingCandidateService(pickingCandidateService).locatorLookup(this::generateLocatorLookupById).build();
}
Also used : HUTraceRepository(de.metas.handlingunits.trace.HUTraceRepository) PickingCandidateRepository(de.metas.handlingunits.picking.PickingCandidateRepository) PickingConfigRepository(de.metas.picking.api.PickingConfigRepository) HuId2SourceHUsService(de.metas.handlingunits.sourcehu.HuId2SourceHUsService) PickingCandidateService(de.metas.handlingunits.picking.PickingCandidateService) IBPartnerBL(de.metas.bpartner.service.IBPartnerBL) HUReservationRepository(de.metas.handlingunits.reservation.HUReservationRepository) HUReservationService(de.metas.handlingunits.reservation.HUReservationService)

Aggregations

HUReservationService (de.metas.handlingunits.reservation.HUReservationService)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableListMultimap (com.google.common.collect.ImmutableListMultimap)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 IBPartnerBL (de.metas.bpartner.service.IBPartnerBL)1 CCache (de.metas.cache.CCache)1 HuId (de.metas.handlingunits.HuId)1 IHandlingUnitsBL (de.metas.handlingunits.IHandlingUnitsBL)1 IHandlingUnitsDAO (de.metas.handlingunits.IHandlingUnitsDAO)1 HUAttributeConstants (de.metas.handlingunits.attribute.HUAttributeConstants)1 I_M_HU (de.metas.handlingunits.model.I_M_HU)1 PickingCandidateRepository (de.metas.handlingunits.picking.PickingCandidateRepository)1 PickingCandidateService (de.metas.handlingunits.picking.PickingCandidateService)1 HUReservationRepository (de.metas.handlingunits.reservation.HUReservationRepository)1 HuId2SourceHUsService (de.metas.handlingunits.sourcehu.HuId2SourceHUsService)1 HUTraceRepository (de.metas.handlingunits.trace.HUTraceRepository)1 IMsgBL (de.metas.i18n.IMsgBL)1 ITranslatableString (de.metas.i18n.ITranslatableString)1 LogManager (de.metas.logging.LogManager)1