diff --git a/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs b/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs index ae143923..479d5c39 100644 --- a/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs @@ -125,7 +125,7 @@ namespace YLErp.Modules.SwapModule string sql = $"select cd.id,{selectStr},co.settl_type from client_deal cd inner join client_order co on co.id=cd.client_order_id where cd.create_time<'{tomorrowDate.ToString("yyyy-MM-dd")}' and cd.create_time>='{valueDate.ToString("yyyy-MM-dd")}'"; return sql; } - public void ResetTradeByDate(DateTime valueDate, int? clientId, string underlyingCode, Action? action, List tradeIds) + public Dictionary> ResetTradeByDate(DateTime valueDate, int? clientId, string underlyingCode, Action? action, List tradeIds) { var swapEvents = DbContext.swap_event.Where(x => x.EventReason.Contains("自动") && x.ValueDate == valueDate); @@ -174,6 +174,14 @@ namespace YLErp.Modules.SwapModule DbContext.swap_flow_merge.RemoveRange(swapflowMerges); DbContext.swap_flow_deal.RemoveRange(swapflowDeals); DbContext.SaveChanges(); + Dictionary> clientUmsDic = new Dictionary>(); + var groupByClientIdDic = swapFlows.ToList().GroupBy(x => x.ClientId).ToDictionary(x => x.Key, x => x.ToList()); + foreach (var item in groupByClientIdDic) + { + var clientUms = item.Value.Select(x => x.UnderlyingCode).Distinct().ToList(); + clientUmsDic.Add(item.Key??0, clientUms); + } + return clientUmsDic; } /// diff --git a/YLErpWeb/Hubs/SwapFlowResetHub.cs b/YLErpWeb/Hubs/SwapFlowResetHub.cs index 92ffaef4..db5474f6 100644 --- a/YLErpWeb/Hubs/SwapFlowResetHub.cs +++ b/YLErpWeb/Hubs/SwapFlowResetHub.cs @@ -38,6 +38,7 @@ namespace YLErp.Web.Hubs await client.SendAsync("ExceptionMessage", "存在大于此清算日期的已簿记流水,无法重置。请先重置后续日期的流水"); return; } + Dictionary> clientUmsDic = null; try { var tradeIds= service.GetNeedResetTradeIds(req.clientId, req.underlyingCode, req.tradeDate); @@ -47,12 +48,13 @@ namespace YLErp.Web.Hubs return; } isProcessing = true; - service.ResetTradeByDate(req.tradeDate, req.clientId, req.underlyingCode, (progress) => + clientUmsDic = service.ResetTradeByDate(req.tradeDate, req.clientId, req.underlyingCode, (progress) => { client.SendAsync("UpdateProgress", Math.Round(progress, 2)); }, tradeIds); isProcessing = false; await client.SendAsync("ProcessCompleted", ""); + service.refreshFrozenCashCache(clientUmsDic); } catch (Exception ex) {