Merge branch 'glms/feature/1.4.2' of http://git.yiliantech.com/gitlab/otc-dev/zszq-trs into glms/feature/1.4.2

This commit is contained in:
嬴政 时
2026-04-29 16:52:40 +08:00
2 changed files with 20 additions and 7 deletions
@@ -19,7 +19,7 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator
protected override string GetTemplateFilePath()
{
var templatePath = Path.Combine(GlobalConfig.PluginFolder, "App_Docs\\settlement_template\\settle_01.docx");
var templatePath = Path.Combine(GlobalConfig.PluginFolder, "App_Docs/settlement_template/settle_01.docx");
return templatePath;
}
@@ -1,4 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using System.Data;
using YieldChain.Commons;
using YLErp.Cache;
using YLErp.Model;
namespace YLErp.Modules.MarginModule
@@ -58,7 +61,7 @@ namespace YLErp.Modules.MarginModule
var query = from config in DbContext.clientMarginConfig
select new ClientMarginConfigDto
{
EncryptId=config.EncryptId,
EncryptId = config.EncryptId,
id = config.id,
client_id = config.client_id,
client_name = config.client_name,
@@ -78,15 +81,15 @@ namespace YLErp.Modules.MarginModule
query = query.Where(o => o.value_date == req.ValueDate.Value);
}
var configs = query.OrderByDescending(o=>o.id).ToList();
var configs = query.OrderByDescending(o => o.id).ToList();
// 为每个配置加载5条固定期限的详情数据
var fixedTerms = ConsMarginTerm.AllowedTerms.ToArray();
foreach (var config in configs)
{
var existingDetails = DbContext.clientMarginDetail.Where(d => d.config_id == config.id).ToList();
var detailDtos = new List<ClientMarginDetailDto>();
for (int i = 0; i < fixedTerms.Length; i++)
{
var term = fixedTerms[i];
@@ -112,11 +115,11 @@ namespace YLErp.Modules.MarginModule
});
}
}
// 直接使用DTO格式返回给前端
config.details = detailDtos;
}
return configs;
}
@@ -142,6 +145,16 @@ namespace YLErp.Modules.MarginModule
DbContext.SaveChanges();
trans.Commit();
// 更新保证金率缓存:通用配置变动清除全部,客户配置变动只清除该客户的
var ylCache = YLServiceLocator.ServiceProvider?.GetService<IYLCache>();
if (ylCache != null)
{
var cachePattern = config.client_id == 0
? "Otc:ClientMarginRate:*"
: $"Otc:ClientMarginRate:{config.client_id}:*";
ylCache.BatchDelete(cachePattern);
}
}
catch
{