diff --git a/DOAN.ServiceCore/DoanBackgroundService.cs b/DOAN.ServiceCore/DoanBackgroundService.cs index 0e90ccf..07171a2 100644 --- a/DOAN.ServiceCore/DoanBackgroundService.cs +++ b/DOAN.ServiceCore/DoanBackgroundService.cs @@ -154,6 +154,9 @@ namespace DOAN.ServiceCore if (updateStoragelocationList.Any()) { await DbScoped.SugarScope.CopyNew().Updateable(updateStoragelocationList).ExecuteCommandAsync(); + // 发送库存变更Socket通知 + string changeMessage = "库存变动"; + await notificationHubContext.Clients.All.SendAsync("PBL_storagelocation_change", changeMessage); } // 插入库存变更日志 @@ -161,11 +164,6 @@ namespace DOAN.ServiceCore { await DbScoped.SugarScope.CopyNew().Insertable(inventoryLogs).ExecuteCommandAsync(); } - - // 发送Socket通知 - string changeMessage = "库存变动"; - await notificationHubContext.Clients.All.SendAsync("PBL_storagelocation_change", changeMessage); - // 添加延迟以避免频繁查询 await Task.Delay(200, stoppingToken); }