保证金算法&资金计算
This commit is contained in:
@@ -599,6 +599,7 @@ namespace YLErp.Modules.ClientModule
|
||||
r.Action = req.Action;
|
||||
r.CashFlag = req.CashFlag;
|
||||
r.CurrencyCode = req.CurrencyCode;
|
||||
r.cash_type = req.cash_type;
|
||||
}
|
||||
|
||||
if (isARAP)
|
||||
@@ -659,26 +660,9 @@ namespace YLErp.Modules.ClientModule
|
||||
//如果出金大于可用资金(修改操作时需要算差价)则抛出错误
|
||||
if (Math.Abs(r.Money ?? 0.0) > realAvailableFund)
|
||||
{
|
||||
if ("出金".Equals(r.Direction))
|
||||
{
|
||||
var msg = "添加出金失败,客户:" + r.ClientName + " 出金:" + r.Money + " 实际可取出资金:" +
|
||||
(Math.Floor(realAvailableFund * 100) / 100).ToString("0.00") + ";";
|
||||
throw new ServiceException(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
var msg = "添加应付预付金失败,客户:" + r.ClientName + " 应付预付金:" + Math.Abs(r.Money ?? 0) + " 实际可取出资金:" +
|
||||
(Math.Floor(realAvailableFund * 100) / 100).ToString("0.00") + ";";
|
||||
throw new ServiceException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ("出金".Equals(r.Direction) && PS.Config.Company == Configuration.CompanyEnum.中金)
|
||||
{
|
||||
if (!CheckClientCashOut(req.ClientId ?? 0, req.Money ?? 0, req.CurrencyCode))
|
||||
{
|
||||
throw new ServiceException($"南向客户币种{req.CurrencyCode}的出金金额不能大于客户账户余额");
|
||||
var msg = "添加出金失败,客户:" + r.ClientName + " 出金:" + r.Money + " 实际可取出资金:" +
|
||||
(Math.Floor(realAvailableFund * 100) / 100).ToString("0.00") + ";";
|
||||
throw new ServiceException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -934,10 +918,9 @@ namespace YLErp.Modules.ClientModule
|
||||
var clientbalance = ClientBalanceUtility.GetClientBanlances(new List<int> { e.ClientId.Value }, DateTime.MinValue, DateTime.Now.Date).FirstOrDefault();
|
||||
//当日可取现金
|
||||
var availableFund = clientbalance == null ? 0 : clientbalance.DesirableFund;
|
||||
var frozenOutFund = clientbalance == null ? 0 : clientbalance.FrozenOutFund;
|
||||
|
||||
//对于0.999999999情况的数据做下处理
|
||||
var realAvailableFund = Math.Round((availableFund + frozenOutFund) * Math.Pow(10, 8)) / Math.Pow(10, 8);
|
||||
var realAvailableFund = Math.Round((availableFund + (e.Money??0)) * Math.Pow(10, 8)) / Math.Pow(10, 8);
|
||||
//如果当前出金金额大于可用资金(不扣除冻结出金部分)则抛出错误
|
||||
if (Math.Abs(e.Money ?? 0) > realAvailableFund)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user