消息传递优化,有变更则主动推送
This commit is contained in:
parent
3d1b605828
commit
9efae261f4
@ -154,6 +154,9 @@ namespace DOAN.ServiceCore
|
|||||||
if (updateStoragelocationList.Any())
|
if (updateStoragelocationList.Any())
|
||||||
{
|
{
|
||||||
await DbScoped.SugarScope.CopyNew().Updateable(updateStoragelocationList).ExecuteCommandAsync();
|
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();
|
await DbScoped.SugarScope.CopyNew().Insertable(inventoryLogs).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送Socket通知
|
|
||||||
string changeMessage = "库存变动";
|
|
||||||
await notificationHubContext.Clients.All.SendAsync("PBL_storagelocation_change", changeMessage);
|
|
||||||
|
|
||||||
// 添加延迟以避免频繁查询
|
// 添加延迟以避免频繁查询
|
||||||
await Task.Delay(200, stoppingToken);
|
await Task.Delay(200, stoppingToken);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user