75 lines
2.7 KiB
C#
75 lines
2.7 KiB
C#
using YLErp.Commons;
|
|
using YLErp.Modules;
|
|
|
|
namespace YLErp.BLL
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class ClientCashinCashoutBLL : YLBaseService
|
|
{
|
|
public ClientCashinCashoutBLL(OptUserInfo userInfo) : base(userInfo)
|
|
{
|
|
|
|
}
|
|
|
|
public ClientCashinCashoutBLL(YLBaseService baseService) : base(baseService)
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 客户资金记录保存
|
|
/// </summary>
|
|
/// <param name="td"></param>
|
|
/// <param name="tc"></param>
|
|
/// <param name="happendDate"></param>
|
|
/// <param name="isZeroMoney">主交易记和tradeCash对应的资金记录时,money需要记为0,否则主交易子交易都有资金,会导致资金double计算</param>
|
|
/// <returns></returns>
|
|
public ClientCashInCashOut CloseTrade_ClientCashInCashOutSave(OtcTradeBase td, trade_cash tc, DateTime? happendDate = null, bool isZeroMoney = false)
|
|
{
|
|
var cl = DataCacheProvider.GetClientDataSource().GetData(td.ClientId);
|
|
|
|
if (cl == null)
|
|
{
|
|
throw new Exception("客户信息未找到,交易编号:" + td.TradeNumber);
|
|
}
|
|
|
|
//增加出入金记录
|
|
var ee = new ClientCashInCashOut
|
|
{
|
|
Direction = "应收",
|
|
Number = UniqueTimeId.GetStr(),
|
|
ClientId = cl.id,
|
|
ClientNumber = cl.Number,
|
|
ClientName = cl.Name,
|
|
Money = isZeroMoney ? 0 : (tc.Amount * -1),
|
|
CurrencyCode = td.SettlementCurrency,
|
|
HappenDate = (happendDate ?? valuedateBLL.ValueDate) == DateTime.Now.Date ? DateTime.Now : (happendDate ?? valuedateBLL.ValueDate),
|
|
State = ClientCashInCashOut.已确认,
|
|
OptId = tc.OptId,
|
|
OptName = tc.OptName,
|
|
OptDate = tc.OptDate,
|
|
CreatorId = tc.OptId,
|
|
CreatorName = tc.OptName,
|
|
CreateDate = tc.OptDate,
|
|
TradeId = tc.TradeId,
|
|
TradeCashId = tc.id,
|
|
Action = tc.Action,
|
|
TradeNumber = td.TradeNumber,
|
|
//组合收益互换得展示子交易
|
|
IsGroup = td.TradeType == "收益互换" ? 0 : td.IsGroup
|
|
};
|
|
|
|
if (td.TradeType == "收益互换" && td.ParentTradeId > 0)
|
|
{
|
|
var parentTrade = DbContext.trade.Find(td.ParentTradeId);
|
|
ee.ParentTradeNumber = parentTrade.TradeNumber;
|
|
}
|
|
DbContext.ClientCashInCashOut.Add(ee);
|
|
DbContext.SaveChanges();
|
|
return ee;
|
|
}
|
|
}
|
|
}
|