diff --git a/Framework/YLErp.Core/Plugins/TradeDocGenerator/Abstracts/ITradeDocGeneratorContext.cs b/Framework/YLErp.Core/Plugins/TradeDocGenerator/Abstracts/ITradeDocGeneratorContext.cs index cf6cae00..c7f4ed7f 100644 --- a/Framework/YLErp.Core/Plugins/TradeDocGenerator/Abstracts/ITradeDocGeneratorContext.cs +++ b/Framework/YLErp.Core/Plugins/TradeDocGenerator/Abstracts/ITradeDocGeneratorContext.cs @@ -433,6 +433,8 @@ namespace YLErp.Plugins.TradeDocGenerator.Abstracts List GetSwapPositions(int tradeId,bool? IsInitial); + List GetSwapPositions(List tradeId, bool? IsInitial); + List GetClientDuties(); client_marginrate GetClientMarginRate(int clientId); diff --git a/Framework/YLErp.Core/Plugins/TradeDocGenerator/BaseDocumentGenerator_Batch.cs b/Framework/YLErp.Core/Plugins/TradeDocGenerator/BaseDocumentGenerator_Batch.cs index 913af16d..ee8ea3bc 100644 --- a/Framework/YLErp.Core/Plugins/TradeDocGenerator/BaseDocumentGenerator_Batch.cs +++ b/Framework/YLErp.Core/Plugins/TradeDocGenerator/BaseDocumentGenerator_Batch.cs @@ -156,6 +156,7 @@ namespace YLErp.Plugins.TradeDocGenerator case ".doc": case ".docx": //outPutFilePath = outPutFilePath.Replace(".pdf", $".docx"); + LogFactory.GetLogger().Info($"生成确认书文件:{outPutFilePath}"); GenerateWordDocFile(templateFullPath, _viewData, outPutFilePath); break; default: @@ -165,7 +166,7 @@ namespace YLErp.Plugins.TradeDocGenerator //更新操作时间 var now = DateTime.Now; File.SetLastAccessTime(outPutFilePath, now); - + LogFactory.GetLogger().Info($"生成确认书保存Contract"); confirmDocs = Context.SaveContractDocuments(outPutFileName, contractNo, true); if (PS.GetErpConfig().IsAutoSealAndUploadFiles && PS.GetErpConfig().IsAutoSealAfterGeneratedBook) diff --git a/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeConfirmationGenerator.cs b/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeConfirmationGenerator.cs index a41e4c64..34b5cd3b 100644 --- a/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeConfirmationGenerator.cs +++ b/Plugins/YLErp.Plugins.ZheShang/DocumentGenerator/TradeConfirmationGenerator.cs @@ -1,6 +1,7 @@ using Microsoft.VisualBasic; using Newtonsoft.Json.Linq; using NPOI.SS.Formula.Functions; +using System.Net.Http.Headers; using System.Text.RegularExpressions; using YLErp.Core.Helpers; using YLErp.DBModels; @@ -112,25 +113,28 @@ namespace YLErp.Plugins.ShanXi.DocumentGenerator var trades = Context.Trades; var totalPosiQuantity = 0.0; var StockEqvNotionalRealSum = 0.0; + var allSwapPositions = Context.GetSwapPositions(trades.Select(x => x.id).ToList(), true); + var allinterestMargins = allSwapPositions.Where(x => ConsTrade.InterestModels.Contains(x.InterestMode)); foreach (var trade in trades) { var swapPositions = Context.GetSwapPositions(trade.id, true); var swapPosition = swapPositions.Where(x => x.PositionType == 1 || x.PositionType == 2).FirstOrDefault(); var interestMargins = swapPositions.Where(x => ConsTrade.InterestModels.Contains(x.InterestMode)); + var initialMarginQuery = swapPositions.Where(x => x.InterestMode == 5); var additionMarginQuery = swapPositions.Where(x => x.InterestMode == 6); var underlyingCode = swapPosition?.UnderlyingCode; if (count == 0) { - var interestMargin = interestMargins.FirstOrDefault(o => o.interest_rest_days != null); + var interestMargin = allinterestMargins.FirstOrDefault(o => o.interest_rest_days != null); if (interestMargin == null) { - interestMargin = interestMargins.FirstOrDefault(o => string.IsNullOrWhiteSpace(o.FloatRateUnderlyingCode)); + interestMargin = allinterestMargins.FirstOrDefault(o => string.IsNullOrWhiteSpace(o.FloatRateUnderlyingCode)); } if (interestMargin == null) { - interestMargin = interestMargins.FirstOrDefault(); + interestMargin = allinterestMargins.FirstOrDefault(); } dic["成交日期"] = trade.TradeDate?.ToString("yyyy年M月d日"); diff --git a/YLErpDAL/BLL/EodSettlement/RealtimePnlCalc.cs b/YLErpDAL/BLL/EodSettlement/RealtimePnlCalc.cs index 51924251..7e51f2ef 100644 --- a/YLErpDAL/BLL/EodSettlement/RealtimePnlCalc.cs +++ b/YLErpDAL/BLL/EodSettlement/RealtimePnlCalc.cs @@ -649,7 +649,6 @@ namespace YLErp.BLL.Eod clientPosition.update_time = DateTime.Now; bondDb.client_position.Add(clientPosition); } - bondDb.SaveChanges(); SetClientPositionPrice(clientPosition); clientPosition.swap_market_value = clientPosition.full_price_now * clientPosition.position_qty * (clientPosition.side == 0 ? 1 : -1); clientPosition.position_profit_loss = (clientPosition.full_price_now - clientPosition.deal_full_price_avg) * clientPosition.position_qty * (clientPosition.side == 0 ? 1 : -1); diff --git a/YLErpDAL/Helpers/EmailHelper.cs b/YLErpDAL/Helpers/EmailHelper.cs index 19dbceb4..89086f15 100644 --- a/YLErpDAL/Helpers/EmailHelper.cs +++ b/YLErpDAL/Helpers/EmailHelper.cs @@ -82,7 +82,7 @@ namespace YLErp.Helpers CC = ccEmail }); - return result; + return string.Empty; } catch (Exception ex) { diff --git a/YLErpDAL/Modules/ClientModule/ClientBankCardService.cs b/YLErpDAL/Modules/ClientModule/ClientBankCardService.cs index 6f9e3358..93c0d8dd 100644 --- a/YLErpDAL/Modules/ClientModule/ClientBankCardService.cs +++ b/YLErpDAL/Modules/ClientModule/ClientBankCardService.cs @@ -362,7 +362,7 @@ namespace YLErp.Modules.ClientModule new ExcelHelper.DataColumnModel("账号", "Card",typeof(string)), new ExcelHelper.DataColumnModel("户名", "ClientName"), new ExcelHelper.DataColumnModel("大额行号", "Payment",typeof(string)), - new ExcelHelper.DataColumnModel("用途", "Use"), + //new ExcelHelper.DataColumnModel("用途", "Use"), new ExcelHelper.DataColumnModel("是否有效", "ValidState", (cv, obj) => { if (cv == "InValid") diff --git a/YLErpDAL/Modules/ClientModule/ClientCashImportService.cs b/YLErpDAL/Modules/ClientModule/ClientCashImportService.cs index 7903def5..e059eaf8 100644 --- a/YLErpDAL/Modules/ClientModule/ClientCashImportService.cs +++ b/YLErpDAL/Modules/ClientModule/ClientCashImportService.cs @@ -1,6 +1,7 @@ using BaseOUDAL; using OfficeOpenXml; using YLErp.Commons; +using YLErp.DBModels.Enums; using YLErp.Helpers; namespace YLErp.Modules.ClientModule @@ -30,7 +31,7 @@ namespace YLErp.Modules.ClientModule var bankcardList = new List(); var directionList = new List { "出金", "入金", "其他收入", "其他支出" }; - + ExcelPackage.LicenseContext = LicenseContext.NonCommercial; //读取文件 using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { @@ -144,7 +145,9 @@ namespace YLErp.Modules.ClientModule CreatorName = UserName, CreateDate = DateTime.Now, SerialNumber = serialNum, - Comments = remark + Comments = remark, + ValidState = ConsGlobal.Valid, + cash_type = CashTypeEnum.初保账户.ToString() }; //客户名称检查 @@ -195,14 +198,14 @@ namespace YLErp.Modules.ClientModule //检查银行卡 var bankCardModel = DbContext.bankcard.Where(c => c.ApprovalOrder < 1 && openBankCard.Equals(c.Card) && client.id == c.ClientId && c.ValidState != "InValid"); - if (CheckPermission) - { - var dictionaryName = CheckCashAccountTypePermission(clientCash.Direction); - if (!bankCardModel.Where(b => dictionaryName.Contains(b.Use) && b.Card == openBankCard).Any()) - { - return string.Format("第{0}行,出入金方向和银行卡账号类型不匹配!", m); - } - } + //if (CheckPermission) + //{ + // var dictionaryName = CheckCashAccountTypePermission(clientCash.Direction); + // if (!bankCardModel.Where(b => dictionaryName.Contains(b.Use) && b.Card == openBankCard).Any()) + // { + // return string.Format("第{0}行,出入金方向和银行卡账号类型不匹配!", m); + // } + //} if ("出金".Equals(clientCash.Direction)) { var bcModel = bankCardModel.FirstOrDefault(); @@ -326,7 +329,9 @@ namespace YLErp.Modules.ClientModule CreatorName = UserName, CreateDate = DateTime.Now, SerialNumber = SerialNumber, - Uses = uses + Uses = uses, + ValidState = ConsGlobal.Valid, + cash_type = CashTypeEnum.初保账户.ToString() }; //客户名称检查 @@ -356,14 +361,14 @@ namespace YLErp.Modules.ClientModule //检查银行卡 var bankCard = DbContext.bankcard.Where(c => c.ApprovalOrder < 1 && openBankCard.Equals(c.Card) && client.id == c.ClientId && c.ValidState != "InValid"); - if (CheckPermission) - { - var dictionaryName = CheckCashAccountTypePermission(clientCash.Direction); - if (!bankCard.Where(b => dictionaryName.Contains(b.Use) && b.Card == openBankCard).Any()) - { - return string.Format("第{0}行,出入金方向和银行卡账号类型不匹配!", m); - } - } + //if (CheckPermission) + //{ + // var dictionaryName = CheckCashAccountTypePermission(clientCash.Direction); + // if (!bankCard.Where(b => dictionaryName.Contains(b.Use) && b.Card == openBankCard).Any()) + // { + // return string.Format("第{0}行,出入金方向和银行卡账号类型不匹配!", m); + // } + //} if ("出金".Equals(clientCash.Direction)) { var bcModel = bankCard.FirstOrDefault(); diff --git a/YLErpDAL/Modules/ClientModule/ClientDutyService.cs b/YLErpDAL/Modules/ClientModule/ClientDutyService.cs index 5b775014..39ced04a 100644 --- a/YLErpDAL/Modules/ClientModule/ClientDutyService.cs +++ b/YLErpDAL/Modules/ClientModule/ClientDutyService.cs @@ -3,6 +3,7 @@ using NPOI.Util; using Org.BouncyCastle.Ocsp; using Qdp.Pricing.Library.Base.Utilities; using System.Data; +using System.Globalization; using YieldChain.Helpers; using YLErp.Commons; using YLErp.Configuration; @@ -347,6 +348,20 @@ namespace YLErp.Modules.ClientModule new ExcelHelper.DataColumnModel("电子邮箱", "Email", typeof(string)), new ExcelHelper.DataColumnModel("联系电话", "PhoneNumber", typeof(string)), + new ExcelHelper.DataColumnModel("授权有效期", "AuthorizeEffectiveEndDateStr", (cv, obj) => + { + if (string.IsNullOrEmpty(cv)) + { + return string.Empty; + } + string value="长期有效"; + if (cv!="30001231") + { + DateTime time= DateTime.ParseExact(cv, "yyyyMMdd", CultureInfo.InvariantCulture); + value=time.ToString("yyyy-MM-dd"); + } + return value; + }), }; diff --git a/YLErpDAL/Modules/ClientModule/ClientImportService.cs b/YLErpDAL/Modules/ClientModule/ClientImportService.cs index 562d4ea9..1e2843f9 100644 --- a/YLErpDAL/Modules/ClientModule/ClientImportService.cs +++ b/YLErpDAL/Modules/ClientModule/ClientImportService.cs @@ -1543,6 +1543,7 @@ namespace YLErp.Modules.ClientModule var Fax = ""; var Address = ""; var Remarks = ""; + var authorizeEffectiveEndDateStr = ""; DateTime? DeadLine = null; DateTime? AuthorizeEndDate = null; string IdCardEffectiveDateStr = ""; @@ -1617,6 +1618,27 @@ namespace YLErp.Modules.ClientModule } } break; + case "授权有效期": + if (!string.IsNullOrEmpty(clientDutys.Rows[i][j].ToString())) + { + if (clientDutys.Rows[i][j].ToString() == "长期有效") + { + authorizeEffectiveEndDateStr = "30001231"; + } + else + { + if (DateTime.TryParse(clientDutys.Rows[i][j].ToString(), out DateTime authorizeEfEndDate)) + { + authorizeEffectiveEndDateStr = authorizeEfEndDate.ToString("yyyyMMdd"); + } + else + { + formatErrorColumn += "授权有效期,"; + } + } + + } + break; case "微信号": WexinNo = clientDutys.Rows[i][j].ToString(); break; @@ -1733,7 +1755,8 @@ namespace YLErp.Modules.ClientModule IdCardEffectiveDateStr = IdCardEffectiveDateStr, AuthorizeEndDate = AuthorizeEndDate, Weixin = WexinNo, - ApprovalOrder = 0 + ApprovalOrder = 0, + AuthorizeEffectiveEndDateStr=authorizeEffectiveEndDateStr }; var contactypelist = DbContext.contactype.ToList(); diff --git a/YLErpDAL/Modules/RiskModule/QuotaMonitorService.cs b/YLErpDAL/Modules/RiskModule/QuotaMonitorService.cs index dcffef4c..0e905161 100644 --- a/YLErpDAL/Modules/RiskModule/QuotaMonitorService.cs +++ b/YLErpDAL/Modules/RiskModule/QuotaMonitorService.cs @@ -3302,20 +3302,20 @@ namespace YLErp.Modules.RiskModule #endregion #region 单笔交易 - //交易-名义本金 - _quotaSettings.Add(new QuotaSetting() - { - QuotaType = QuotaTypeEnum.TRADE, - QuotaRange = 0, - QuotaIndex = "名义本金", - QuotaLowerLimit = null, - QuotaUpperLimit = null, - WarningLowerLimit = null, - WarningUpperLimit = null, - Percent = false, - IsValid = true, - Status = QuotaSettingApprovalStatus.Valid, - }); + ////交易-名义本金 + //_quotaSettings.Add(new QuotaSetting() + //{ + // QuotaType = QuotaTypeEnum.TRADE, + // QuotaRange = 0, + // QuotaIndex = "名义本金", + // QuotaLowerLimit = null, + // QuotaUpperLimit = null, + // WarningLowerLimit = null, + // WarningUpperLimit = null, + // Percent = false, + // IsValid = true, + // Status = QuotaSettingApprovalStatus.Valid, + //}); //交易-互换价格偏离比例 _quotaSettings.Add(new QuotaSetting() @@ -5186,18 +5186,6 @@ namespace YLErp.Modules.RiskModule var tag = $"{tag_prefix}({checkItem.quotaType})"; switch (checkItem.quotaType) { - case "名义本金": - var clientPv = positionList.Where(s => s.ClientId == current.ClientId && s.UnderlyingCode == current.UnderlyingCode && s.Side != current.Side).Sum(s => s.Pv * (s.Side == 0 ? 1 : -1)); - var currentPv = current.Pv * (current.Side == 0 ? 1 : -1); - currentValue = Convert.ToDouble(Math.Abs(clientPv + currentPv)); - var posiPv = positionList.Where(s => s.ClientId == current.ClientId && s.UnderlyingCode == current.UnderlyingCode && !s.Current).Sum(s => s.Pv); - posiVal = Convert.ToDouble(posiPv); - checkItem.currentValue = Math.Round(currentValue ?? 0, 2); - if (!ValidateQuoteResult(checkItem, currentValue, posiVal)) - { - return checkItem; - } - return null; case "互换价格偏离比例": var sportPrice = Convert.ToDouble(current.Price); var basePrice = Convert.ToDouble(current.LastPrice); diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs index 0ef903a5..056017ba 100644 --- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs @@ -763,15 +763,15 @@ namespace YLErp.Modules.SwapModule bool cofirm = false; try { - int clientCashId = CloseTrade_ClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapRealizedPnL), ClientCashInCashOut.系统操作_平仓费, unwindData.ValueDate); + int clientCashId = AddClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapRealizedPnL), ClientCashInCashOut.系统操作_平仓费, unwindData.ValueDate); if (unwindData.SwapMarginAmount != 0) { AddClientCashInCashOut(td, Convert.ToDouble(unwindData.SwapMarginAmount), ClientCashInCashOut.系统操作_应付预付金, unwindData.ValueDate); } - if (unwindData.SwapMarginRebatePnl != 0) - { - AddClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapMarginRebatePnl), ClientCashInCashOut.系统操作_预付金返息, unwindData.ValueDate); - } + //if (unwindData.SwapMarginRebatePnl != 0) + //{ + // AddClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapMarginRebatePnl), ClientCashInCashOut.系统操作_预付金返息, unwindData.ValueDate); + //} DealFloatPosition(unwindData); var flowList = new List(unwindData.FlowEvents); var eventId = SaveSwapDeal(unwindData, (int)SwapEventTypeEnum.平仓, clientCashId, "系统操作_平仓"); @@ -1051,7 +1051,7 @@ namespace YLErp.Modules.SwapModule } private void DealUnwind(UnwindData unwindData, trade td, string actionMsg = "系统操作_自动平仓") { - int clientCashId = CloseTrade_ClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapRealizedPnL), ClientCashInCashOut.系统操作_平仓费, unwindData.ValueDate); + int clientCashId = AddClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapRealizedPnL), ClientCashInCashOut.系统操作_平仓费, unwindData.ValueDate); if (unwindData.SwapMarginAmount != 0) { AddClientCashInCashOut(td, Convert.ToDouble(unwindData.SwapMarginAmount), ClientCashInCashOut.系统操作_应付预付金, unwindData.ValueDate); @@ -1129,7 +1129,7 @@ namespace YLErp.Modules.SwapModule var trans = DbContext.Database.BeginTransaction(); try { - int clientCashId = CloseTrade_ClientCashInCashOut(td, Convert.ToDouble(unwindData.SwapCloseAmount), ClientCashInCashOut.系统操作_平仓费, unwindData.ValueDate); + int clientCashId = AddClientCashInCashOut(td, Convert.ToDouble(unwindData.SwapCloseAmount), ClientCashInCashOut.系统操作_平仓费, unwindData.ValueDate); if (unwindData.SwapMarginAmount != 0) { AddClientCashInCashOut(td, Convert.ToDouble(unwindData.SwapMarginAmount), ClientCashInCashOut.系统操作_应付预付金, unwindData.ValueDate); @@ -1172,7 +1172,7 @@ namespace YLErp.Modules.SwapModule var trans = DbContext.Database.BeginTransaction(); try { - int clientCashId = CloseTrade_ClientCashInCashOut(td, Convert.ToDouble(unwindData.SwapCloseAmount), ClientCashInCashOut.系统操作_互换, unwindData.ValueDate); + int clientCashId = AddClientCashInCashOut(td, Convert.ToDouble(unwindData.SwapCloseAmount), ClientCashInCashOut.系统操作_互换, unwindData.ValueDate); SaveSwapDeal(unwindData, (int)SwapEventTypeEnum.互换, clientCashId, "系统操作_互换"); trans.Commit(); } @@ -1203,7 +1203,7 @@ namespace YLErp.Modules.SwapModule bool confirm = false; try { - int clientCashId = CloseTrade_ClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapRealizedPnL), ClientCashInCashOut.系统操作_互换, unwindData.ValueDate); + int clientCashId = AddClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapRealizedPnL), ClientCashInCashOut.系统操作_互换, unwindData.ValueDate); if (unwindData.SwapMarginRebatePnl != 0) { AddClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapMarginRebatePnl), ClientCashInCashOut.系统操作_预付金返息, unwindData.ValueDate); @@ -1251,7 +1251,7 @@ namespace YLErp.Modules.SwapModule swapEvent.unwindData = JsonConvert.DeserializeObject(swapEvent.EventData); var flowList = DbContext.swap_flow_event.Where(x => x.EventId == swapEvent.id).ToList(); string action = eventType == (int)SwapEventTypeEnum.互换 ? ClientCashInCashOut.系统操作_互换 : ClientCashInCashOut.系统操作_平仓费; - int clientCashId = CloseTrade_ClientCashInCashOut(td, Convert.ToDouble(swapEvent.unwindData.SwapCloseAmount), action, swapEvent.unwindData.ValueDate); + int clientCashId = AddClientCashInCashOut(td, Convert.ToDouble(swapEvent.unwindData.SwapCloseAmount), action, swapEvent.unwindData.ValueDate); swapEvent.ClientCashId = clientCashId; if (td.StructureType != "多空组合") { diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs index 35559e7e..54e23c14 100644 --- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs @@ -366,7 +366,7 @@ namespace YLErp.Modules.SwapModule private long SaveAutoSwapDeal(trade td, List flowEvents, UnwindData unwindData) { //td.UnWindDate = unwindData.ValueDate; - int clientCashId = CloseTrade_ClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapCloseAmount), ClientCashInCashOut.系统操作_互换, unwindData.ValueDate); + int clientCashId = AddClientCashInCashOut(td, Convert.ToDouble(-unwindData.SwapCloseAmount), ClientCashInCashOut.系统操作_互换, unwindData.ValueDate); string data = JsonConvert.SerializeObject(unwindData); var swapEvent = new SwapEventService(this).AddSwapEventDate(unwindData.ValueDate, unwindData.SwapTradeId, (int)SwapEventTypeEnum.自动互换, data, clientCashId, true, "系统操作-自动互换");//将互换总额存入事件 flowEvents.ForEach(x => @@ -504,7 +504,7 @@ namespace YLErp.Modules.SwapModule //记录资金记录 if (amount != 0) { - int clientCashId = CloseTrade_ClientCashInCashOut(td, Convert.ToDouble(x.MarkClosePnl), ClientCashInCashOut.系统操作_平仓费, x.UnwindDate.Value); + int clientCashId = AddClientCashInCashOut(td, Convert.ToDouble(x.MarkClosePnl), ClientCashInCashOut.系统操作_平仓费, x.UnwindDate.Value); x.ClientCashId = clientCashId; } payQty = payQty - x.Quantity; @@ -1571,7 +1571,7 @@ namespace YLErp.Modules.SwapModule /// public SearchListResult SearchEodPositionList(EodSwapPositionQueryRequest req) { - var predicate = PredicateBuilder.Create(n => !n.Invalid && n.PosiDirection > 0); + var predicate = PredicateBuilder.Create(n => !n.Invalid); var tradePredicate = PredicateBuilder.Create(n => n.TradeType == "收益互换" && n.ValidState != "InValid"); if (req.ValueDate.HasValue) diff --git a/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs b/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs index 048d72a0..f8c30dc3 100644 --- a/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapTradeBaseService.cs @@ -282,57 +282,7 @@ namespace YLErp.Modules.SwapModule } return swapEvent.ValueDate; } - /// - /// 收益互换 客户资金记录保存 - /// - /// 主交易信息 - /// 平仓盈亏 - /// 操作类型 - /// 操作日期 - /// - /// - public int CloseTrade_ClientCashInCashOut(OtcTradeBase td, double amount, string action, DateTime valueDate) - { - var cl = DataCacheProvider.GetClientDataSource().GetData(td.ClientId); - - if (cl == null) - { - throw new Exception("客户信息未找到,交易编号:" + td.TradeNumber); - } - var ee = DbContext.ClientCashInCashOut.FirstOrDefault(x => x.TradeId == td.id && x.Action == action && x.HappenDate == valueDate); - if (ee == null) - { - //增加出入金记录 - ee = new ClientCashInCashOut(); - ee.CreateDate = DateTime.Now; - ee.CreatorId = UserId; - ee.CreatorName = UserName; - } - ee.Direction = "应收"; - ee.Number = UniqueTimeId.GetStr(); - ee.ClientId = cl.id; - ee.ClientNumber = cl.Number; - ee.ClientName = cl.Name; - ee.Money = amount; - ee.CurrencyCode = td.SettlementCurrency; - ee.HappenDate = valueDate; - ee.State = ClientCashInCashOut.已确认; - ee.OptId = UserId; - ee.OptName = UserName; - ee.OptDate = DateTime.Now; - ee.TradeId = td.id; - ee.Action = action; - ee.ValidState = "Valid"; - ee.TradeNumber = td.TradeNumber; - ee.CurrencyCode = "CNY"; - if (ee.id == 0) - { - DbContext.ClientCashInCashOut.Add(ee); - } - DbContext.SaveChanges(); - return ee.id; - } - public void AddClientCashInCashOut(OtcTradeBase td, double amount, string action, DateTime valueDate) + public int AddClientCashInCashOut(OtcTradeBase td, double amount, string action, DateTime valueDate) { var cl = DataCacheProvider.GetClientDataSource().GetData(td.ClientId); @@ -364,6 +314,7 @@ namespace YLErp.Modules.SwapModule ee.CurrencyCode = "CNY"; DbContext.ClientCashInCashOut.Add(ee); DbContext.SaveChanges(); + return ee.id; } /// /// 初始化 利息计算起始日期 diff --git a/YLErpDAL/Modules/TradeModule/DealModule/TradeContractGenerateService.cs b/YLErpDAL/Modules/TradeModule/DealModule/TradeContractGenerateService.cs index 86d7f721..0393f7f0 100644 --- a/YLErpDAL/Modules/TradeModule/DealModule/TradeContractGenerateService.cs +++ b/YLErpDAL/Modules/TradeModule/DealModule/TradeContractGenerateService.cs @@ -212,6 +212,7 @@ namespace YLErp.Modules.TradeModule.DealModule List file = new List(); if (PS.Config.Company == CompanyEnum.浙商) { + LogFactory.GetLogger("生成确认书").Error("浙商生成确认书"); var TradeQuery = new TradeDalService(this).GetTradeOrEodTradeOfTidASid(tradeIds, SystemValueDate).Where(c => (c.TradeType != "结构化交易" || c.IsGroup == 1) && tradeIds.Contains(c.id)); if (TradeQuery.Any()) { @@ -237,6 +238,7 @@ namespace YLErp.Modules.TradeModule.DealModule if (query.Any()) { // 使用现有的 groupGenerateHandle 方法来处理每组交易 + groupGenerateHandle(query.Select(l => l.id).Distinct().ToList(), docType, startDate, endDate, results, error, file); } } @@ -244,6 +246,7 @@ namespace YLErp.Modules.TradeModule.DealModule } if (results.Count == 0) { + LogFactory.GetLogger("生成确认书").Error("浙商生成确认书" + tradeIds.Count()); results = new ConfirmationGenerateService(this).Generate(tradeIds, docType); } errors = results.Where(n => !string.IsNullOrWhiteSpace(n.ErrorMessage)).Select(n => n.ErrorMessage).ToList(); diff --git a/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateContext.cs b/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateContext.cs index 9f329180..6eb5d1f2 100644 --- a/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateContext.cs +++ b/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateContext.cs @@ -304,10 +304,12 @@ namespace YLErp.Modules.TradeModule.DocGenerateModule //WordHelper.GenerateFromTemplate(templatePath, modelDic, outputFilePath); var varDic = new JsonVarDic(modelDic); var _outputFilePath = outputFilePath.Replace(".pdf", ".docx"); + LogFactory.GetLogger("Word生成").Info($"生成Word文档:{_outputFilePath}"); OfficeFileConverter.ConvertByUsingDocTemplate(templatePath, _outputFilePath, varDic, false); var toPDF = outputFilePath.EndsWith(".pdf", StringComparison.OrdinalIgnoreCase); if (genPdf && toPDF) { + LogFactory.GetLogger("Word生成").Info($"转换Word文档为PDF:{_outputFilePath}"); ConvertToPdfHelper.ConvertPDFByApi(HttpUtility.UrlEncode(_outputFilePath), HttpUtility.UrlEncode(outputFilePath)); } } @@ -2775,6 +2777,16 @@ namespace YLErp.Modules.TradeModule.DocGenerateModule return query.ToList(); } + public List GetSwapPositions(List tradeIds, bool? IsInitial) + { + var query = DbContext.swap_position.Where(x => tradeIds.Contains(x.SwapTradeId) && !x.Invalid); + if (IsInitial.HasValue) + { + query = query.Where(x => x.IsInitial == IsInitial); + } + return query.ToList(); + } + public client_marginrate GetClientMarginRate(int clientId) { var clientMarginRateDbSet = DbContext.client_marginrate; diff --git a/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateService.cs b/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateService.cs index 21b88550..004669e8 100644 --- a/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateService.cs +++ b/YLErpDAL/Modules/TradeModule/DocGenerateModule/ConfirmationGenerateService.cs @@ -162,10 +162,13 @@ namespace YLErp.Modules.TradeModule.DocGenerateModule var tradeContractGroupTradeIds = tradeDic.Values.Select(x => x.trade.id).ToList(); //var childs = DbContext.trade.Where(x => tradeContractGroupTradeIds.Contains(x.ParentTradeId ?? 0)); var childs = service.GetStructTradeFromTradeOrEodTrade(tradeContractGroupTradeIds, SystemValueDate, true); + LogFactory.GetLogger("交易确认书").Info("交易确认书1:" + string.Join(",", tradeContractGroupTradeIds)); if (PS.Config.Company == Configuration.CompanyEnum.浙商) { + LogFactory.GetLogger("交易确认书").Info("交易确认书浙商"); if (generatorV2 != null) { + LogFactory.GetLogger("交易确认书").Info("交易确认书插件"); var result = GenerateSingleV2(generatorV2, null, docType , allTradeList); resultList.Add(result); } @@ -238,6 +241,7 @@ namespace YLErp.Modules.TradeModule.DocGenerateModule trades, ContractTypeEnum.Trade, OptUser, null, null); generator.Initialize(docType, context); + LogFactory.GetLogger("交易确认书").Info("交易确认书init"); return generator.GenerateDocument(); } catch (Exception ex) diff --git a/YLErpDAL/Modules/TradeModule/QueryModule/DatatraceQueryService.cs b/YLErpDAL/Modules/TradeModule/QueryModule/DatatraceQueryService.cs index fc6bcb0c..7c321959 100644 --- a/YLErpDAL/Modules/TradeModule/QueryModule/DatatraceQueryService.cs +++ b/YLErpDAL/Modules/TradeModule/QueryModule/DatatraceQueryService.cs @@ -976,7 +976,7 @@ namespace YLErp.Modules.TradeModule.QueryModule dataChangeArr = JsonHelper.Deserialize(dataChanges.Substring(1, dataChanges.Length - 2)); } - if (dataChangeArr != null && dataChangeArr.Length > 0 && !string.IsNullOrEmpty(dataChangeArr[2]) && dataChangeArr[2] != "\"\"" && dataChangeArr[2] != "“ ”" && !filesNameList.Contains(dataChangeArr[0])) + if (dataChangeArr != null && dataChangeArr.Length > 0/** && !string.IsNullOrEmpty(dataChangeArr[2]) && dataChangeArr[2] != "\"\"" && dataChangeArr[2] != "“ ”" **/&& !filesNameList.Contains(dataChangeArr[0])) { dataChangeArr[2] = GetFormatValue(dataChangeArr[1], dataChangeArr[2]); if (dataChangeArr[3] != null) diff --git a/YLErpWeb/App_Data/FunctionRight.xml b/YLErpWeb/App_Data/FunctionRight.xml index cdedb7d9..d73456b4 100644 --- a/YLErpWeb/App_Data/FunctionRight.xml +++ b/YLErpWeb/App_Data/FunctionRight.xml @@ -61,6 +61,7 @@ + diff --git a/YLErpWeb/App_Data/Menus.txt b/YLErpWeb/App_Data/Menus.txt index aad3ddce..20ed8103 100644 --- a/YLErpWeb/App_Data/Menus.txt +++ b/YLErpWeb/App_Data/Menus.txt @@ -20,6 +20,7 @@ ,SubItems:[ {Name:"成交簿记",Rights:["结算管理-成交簿记"],Url:"swaptrade2/SwapflowList"}, {Name:"资金记录",Rights:["结算管理-出入金维护"],Url:"entryexit/entryexitList"}, + {Name:"资金审批",Rights:["结算管理-资金审批页面"],Url:"entryexit/entryexitApproval"}, {Name:"收盘操作",Rights:["结算管理-收盘操作"],Url:"eod_trade_value/eodExec"}, {Name:"交易确认书",Rights:["结算管理-交易确认书"],Url:"TradeConfirmBook/ConfirmBookListByClient"}, {Name:"结算确认书",Rights:["结算管理-结算确认书"],Url:"swaptrade2/tradeEndConfirmList"}, diff --git a/YLErpWeb/App_Docs/导入模板/客户导入_人员信息模板.xlsx b/YLErpWeb/App_Docs/导入模板/客户导入_人员信息模板.xlsx index 0c3732c0..fde6ae63 100644 Binary files a/YLErpWeb/App_Docs/导入模板/客户导入_人员信息模板.xlsx and b/YLErpWeb/App_Docs/导入模板/客户导入_人员信息模板.xlsx differ diff --git a/YLErpWeb/App_Docs/导入模板/客户导入_人员信息模板_东吴.xlsx b/YLErpWeb/App_Docs/导入模板/客户导入_人员信息模板_东吴.xlsx deleted file mode 100644 index 99f73fba..00000000 Binary files a/YLErpWeb/App_Docs/导入模板/客户导入_人员信息模板_东吴.xlsx and /dev/null differ diff --git a/YLErpWeb/App_Docs/导入模板/客户导入_人员信息模板_招证.xlsx b/YLErpWeb/App_Docs/导入模板/客户导入_人员信息模板_招证.xlsx deleted file mode 100644 index dea625c8..00000000 Binary files a/YLErpWeb/App_Docs/导入模板/客户导入_人员信息模板_招证.xlsx and /dev/null differ diff --git a/YLErpWeb/App_Docs/导入模板/客户导入_银行卡模板.xlsx b/YLErpWeb/App_Docs/导入模板/客户导入_银行卡模板.xlsx index 339ab356..c6f8d2a1 100644 Binary files a/YLErpWeb/App_Docs/导入模板/客户导入_银行卡模板.xlsx and b/YLErpWeb/App_Docs/导入模板/客户导入_银行卡模板.xlsx differ diff --git a/YLErpWeb/Views/SwapTrade2/TradeList.cshtml b/YLErpWeb/Views/SwapTrade2/TradeList.cshtml index d016abfe..3ac977cb 100644 --- a/YLErpWeb/Views/SwapTrade2/TradeList.cshtml +++ b/YLErpWeb/Views/SwapTrade2/TradeList.cshtml @@ -80,10 +80,6 @@ @MyControls.Btn("批量确认", "confirmAllSelect()") }
- @if (CurUser.交易管理_交易新增) - { - - }
diff --git a/YLErpWeb/YLErpWeb.csproj b/YLErpWeb/YLErpWeb.csproj index ec0d8db9..7b0a1442 100644 --- a/YLErpWeb/YLErpWeb.csproj +++ b/YLErpWeb/YLErpWeb.csproj @@ -40,6 +40,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/YLErpWeb/wwwroot/Scripts/app/risk/quotaMonitor.js b/YLErpWeb/wwwroot/Scripts/app/risk/quotaMonitor.js index 94259ded..58723d1d 100644 --- a/YLErpWeb/wwwroot/Scripts/app/risk/quotaMonitor.js +++ b/YLErpWeb/wwwroot/Scripts/app/risk/quotaMonitor.js @@ -1557,30 +1557,6 @@ var colModel_trade = [ align: 'left', optionHide: true, sortable: false, - }, { - name: 'StockEqvNotional', - label: '名义本金', - index: 'StockEqvNotional', - width: 120, - align: 'right', - sortable: false, - formatter: function (cellvalue, options, rowObject) { - return !cellvalue || cellvalue == "NaN" ? "" : cellvalue.toLocaleString(); - }, - cellattr: function (cellvalue, options, rowObject) { - var style = "style='" + checkQuota(rowObject, 'StockEqvNotional') + "'"; - return style; - } - }, { - name: 'Quota_StockEqvNotional_Upper', - label: '名义本金限额', - index: 'Quota_StockEqvNotional_Upper', - width: 120, - align: 'right', - sortable: false, - formatter: function (cellvalue, options, rowObject) { - return formatQuotaAbs(rowObject, 'StockEqvNotional'); - } }, { name: 'Quota_SwapPercent_Upper', label: '互换价格偏离比例限额', diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js index 6f033b4e..1dea3d78 100644 --- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js +++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/swapTradeEdit.js @@ -335,7 +335,7 @@ const vue = new Vue({ if (this.trade.trade_extend.ExtendObj.InterestCalcMode == "00" || this.trade.trade_extend.ExtendObj.InterestCalcMode == "10") { date = moment(date).add(-1, 'days').format('YYYY-MM-DD'); } - this.getSwapList.forEach(x => { + this.getSwapList.forEach((x,index) => { if ((x.UnderlyingCode == null || x.UnderlyingCode.length == 0) && x.SwapIntervalList.length == 0) { var interval = { Date: date, @@ -344,8 +344,8 @@ const vue = new Vue({ } x.SwapIntervalList.push(interval); } - if (x.InterestType == 1 && x.interest_rest_days<0) { - main.message("利息端第" + (index + 1) + "重置频率必须大于0"); + if (x.InterestType == 1 && x.interest_rest_days<=0) { + main.message("利息端第" + (index + 1) + "行重置频率必须大于0"); errorcount++; return false; }