mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merge branch 'hotfix/3754-lieferschein-erneut-drucken'
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ReceiptOrderItemSubsetReferenceValues, ReceiptService } from '@swagger/oms';
|
||||
import { memorize } from '@utils/common';
|
||||
import { shareReplay } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class DomainReceiptService {
|
||||
@@ -9,9 +11,12 @@ export class DomainReceiptService {
|
||||
return this.receiptService.ReceiptCreateShippingNote2(params);
|
||||
}
|
||||
|
||||
@memorize({ ttl: 1000 })
|
||||
getReceipts(payload: ReceiptOrderItemSubsetReferenceValues) {
|
||||
return this.receiptService.ReceiptGetReceiptsByOrderItemSubset({
|
||||
payload: payload,
|
||||
});
|
||||
return this.receiptService
|
||||
.ReceiptGetReceiptsByOrderItemSubset({
|
||||
payload: payload,
|
||||
})
|
||||
.pipe(shareReplay(1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import { OrderDTO, OrderItemListItemDTO, ReceiptDTO, ReceiptType } from '@swagge
|
||||
import { UiModalService } from '@ui/modal';
|
||||
import { isEqual } from 'lodash';
|
||||
import { combineLatest, NEVER } from 'rxjs';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { catchError, filter, first, map, switchMap, withLatestFrom } from 'rxjs/operators';
|
||||
import { SharedGoodsInOutOrderDetailsStore } from '../goods-in-out-order-details.store';
|
||||
|
||||
@@ -159,11 +160,11 @@ export class SharedGoodsInOutOrderDetailsItemComponent extends ComponentStore<Sh
|
||||
this._host.selectOrderItem(this.orderItem, false);
|
||||
}
|
||||
|
||||
loadReceipts = this.effect(($) =>
|
||||
$.pipe(
|
||||
loadReceipts = this.effect((done$: Observable<(receipts: ReceiptDTO[]) => void | undefined>) =>
|
||||
done$.pipe(
|
||||
withLatestFrom(this.orderItem$),
|
||||
filter(([_, orderItem]) => !!orderItem),
|
||||
switchMap(([_, orderItem]) =>
|
||||
switchMap(([done, orderItem]) =>
|
||||
this._domainReceiptService
|
||||
.getReceipts({
|
||||
receiptType: 65 as ReceiptType,
|
||||
@@ -173,9 +174,18 @@ export class SharedGoodsInOutOrderDetailsItemComponent extends ComponentStore<Sh
|
||||
.pipe(
|
||||
tapResponse(
|
||||
(res) => {
|
||||
this.receipts = res.result.map((r) => r.item3?.data).filter((f) => !!f);
|
||||
const receipts = res.result.map((r) => r.item3?.data).filter((f) => !!f);
|
||||
this.receipts = receipts;
|
||||
|
||||
if (typeof done === 'function') {
|
||||
done?.(receipts);
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
if (typeof done === 'function') {
|
||||
done?.([]);
|
||||
}
|
||||
},
|
||||
(err) => {},
|
||||
() => {}
|
||||
)
|
||||
)
|
||||
@@ -204,7 +214,7 @@ export class SharedGoodsInOutOrderDetailsItemComponent extends ComponentStore<Sh
|
||||
setMore(more: boolean) {
|
||||
this.patchState({ more });
|
||||
if (more && this.receipts.length === 0) {
|
||||
this.loadReceipts();
|
||||
this.loadReceipts(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@ import { Component, ChangeDetectionStrategy, ContentChildren, QueryList } from '
|
||||
import { BreadcrumbService } from '@core/breadcrumb';
|
||||
import { CommandService } from '@core/command';
|
||||
import { OrderItemsContext } from '@domain/oms';
|
||||
import { KeyValueDTOOfStringAndString, OrderItemListItemDTO } from '@swagger/oms';
|
||||
import { KeyValueDTOOfStringAndString, OrderItemListItemDTO, ReceiptDTO } from '@swagger/oms';
|
||||
import { UiErrorModalComponent, UiModalService } from '@ui/modal';
|
||||
import { unionBy } from 'lodash';
|
||||
import { BehaviorSubject, combineLatest, merge, of, Subscription } from 'rxjs';
|
||||
import { first, map, switchMap } from 'rxjs/operators';
|
||||
import { SharedGoodsInOutOrderDetailsCoversComponent } from './goods-in-out-order-details-covers';
|
||||
@@ -163,6 +164,19 @@ export class SharedGoodsInOutOrderDetailsComponent extends SharedGoodsInOutOrder
|
||||
this.patchState({ fetchPartial: true });
|
||||
return;
|
||||
}
|
||||
let receipts: ReceiptDTO[] = [];
|
||||
if (action.command.includes('PRINT_SHIPPINGNOTE')) {
|
||||
const receiptsPromise = this.orderDetailsItemComponents.toArray().map(
|
||||
(timeComponent) =>
|
||||
new Promise<ReceiptDTO[]>((resolve) => {
|
||||
timeComponent.loadReceipts((r) => resolve(r));
|
||||
})
|
||||
);
|
||||
|
||||
receipts = await Promise.all(receiptsPromise).then((r) => r.flat());
|
||||
|
||||
receipts = unionBy(receipts, 'id');
|
||||
}
|
||||
|
||||
// #2737 Bei Zubuchen kein Abholfachzettel ausdrucken
|
||||
let command = action.command;
|
||||
@@ -179,7 +193,7 @@ export class SharedGoodsInOutOrderDetailsComponent extends SharedGoodsInOutOrder
|
||||
compartmentCode:
|
||||
action.command.includes('PRINT_PRICEDIFFQRCODELABEL') && !compartmentCode ? this.orderItems[0]?.compartmentCode : compartmentCode,
|
||||
itemQuantity: this.getItemQuantityMap(),
|
||||
receipts: this.receipts,
|
||||
receipts,
|
||||
};
|
||||
try {
|
||||
commandData = await this.commandService.handleCommand(command, commandData);
|
||||
|
||||
Reference in New Issue
Block a user