重置流水时刷新冻结资金缓存
This commit is contained in:
@@ -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<decimal>? action, List<int> tradeIds)
|
||||
public Dictionary<long, List<string>> ResetTradeByDate(DateTime valueDate, int? clientId, string underlyingCode, Action<decimal>? action, List<int> 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<long, List<string>> clientUmsDic = new Dictionary<long, List<string>>();
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace YLErp.Web.Hubs
|
||||
await client.SendAsync("ExceptionMessage", "存在大于此清算日期的已簿记流水,无法重置。请先重置后续日期的流水");
|
||||
return;
|
||||
}
|
||||
Dictionary<long, List<string>> 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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user