fix(reconcile): F07 对账按指标类型使用独立容差,自定义列改为 Decimal 参考对账

- 对账检查页新增容差列:人数严格相等(容差 0)、金额 0.01、比率 0.0001,
  状态公式改为 ABS(差异)<=容差,不再统一使用 0.01
- 自定义列不再标注“需业务验收/无服务器参考”:新增 to_decimal 白名单表达式
  解释器(仅遍历 metric/number/四则节点,不执行代码)在服务器端用 Decimal
  计算参考值,缺失指标或除零返回 None(对应 #N/A → 无参考)
- 参数页写明对账规则与“容差调整需财务负责人批准”
- 测试:求值器黄金样例(大数/抵消/极小值/除零/缺失/多层表达式)、
  分指标容差列、自定义列 Decimal 参考与缺失场景、全指标覆盖检查;
  LibreOffice 用例验证全部对账行重算后为“通过/无参考”(本机跳过)
This commit is contained in:
Jayway Liu
2026-09-26 01:42:03 +08:00
parent 9962573379
commit 649fec4121
4 changed files with 284 additions and 8 deletions
+4 -3
View File
@@ -20,11 +20,12 @@ def test_reconcile_status_guards_non_numeric_difference(workspace):
output,
)
workbook = load_workbook(BytesIO(output.getvalue()), data_only=False)
status_cells = [row[7] for row in workbook["对账检查"].iter_rows(min_row=2)]
formulas = [
row[6].value
for row in workbook["对账检查"].iter_rows(min_row=2)
if isinstance(row[6].value, str) and row[6].value.startswith("=IF(D")
cell.value for cell in status_cells if isinstance(cell.value, str) and cell.value.startswith("=IF(D")
]
assert formulas
assert all("ISNUMBER(F" in formula for formula in formulas)
assert all('"通过"' in formula for formula in formulas)
# 容差列独立成列,状态按容差比较而不是统一 0.01
assert all(row[6].value is not None for row in workbook["对账检查"].iter_rows(min_row=2))