mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merged PR 1229: #3108 Remission Restmenge nach dem remittieren angepasst
#3108 Remission Restmenge nach dem remittieren angepasst Related work items: #3108
This commit is contained in:
committed by
Nino Righi
parent
e99d669086
commit
4c98a73204
@@ -171,6 +171,7 @@ export class RemissionListItemComponent implements OnDestroy {
|
||||
|
||||
this._store.removeItem(this.item);
|
||||
if (response && !!response?.item2) {
|
||||
response.item2.placementType = placementType;
|
||||
this.addItem(response.item2);
|
||||
}
|
||||
this._store.updateCache();
|
||||
@@ -214,7 +215,7 @@ export class RemissionListItemComponent implements OnDestroy {
|
||||
this._store.search({ newSearch: true });
|
||||
}
|
||||
|
||||
addItem(responseItem: ReturnItemDTO | ReturnSuggestionDTO) {
|
||||
async addItem(responseItem: ReturnItemDTO | ReturnSuggestionDTO) {
|
||||
let item: RemissionListItem;
|
||||
if (this.item.dtoType === 'return') {
|
||||
item = mapFromReturnItemDTO(responseItem);
|
||||
@@ -223,6 +224,22 @@ export class RemissionListItemComponent implements OnDestroy {
|
||||
} else {
|
||||
throw new Error('Fehler beim Mapping der DTO');
|
||||
}
|
||||
|
||||
// Anzeige der Remi-Menge und des aktuellen Bestands aktualisieren
|
||||
item = await this.updateStockInformation(item);
|
||||
|
||||
this._store.addItems([item]);
|
||||
}
|
||||
|
||||
async updateStockInformation(item: RemissionListItem) {
|
||||
try {
|
||||
const res = (await this._remissionService.getStockInformation([item]).toPromise())?.find((_) => true);
|
||||
item.remissionQuantity = res.remissionQuantity;
|
||||
item.remainingQuantity = res.remainingQuantity;
|
||||
item.inStock = res.inStock;
|
||||
return item;
|
||||
} catch (err) {
|
||||
throw new Error('Fehler bei der Bestandsabfrage');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user