diff --git a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs index 5fba935c..a91257e4 100644 --- a/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs +++ b/Plugins/YLErp.Plugins.GuoLian/DocumentGenerator/TradeConfirmationGenerator.cs @@ -54,8 +54,11 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator var trade = Context.Trade; var underlying = Context.GetTradeUnderlying(); - // 判断看多/看空方向 - bool isLong = IsLongPosition(trade); + // 判断看多/看空方向(通过持仓方向判断:PositionType: 1=多头/看多,2=空头/看空) + var swapPosition = Context.GetSwapPositions(trade.id, true) + .Where(x => x.PositionType == (int)PositionTypeFlag.Long || x.PositionType == (int)PositionTypeFlag.Short) + .FirstOrDefault(); + bool isLong = swapPosition?.PositionType == (int)PositionTypeFlag.Long; // 判断标的类型(债券ETF vs 现券) bool isEtf = IsBondEtf(underlying?.UnderlyingCode ?? string.Empty); @@ -71,16 +74,7 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator else templateName = "国联民生-收益互换交易确认书-境内模板-【客户看空】-【债券ETF】-清洁版.docx"; - return Path.Combine(GlobalConfig.PluginFolder, "App_Docs\\contract_template", templateName); - } - - /// - /// 判断是否为多头/看多方向 - /// - private bool IsLongPosition(OtcTradeBase trade) - { - // 通过BuySell判断:买入=看多,卖出=看空 - return trade.BuySell == "买入"; + return Path.Combine(GlobalConfig.PluginFolder, "App_Docs/contract_template", templateName); } ///