Merge branch 'glms/feature/swaptrade_6603_mbb' into glms/feature/1.4.2
# Conflicts: # YLErpDAL/Modules/SwapModule/SwapTradeService.cs
This commit is contained in:
@@ -246,6 +246,10 @@ namespace YLErp.DBModels
|
||||
/// </summary>
|
||||
public int? interest_rule { get; set; }
|
||||
/// <summary>
|
||||
/// 利息端类别
|
||||
/// </summary>
|
||||
public string category_tag { get; set; }
|
||||
/// <summary>
|
||||
/// 互换观察日集合
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<dictionary name="业务部门编号" catalog="客户"></dictionary>
|
||||
<dictionary name="自定义交易要素" catalog="交易"></dictionary>
|
||||
<dictionary name="自定义结构类型" catalog="交易"></dictionary>
|
||||
<dictionary name="保证金模板名称" catalog="交易"></dictionary>
|
||||
<dictionary name="实际控制主体" catalog="客户"></dictionary>
|
||||
<dictionary name="银行信用评级" catalog="客户"></dictionary>
|
||||
<dictionary name="指数类型" catalog="客户"></dictionary>
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -241,11 +241,21 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator
|
||||
dic["参考标的期初全价%"] = ((double)swapPosition.PosiGrossPrice * 100).ToString("N4");
|
||||
dic["参考标的期初净价%"] = ((double)(swapPosition.PosiNetNoFeePrice ?? 0m) * 100).ToString("N4");
|
||||
|
||||
// 固定收益率(年化)- 债券期初到期收益率
|
||||
//dic["固定收益率(年化)"] = swapPosition.InitYtm.HasValue
|
||||
// ? ((double)swapPosition.InitYtm.Value * 100).ToString("N4")
|
||||
// : "0.0000";
|
||||
dic["固定收益率(年化)"] = "0.0000"; //需求说直接都是0
|
||||
// 固定收益率(年化)- ETF默认取"增强收益"腿的计息利率
|
||||
bool isEtf = IsBondEtf(underlying?.UnderlyingCode ?? string.Empty);
|
||||
if (isEtf)
|
||||
{
|
||||
var enhancePosition = swapPositions
|
||||
.Where(x => ConsTrade.InterestModels.Contains(x.InterestMode) && x.category_tag == "增强收益")
|
||||
.FirstOrDefault();
|
||||
dic["固定收益率"] = enhancePosition != null
|
||||
? ((double)enhancePosition.InterestRateDefault * 100).ToString("N4")
|
||||
: "0.0000";
|
||||
}
|
||||
else
|
||||
{
|
||||
dic["固定收益率"] = "0.0000";
|
||||
}
|
||||
|
||||
// 获取客户适用的保证金率
|
||||
var clientMarginRate = UnderlyingHelper.GetApplicableMarginRate(
|
||||
@@ -405,9 +415,18 @@ namespace YLErp.Plugins.GuoLian.DocumentGenerator
|
||||
: "0.0000";
|
||||
|
||||
// 利率类型判断(固定/浮动)
|
||||
var interestMargin = swapPositions
|
||||
.Where(x => ConsTrade.InterestModels.Contains(x.InterestMode) && x.interest_rest_days != null)
|
||||
.FirstOrDefault();
|
||||
swap_position interestMargin = null;
|
||||
// ETF: 优先取"互换利率"腿
|
||||
if (isEtf)
|
||||
{
|
||||
interestMargin = swapPositions
|
||||
.Where(x => ConsTrade.InterestModels.Contains(x.InterestMode) && x.category_tag == "互换利率")
|
||||
.FirstOrDefault();
|
||||
}
|
||||
if (interestMargin == null)
|
||||
interestMargin = swapPositions
|
||||
.Where(x => ConsTrade.InterestModels.Contains(x.InterestMode) && x.interest_rest_days != null)
|
||||
.FirstOrDefault();
|
||||
if (interestMargin == null)
|
||||
interestMargin = swapPositions
|
||||
.Where(x => ConsTrade.InterestModels.Contains(x.InterestMode) && string.IsNullOrWhiteSpace(x.FloatRateUnderlyingCode))
|
||||
|
||||
@@ -306,14 +306,13 @@ namespace YLErp.Modules.AppModule
|
||||
//-----------------------------------------------
|
||||
configService.AddDataIfNotExists("ProjectConfig", "Erp.IsAutoSealAfterGeneratedBook", "false", "bool", "确认书生成时是否自动用印(IsAutoSealAndUploadFiles勾选时生效)");
|
||||
configService.AddDataIfNotExists("ProjectConfig", "Erp.ReportFileBeginNumber", "0", "int", "报送文件开始编号");
|
||||
//-----------------------------------------------
|
||||
// 删除不再使用的
|
||||
//-----------------------------------------------
|
||||
RemoveUnUsed(configService);
|
||||
}
|
||||
|
||||
private static void RemoveUnUsed(InnerAppConfigService configService)
|
||||
{
|
||||
configService.RemoveData("ProjectConfig", "Trade.SwapMarginTemplateConfig");
|
||||
|
||||
if (AppManager.Version.Major < 3)
|
||||
{
|
||||
configService.RemoveData("ProjectConfig", "Erp.TradeConfirmBookEmailTPL");
|
||||
@@ -453,6 +452,38 @@ namespace YLErp.Modules.AppModule
|
||||
}
|
||||
|
||||
adminDb.SaveChanges();
|
||||
|
||||
var marginTemplateDictionary = adminDb.Dictionaries.FirstOrDefault(item => item.Name == YLErp.Modules.SwapModule.SwapMarginTemplateConfigService.DictionaryName);
|
||||
if (marginTemplateDictionary == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var existingNames = adminDb.DictionaryItems
|
||||
.Where(item => item.DictId == marginTemplateDictionary.Id)
|
||||
.Select(item => item.Name)
|
||||
.ToHashSet();
|
||||
var nextIndex = adminDb.DictionaryItems
|
||||
.Where(item => item.DictId == marginTemplateDictionary.Id)
|
||||
.Select(item => item.IndexNum)
|
||||
.DefaultIfEmpty(-1)
|
||||
.Max();
|
||||
foreach (var templateName in YLErp.Modules.SwapModule.SwapMarginTemplateConfigService.InitialTemplateNames)
|
||||
{
|
||||
if (existingNames.Contains(templateName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
adminDb.DictionaryItems.Add(new BaseOUDAL.DictionaryItem
|
||||
{
|
||||
DictId = marginTemplateDictionary.Id,
|
||||
Name = templateName,
|
||||
ShortName = templateName,
|
||||
IndexNum = ++nextIndex
|
||||
});
|
||||
}
|
||||
adminDb.SaveChanges();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -455,7 +455,7 @@ namespace YLErp.Modules.EodModule
|
||||
Lots = swapFlow.Lots,
|
||||
IsNight = swapFlow.IsNight,
|
||||
OpponentRole = "甲方",
|
||||
MarginTemplateName = "系统默认",
|
||||
MarginTemplateName = null,
|
||||
MarginType = MarginTypeEnum.DEFAULT,
|
||||
IsGroup = isSingleTrade ? 0 : 2
|
||||
};
|
||||
@@ -743,7 +743,7 @@ namespace YLErp.Modules.EodModule
|
||||
td.OriginalNotional = td.Notional;
|
||||
td.OriginalStockEqvNotional = td.StockEqvNotional;
|
||||
td.StockEqvNotionalReal = td.StockEqvNotionalReal;
|
||||
td.MarginTemplateName = "系统默认";
|
||||
td.MarginTemplateName = null;
|
||||
td.MarginType = MarginTypeEnum.DEFAULT;
|
||||
td.IsTradePricePayType = true;
|
||||
td.TradeSource = TradeSourceEnum.导入交易.ToString();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using BaseOUDAL;
|
||||
using YLErp.Models;
|
||||
|
||||
namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
public static class SwapMarginTemplateConfigService
|
||||
{
|
||||
public const string DictionaryName = "保证金模板名称";
|
||||
|
||||
public static readonly string[] InitialTemplateNames = { "现金保证金", "授信保证金" };
|
||||
|
||||
public static SwapMarginTemplateConfig GetConfig()
|
||||
{
|
||||
using var db = new ErpBaseContext();
|
||||
var dictionaryId = db.Dictionaries
|
||||
.Where(item => item.Name == DictionaryName)
|
||||
.Select(item => item.Id)
|
||||
.FirstOrDefault();
|
||||
var items = db.DictionaryItems
|
||||
.Where(item => item.DictId == dictionaryId && !string.IsNullOrWhiteSpace(item.Name))
|
||||
.OrderBy(item => item.IndexNum)
|
||||
.Select(item => new SelectItem { Text = item.Name, Value = item.Name })
|
||||
.ToArray();
|
||||
|
||||
return new SwapMarginTemplateConfig
|
||||
{
|
||||
options = items,
|
||||
defaultValue = items.FirstOrDefault()?.Value
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class SwapMarginTemplateConfig
|
||||
{
|
||||
public IEnumerable<SelectItem> options { get; set; }
|
||||
|
||||
public string defaultValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using BaseOUDAL;
|
||||
using BaseOUDAL;
|
||||
using ClosedXML.Report.Options;
|
||||
using Confluent.Kafka;
|
||||
using CsvHelper;
|
||||
@@ -341,7 +341,7 @@ namespace YLErp.Modules.SwapModule
|
||||
TradeDate = flowMerge.OccurTime,
|
||||
TraderId = asset.TraderIdsInt.FirstOrDefault(),
|
||||
TraderName = asset.TraderNamesList.FirstOrDefault(),
|
||||
MarginTemplateName = "系统默认",
|
||||
MarginTemplateName = null,
|
||||
OpponentRole = "乙方",
|
||||
StructureType = structureType,
|
||||
InitialMargin = 0,
|
||||
@@ -1414,6 +1414,7 @@ namespace YLErp.Modules.SwapModule
|
||||
position.FloatRateUnderlyingCode = swap.FloatRateUnderlyingCode;
|
||||
position.interest_rest_days = swap.interest_rest_days;
|
||||
position.interest_rule = swap.interest_rule;
|
||||
position.category_tag = string.IsNullOrEmpty(swap.category_tag) ? "互换利率" : swap.category_tag;
|
||||
position.InitYtm = RoundSwapBondNetPriceAndYtm(swap.InitYtm);
|
||||
if (position.InitYtm != null && position.InitYtm > 0)
|
||||
{
|
||||
|
||||
@@ -378,7 +378,7 @@ namespace YLErp.Modules.TradeModule.SwapModule
|
||||
importTrade.StockEqvNotionalReal = importTrade.StockEqvNotionalReal;
|
||||
importTrade.trade_swap.RateCalcMode = "01";
|
||||
importTrade.IsUsePremiumRate = true;
|
||||
importTrade.MarginTemplateName = "系统默认";
|
||||
importTrade.MarginTemplateName = null;
|
||||
importTrade.MarginType = MarginTypeEnum.DEFAULT;
|
||||
importTrade.IsTradePricePayType = true;
|
||||
importTrade.TradeSource = TradeSourceEnum.导入交易.ToString();
|
||||
|
||||
@@ -519,7 +519,7 @@ namespace YLErp.Modules.TradeModule.SwapModule
|
||||
importTrade.ParticipationRate = 1;
|
||||
|
||||
//预付金
|
||||
importTrade.MarginTemplateName = "系统默认";
|
||||
importTrade.MarginTemplateName = null;
|
||||
importTrade.MarginType = MarginTypeEnum.DEFAULT;
|
||||
|
||||
SetDBModelCreator(importTrade);
|
||||
|
||||
@@ -726,7 +726,7 @@ namespace YLErp.Modules.TradeModule.SwapModule
|
||||
td.OriginalStockEqvNotional = td.StockEqvNotional;
|
||||
td.StockEqvNotionalReal = td.StockEqvNotionalReal;
|
||||
td.IsUsePremiumRate = true;
|
||||
td.MarginTemplateName = "系统默认";
|
||||
td.MarginTemplateName = null;
|
||||
td.MarginType = MarginTypeEnum.DEFAULT;
|
||||
td.IsTradePricePayType = true;
|
||||
td.TradeSource = TradeSourceEnum.导入交易.ToString();
|
||||
@@ -2815,7 +2815,7 @@ namespace YLErp.Modules.TradeModule.SwapModule
|
||||
td.SettlementDate = td.ExerciseDate;
|
||||
|
||||
td.StockEqvNotional = reader.GetDouble("名义本金(人民币)", true) ?? 0;
|
||||
td.MarginTemplateName = "系统默认";
|
||||
td.MarginTemplateName = null;
|
||||
td.UnWindDate = reader.GetDate("提前终止日/终止日", true);
|
||||
td.Comments = reader.GetString("备注", false);
|
||||
//td.UnderlyingName = reader.GetString("标的名称", true);
|
||||
|
||||
@@ -282,4 +282,4 @@ namespace YLErp.Web.Areas.Admin.Controllers
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,48 +45,26 @@ namespace YLErp.Web.Controllers
|
||||
ViewBag.observationDate = observationDate;
|
||||
return View();
|
||||
}
|
||||
public ActionResult TradeEdit(string enid, bool isUseApproval = false)
|
||||
public ActionResult TradeEdit(string enid, string renewEnid = null, bool isUseApproval = false)
|
||||
{
|
||||
ViewBag.isUseApproval = isUseApproval;
|
||||
var intid = DecryptInt(enid);
|
||||
// The new/renew flow uses the literal "0" to indicate that no trade exists yet.
|
||||
var intid = enid == "0" ? 0 : DecryptInt(enid);
|
||||
trade r = null;
|
||||
if (intid == 0)
|
||||
{
|
||||
TradeExtendJson tradeExtendJson = new TradeExtendJson()
|
||||
r = CreateNewTrade();
|
||||
var renewTradeId = DecryptInt(renewEnid);
|
||||
if (renewTradeId > 0)
|
||||
{
|
||||
FlowBookMode = (int)FlowBookModeEnum.否,
|
||||
FloatingPnlAnnualized = false,
|
||||
NeedOpenFee = false,
|
||||
OpenFeeType = 0,
|
||||
InterestCalcMode = "10",
|
||||
SettlementRules=0,
|
||||
DividendPayDate=0
|
||||
};
|
||||
var tradeDateCountry = GetBestCountry(valuedateBLL.ValueDate.Year);
|
||||
r = new trade()
|
||||
{
|
||||
TradeType = "收益互换",
|
||||
UnderlyingInstrumentType = "Stock",
|
||||
StartDate = valuedateBLL.ValueDate,
|
||||
TradeDate = QdpCalendarHelper.GetNonHolidayDefore(valuedateBLL.ValueDate.AddDays(-1), tradeDateCountry),
|
||||
TraderId = CurUser.UserId,
|
||||
TraderName = CurUser.UserName,
|
||||
MarginTemplateName = "系统默认",
|
||||
OpponentRole = "乙方",
|
||||
OriginalStockEqvNotional = 0,
|
||||
StructureType = "普通收益互换",
|
||||
InitialMargin = 0
|
||||
};
|
||||
r.StructureType = "普通债券类收益互换";
|
||||
tradeExtendJson.FlowBookMode = (int)FlowBookModeEnum.先进先出;
|
||||
r.trade_extend = new trade_extend()
|
||||
{
|
||||
ExtendJson = JsonHelper.Serialize(tradeExtendJson)
|
||||
};
|
||||
r.MetaDic = new Dictionary<string, string>
|
||||
{
|
||||
{ "清算机构", "甲方" }
|
||||
};
|
||||
var sourceTrade = new SwapTradeService(CurUser).GetSwapTrade(renewTradeId);
|
||||
if (sourceTrade == null)
|
||||
{
|
||||
return ShowError("没有找到交易数据");
|
||||
}
|
||||
|
||||
r = CreateRenewTrade(sourceTrade, r);
|
||||
}
|
||||
return View(r);
|
||||
}
|
||||
SwapTradeService swapTradeService = new SwapTradeService(CurUser);
|
||||
@@ -98,6 +76,115 @@ namespace YLErp.Web.Controllers
|
||||
|
||||
return View(r);
|
||||
}
|
||||
|
||||
private trade CreateNewTrade()
|
||||
{
|
||||
var defaultMarginTemplateName = SwapMarginTemplateConfigService.GetConfig().defaultValue;
|
||||
var tradeExtendJson = new TradeExtendJson()
|
||||
{
|
||||
FlowBookMode = (int)FlowBookModeEnum.先进先出,
|
||||
FloatingPnlAnnualized = false,
|
||||
NeedOpenFee = false,
|
||||
OpenFeeType = 0,
|
||||
InterestCalcMode = "10",
|
||||
SettlementRules = 0,
|
||||
DividendPayDate = 0
|
||||
};
|
||||
var tradeDateCountry = GetBestCountry(valuedateBLL.ValueDate.Year);
|
||||
return new trade()
|
||||
{
|
||||
TradeType = "收益互换",
|
||||
UnderlyingInstrumentType = "Stock",
|
||||
StartDate = valuedateBLL.ValueDate,
|
||||
TradeDate = QdpCalendarHelper.GetNonHolidayDefore(valuedateBLL.ValueDate.AddDays(-1), tradeDateCountry),
|
||||
TraderId = CurUser.UserId,
|
||||
TraderName = CurUser.UserName,
|
||||
MarginTemplateName = defaultMarginTemplateName,
|
||||
OpponentRole = "乙方",
|
||||
OriginalStockEqvNotional = 0,
|
||||
StructureType = "普通债券类收益互换",
|
||||
InitialMargin = 0,
|
||||
trade_extend = new trade_extend()
|
||||
{
|
||||
ExtendJson = JsonHelper.Serialize(tradeExtendJson)
|
||||
},
|
||||
MetaDic = new Dictionary<string, string>
|
||||
{
|
||||
{ "清算机构", "甲方" }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private trade CreateRenewTrade(trade sourceTrade, trade defaultTrade)
|
||||
{
|
||||
var renewTrade = sourceTrade.Clone();
|
||||
renewTrade.id = 0;
|
||||
renewTrade.TradeNumber = string.Empty;
|
||||
renewTrade.ParentTradeId = 0;
|
||||
renewTrade.TradeDate = defaultTrade.TradeDate;
|
||||
renewTrade.StartDate = defaultTrade.StartDate;
|
||||
renewTrade.ExerciseDate = null;
|
||||
renewTrade.MaturityDate = null;
|
||||
renewTrade.SettlementDate = null;
|
||||
renewTrade.UnWindDate = null;
|
||||
renewTrade.PremiumPayDate = null;
|
||||
renewTrade.SettlementFlagDate = null;
|
||||
renewTrade.HasPartialUnWind = null;
|
||||
renewTrade.TradeStatus = null;
|
||||
renewTrade.CheckStatus = null;
|
||||
renewTrade.ProcessStatus = null;
|
||||
renewTrade.ProcessOrderId = 0;
|
||||
renewTrade.ProcessOrderBranch = 0;
|
||||
renewTrade.ProcessOptDate = null;
|
||||
renewTrade.ValidState = null;
|
||||
renewTrade.CreateDate = null;
|
||||
renewTrade.TradeSource = null;
|
||||
// 恢复初始持仓名义本金(源交易若有过部分平仓,StockEqvNotional/TradeAmount 已递减,
|
||||
// 但 OriginalStockEqvNotional 和 OriginalNotional 始终保留原始值不被递减)
|
||||
if (renewTrade.OriginalStockEqvNotional != null)
|
||||
{
|
||||
renewTrade.StockEqvNotional = (double)renewTrade.OriginalStockEqvNotional;
|
||||
}
|
||||
|
||||
renewTrade.TradeAmount = renewTrade.OriginalNotional ?? renewTrade.TradeAmount;
|
||||
renewTrade.trade_extend = sourceTrade.trade_extend?.Clone() ?? defaultTrade.trade_extend;
|
||||
renewTrade.trade_extend.TradeId = 0;
|
||||
renewTrade.trade_Initial_Margin = sourceTrade.trade_Initial_Margin?.Clone() ?? new trade_initial_margin();
|
||||
renewTrade.trade_Initial_Margin.TradeId = 0;
|
||||
renewTrade.MetaDic = sourceTrade.MetaDic == null
|
||||
? new Dictionary<string, string>()
|
||||
: new Dictionary<string, string>(sourceTrade.MetaDic);
|
||||
// 只克隆初始持仓(IsInitial=true),避免将部分平仓后的实时持仓(名义本金已递减)带入续做交易
|
||||
renewTrade.swap_positions = sourceTrade.swap_positions
|
||||
?.Where(p => p.IsInitial)
|
||||
.Select(position =>
|
||||
{
|
||||
var renewPosition = position.Clone();
|
||||
renewPosition.id = 0;
|
||||
renewPosition.PositionId = 0;
|
||||
renewPosition.SwapTradeId = 0;
|
||||
renewPosition.PosiNumber = null;
|
||||
renewPosition.PosiStartDate = defaultTrade.StartDate.Value;
|
||||
renewPosition.PosiMatuirityDate = null;
|
||||
// 预付金腿的 HappenDate 用于后续生成资金流水(ResetMarginAmount 按 HappenDate 过滤),
|
||||
// 续做时设为新交易的起始日;非预付金腿的 HappenDate 无实际用途,置 null
|
||||
renewPosition.HappenDate =
|
||||
position.InterestMode == (int)YLErp.DBModels.InterestModeEnum.初始预付金
|
||||
? defaultTrade.StartDate
|
||||
: null;
|
||||
renewPosition.InterestSwapInterval = null;
|
||||
renewPosition.Obervation = null;
|
||||
return renewPosition;
|
||||
}).ToList() ?? new List<swap_position>();
|
||||
// 清空源交易的事件/持仓快照等集合,避免与源交易共享引用
|
||||
renewTrade.swap_Events = new List<swap_event>();
|
||||
renewTrade.swap_Flow_Events = new List<swap_flow_event>();
|
||||
renewTrade.eod_swaps = new List<eod_swap>();
|
||||
renewTrade.inital_eod_swap_positions = new List<eod_swap_position>();
|
||||
renewTrade.eod_swap_positions = new List<eod_swap_position>();
|
||||
renewTrade.ClientCashInCashOutList = new List<ClientCashInCashOut>();
|
||||
return renewTrade;
|
||||
}
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
@@ -115,6 +202,12 @@ namespace YLErp.Web.Controllers
|
||||
{
|
||||
return ShowError("没有找到交易数据");
|
||||
}
|
||||
var marginTemplateConfig = SwapMarginTemplateConfigService.GetConfig();
|
||||
if (string.IsNullOrWhiteSpace(tradeObj.MarginTemplateName)
|
||||
|| !marginTemplateConfig.options.Any(item => item.Value == tradeObj.MarginTemplateName))
|
||||
{
|
||||
tradeObj.MarginTemplateName = marginTemplateConfig.defaultValue;
|
||||
}
|
||||
TradeViewModel model;
|
||||
|
||||
model = new TradeViewModel(tradeObj)
|
||||
@@ -1111,4 +1204,4 @@ namespace YLErp.Web.Controllers
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace YLErp.Web.Controllers
|
||||
TradeDate = valuedateBLL.ValueDate,
|
||||
TraderId = CurUser.UserId,
|
||||
TraderName = CurUser.UserName,
|
||||
MarginTemplateName = "系统默认",
|
||||
MarginTemplateName = null,
|
||||
OpponentRole = "乙方",
|
||||
trade_swap = new trade_swap()
|
||||
{
|
||||
@@ -1196,4 +1196,4 @@ namespace YLErp.Web.Controllers
|
||||
return JsonSuccess("", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@using YLErp.Web.Models.JsModels;
|
||||
@using YLErp.Commons;
|
||||
@using YLErp.Modules.SwapModule;
|
||||
@model trade
|
||||
@{
|
||||
ViewBag.Title = "交易信息 | 编辑";
|
||||
@@ -13,12 +14,14 @@
|
||||
var jsClient = canChangeClient && Model.ClientId > 0 ? jsClients.FirstOrDefault(n => n.id == Model.ClientId) : null;
|
||||
var jsAssetUnits = JsDataModel.GetAssetUnits(CurUser);
|
||||
var tradeMarginTemplates = new tradeController().GetMarginTemplates();
|
||||
var swapMarginTemplateItems = SwapMarginTemplateConfigService.GetConfig().options;
|
||||
var tradeMarginTemplateItems = new tradeController().GetMarginTemplateItems();
|
||||
var jsAssetUnit = Model.AssetId > 0 ? jsAssetUnits.FirstOrDefault(n => n.id == Model.AssetId) : null;
|
||||
var assetunits = JsDataModel.GetAssetUnits(CurUser);
|
||||
var jsTraders = canAddNewTrader ? JsDataModel.GetTraders(assetunits) : Enumerable.Empty<TraderJsModel>();
|
||||
var jsTrader = canAddNewTrader && Model.TraderId > 0 ? jsTraders.FirstOrDefault(n => n.id == Model.TraderId) : null;
|
||||
var currencys = CurrencyController.getList();
|
||||
var categoryTagOptions = DictionaryBLL.GetList("利息端类别", false, "互换利率");
|
||||
List<string> places = new List<string>();
|
||||
List<string> agencys = new List<string>();
|
||||
var tradingPlaceMap = YLErp.DBModels.Consts.ConsReport.TradingPlaceMapDisplay;
|
||||
@@ -66,6 +69,7 @@
|
||||
jsTrader,
|
||||
jsTraders,
|
||||
tradeMarginTemplates = tradeMarginTemplates,
|
||||
swapMarginTemplateItems = swapMarginTemplateItems,
|
||||
tradeMarginTemplateItems = tradeMarginTemplateItems,
|
||||
needRemark = !isAdd && valuedateBLL.SystemDate.EditTradeNeedRemark,
|
||||
parentTradeId = ViewBag.ParentTradeId,
|
||||
@@ -266,6 +270,14 @@
|
||||
<option value=3>派息日+2</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="formlabel half">保证金模板</label>
|
||||
<select v-model="trade.MarginTemplateName">
|
||||
<option v-for="item in page.swapMarginTemplateItems" :key="item.Value" :value="item.Value">
|
||||
{{ item.Text }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
@@ -351,6 +363,7 @@
|
||||
<th>计息方式</th>
|
||||
<th>重置频率(天)</th>
|
||||
<th>利率准则</th>
|
||||
<th>类别</th>
|
||||
<th>结算规则</th>
|
||||
<th> <button class="btn btn-primary swapadd" type="button" v-on:click="addGetSwapRate">+</button></th>
|
||||
</tr>
|
||||
@@ -401,6 +414,14 @@
|
||||
<option value=-1>前一营业日</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select v-model="item.category_tag">
|
||||
@foreach (var option in categoryTagOptions)
|
||||
{
|
||||
<option value="@option.Value">@option.Text</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-outline-danger" type="button" v-on:click="initObservationDates(item,1)">设置观察日</button>
|
||||
</td>
|
||||
|
||||
@@ -236,6 +236,10 @@
|
||||
<td>派息金额支付日</td>
|
||||
<td class="color-bule">@(trade.trade_extend.ExtendObj.DividendPayDate == 0 ? "到期结算日" : "派息日+" + (trade.trade_extend.ExtendObj.DividendPayDate - 1))</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>保证金模板</td>
|
||||
<td class="color-bule">@trade.MarginTemplateName</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -300,6 +304,7 @@
|
||||
<th>计息方式</th>
|
||||
<th>重置频率(天)</th>
|
||||
<th>利率准则</th>
|
||||
<th>类别</th>
|
||||
<th>结算规则</th>
|
||||
</tr>
|
||||
@if (trade.swap_positions != null)
|
||||
@@ -344,6 +349,7 @@
|
||||
</td>
|
||||
<td>@item.interest_rest_days</td>
|
||||
<td>@((item.interest_rule != null) ? (SwapInterestRule)item.interest_rule : "")</td>
|
||||
<td>@(string.IsNullOrEmpty(item.category_tag) ? "互换利率" : item.category_tag)</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-outline-danger" type="button" onclick="showSwapRate('@(item.InterestSwapInterval)', false)" style="height:22px;">查看</button>
|
||||
</td>
|
||||
@@ -504,6 +510,7 @@
|
||||
<th>计息方式</th>
|
||||
<th>重置频率(天)</th>
|
||||
<th>利率准则</th>
|
||||
<th>类别</th>
|
||||
<th>结算规则</th>
|
||||
</tr>
|
||||
@{
|
||||
@@ -545,6 +552,7 @@
|
||||
<td>@(item.InterestType == 0 ? "单利" : "复利")</td>
|
||||
<td>@item.interest_rest_days</td>
|
||||
<td>@((item.interest_rule != null) ? (SwapInterestRule)item.interest_rule : "")</td>
|
||||
<td>@(string.IsNullOrEmpty(item.category_tag) ? "互换利率" : item.category_tag)</td>
|
||||
<td><button class="btn btn-sm btn-outline-danger" type="button" onclick="showSwapRate('@(item.InterestSwapInterval)')" style="height:22px;">查看</button></td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
@@ -157,6 +157,7 @@
|
||||
{
|
||||
@MyControls.Btn("收益结算", string.Format("unWindLongShortSwap('{0}')", tradeModel.EncryptId))
|
||||
}
|
||||
@MyControls.Btn("续做", string.Format("renewTrade('{0}')", tradeModel.EncryptId))
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1414,6 +1414,7 @@ const vue = new Vue({
|
||||
thisObj.getSwapList = thisObj.trade.swap_positions.filter(x => { if ((x.UnderlyingCode == null || x.UnderlyingCode.length == 0) && x.IsInitial && (x.InterestMode == 1 || x.InterestMode == 2 || x.InterestMode == 7 || x.InterestMode == 8 || x.InterestMode == 9)) return x; });
|
||||
thisObj.getSwapList.forEach((val, num, arr) => {
|
||||
arr[num].index = num;
|
||||
arr[num].category_tag = arr[num].category_tag || '互换利率';
|
||||
// 解析 InterestSwapInterval 为 SwapIntervalList
|
||||
if (arr[num].InterestSwapInterval && !arr[num].SwapIntervalList) {
|
||||
try {
|
||||
@@ -1502,7 +1503,8 @@ const vue = new Vue({
|
||||
HappenDate: null,//发生日期,
|
||||
Currency: 'CNY',//币种
|
||||
interest_rest_days: 7,//重置频率
|
||||
interest_rule: null//利率准则
|
||||
interest_rule: null,//利率准则
|
||||
category_tag: '互换利率'//类别
|
||||
}
|
||||
thisObj.getSwapList.push(getSwap);
|
||||
},
|
||||
|
||||
@@ -26,6 +26,10 @@ function editTrade(enid) {
|
||||
window.location.href = `/swapTrade2/tradeEdit/?enid=${enid}`;
|
||||
}
|
||||
|
||||
function renewTrade(enid) {
|
||||
window.location.href = `/swapTrade2/tradeEdit/?enid=0&renewEnid=${encodeURIComponent(enid)}`;
|
||||
}
|
||||
|
||||
function editTradeRemarkInfo(enid) {
|
||||
main.open("修改备注", "/trade/EditRemarkInfo?enid=" + enid, { area: ["700px", "500px"] });
|
||||
}
|
||||
@@ -586,4 +590,4 @@ function SubmissionFields(enid) {
|
||||
|
||||
function SubmissionFieldsHistory(enid) {
|
||||
main.open("报送相关字段填写", "/trade/submissionFieldsHistory?encryptId=" + enid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user