Merge branch 'main' of http://git.yiliantech.com/gitlab/otc-dev/zszq-trs
This commit is contained in:
@@ -433,6 +433,8 @@ namespace YLErp.Plugins.TradeDocGenerator.Abstracts
|
||||
|
||||
List<swap_position> GetSwapPositions(int tradeId,bool? IsInitial);
|
||||
|
||||
List<swap_position> GetSwapPositions(List<int> tradeId, bool? IsInitial);
|
||||
|
||||
List<ClientDuty> GetClientDuties();
|
||||
|
||||
client_marginrate GetClientMarginRate(int clientId);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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日");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace YLErp.Helpers
|
||||
CC = ccEmail
|
||||
});
|
||||
|
||||
return result;
|
||||
return string.Empty;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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<ClientBankCard>();
|
||||
|
||||
var directionList = new List<string> { "出金", "入金", "其他收入", "其他支出" };
|
||||
|
||||
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();
|
||||
|
||||
@@ -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;
|
||||
}),
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<swap_flow_event>(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<UnwindData>(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 != "多空组合")
|
||||
{
|
||||
|
||||
@@ -366,7 +366,7 @@ namespace YLErp.Modules.SwapModule
|
||||
private long SaveAutoSwapDeal(trade td, List<swap_flow_event> 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
|
||||
/// <returns></returns>
|
||||
public SearchListResult<SwapPositionResponse> SearchEodPositionList(EodSwapPositionQueryRequest req)
|
||||
{
|
||||
var predicate = PredicateBuilder.Create<eod_swap_position>(n => !n.Invalid && n.PosiDirection > 0);
|
||||
var predicate = PredicateBuilder.Create<eod_swap_position>(n => !n.Invalid);
|
||||
var tradePredicate = PredicateBuilder.Create<trade>(n => n.TradeType == "收益互换"
|
||||
&& n.ValidState != "InValid");
|
||||
if (req.ValueDate.HasValue)
|
||||
|
||||
@@ -282,57 +282,7 @@ namespace YLErp.Modules.SwapModule
|
||||
}
|
||||
return swapEvent.ValueDate;
|
||||
}
|
||||
/// <summary>
|
||||
/// 收益互换 客户资金记录保存
|
||||
/// </summary>
|
||||
/// <param name="td">主交易信息</param>
|
||||
/// <param name="amount">平仓盈亏</param>
|
||||
/// <param name="action">操作类型</param>
|
||||
/// <param name="valueDate">操作日期</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 初始化 利息计算起始日期
|
||||
|
||||
@@ -212,6 +212,7 @@ namespace YLErp.Modules.TradeModule.DealModule
|
||||
List<string> file = new List<string>();
|
||||
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();
|
||||
|
||||
@@ -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<swap_position> GetSwapPositions(List<int> 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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -976,7 +976,7 @@ namespace YLErp.Modules.TradeModule.QueryModule
|
||||
dataChangeArr = JsonHelper.Deserialize<string[]>(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)
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<FunctionSub Name="结算确认书重置" Title="结算确认书重置" Type="Operate" Note="是否有结算确认书重置权限" ></FunctionSub>
|
||||
<FunctionSub Name="结算确认书邮件发送" Title="结算确认书邮件发送" Type="Operate" Note="是否有结算确认书邮件发送权限" ></FunctionSub>
|
||||
<FunctionSub Name="出入金维护" Title="资金记录"></FunctionSub>
|
||||
<FunctionSub Name="资金审批页面" Title="资金审批"></FunctionSub>
|
||||
<FunctionSub Name="出入金执行" Title="出入金执行" Type="Operate" Note="资金记录页面是否有出入金执行权限" ></FunctionSub>
|
||||
<FunctionSub Name="出入金拒绝" Title="出入金拒绝" Type="Operate" Note="资金记录是否有出入金拒绝权限" ></FunctionSub>
|
||||
<FunctionSub Name="出入金新增" Title="出入金新增" Type="Operate" Note="资金记录页面是否有出入金新增,导入权限,是否可以撤回" ></FunctionSub>
|
||||
|
||||
@@ -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"},
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -80,10 +80,6 @@
|
||||
@MyControls.Btn("批量确认", "confirmAllSelect()")
|
||||
}
|
||||
<div id="date" style="float:right">
|
||||
@if (CurUser.交易管理_交易新增)
|
||||
{
|
||||
<button class="btn btn-primary" onclick="showImport()">导入日终持仓估值</button>
|
||||
}
|
||||
<div style="width: 30px; display: inline;" onclick="showcolumnChooser();return false;">
|
||||
<img src="~/Images/configure.png" />
|
||||
</div>
|
||||
|
||||
@@ -40,6 +40,12 @@
|
||||
<None Update="App_Docs\导入模板\互换预付金率导入模板.xlsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="App_Docs\导入模板\客户导入_人员信息模板.xlsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="App_Docs\导入模板\客户导入_银行卡模板.xlsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="App_Docs\导入模板\批量对冲波动率模板.xlsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -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: '互换价格偏离比例限额',
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user