#TRS-ZS-58 收盘操作:删除从衡泰获取数据等等功能
This commit is contained in:
@@ -138,22 +138,6 @@ namespace YLErp.Modules.SwapModule
|
||||
var positions = DbContext.swap_position.Where(x => x.SwapTradeId == td.id && x.IsInitial && !x.Invalid).ToList();
|
||||
td.swap_positions = positions.Where(x => marginModes.Contains(x.InterestMode)).ToList();
|
||||
var posiPositions = positions.Where(x => x.PosiDirection > 0).ToList();
|
||||
var pushLogService = new PushLogService(UserInfo);
|
||||
pushLogService.AddLog(td.id, SwapPushDataEnum.收益互换交易新增, SwapPushDataEnum.收益互换交易修改, td.TradeNumber);
|
||||
if (posiPositions.Any())
|
||||
{
|
||||
foreach (var position in posiPositions)
|
||||
{
|
||||
pushLogService.AddLog(position.id, SwapPushDataEnum.互换资产交易新增, SwapPushDataEnum.互换资产交易修改, position.PosiNumber);
|
||||
}
|
||||
}
|
||||
if (td.swap_positions.Any())
|
||||
{
|
||||
foreach (var position in td.swap_positions)
|
||||
{
|
||||
pushLogService.AddLog(position.id, SwapPushDataEnum.预付金交易新增, SwapPushDataEnum.预付金交易修改, position.PosiNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 校验 定义文件型债券收益互换 持仓标的只能存在一笔
|
||||
@@ -216,25 +200,7 @@ namespace YLErp.Modules.SwapModule
|
||||
DeleteTradeDetials(id);
|
||||
DeleteTradeCashInCashOut(id);
|
||||
DbContext.SaveChanges();
|
||||
if (addLog)
|
||||
{
|
||||
var pushService = new PushLogService(UserInfo);
|
||||
pushService.DeleteLog(tradeNumber);
|
||||
if (dbTrade.StructureType == "多空组合")
|
||||
{
|
||||
var swapPosiList = DbContext.swap_position.Where(x => x.IsInitial && x.SwapTradeId == id && !x.Invalid).AsNoTracking().ToList();
|
||||
var posiList = swapPosiList.Where(x => x.PosiDirection > 0 || x.InterestMode == (int)InterestModeEnum.固定值).ToList();
|
||||
foreach (var item in posiList)
|
||||
{
|
||||
pushService.AddLogWithCheck(item.id, SwapPushDataEnum.合约撤单, item.PosiNumber);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pushService.AddLogWithCheck(dbTrade.id, SwapPushDataEnum.合约撤单, tradeNumber);
|
||||
}
|
||||
}
|
||||
// new SwapFlowService(this).DeleteSwapFlow(id, dbTrade.TradeDate.Value, false);
|
||||
|
||||
}
|
||||
private void DeleteTradeDetials(int tradeId)
|
||||
{
|
||||
@@ -1648,7 +1614,6 @@ namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
DeleteTradeCashInCashOut(tradeId);
|
||||
DeleteTradeDetials(tradeId);
|
||||
new PushLogService(UserInfo).DeleteLogWithUnwind(td.TradeNumber);
|
||||
DbContext.SaveChanges();
|
||||
if (del)
|
||||
{
|
||||
@@ -1661,10 +1626,8 @@ namespace YLErp.Modules.SwapModule
|
||||
var tradeNumber = td.TradeNumber;
|
||||
td.TradeNumber = td.TradeNumber.Insert(0, "XX");
|
||||
td.OptDate = OptDate;
|
||||
new PushLogService(UserInfo).DeleteLog(tradeNumber);
|
||||
swapEventService.AddSwapEventDate(valueDate, tradeId, (int)SwapEventTypeEnum.删除, string.Empty, 0, false);
|
||||
DbContext.SaveChanges();
|
||||
new PushLogService(UserInfo).AddLogWithCheck(td.id, SwapPushDataEnum.合约撤单, tradeNumber);
|
||||
trans.Commit();
|
||||
return;
|
||||
}
|
||||
@@ -1772,7 +1735,7 @@ namespace YLErp.Modules.SwapModule
|
||||
var eodSwapPositionList = DbContext.eod_swap_position.Where(x => x.ValueDate == preDay && x.SwapTradeId == td.id).ToList();
|
||||
var swapFlowEvents = DbContext.swap_flow_event.Where(x => x.SwapTradeId == td.id && x.EventDate >= valueDate && x.DataState > (int)SwapFlowDateStateEnum.废弃).ToList();
|
||||
var positions = swapPositions.Where(x => x.PosiDirection > 0 && !x.IsInitial).ToList();
|
||||
var pushService = new PushLogService(UserInfo);
|
||||
|
||||
foreach (var posi in positions)
|
||||
{
|
||||
var eodPosi = eodSwapPositionList.FirstOrDefault(x => x.PositionId == posi.PositionId);
|
||||
@@ -1814,14 +1777,10 @@ namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
var positions = swapPositions.Where(x => !x.IsInitial || x.InterestDirection == 0).ToList();
|
||||
var orignPositions = swapPositions.Where(x => x.IsInitial && x.InterestDirection > 0).ToList();
|
||||
var pushService = new PushLogService(UserInfo);
|
||||
|
||||
foreach (var item in positions)
|
||||
{
|
||||
item.Invalid = true;
|
||||
if ((item.PosiDirection > 0 || item.InterestMode == (int)InterestModeEnum.固定值) && item.IsInitial)
|
||||
{
|
||||
pushService.AddLog(item.id, SwapPushDataEnum.合约撤单, item.PosiNumber);
|
||||
}
|
||||
}
|
||||
//DbContext.swap_position.RemoveRange(positions);
|
||||
foreach (var item in orignPositions)
|
||||
|
||||
Reference in New Issue
Block a user