Merged PR 1289: #3212 Remission Stapel aktualisieren fix

#3212 Remission Stapel aktualisieren fix
This commit is contained in:
Andreas Schickinger
2022-06-24 09:04:58 +00:00
committed by Lorenz Hilpert
parent e228490812
commit fa2838ea5c

View File

@@ -169,15 +169,11 @@ export class RemissionListItemComponent implements OnDestroy {
throw new Error('Item hat keinen passenden DTO Typ');
}
this._store.removeItem(this.item);
if (response && !!response?.item2) {
response.item2.placementType = placementType;
await this.addItem(response.item2);
}
// Bei remittieren eines Stapels die StockInformation für alle anderen Stapel mit der selben EAN aktualisieren
if (this.item.placementType === 'Stapel' && placementType !== 'Leistung') {
const itemsByEan = await (await this._store.items$.pipe(first()).toPromise()).filter(
if (placementType != 'Leistung') {
const items = await this._store.items$.pipe(first()).toPromise();
const itemsByEan = items?.filter(
(i) => i.dto.product.ean === this.item.dto.product.ean && i.dto.id !== this.item.dto.id && i.placementType === 'Stapel'
);
@@ -187,6 +183,12 @@ export class RemissionListItemComponent implements OnDestroy {
}
}
this._store.removeItem(this.item);
if (response && !!response?.item2) {
response.item2.placementType = placementType;
await this.addItem(response.item2);
}
this._store.updateCache();
} catch (err) {
this._modal.open({