From fded8a39ff1fcc2b0a748769b284dd0af5e214ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=A6=E9=BA=9F=20=E7=8E=8B?= Date: Thu, 14 May 2026 17:22:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E7=BC=96=E5=8F=B7=E8=8E=B7=E5=8F=96=E9=80=BB=E8=BE=91=E5=8F=8A?= =?UTF-8?q?=E5=88=A9=E7=8E=87=E5=AD=97=E6=AE=B5=E5=B1=95=E7=A4=BA=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TradeConfirmationGenerator.cs | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs index 4972eba5..5edf5907 100644 --- a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs +++ b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs @@ -187,7 +187,21 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator ? client.Name : $"{client.Manager}作为管理人代表{client.Name}"; - dic["主协议编号"] = client.MainProtocolCode ?? ""; + // 主协议编号:优先取 client 表字段,为空时从 client_meta 表兜底 + var mainProtocolCode = client.MainProtocolCode; + if (string.IsNullOrWhiteSpace(mainProtocolCode)) + { + mainProtocolCode = Context.GetClientMeta(client.id, ConsTradeMetaKey.MainProtocolCode)?.MetaValue; + } + dic["主协议编号"] = mainProtocolCode ?? ""; + + // 补充协议编号:优先取 client 表字段,为空时从 client_meta 表兜底 + var supProtocolCode = client.SupProtocolCode; + if (string.IsNullOrWhiteSpace(supProtocolCode)) + { + supProtocolCode = Context.GetClientMeta(client.id, ConsTradeMetaKey.SupProtocolCode)?.MetaValue; + } + dic["补充协议编号"] = supProtocolCode ?? ""; dic["名义本金"] = trade.OriginalStockEqvNotional?.ToString("N2") ?? "0.00"; // 银行账户信息 @@ -208,7 +222,7 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator var bond = JsonHelper.Deserialize(underlying.ExJson) ?? new UnderlyingBond(); dic["参考标的发行人"] = bond.UnderlyingIssuer ?? ""; dic["参考标的担保人"] = ""; - dic["票面利率"] = (bond.CouponRate ?? 0).ToString("N4"); + dic["票面利率"] = ((double)(bond.CouponRate ?? 0) * 100).ToString("N4"); dic["参考标的到期日"] = underlying.MaturityDate?.ToString("yyyy年M月d日") ?? ""; } @@ -326,7 +340,7 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator dic["利率类型"] = "浮动利率"; dic["IsFloat"] = "☑"; dic["固定利率"] = ""; - dic["利差"] = ((double)interestMargin.InterestRateDefault * 10000).ToString("N2"); + dic["利差"] = ((double)interestMargin.InterestRateDefault * 10000).ToString("N0"); dic["重置频率"] = (interestMargin.interest_rest_days ?? 0) + "天"; } } From 167dea4e2d26c91c43eefb0d85a331d5b31b143f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=96=B9=E6=B5=B7?= Date: Fri, 15 May 2026 10:05:48 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=94=B6=E7=9B=98=E4=BA=92=E6=8D=A2?= =?UTF-8?q?=E8=AE=A1=E6=81=AF=E5=9F=BA=E6=95=B0=E8=AE=B0=E5=BD=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs index deb84211..848e42d2 100644 --- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs @@ -854,7 +854,7 @@ namespace YLErp.Modules.SwapModule newEodPayPosition.FloatRateUnderlyingCode = position.FloatRateUnderlyingCode; newEodPayPosition.InterestFeePending = 0; //利息端估值用信息 - eodPayPosition.TdInterestPrincipal = interestModes.Contains(position.InterestMode) ? eodPayPosition.InterestPrincipalFix : posiNotionalValue; + newEodPayPosition.TdInterestPrincipal = interestModes.Contains(position.InterestMode) ? eodPayPosition.InterestPrincipalFix : posiNotionalValue; newEodPayPosition.TdInterestRate = interval.Rate; //当日已实现 //newEodPayPosition.TdInterestFee = 0; From e5b5b723b310c09b7430b054243dab322ec21549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AC=B4=E6=94=BF=20=E6=97=B6?= Date: Fri, 15 May 2026 10:56:27 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E7=94=9F=E6=88=90=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E4=B9=A6=E6=97=B6,=20=E8=81=94=E7=B3=BB=E4=BA=BA=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E6=9C=89=E5=A4=9A=E4=B8=AA,=20=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Abstracts/ITradeDocGeneratorContext.cs | 17 +++++++----- .../TradeConfirmationGenerator.cs | 11 ++++---- .../ConfirmationGenerateContext.cs | 26 ++++++++++++------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/Framework/YLErp.Core/Plugins/TradeDocGenerator/Abstracts/ITradeDocGeneratorContext.cs b/Framework/YLErp.Core/Plugins/TradeDocGenerator/Abstracts/ITradeDocGeneratorContext.cs index 76e98cf8..f74110c6 100644 --- a/Framework/YLErp.Core/Plugins/TradeDocGenerator/Abstracts/ITradeDocGeneratorContext.cs +++ b/Framework/YLErp.Core/Plugins/TradeDocGenerator/Abstracts/ITradeDocGeneratorContext.cs @@ -4,6 +4,7 @@ using YLErp.Abstract; using YLErp.Configuration; using YLErp.DBModels; using YLErp.DBModels.Abstract; +using YLErp.DBModels.Consts; using YLErp.Models; namespace YLErp.Plugins.TradeDocGenerator.Abstracts @@ -78,7 +79,7 @@ namespace YLErp.Plugins.TradeDocGenerator.Abstracts string Gettrade_contract_r(); string Gettrade_contract_r(string type); - string Gettrade_contract_r(int tradeId,string type); + string Gettrade_contract_r(int tradeId, string type); string Gettrade_contract_r(string type, int tradeCashId); @@ -258,10 +259,10 @@ namespace YLErp.Plugins.TradeDocGenerator.Abstracts /// /// /// - string GenerateWCZDChildrenContractNo(int tId,int tcId); + string GenerateWCZDChildrenContractNo(int tId, int tcId); - string GetWCZDConfirmNumber(int tId, int tcId,string type); + string GetWCZDConfirmNumber(int tId, int tcId, string type); /// /// 获取交易关联的协议信息 /// @@ -431,15 +432,17 @@ namespace YLErp.Plugins.TradeDocGenerator.Abstracts List GetSwapEvents(int tradeId); - List GetSwapPositions(int tradeId,bool? IsInitial); + List GetSwapPositions(int tradeId, bool? IsInitial); List GetSwapPositions(List tradeId, bool? IsInitial); List GetClientDuties(); + List GetContractTypes(); + client_marginrate GetClientMarginRate(int clientId); - int GetDMASelttementCount(int clientId,DateTime valueDate); + int GetDMASelttementCount(int clientId, DateTime valueDate); List GetSwapFlows(int tradeId); List GetUnderlyings(List underlyingCodes); @@ -451,14 +454,14 @@ namespace YLErp.Plugins.TradeDocGenerator.Abstracts /// /// /// - List GetFlowEvents(int tradeId,List eventTypes); + List GetFlowEvents(int tradeId, List eventTypes); /// /// 获取日终估值 /// /// /// /// - List GetEodPositions(int tradeId,DateTime valueDate); + List GetEodPositions(int tradeId, DateTime valueDate); /// /// 获取定义文件类型流水拆分明细 /// diff --git a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs index 5edf5907..c0cd3c47 100644 --- a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs +++ b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs @@ -393,13 +393,12 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator ? ((double)swapPosition.PosiQuantity).ToString("N2") : "0.00"; dic["参考标的基金管理人"] = ""; - + var contractTypeId = (Context.GetContractTypes().FirstOrDefault(O => O.ContactType == "交易确认书接收")?.id) ?? 0; // 乙方联系人信息 - var clientDuties = Context.GetClientDuties(); - var contact = clientDuties.FirstOrDefault(); - dic["联系人"] = contact?.ContactName ?? ""; - dic["电子邮件"] = contact?.Email ?? ""; - dic["电话"] = contact?.PhoneNumber ?? ""; + var clientDuties = Context.GetClientDuties().Where(O => O.ContactTypeIdsInt.Contains(contractTypeId)).ToList(); + dic["联系人"] = string.Join(",", clientDuties.Select(O => O.ContactName)).Trim(','); + dic["电子邮件"] = string.Join(";", clientDuties.Select(O => O.Email)).Trim(';'); + dic["电话"] = string.Join(";", clientDuties.Select(O => O.PhoneNumber)).Trim(';'); // 表格数据示例 var table1 = new JArray(); diff --git a/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateContext.cs b/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateContext.cs index fbc8eb50..7894e15b 100644 --- a/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateContext.cs +++ b/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateContext.cs @@ -970,6 +970,12 @@ namespace YLErp.Modules.TradeModule.DocGenerateModule return result; } + public List GetContractTypes() + { + var result = DbContextFactory.GetClientDbContext(OptUser).contactype.ToList(); + return result; + } + /// /// 获取工作日天数 /// @@ -1310,7 +1316,7 @@ namespace YLErp.Modules.TradeModule.DocGenerateModule join t in DbContext.trade on r.TradeId equals t.id where r.Type == ContractTypeEnum.Trade && r.ContractCode.StartsWith(prefix) select r; - var codeList = query.Select(s=>s.ContractCode).ToList(); + var codeList = query.Select(s => s.ContractCode).ToList(); var count = codeList.Count; do { @@ -1336,7 +1342,7 @@ namespace YLErp.Modules.TradeModule.DocGenerateModule var posi = GetSwapPositions(Trade.id, true).FirstOrDefault(p => p.PositionType > 0); var isLong = posi?.PositionType == (int)PositionTypeFlag.Short ? false : true; - return "GLMS-" + _client.Number + "-" + Trade.TradeDate?.ToString("yyyyMMdd") + (isLong ? "-L" : "-S"); + return "GLMS-" + _client.Number + "-" + Trade.TradeDate?.ToString("yyyyMMdd") + (isLong ? "-L" : "-S"); } return Trade.TradeNumber; } @@ -2788,12 +2794,12 @@ namespace YLErp.Modules.TradeModule.DocGenerateModule return DbContext.swap_event.Where(x => x.SwapTradeId == tradeId && x.Invalid == true).ToList(); } - public List GetSwapPositions(int tradeId,bool? IsInitial) + public List GetSwapPositions(int tradeId, bool? IsInitial) { - var query = DbContext.swap_position.Where(x => x.SwapTradeId == tradeId&&!x.Invalid); + var query = DbContext.swap_position.Where(x => x.SwapTradeId == tradeId && !x.Invalid); if (IsInitial.HasValue) { - query = query.Where(x=>x.IsInitial== IsInitial); + query = query.Where(x => x.IsInitial == IsInitial); } return query.ToList(); } @@ -2842,9 +2848,9 @@ namespace YLErp.Modules.TradeModule.DocGenerateModule return query.Distinct().Count(); } - public List GetSwapFlows(int tradeId) + public List GetSwapFlows(int tradeId) { - return DbContext.swap_flow.Where(x=>x.SwapTradeId==tradeId&&x.DataState==(int)SwapFlowDateStateEnum.完成).AsNoTracking().ToList(); + return DbContext.swap_flow.Where(x => x.SwapTradeId == tradeId && x.DataState == (int)SwapFlowDateStateEnum.完成).AsNoTracking().ToList(); } public List GetUnderlyings(List underlyingCodes) @@ -2857,16 +2863,16 @@ namespace YLErp.Modules.TradeModule.DocGenerateModule } public List GetFlowEvents(int tradeId, List eventTypes) { - return DbContext.swap_flow_event.Where(x => eventTypes.Contains(x.EventType)&&x.SwapTradeId==tradeId&&x.DataState==(int)SwapFlowDateStateEnum.完成).AsNoTracking().ToList(); + return DbContext.swap_flow_event.Where(x => eventTypes.Contains(x.EventType) && x.SwapTradeId == tradeId && x.DataState == (int)SwapFlowDateStateEnum.完成).AsNoTracking().ToList(); } public List GetEodPositions(int tradeId, DateTime valueDate) { - return DbContext.eod_swap_position.Where(x=> x.SwapTradeId==tradeId && !x.Invalid&&x.ValueDate==valueDate).AsNoTracking().ToList(); + return DbContext.eod_swap_position.Where(x => x.SwapTradeId == tradeId && !x.Invalid && x.ValueDate == valueDate).AsNoTracking().ToList(); } public List GetSwapFlowDeals(int tradeId) { - return DbContext.swap_flow_deal.Where(x => x.SwapTradeId == tradeId).AsNoTracking().ToList(); + return DbContext.swap_flow_deal.Where(x => x.SwapTradeId == tradeId).AsNoTracking().ToList(); } public swap_event GetEvent(long eventId) From bbde493068a8bb6f8d134f44c1f4bbdb9efcaefc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=96=B9=E6=B5=B7?= Date: Fri, 15 May 2026 15:54:39 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=94=B9=E4=B8=AA=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml b/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml index 00b0d748..6a395497 100644 --- a/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml +++ b/YLErpWeb/Views/SwapTrade2/TradeEdit.cshtml @@ -515,7 +515,7 @@
交易日历