mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Compare commits
1 Commits
1cc13eebe1
...
fix/3265-W
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41b985c8ee |
@@ -23,9 +23,6 @@ export class CanActivateGoodsOutGuard implements CanActivate {
|
|||||||
await this._applicationService.getLastActivatedProcessWithSectionAndType$('customer', 'goods-out').pipe(first()).toPromise()
|
await this._applicationService.getLastActivatedProcessWithSectionAndType$('customer', 'goods-out').pipe(first()).toPromise()
|
||||||
)?.id;
|
)?.id;
|
||||||
|
|
||||||
console.log(processesIds);
|
|
||||||
|
|
||||||
// if (!lastActivatedProcessId) {
|
|
||||||
lastActivatedProcessId = Date.now();
|
lastActivatedProcessId = Date.now();
|
||||||
await this._applicationService.createProcess({
|
await this._applicationService.createProcess({
|
||||||
id: lastActivatedProcessId,
|
id: lastActivatedProcessId,
|
||||||
@@ -33,7 +30,6 @@ export class CanActivateGoodsOutGuard implements CanActivate {
|
|||||||
section: 'customer',
|
section: 'customer',
|
||||||
name: `Warenausgabe ${Math.max(...processesIds, 0) + 1}`,
|
name: `Warenausgabe ${Math.max(...processesIds, 0) + 1}`,
|
||||||
});
|
});
|
||||||
// }
|
|
||||||
|
|
||||||
await this._router.navigate(this.getUrlFromSnapshot(route, ['/kunde', String(lastActivatedProcessId)]));
|
await this._router.navigate(this.getUrlFromSnapshot(route, ['/kunde', String(lastActivatedProcessId)]));
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Component, ChangeDetectionStrategy, Output, EventEmitter, ChangeDetectorRef, OnInit, OnDestroy, Input } from '@angular/core';
|
import { Component, ChangeDetectionStrategy, Output, EventEmitter, ChangeDetectorRef, OnInit, OnDestroy, Input } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { BreadcrumbService } from '@core/breadcrumb';
|
import { BreadcrumbService } from '@core/breadcrumb';
|
||||||
import { Config } from '@core/config';
|
|
||||||
import { OrderItemListItemDTO } from '@swagger/oms';
|
import { OrderItemListItemDTO } from '@swagger/oms';
|
||||||
import { UiFilter } from '@ui/filter';
|
import { UiFilter } from '@ui/filter';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Observable, Subject } from 'rxjs';
|
||||||
@@ -33,8 +32,7 @@ export class GoodsOutSearchFilterComponent implements OnInit, OnDestroy {
|
|||||||
private _goodsOutSearchStore: GoodsOutSearchStore,
|
private _goodsOutSearchStore: GoodsOutSearchStore,
|
||||||
private _breadcrumb: BreadcrumbService,
|
private _breadcrumb: BreadcrumbService,
|
||||||
private _cdr: ChangeDetectorRef,
|
private _cdr: ChangeDetectorRef,
|
||||||
private _router: Router,
|
private _router: Router
|
||||||
private readonly _config: Config
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -91,7 +89,7 @@ export class GoodsOutSearchFilterComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this._goodsOutSearchStore.search({});
|
this._goodsOutSearchStore.search();
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateBreadcrumb() {
|
async updateBreadcrumb() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { ComponentStore, tapResponse } from '@ngrx/component-store';
|
|||||||
import { ListResponseArgsOfOrderItemListItemDTO, OrderItemListItemDTO, QuerySettingsDTO } from '@swagger/oms';
|
import { ListResponseArgsOfOrderItemListItemDTO, OrderItemListItemDTO, QuerySettingsDTO } from '@swagger/oms';
|
||||||
import { UiFilter } from '@ui/filter';
|
import { UiFilter } from '@ui/filter';
|
||||||
import { isResponseArgs } from '@utils/object';
|
import { isResponseArgs } from '@utils/object';
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { switchMap, mergeMap, withLatestFrom, filter, take, tap } from 'rxjs/operators';
|
import { switchMap, mergeMap, withLatestFrom, filter, take, tap } from 'rxjs/operators';
|
||||||
|
|
||||||
export interface GoodsOutSearchState {
|
export interface GoodsOutSearchState {
|
||||||
@@ -143,61 +143,39 @@ export class GoodsOutSearchStore extends ComponentStore<GoodsOutSearchState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
searchRequest(options?: { take?: number; skip?: number; reload?: boolean }) {
|
searchRequest(options?: { take?: number; skip?: number }) {
|
||||||
return this.filter$.pipe(
|
return this.filter$.pipe(
|
||||||
filter((f) => f instanceof UiFilter),
|
filter((f) => f instanceof UiFilter),
|
||||||
take(1),
|
take(1),
|
||||||
mergeMap((filter) =>
|
mergeMap((filter) =>
|
||||||
this._domainGoodsInService.searchWarenausgabe({
|
this._domainGoodsInService.searchWarenausgabe({
|
||||||
...filter.getQueryToken(),
|
...filter.getQueryToken(),
|
||||||
skip: options.reload ? 0 : options?.skip ?? this.results.length,
|
skip: options?.skip ?? this.results.length,
|
||||||
take: options.reload ? this.results.length : options?.take ?? 50,
|
take: options?.take ?? 50,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
search = this.effect((options$: Observable<{ siletReload?: boolean }>) =>
|
search = this.effect(($) =>
|
||||||
options$.pipe(
|
$.pipe(
|
||||||
tap((options) => {
|
tap(() => {
|
||||||
if (!options?.siletReload) {
|
this.patchState({ fetching: true });
|
||||||
this.patchState({ fetching: true });
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
withLatestFrom(this.results$),
|
withLatestFrom(this.results$),
|
||||||
switchMap(([_options, _results]) => {
|
switchMap(([_options, _results]) => {
|
||||||
const queryToken = this.filter?.getQueryToken();
|
return this.searchRequest({ ...this.searchOptions }).pipe(
|
||||||
|
|
||||||
if (queryToken && this._cache.get(queryToken)) {
|
|
||||||
const cached = this._cache.get(queryToken);
|
|
||||||
|
|
||||||
this.patchState(cached);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.searchRequest({ ...this.searchOptions, reload: _options.siletReload }).pipe(
|
|
||||||
tapResponse(
|
tapResponse(
|
||||||
(res) => {
|
(res) => {
|
||||||
let results: OrderItemListItemDTO[] = [];
|
let results: OrderItemListItemDTO[] = [];
|
||||||
if (_options.siletReload) {
|
|
||||||
results = res.result;
|
results = [...(_results ?? []), ...(res.result ?? [])];
|
||||||
} else {
|
|
||||||
results = [...(_results ?? []), ...(res.result ?? [])];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.patchState({
|
this.patchState({
|
||||||
hits: res.hits,
|
hits: res.hits,
|
||||||
results,
|
results,
|
||||||
fetching: false,
|
fetching: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (queryToken) {
|
|
||||||
this._cache.set(queryToken, {
|
|
||||||
hits: res.hits,
|
|
||||||
results,
|
|
||||||
fetching: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this._searchResultSubject.next(res);
|
this._searchResultSubject.next(res);
|
||||||
},
|
},
|
||||||
(err: Error) => {
|
(err: Error) => {
|
||||||
|
|||||||
@@ -102,9 +102,7 @@ export class GoodsOutSearchMainComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this._cdr.markForCheck();
|
this._cdr.markForCheck();
|
||||||
});
|
});
|
||||||
|
this._goodsOutSearchStore.search();
|
||||||
this._goodsOutSearchStore.searchOptions = { take: 50, skip: 0 };
|
|
||||||
this._goodsOutSearchStore.search({});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateBreadcrumb(processId: number, params: Record<string, string>) {
|
async updateBreadcrumb(processId: number, params: Record<string, string>) {
|
||||||
|
|||||||
@@ -68,8 +68,6 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
|
|||||||
|
|
||||||
processId$ = this._activatedRoute.parent.data.pipe(map((data) => +data.processId));
|
processId$ = this._activatedRoute.parent.data.pipe(map((data) => +data.processId));
|
||||||
|
|
||||||
previousProcessId: undefined | number;
|
|
||||||
|
|
||||||
private _onDestroy$ = new Subject();
|
private _onDestroy$ = new Subject();
|
||||||
|
|
||||||
trackByFn = (item: OrderItemListItemDTO) => `${item.orderId}${item.orderItemId}${item.orderItemSubsetId}`;
|
trackByFn = (item: OrderItemListItemDTO) => `${item.orderId}${item.orderItemId}${item.orderItemSubsetId}`;
|
||||||
@@ -91,29 +89,26 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
|
|||||||
this.processId$
|
this.processId$
|
||||||
.pipe(takeUntil(this._onDestroy$), debounceTime(1), withLatestFrom(this._activatedRoute.queryParams))
|
.pipe(takeUntil(this._onDestroy$), debounceTime(1), withLatestFrom(this._activatedRoute.queryParams))
|
||||||
.subscribe(([processId, params]) => {
|
.subscribe(([processId, params]) => {
|
||||||
|
console.log(params);
|
||||||
this._goodsOutSearchStore.setQueryParams(params);
|
this._goodsOutSearchStore.setQueryParams(params);
|
||||||
this.updateBreadcrumb(processId, params);
|
this.updateBreadcrumb(processId, params);
|
||||||
|
|
||||||
|
this._goodsOutSearchStore.clearResults();
|
||||||
this.initInitialSearch(processId, params);
|
this.initInitialSearch(processId, params);
|
||||||
this.createBreadcrumb(processId, params);
|
this.createBreadcrumb(processId, params);
|
||||||
this.removeBreadcrumbs(processId);
|
this.removeBreadcrumbs(processId);
|
||||||
|
|
||||||
if (this.previousProcessId && processId !== this.previousProcessId) {
|
|
||||||
this._goodsOutSearchStore.clearResults();
|
|
||||||
this._goodsOutSearchStore.search({ siletReload: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
this.previousProcessId = processId;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this._goodsOutSearchStore.searchResultCleared.pipe(takeUntil(this._onDestroy$)).subscribe((_) => this.clearSelectedItems());
|
this._goodsOutSearchStore.searchResultCleared.pipe(takeUntil(this._onDestroy$)).subscribe((_) => this.clearSelectedItems());
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
async ngOnDestroy() {
|
||||||
this._onDestroy$.next();
|
this._onDestroy$.next();
|
||||||
this._onDestroy$.complete();
|
this._onDestroy$.complete();
|
||||||
|
|
||||||
// this.updateBreadcrumb(this._goodsOutSearchStore.filter?.getQueryParams());
|
const processId = await this.processId$.pipe(first()).toPromise();
|
||||||
|
const queryParams = await this._activatedRoute.queryParams.pipe(first()).toPromise();
|
||||||
|
this.updateBreadcrumb(processId, queryParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeBreadcrumbs(processId: number) {
|
async removeBreadcrumbs(processId: number) {
|
||||||
@@ -188,7 +183,7 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this._goodsOutSearchStore.search({});
|
this._goodsOutSearchStore.search();
|
||||||
}
|
}
|
||||||
|
|
||||||
const { scroll_position, take } = this._goodsOutSearchStore.queryParams;
|
const { scroll_position, take } = this._goodsOutSearchStore.queryParams;
|
||||||
@@ -199,7 +194,7 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
|
|||||||
|
|
||||||
async loadMore() {
|
async loadMore() {
|
||||||
if (this._goodsOutSearchStore.hits > this._goodsOutSearchStore.results.length && !this._goodsOutSearchStore.fetching) {
|
if (this._goodsOutSearchStore.hits > this._goodsOutSearchStore.results.length && !this._goodsOutSearchStore.fetching) {
|
||||||
this._goodsOutSearchStore.search({});
|
this._goodsOutSearchStore.search();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user