Add logging for stock taking close operations
Added info logs to CloseStockTaking for invocation and item updates. Added error log in StockSignalREndpointServer when closing fails.
This commit is contained in:
parent
f5e356555c
commit
c5da19a3ee
|
|
@ -43,6 +43,8 @@ public class StockSignalREndpointServer(StockTakingDbContext ctx, SignalRSendToC
|
|||
});
|
||||
|
||||
if (result) return await ctx.StockTakings.GetByIdAsync(stockTakingId, false);
|
||||
|
||||
_logger.Error($"StockTaking closing ERROR! stockTakingId: {stockTakingId}");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,11 +83,15 @@ public class StockTakingDbContext : MgDbContextBase,
|
|||
|
||||
public async Task CloseStockTaking(int stockTakingId)
|
||||
{
|
||||
Logger.Info($"CloseStockTaking invoked! stockTakingId: {stockTakingId}");
|
||||
|
||||
var count = 0;
|
||||
|
||||
var stockTaking = await StockTakings.GetByIdAsync(stockTakingId, true);
|
||||
|
||||
if (!stockTaking.IsReadyForClose()) throw new Exception($"Not all IsRequiredForMeasuring items are IsMeasured! IsReadyForClose: false;");
|
||||
|
||||
var count = 0;
|
||||
//TODO: Mi legyen az invalid item-ekkel? - J.
|
||||
foreach (var stockTakingItem in stockTaking.StockTakingItems!.Where(stockTakingItem => stockTakingItem is { IsMeasured: true, IsInvalid: false }))
|
||||
{
|
||||
count++;
|
||||
|
|
@ -95,6 +99,8 @@ public class StockTakingDbContext : MgDbContextBase,
|
|||
//await _fruitBankDbContext.UpdateStockQuantityAndWeightAsync(stockTakingItem.Product!, stockTakingItem.QuantityDiff,
|
||||
// $"Leltár által módosítva! stockTakingId: #{stockTaking.Id}, stockTakingItemId: #{stockTakingItem.Id}",
|
||||
// stockTakingItem.NetWeightDiff);
|
||||
|
||||
Logger.Info($"CloseStockTaking.UpdateStockQuantityAndWeightAsync; {stockTakingItem.Product}; qntDiff: {stockTakingItem.QuantityDiff} db; netWeightDiff: {stockTakingItem.NetWeightDiff} kg");
|
||||
}
|
||||
|
||||
stockTaking.IsClosed = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue