diff --git a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/StockSignalREndpointServer.cs b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/StockSignalREndpointServer.cs index 2b1c33c..093ed4d 100644 --- a/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/StockSignalREndpointServer.cs +++ b/Nop.Plugin.Misc.AIPlugin/Areas/Admin/Controllers/StockSignalREndpointServer.cs @@ -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; } diff --git a/Nop.Plugin.Misc.AIPlugin/Domains/DataLayer/StockTakingDbContext.cs b/Nop.Plugin.Misc.AIPlugin/Domains/DataLayer/StockTakingDbContext.cs index a57d217..c86e951 100644 --- a/Nop.Plugin.Misc.AIPlugin/Domains/DataLayer/StockTakingDbContext.cs +++ b/Nop.Plugin.Misc.AIPlugin/Domains/DataLayer/StockTakingDbContext.cs @@ -83,18 +83,24 @@ 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++; - - //await _fruitBankDbContext.UpdateStockQuantityAndWeightAsync(stockTakingItem.Product!, stockTakingItem.QuantityDiff, - // $"Leltár által módosítva! stockTakingId: #{stockTaking.Id}, stockTakingItemId: #{stockTakingItem.Id}", + + //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;