Merge branch 'main' of http://git.yiliantech.com/gitlab/otc-dev/zszq-trs
This commit is contained in:
@@ -34,7 +34,7 @@ namespace YLErp.Modules.SwapModule
|
||||
public class SwapTradeAutoService : YLBaseService
|
||||
{
|
||||
protected static IYcLogger Log = LogFactory.GetLogger(typeof(SwapTradeAutoService).FullName);
|
||||
private static string LongShortStructType = "定义文件型债券收益互换";
|
||||
private static string LongShortStructType = "普通债券类收益互换";
|
||||
public SwapTradeAutoService(OptUserInfo optUser) : base(optUser)
|
||||
{
|
||||
|
||||
@@ -450,7 +450,7 @@ namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
return;
|
||||
}
|
||||
var swaptrades = DbContext.trade.Where(t => t.StructureType == "定义文件型债券收益互换"
|
||||
var swaptrades = DbContext.trade.Where(t => t.TradeType == "收益互换"
|
||||
&& t.TradeDate <= valueDate
|
||||
&& t.ValidState != ConsGlobal.InValid
|
||||
&& !ConsTrade.TradeCompleteStatus.Contains(t.TradeStatus)).ToList();
|
||||
|
||||
@@ -1556,17 +1556,9 @@ namespace YLErp.Modules.SwapModule
|
||||
throw new ServiceException("交易不存在");
|
||||
}
|
||||
bool backToBegin = td.TradeDate == valueDate;
|
||||
bool longshort = td.StructureType == ClientMarginTypeEnum.多空组合.ToString();
|
||||
var swapPositions = DbContext.swap_position.Where(x => x.SwapTradeId == tradeId && !x.Invalid).ToList();
|
||||
td.trade_extend = DbContext.trade_extend.FirstOrDefault(x => x.TradeId == td.id);
|
||||
if (longshort)
|
||||
{
|
||||
var anyTrade = DbContext.trade.FirstOrDefault(x => x.StructureType == ClientMarginTypeEnum.多空组合.ToString() && x.TradeStatus == "确认成交" && x.ValidState != ConsGlobal.InValid && x.id != tradeId && x.ClientId == td.ClientId);
|
||||
if (anyTrade != null)
|
||||
{
|
||||
throw new ServiceException($"{td.ClientName}存在存续期多空组合框架合约,不能回退");
|
||||
}
|
||||
}
|
||||
|
||||
//展期
|
||||
var swapEvent = DbContext.swap_event.Where(x => x.SwapTradeId == tradeId && x.EventType == (int)SwapEventTypeEnum.展期 && !x.Invalid && x.ValueDate <= valueDate).OrderByDescending(o => o.ValueDate).FirstOrDefault();
|
||||
var trans = DbContext.Database.BeginTransaction();
|
||||
@@ -1581,22 +1573,11 @@ namespace YLErp.Modules.SwapModule
|
||||
td.StockEqvNotional = td.OriginalStockEqvNotional ?? 0;
|
||||
td.UnWindDate = null;
|
||||
td.HasPartialUnWind = null;
|
||||
if (!longshort)
|
||||
{
|
||||
SingleTradeBackToBegin(td, swapPositions);
|
||||
}
|
||||
else
|
||||
{
|
||||
LongshortTradeBackToBegin(swapPositions);
|
||||
}
|
||||
SingleTradeBackToBegin(td, swapPositions);
|
||||
}
|
||||
else
|
||||
{
|
||||
TradeBackByDate(td, valueDate, swapPositions, longshort);
|
||||
}
|
||||
if (longshort)
|
||||
{
|
||||
new SwapFlowService(this).ResetFlows(td.ClientId, valueDate);
|
||||
TradeBackByDate(td, valueDate, swapPositions);
|
||||
}
|
||||
if (swapEvent != null)//展期
|
||||
{
|
||||
@@ -1727,7 +1708,7 @@ namespace YLErp.Modules.SwapModule
|
||||
/// </summary>
|
||||
/// <param name="td"></param>
|
||||
/// <param name="swapEvent"></param>
|
||||
private void TradeBackByDate(trade td, DateTime valueDate, List<swap_position> swapPositions, bool longshort)
|
||||
private void TradeBackByDate(trade td, DateTime valueDate, List<swap_position> swapPositions)
|
||||
{
|
||||
SwapEodPositionService eodPositionService = new SwapEodPositionService(this);
|
||||
SwapDealService swapDealService = new SwapDealService(this);
|
||||
|
||||
@@ -32,11 +32,11 @@ namespace YLErp.Web.Hubs
|
||||
await client.SendAsync("ExceptionMessage", "登录已失效,请重新登录");
|
||||
return;
|
||||
}
|
||||
if (req.flowIds == null || req.flowIds.Count == 0)
|
||||
{
|
||||
await client.SendAsync("ExceptionMessage", "未选择任何流水");
|
||||
return;
|
||||
}
|
||||
//if (req.flowIds == null || req.flowIds.Count == 0)
|
||||
//{
|
||||
// await client.SendAsync("ExceptionMessage", "未选择任何流水");
|
||||
// return;
|
||||
//}
|
||||
var service = new SwapTradeAutoService(user);
|
||||
if (isProcessing)
|
||||
{
|
||||
@@ -46,7 +46,7 @@ namespace YLErp.Web.Hubs
|
||||
try
|
||||
{
|
||||
isProcessing = true;
|
||||
var swapFlows = service.GetFlows(req.flowIds);
|
||||
var swapFlows = service.GetFlows(req.tradeDate);
|
||||
if (swapFlows.Count == 0)
|
||||
{
|
||||
isProcessing = false;
|
||||
@@ -67,36 +67,20 @@ namespace YLErp.Web.Hubs
|
||||
service.BookingValidate(mergeList);
|
||||
currentStep = "正在合成簿记";
|
||||
await client.SendAsync("ReceiveMessage", currentStep);
|
||||
var dmaMergeList = mergeList.Where(x => x.SwapTradeType == 1).ToList();
|
||||
var dmaClientIds = dmaMergeList.Select(x=>x.ClientId).Distinct();
|
||||
var dmaFlows = swapFlows.Where(x => dmaClientIds.Contains(x.ClientId)).ToList();
|
||||
var noDmaMergeList = mergeList.Where(x => x.SwapTradeType == 0).ToList();
|
||||
#region 非DMA合成持仓
|
||||
if (noDmaMergeList.Count > 0)
|
||||
{
|
||||
currentStep = $"正在合成普通文件簿记:共{noDmaMergeList.Count}条合成流水";
|
||||
await client.SendAsync("ReceiveMessage", currentStep);
|
||||
service.MergeRestModeCompose(noDmaMergeList, req.tradeDate, (dealCount) =>
|
||||
{
|
||||
currentStep = $"正在合成普通文件簿记:{dealCount}/{noDmaMergeList.Count}";
|
||||
client.SendAsync("ReceiveMessage", currentStep);
|
||||
});
|
||||
currentStep = "普通文件簿记合成完毕";
|
||||
await client.SendAsync("ReceiveMessage", currentStep);
|
||||
}
|
||||
#endregion
|
||||
//var dmaFlows = swapFlows.Where(x => dmaClientIds.Contains(x.ClientId)).ToList();
|
||||
|
||||
#region DMA合成持仓
|
||||
if (dmaFlows.Count > 0)
|
||||
if (swapFlows.Count > 0)
|
||||
{
|
||||
currentStep = $"正在合成定义文件型簿记:共{dmaFlows.Count}条流水";
|
||||
currentStep = $"正在合成簿记:共{swapFlows.Count}条流水";
|
||||
await client.SendAsync("ReceiveMessage", currentStep);
|
||||
|
||||
service.MergeAvgModeCompose(dmaFlows, req.tradeDate, (dealCount) =>
|
||||
service.MergeAvgModeCompose(swapFlows, req.tradeDate, (dealCount) =>
|
||||
{
|
||||
currentStep = $"正在合成定义文件簿记:{dealCount}/{dmaFlows.Count}";
|
||||
currentStep = $"正在合成簿记:{dealCount}/{swapFlows.Count}";
|
||||
client.SendAsync("ReceiveMessage", currentStep);
|
||||
});
|
||||
currentStep = "普通文件簿记合成完毕";
|
||||
currentStep = "簿记合成完毕";
|
||||
await client.SendAsync("ReceiveMessage", currentStep);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -40,6 +40,11 @@ namespace YLErp.Web.Hubs
|
||||
try
|
||||
{
|
||||
var tradeIds= service.GetNeedResetTradeIds(req.clientId, req.underlyingCode, req.tradeDate);
|
||||
if (!tradeIds.Any())
|
||||
{
|
||||
await client.SendAsync("ProcessCompleted", "");
|
||||
return;
|
||||
}
|
||||
isProcessing = true;
|
||||
service.ResetTradeByDate(req.tradeDate, req.clientId, req.underlyingCode, (progress) =>
|
||||
{
|
||||
|
||||
@@ -667,7 +667,7 @@ function intiGrid(step) {
|
||||
if (vue) {
|
||||
vue.setStep(step);
|
||||
}
|
||||
var multiselect = true;
|
||||
var multiselect = false;
|
||||
var colModelGrid = getColModelGridStep1();
|
||||
if (step == 2) {
|
||||
colModelGrid = getColModelGridStep2();
|
||||
|
||||
Reference in New Issue
Block a user