From d836d192fe36d10d3e598ef5604d71680dc508a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=86=B0=E5=86=B0?= <437394478@qq.com> Date: Tue, 28 Jul 2026 16:48:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#EQD-6812=20=E5=9B=BD=E8=81=94=E6=B0=91?= =?UTF-8?q?=E7=94=9F-TRS=E7=B0=BF=E8=AE=B0=E9=A1=B5=E9=9D=A2=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=BB=AD=E5=81=9A=E6=8C=89=E9=92=AE=EF=BC=88=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=96=B0=E5=BB=BA=E4=B8=80=E4=B8=AA=E9=99=A4=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E5=A4=96=E8=A6=81=E7=B4=A0=E7=9B=B8=E5=90=8C=E7=9A=84?= =?UTF-8?q?=E5=90=88=E7=BA=A6=EF=BC=89-=E4=BA=A4=E6=98=93=E8=B4=B9?= =?UTF-8?q?=E7=94=A8=E5=90=8E=E4=BB=98=E5=AD=97=E6=AE=B5=E6=9C=AA=E5=A1=AB?= =?UTF-8?q?=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YLErpDAL/Modules/AppModule/AppUpgrader.cs | 4 +-- YLErpWeb/Controllers/SwapTrade2Controller.cs | 1 - .../Scripts/app/swaptrade/swapTradeEdit.js | 27 +++++++++++++------ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/YLErpDAL/Modules/AppModule/AppUpgrader.cs b/YLErpDAL/Modules/AppModule/AppUpgrader.cs index ead11cb0..945744b1 100644 --- a/YLErpDAL/Modules/AppModule/AppUpgrader.cs +++ b/YLErpDAL/Modules/AppModule/AppUpgrader.cs @@ -465,9 +465,7 @@ namespace YLErp.Modules.AppModule .ToHashSet(); var nextIndex = adminDb.DictionaryItems .Where(item => item.DictId == marginTemplateDictionary.Id) - .Select(item => item.IndexNum) - .DefaultIfEmpty(-1) - .Max(); + .Max(item => (int?)item.IndexNum) ?? -1; foreach (var templateName in YLErp.Modules.SwapModule.SwapMarginTemplateConfigService.InitialTemplateNames) { if (existingNames.Contains(templateName)) diff --git a/YLErpWeb/Controllers/SwapTrade2Controller.cs b/YLErpWeb/Controllers/SwapTrade2Controller.cs index 00297abc..b0115d2f 100644 --- a/YLErpWeb/Controllers/SwapTrade2Controller.cs +++ b/YLErpWeb/Controllers/SwapTrade2Controller.cs @@ -186,7 +186,6 @@ namespace YLErp.Web.Controllers renewPosition.InterestAmount = 0; renewPosition.InterestFeePending = 0; renewPosition.PosiDividendIncome = 0; - renewPosition.PosiTradingFeePending = 0; renewPosition.InterestSwapInterval = null; renewPosition.Obervation = null; return renewPosition; diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js index fa6b7011..8f1b647e 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js @@ -684,13 +684,7 @@ const vue = new Vue({ } }, setUnderlyingCode(data, item) { - var underlyingCode = item.UnderlyingCode; - if (underlyingCode != data.Code) { - this.getSpotPrice(data.Code, this.trade.TradeDate, item); - } else { - item.PosiGrossPrice = item.PosiGrossPrice; - item.PosiNetNoFeePrice = item.PosiNetNoFeePrice; - } + if (!data || !data.Code) return; item.CountRatio = data.CountRatio; item.ContractSize = data.ContractSize; item.UnderlyingInstrumentType = data.InstrumentType; @@ -704,11 +698,13 @@ const vue = new Vue({ item.underlying.Price = data.Price; item.underlying.UnderlyingInstrumentType = data.InstrumentType; item.underlying.QuoteUnitString = data.QuoteUnitString; - this.trade.UnderlyingCode = underlyingCode; + this.trade.UnderlyingCode = data.Code; // 债券标的:标记该浮动腿可启用净价/全价/收益率互算 this.$set(item, 'isBond', tradeHelper.IsBond(data.InstrumentType)); // 切换标的时清空债券三字段互算的手动/源标志(D1 修复:避免旧债券手填状态污染新债券) SwapCalc.clearBondCalcFlags(item); + // Refresh the initial price even when the user re-selects the same underlying. + this.getSpotPrice(item.UnderlyingCode, this.trade.TradeDate, item); //this.initMarginRate(); }, setFloatRateUnderlyingCode(data, item) { @@ -745,8 +741,13 @@ const vue = new Vue({ }, getSpotPrice(underlyingCode, StartDate, item) { var thisObj = this; + if (!underlyingCode) return; main.post("/pricing/AjaxGetUnderlyingPrice", { underlyingCode: underlyingCode, tradeDate: StartDate }) .done(function (resp) { + if (!resp || !resp.success || !resp.obj) { + main.message("未获取到标的价格"); + return; + } // 行情接口(AjaxGetUnderlyingPrice)对债券返回的 price/netPrice 本就是【存储态小数】(1.0 代表 100 元), // 与 PosiGrossPrice/PosiNetNoFeePrice 模型字段同量纲(见 PricingController: EodPrice 直接返回、 // 非 EodPrice 分支 ×bondPriceMultiple=0.01)。故此处仅做精度格式化,**不可**再 bondCalcPriceToStorage(÷100), @@ -1465,6 +1466,16 @@ const vue = new Vue({ //} }, + // A renewal opens as a new trade, so the underlying autocomplete only restores + // its code and does not emit change. Fetch the initial price explicitly. + refreshInitialUnderlyingPrices() { + if (!page.isAdd) return; + this.paySwapList.forEach(item => { + if (item.UnderlyingCode) { + this.getSpotPrice(item.UnderlyingCode, this.trade.TradeDate, item); + } + }); + }, //利息端添加行 addGetSwapRate() { var InterestMode = 9;