Merged PR 1455: #3691 WA Kunden mit unterschiedlichen Kundennummern und gleicher Abholfachnummer

#3691 WA Kunden mit unterschiedlichen Kundennummern und gleicher Abholfachnummer

Related work items: #3691
This commit is contained in:
Andreas Schickinger
2022-12-07 14:31:54 +00:00
committed by Nino Righi
parent 168847b24a
commit 2e286b2de3
4 changed files with 41 additions and 20 deletions

View File

@@ -32,18 +32,18 @@ export class DomainGoodsService {
});
}
getWarenausgabeItemByOrderNumber(orderNumber: string) {
getWarenausgabeItemByOrderNumber(orderNumber: string, archive: boolean) {
return this.abholfachService.AbholfachWarenausgabe({
filter: { all_branches: 'true', archive: 'true' },
filter: { all_branches: 'true', archive: `${archive}` },
input: {
qs: orderNumber,
},
});
}
getWarenausgabeItemByCompartment(compartmentCode: string) {
getWarenausgabeItemByCompartment(compartmentCode: string, archive: boolean) {
return this.abholfachService.AbholfachWarenausgabe({
filter: { all_branches: 'true', archive: 'true' },
filter: { all_branches: 'true', archive: `${archive}` },
input: {
qs: compartmentCode,
},

View File

@@ -16,6 +16,7 @@ export interface GoodsOutDetailsComponentState {
compartmentCode?: string;
items?: OrderItemListItemDTO[];
orderId?: number;
archive?: boolean;
}
@Component({
@@ -33,6 +34,11 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
processingStatus$ = this.select((s) => s.processingStatus);
archive$ = this.select((s) => s.archive);
get archive() {
return this.get((s) => s.archive);
}
items$ = this.select((s) => s.items ?? []);
orderId$ = this.select((s) => s.orderId);
@@ -71,7 +77,8 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
ngOnInit() {
this._activatedRoute.queryParams.pipe(takeUntil(this._onDestroy$)).subscribe((params) => {
const buyerNumber: string = decodeURIComponent(params.buyerNumber ?? '');
this.patchState({ buyerNumber });
const archive = params?.archive || false;
this.patchState({ buyerNumber, archive });
});
this._activatedRoute.params.pipe(takeUntil(this._onDestroy$)).subscribe(async (params) => {
@@ -100,6 +107,7 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
path: this.getDetailsPath(item),
params: {
buyerNumber: item.buyerNumber,
archive: this.archive,
},
section: 'customer',
tags: ['goods-out', 'details', item?.compartmentCode || item?.orderNumber],
@@ -131,13 +139,13 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
$.pipe(
tap(() => this.patchState({ fetching: false })),
debounceTime(500),
withLatestFrom(this.orderNumber$, this.compartmentCode$),
switchMap(([_, orderNumber, compartmentCode]) => {
withLatestFrom(this.orderNumber$, this.compartmentCode$, this.archive$),
switchMap(([_, orderNumber, compartmentCode, archive]) => {
let request$: Observable<ListResponseArgsOfOrderItemListItemDTO>;
if (compartmentCode) {
request$ = this._domainGoodsInService.getWarenausgabeItemByCompartment(compartmentCode);
request$ = this._domainGoodsInService.getWarenausgabeItemByCompartment(compartmentCode, archive);
} else {
request$ = this._domainGoodsInService.getWarenausgabeItemByOrderNumber(orderNumber);
request$ = this._domainGoodsInService.getWarenausgabeItemByOrderNumber(orderNumber, archive);
}
return combineLatest([request$, this.processingStatus$, this.buyerNumber$]).pipe(
@@ -179,11 +187,15 @@ export class GoodsOutDetailsComponent extends ComponentStore<GoodsOutDetailsComp
}
navigateToEditPage(orderItem: OrderItemListItemDTO) {
this._router.navigate([this.getEditPath(orderItem)], { queryParams: { buyerNumber: orderItem.buyerNumber } });
this._router.navigate([this.getEditPath(orderItem)], {
queryParams: { buyerNumber: orderItem.buyerNumber, archive: this.archive },
});
}
navigateToDetailsPage(item: OrderItemListItemDTO) {
this._router.navigate([this.getDetailsPath(item)], { queryParams: { buyerNumber: item.buyerNumber } });
this._router.navigate([this.getDetailsPath(item)], {
queryParams: { buyerNumber: item.buyerNumber, archive: this.archive },
});
}
navigateToLandingPage() {

View File

@@ -26,21 +26,22 @@ export class GoodsOutEditComponent implements OnInit {
processingStatus$ = this._activatedRoute.params.pipe(map((params) => params?.processingStatus || undefined));
archive$ = this._activatedRoute.queryParams.pipe(map((params) => params?.archive || false));
compartmentCode$: Observable<string> = this._activatedRoute.params.pipe(
map((params) => decodeURIComponent(params?.compartmentCode ?? '') || undefined)
);
buyerNumber$ = this._activatedRoute.queryParams.pipe(map((params) => params.buyerNumber));
items$ = combineLatest([this.orderNumber$, this.compartmentCode$]).pipe(
switchMap(([orderNumber, compartmentCode]) =>
items$ = combineLatest([this.orderNumber$, this.compartmentCode$, this.archive$]).pipe(
switchMap(([orderNumber, compartmentCode, archive]) =>
compartmentCode
? this._domainGoodsInService.getWarenausgabeItemByCompartment(compartmentCode)
: this._domainGoodsInService.getWarenausgabeItemByOrderNumber(orderNumber)
? this._domainGoodsInService.getWarenausgabeItemByCompartment(compartmentCode, archive)
: this._domainGoodsInService.getWarenausgabeItemByOrderNumber(orderNumber, archive)
),
withLatestFrom(this.processingStatus$, this.buyerNumber$),
map(([response, processingStatus, buyerNumber]) => {
console.log(response, processingStatus, buyerNumber);
return response.result.filter(
(item) => item.processingStatus === +processingStatus && (!!buyerNumber ? item.buyerNumber === buyerNumber : true)
);
@@ -66,6 +67,7 @@ export class GoodsOutEditComponent implements OnInit {
const compartmentCode = this._activatedRoute.snapshot.params.compartmentCode;
const processingStatus = this._activatedRoute.snapshot.params.processingStatus;
const buyerNumber = this._activatedRoute.snapshot.queryParams.buyerNumber;
const archive = this._activatedRoute.snapshot.queryParams.archive;
await this._breadcrumb.addOrUpdateBreadcrumbIfNotExists({
key: this.processId,
name: 'Bearbeiten',
@@ -73,7 +75,7 @@ export class GoodsOutEditComponent implements OnInit {
? `/kunde/${this.processId}/goods/out/details/compartment/${encodeURIComponent(compartmentCode)}/${processingStatus}/edit`
: `/kunde/${this.processId}/goods/out/details/order/${encodeURIComponent(orderNumber)}/${processingStatus}/edit`,
section: 'customer',
params: { buyerNumber },
params: { buyerNumber, archive },
tags: ['goods-out', 'edit', compartmentCode || orderNumber],
});
}
@@ -83,13 +85,14 @@ export class GoodsOutEditComponent implements OnInit {
const compartmentCode = this._activatedRoute.snapshot.params.compartmentCode;
const processingStatus = options?.processingStatus ? options.processingStatus : this._activatedRoute.snapshot.params.processingStatus;
const buyerNumber = this._activatedRoute.snapshot.queryParams.buyerNumber;
const archive = this._activatedRoute.snapshot.queryParams.archive;
compartmentCode
? this._router.navigate(
[`/kunde/${this.processId}/goods/out/details/compartment/${encodeURIComponent(compartmentCode)}/${processingStatus}`],
{ queryParams: { buyerNumber } }
{ queryParams: { buyerNumber, archive } }
)
: this._router.navigate([`/kunde/${this.processId}/goods/out/details/order/${encodeURIComponent(orderNumber)}/${processingStatus}`], {
queryParams: { buyerNumber },
queryParams: { buyerNumber, archive },
});
}

View File

@@ -258,6 +258,7 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
const orderNumber = orderItem.orderNumber;
const processingStatus = orderItem.processingStatus;
const compartmentCode = orderItem.compartmentCode;
const archive = !!this._goodsOutSearchStore.filter?.getQueryParams()?.main_archive || false;
if (compartmentCode) {
this._router.navigate(
@@ -265,11 +266,16 @@ export class GoodsOutSearchResultsComponent extends ComponentStore<GoodsOutSearc
{
queryParams: {
buyerNumber: orderItem.buyerNumber,
archive,
},
}
);
} else {
this._router.navigate([`/kunde/${processId}/goods/out/details/order/${encodeURIComponent(orderNumber)}/${processingStatus}`]);
this._router.navigate([`/kunde/${processId}/goods/out/details/order/${encodeURIComponent(orderNumber)}/${processingStatus}`], {
queryParams: {
archive,
},
});
}
}