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 6cadad28..5164d423 100644 Binary files a/Plugins/YLErp.Plugins.ZheShang/App_Docs/结算单/非DMA结算单.xlsx and b/Plugins/YLErp.Plugins.ZheShang/App_Docs/结算单/非DMA结算单.xlsx differ diff --git a/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeSettleBillGenerator.cs b/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeSettleBillGenerator.cs index 2a5d6167..06d52fa3 100644 --- a/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeSettleBillGenerator.cs +++ b/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeSettleBillGenerator.cs @@ -69,6 +69,7 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator decimal interestRate = unwindFlowEvents.Where(x => 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": "",