fix(settlement): 修复预付金计算中的精度问题
- 对保证金比率进行四舍五入到小数点后两位处理 - 将硬编码的保证金最大比率计算改为基于调整后的保证金比率 - 修复可取预付金计算中的类型转换问题 - 确保计算过程中数值精度的一致性 - 移除多余的文件末尾大括号以符合代码规范
This commit is contained in:
@@ -42,8 +42,8 @@ namespace YLErp.Modules.EodModule.SettlementModule
|
||||
var currencyProvider = _context.EodCurrencyProvider;
|
||||
List<int> marginTypes = new List<int>() { (int)InterestModeEnum.追加预付金, (int)InterestModeEnum.初始预付金 };
|
||||
//预付金可取上浮比率
|
||||
var marginRatio = _context.SystemValue.MarginRatio ?? 0.15;
|
||||
var marginMaxRatio = marginRatio + 0.02;
|
||||
var marginRatio = Math.Round((decimal)(_context.SystemValue.MarginRatio ?? 0.15), 2, MidpointRounding.AwayFromZero);
|
||||
var marginMaxRatio = marginRatio + 0.02m;
|
||||
var preBalanceDate = _context.PreSettleDate;
|
||||
var preClientbalancedailys = DbContext.ClientBalanceDaily.Where(t => t.BalanceDate == preBalanceDate).ToList();
|
||||
if (reqClientIds != null && reqClientIds.Any())
|
||||
@@ -946,7 +946,7 @@ namespace YLErp.Modules.EodModule.SettlementModule
|
||||
}
|
||||
}
|
||||
//可取预付金为预付金余额 - 应缴预付金(上浮2%) 20220207新增减去互换预付金容忍额
|
||||
AdvisableMargin = Math.Max(MarginBalance + (PayableMargin - SwapUnPayableMargin) * marginMaxRatio / marginRatio, 0);
|
||||
AdvisableMargin = Math.Max(MarginBalance + (PayableMargin - SwapUnPayableMargin) * (double)(marginMaxRatio / marginRatio), 0);
|
||||
|
||||
//计算追保金额 维持预付金带方向 所以计算追保金额是 为相加
|
||||
var IsTradeCredit = (client.IsTradeCredit ?? 0) == 1;
|
||||
@@ -1378,4 +1378,4 @@ namespace YLErp.Modules.EodModule.SettlementModule
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user