diff --git a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeSettleBillGenerator.cs b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeSettleBillGenerator.cs index fa249dac..c9ef61ca 100644 --- a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeSettleBillGenerator.cs +++ b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeSettleBillGenerator.cs @@ -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; } diff --git a/YLErpDAL/Modules/MarginModule/ClientMarginConfigService.cs b/YLErpDAL/Modules/MarginModule/ClientMarginConfigService.cs index b1c4efe1..370e1b51 100644 --- a/YLErpDAL/Modules/MarginModule/ClientMarginConfigService.cs +++ b/YLErpDAL/Modules/MarginModule/ClientMarginConfigService.cs @@ -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(); - + 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(); + if (ylCache != null) + { + var cachePattern = config.client_id == 0 + ? "Otc:ClientMarginRate:*" + : $"Otc:ClientMarginRate:{config.client_id}:*"; + ylCache.BatchDelete(cachePattern); + } } catch {