diff --git a/YLErpDAL/Modules/TradeModule/TradeBLL.cs b/YLErpDAL/Modules/TradeModule/TradeBLL.cs index 2efe1960..62e42170 100644 --- a/YLErpDAL/Modules/TradeModule/TradeBLL.cs +++ b/YLErpDAL/Modules/TradeModule/TradeBLL.cs @@ -276,10 +276,10 @@ namespace YLErp.BLL } var swapPositions = db.Set() .Where(sp => swapTradeIds.Contains(sp.SwapTradeId) && sp.IsInitial && sp.UnderlyingCode != null) - .Select(sp => new { sp.SwapTradeId, sp.PosiNetPrice, sp.UnderlyingCode }) + .Select(sp => new { sp.SwapTradeId, sp.PosiGrossPrice, sp.UnderlyingCode }) .ToList(); var logger = LogFactory.GetLogger(); - var posDict = swapPositions.GroupBy(sp => sp.SwapTradeId).ToDictionary(g => g.Key, g => g.First().PosiNetPrice); + var posDict = swapPositions.GroupBy(sp => sp.SwapTradeId).ToDictionary(g => g.Key, g => g.First().PosiGrossPrice); var umProvider = DataCacheProvider.GetUnderlyingDataSource(); // 需求②:平仓/行权/互换交易,审批角色应取 CloseProcess 流程的节点角色,而非 TradeProcess var closeProcessRoles = db.approvalprocess @@ -312,14 +312,14 @@ namespace YLErp.BLL tradeLinq.TradeSinglePrice = option.OpenCommission; } - // --- 新增逻辑:针对收益互换类型,用 swap_position.PosiNetPrice 覆盖展示用的期初标的价格 --- + // --- 针对收益互换类型,用 swap_position.PosiGrossPrice 覆盖展示用的期初标的价格 --- try { - if (tradeLinq.TradeType == "收益互换" && posDict.TryGetValue(tradeLinq.id, out var netPrice) && netPrice > 0) + if (tradeLinq.TradeType == "收益互换" && posDict.TryGetValue(tradeLinq.id, out var grossPrice) && grossPrice > 0) { - // 将期初价格覆盖为互换持仓的 PosiNetPrice(仅使用 PosiDirection != 0 的期初持仓) - logger.Info($"tradeOpeningProcessQuery.DAL override: tradeId={tradeLinq.id} beforeInitialSpot={tradeLinq.InitialSpotPrice} dbPosi={netPrice}"); - tradeLinq.InitialSpotPrice = Convert.ToDouble(netPrice); + // 将期初价格覆盖为互换持仓的 PosiGrossPrice(仅使用 PosiDirection != 0 的期初持仓) + logger.Info($"tradeOpeningProcessQuery.DAL override: tradeId={tradeLinq.id} beforeInitialSpot={tradeLinq.InitialSpotPrice} dbPosi={grossPrice}"); + tradeLinq.InitialSpotPrice = Convert.ToDouble(grossPrice); } } catch (Exception ex)