平仓资金记录不应该被覆盖
This commit is contained in:
@@ -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>
|
||||
/// 初始化 利息计算起始日期
|
||||
|
||||
Reference in New Issue
Block a user