BugFix 特批路径没法走通
This commit is contained in:
@@ -80,10 +80,13 @@ namespace YLErp.Modules.SwapModule
|
||||
}
|
||||
/// <summary>
|
||||
/// 互换交易保存
|
||||
/// ignoreMoneyCheck=true:资金不足特批放行(additionalProcessing=LackOfMoney,controller 按 系统参数"允许交易特批"
|
||||
/// 判定后传入,与确认/审批环节 ignoreMoneyCheck 同口径);确认成交时资金校验独立再跑,特批链路在那边仍有兜底。
|
||||
/// </summary>
|
||||
/// <param name="td"></param>
|
||||
/// <param name="ignoreMoneyCheck"></param>
|
||||
/// <returns></returns>
|
||||
public trade SaveTrade(trade req)
|
||||
public trade SaveTrade(trade req, bool ignoreMoneyCheck = false)
|
||||
{
|
||||
var um = checkUnderlying(req);
|
||||
trade dbTrade = new trade();
|
||||
@@ -91,11 +94,12 @@ namespace YLErp.Modules.SwapModule
|
||||
//资金校验须在其后取值,否则互换表单不填平铺 InitialMargin 时校验会按 0 放行)
|
||||
var tradeNumberGenerated = PrepareTrade(req, TradeSourceEnum.系统交易, um);
|
||||
// R4 簿记资金校验:可用资金(现金结存+授信−已使用授信,口径见 RealtimePnlCalc.TradeCanBeConfirm)
|
||||
// 需覆盖 应付预付金+成交金额,不足拦截抛错;特批放行发生在确认成交环节(ignoreMoneyCheck)。
|
||||
// 需覆盖 应付预付金+成交金额;不足时抛 TradeLackOfMoneyException——controller 依"允许交易特批"开关
|
||||
// 走 AdditionalProcessing/LackOfMoney 特批协议(与确认/审批环节一致)或按保存失败拦截。
|
||||
// ExerciseDate 为空(异常数据)时跳过该校验,避免 TradeCanBeConfirm 内部解引用抛错。
|
||||
if (req.ExerciseDate.HasValue && !RealtimePnlCalc.TradeCanBeConfirm(req.ClientId, req, out var fundErrorMsg))
|
||||
if (!ignoreMoneyCheck && req.ExerciseDate.HasValue && !RealtimePnlCalc.TradeCanBeConfirm(req.ClientId, req, out var fundErrorMsg))
|
||||
{
|
||||
throw new ServiceException(fundErrorMsg);
|
||||
throw new TradeLackOfMoneyException(fundErrorMsg);
|
||||
}
|
||||
|
||||
var trans = DbContext.Database.BeginTransaction();
|
||||
|
||||
Reference in New Issue
Block a user