From 23dabc7f868c71ae84c92e425871fe086481734d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=96=B9=E6=B5=B7?= Date: Thu, 29 May 2025 11:05:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=92=E6=8D=A2=E4=BC=B0=E5=80=BCbug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../YLErp.Core/Models/SwapEndConfirmModel.cs | 2 ++ .../App_Docs/结算单/非DMA结算单.xlsx | Bin 10448 -> 10443 bytes .../TradeSettleBillGenerator.cs | 1 + .../Modules/SwapModule/SwapDealService.cs | 1 + .../SwapModule/SwapEodPositionService.cs | 5 ++++- .../SwapModule/SwapFlowEventService.cs | 19 +++++++++++------- YLErpWeb/appsettings.local.json | 2 +- 7 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Framework/YLErp.Core/Models/SwapEndConfirmModel.cs b/Framework/YLErp.Core/Models/SwapEndConfirmModel.cs index 6ffbccf3..b796debe 100644 --- a/Framework/YLErp.Core/Models/SwapEndConfirmModel.cs +++ b/Framework/YLErp.Core/Models/SwapEndConfirmModel.cs @@ -43,5 +43,7 @@ namespace YLErp.Models /// 分红 /// public string DividendIn { get; set; } + + public string Quantity { get; set; } } } diff --git a/Plugins/YLErp.Plugins.ZheShang/App_Docs/结算单/非DMA结算单.xlsx b/Plugins/YLErp.Plugins.ZheShang/App_Docs/结算单/非DMA结算单.xlsx index 6cadad288c1aa88bd804cbdb0dbae9d22cafb719..5164d42360a607a6cef765bf00ba5d24291f008e 100644 GIT binary patch delta 2693 zcmV;03VQX>QOi-V;sykDf7`>8<_0EzhU;R7;e9l!Ij= zWI;46<$|jaOtgbtFe2T0C8I<^txhyl0r>^w7^Xm zNfME<8WNpZmCR$*k496bdq8w_r|zz8E!Ak4S5wB-=sv-oGs35%gR;DY zx>2LYKR+IS|N8s==je%o$#%K?hlWXFqT@h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GQ>%mrWC(mK9N1_Z&_CyfrALeX3xs#J%E<~Bf{6oEb-3IE(JiURh zEl!!<({2Gdgf=yVN3Ma`W|V>8a>_t*bIL$;3&IG0d>UJ8q}vP3jxvzNo;nX?aj?d{4+La!r0PHxC(1w;XTnIx;zAk7;?0_bh5G9I zU*_;}wf+IK8xUa&4ypK7fNlZ+0J{YM02Ba|;U^YN)7fpG_yuQKHL=~T z(Z`*0=FB~J&%Md<1&10Xa0THkg>EE9kO3^mZNlbLXm)1u`W<8liJ6TlXOKc=5NO=G zd?_h^gf#SBCQ>LbWns)TMJ^8x771Perjdu-b+FW*?z|}qE?`^a0i;9C(UFncrh^GX zMvfPmOre{%kWpmhQ4!L=53HmhR#IA>?+4z_mO5&AwY8)vt)v;8hgkRIRDD|W>L2<6 zzrE!*>k)vrebj01L;z~zX?N+F_pai2{u<)gpXqhPVCAf4v&*DEt{-V_mK8caK~C_Thj=Wl47;?0=+2keV@3z&V|N zCLId_ZV8ZO=(t=V5}a#<*|1;`W;ominvi&o!qvsc{qHOWx9=a`*UMXsf2WSu=(kW1o)e<2{yw?yU0u({D2+(e^U1)EhBGpx{R>LS zV}1G2`C72uD0T|}6Z<~t`_W)V&S@{AXZ;Rw4@evD<4=)(0{{U3vz#E}1q38IlZumq zCV>gc)F`891ONbglME+U0ics)CqNCb761TvY%g#qKfNlZ+0J{YM z02BZK00000000000001Sli(*O8ye%>t6Tv90AT_E01*HH00000000000000HlOiZS W0i=^*C_Mpqlb ConsTrade.InterestModels.Contains(x.InterestMode)).Sum(s => s.InterestRate); row.InterestRate = interestRate.ToString("0.00%"); var PosiNotionalValue = flowEventGroup.Quantity * flowEventGroup.ContractSize* posi.PosiGrossPrice; + row.Quantity= flowEventGroup.Quantity.ToString("0.00"); row.PosiNotionalValue = PosiNotionalValue.ToString("0.00"); row.PosiNetPrice = (posi.PosiGrossPrice * 100).OtcFormat(OtcFormatFlag.umprice); //var tradingFee = (flowEventGroup.TradingAmountFeeAvg- posi.PosiNetPrice- flowEventGroup.TradingAmountAvg+ posi.PosiGrossPrice)* PosiNotionalValue* ratio; diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs index 33093c4c..1f3ba829 100644 --- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs @@ -1350,6 +1350,7 @@ namespace YLErp.Modules.SwapModule decimal shortRatio = item.PositionType == (int)PositionTypeFlag.Long ? -1m : 1m; item.TradingAmountFeeAvg = item.TradingAmountAvg + item.TradingFeePending / unwindData.CloseQty * shortRatio; item.TradingAmountNetFeeAvg = item.TradingAmountNetAvg + item.TradingFeePending / unwindData.CloseQty * shortRatio; + item.TradingAmount= item.TradingAmountAvg * unwindData.CloseQty; } } } diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs index fb7d29c7..e13a929d 100644 --- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs @@ -1834,7 +1834,7 @@ namespace YLErp.Modules.SwapModule private SearchListResult GetSearchEodPositionList(ClientSwapPositionRequest req) { - var predicate = PredicateBuilder.Create(n => !n.Invalid && n.PosiDirection > 0); + var predicate = PredicateBuilder.Create(n => !n.Invalid && n.PosiQuantity > 0); var interestPredicate = PredicateBuilder.Create(n => !n.Invalid && n.InterestDirection > 0); var tradePredicate = PredicateBuilder.Create(n => n.StructureType == req.StructureType && n.ValidState != "InValid"); @@ -1901,6 +1901,9 @@ namespace YLErp.Modules.SwapModule var interests = eodPositions.Where(x => x.SwapTradeId == item.position.SwapTradeId && x.ValueDate == item.position.ValueDate); var eodMargins = interests.Where(x => marginTypes.Contains(x.InterestMode)); var eodInterests = interests.Where(x => !marginTypes.Contains(x.InterestMode)); + var floatRateInterest = eodInterests.Where(x => !string.IsNullOrEmpty(x.FloatRateUnderlyingCode)).FirstOrDefault(); + item.position.FloatRateUnderlyingCode = floatRateInterest.FloatRateUnderlyingCode; + item.position.FloatRate= floatRateInterest.FloatRate; item.OpenMarginAmount = margins.Sum(s => s.InterestPrincipalFix * (s.InterestDirection == (int)SwapDirectionEnum.收取 ? 1 : -1)); item.OpenMarginRate = margins.Sum(s => s.InterestRateDefault * (s.InterestDirection == (int)SwapDirectionEnum.收取 ? 1 : -1)); item.MarginInterestAmount = eodMargins.Sum(s => s.InterestIncomeSum * (s.InterestDirection == (int)SwapDirectionEnum.收取 ? 1 : -1)); diff --git a/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs b/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs index 309be6d3..3ad368ef 100644 --- a/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapFlowEventService.cs @@ -458,7 +458,7 @@ namespace YLErp.Modules.SwapModule // List eventTyps = new List() { (int)SwapEventTypeEnum.平仓, (int)SwapEventTypeEnum.互换, (int)SwapEventTypeEnum.自动互换 }; var predicate = PredicateBuilder.Create(n => n.DataState == (int)SwapFlowDateStateEnum.完成 ); var tradePredicate = PredicateBuilder.Create(n => n.TradeType == "收益互换" - && n.ValidState != "InValid"); + && n.ValidState == ConsGlobal.Valid); if (req.ClientId > 0) { tradePredicate = tradePredicate.And(x => x.ClientId == req.ClientId); @@ -471,12 +471,13 @@ namespace YLErp.Modules.SwapModule { predicate = predicate.And(x => x.EventDate <= req.ValueDate); } + DbContext.SetDebugLog(); var positionQuery = DbContext.swap_flow_event.Where(predicate); var tradeQuery = DbContext.trade.Where(tradePredicate); - var query = from flow in positionQuery - join td in tradeQuery on flow.SwapTradeId equals td.id - join posi in DbContext.swap_position on flow.PositionId equals posi.PositionId - join tr in DbContext.trade_contract_r on td.id equals tr.TradeId into tradeContractGroup + var query = from td in tradeQuery + //join posi in DbContext.swap_position.Where(s=>!s.Invalid&&s.IsInitial) on td.id equals posi.SwapTradeId + join flow in positionQuery on td.id equals flow.SwapTradeId + join tr in DbContext.trade_contract_r.Where(x=>x.IsValid&&x.Type=="交易确认书") on td.id equals tr.TradeId into tradeContractGroup from tradeContract in tradeContractGroup.DefaultIfEmpty() select new ClientSwapPositionResponse { @@ -486,7 +487,7 @@ namespace YLErp.Modules.SwapModule ClientName = td.ClientName, ClientId = td.ClientId, ContractCode = tradeContract.ContractCode, - FloatRateUnderlyingCode=posi.FloatRateUnderlyingCode, + // FloatRateUnderlyingCode=posi.FloatRateUnderlyingCode, StartDate = td.StartDate.Value, }; if (string.IsNullOrEmpty(req.sidx)) @@ -495,6 +496,8 @@ namespace YLErp.Modules.SwapModule req.sord = "asc"; } var retListResult = query.ToSearchList(req); + var tds= retListResult.rows.Select(x => x.FlowEvent.SwapTradeId).Distinct().ToList(); + var posiList = DbContext.swap_position.Where(s => !s.Invalid && s.IsInitial && tds.Contains(s.SwapTradeId)&&!string.IsNullOrEmpty(s.FloatRateUnderlyingCode)).ToList(); foreach (var item in retListResult.rows) { item.FlowEvent.DividendPending = -item.FlowEvent.DividendPending; @@ -504,7 +507,9 @@ namespace YLErp.Modules.SwapModule item.FlowEvent.InterestFee = -item.FlowEvent.InterestFee; item.FlowEvent.TradingFee = -item.FlowEvent.TradingFee; item.FlowEvent.TradingFeePending = -item.FlowEvent.TradingFeePending; - + item.FlowEvent.InterestClosePnL = -item.FlowEvent.InterestClosePnL; + var posi= posiList.FirstOrDefault(s => s.id == item.FlowEvent.PositionId); + item.FloatRateUnderlyingCode= posi?.FloatRateUnderlyingCode; if (item.FlowEvent.EventType==(int)SwapFlowEventTypeEnum.开仓) { item.TradeFee = 0; diff --git a/YLErpWeb/appsettings.local.json b/YLErpWeb/appsettings.local.json index e0abe159..4463f59d 100644 --- a/YLErpWeb/appsettings.local.json +++ b/YLErpWeb/appsettings.local.json @@ -16,7 +16,7 @@ "AppSettings": { "VirtualPathRoot": "", "UseRightAligned": "", - "PluginFolder": "D:\\CurPorg\\zhesh\\Plugins\\build\\ZheShang\\Debug\\net6.0" + "PluginFolder": "D:\\gitCode\\zszq-trs\\Plugins\\build\\ZheShang\\Debug\\net6.0" }, "LibreOffice": { "ExePath": "",