diff --git a/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs b/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs
index 16f3a7c1..552d3f18 100644
--- a/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs
+++ b/YLErpDAL/Modules/SwapModule/SwapTradeAutoService.cs
@@ -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();
diff --git a/YLErpDAL/Modules/SwapModule/SwapTradeService.cs b/YLErpDAL/Modules/SwapModule/SwapTradeService.cs
index d97c5e82..ef01a2d5 100644
--- a/YLErpDAL/Modules/SwapModule/SwapTradeService.cs
+++ b/YLErpDAL/Modules/SwapModule/SwapTradeService.cs
@@ -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
///
///
///
- private void TradeBackByDate(trade td, DateTime valueDate, List swapPositions, bool longshort)
+ private void TradeBackByDate(trade td, DateTime valueDate, List swapPositions)
{
SwapEodPositionService eodPositionService = new SwapEodPositionService(this);
SwapDealService swapDealService = new SwapDealService(this);
diff --git a/YLErpWeb/Hubs/SwapFlowCombookingHub.cs b/YLErpWeb/Hubs/SwapFlowCombookingHub.cs
index a47b3e82..d5bd4898 100644
--- a/YLErpWeb/Hubs/SwapFlowCombookingHub.cs
+++ b/YLErpWeb/Hubs/SwapFlowCombookingHub.cs
@@ -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
diff --git a/YLErpWeb/Hubs/SwapFlowResetHub.cs b/YLErpWeb/Hubs/SwapFlowResetHub.cs
index 2b326a9f..c18df849 100644
--- a/YLErpWeb/Hubs/SwapFlowResetHub.cs
+++ b/YLErpWeb/Hubs/SwapFlowResetHub.cs
@@ -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) =>
{
diff --git a/YLErpWeb/wwwroot/Scripts/app/swaptrade/SwapflowList.js b/YLErpWeb/wwwroot/Scripts/app/swaptrade/SwapflowList.js
index c4021a37..0f4ace36 100644
--- a/YLErpWeb/wwwroot/Scripts/app/swaptrade/SwapflowList.js
+++ b/YLErpWeb/wwwroot/Scripts/app/swaptrade/SwapflowList.js
@@ -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();