feat(核算)!: 添加 T+ 正式核算与采集托管

补齐源快照、资料预演、正式导入及工资核算的依赖链路。
新增版本化输入、逐段 FIFO、生成锁和结构化当月调整,
并提供默认关闭的周期采集、有限重试及 Windows 托管。

原始客户资料、私有配置及首页改动不纳入本次提交。

BREAKING CHANGE: 升级前需应用新增迁移,并通过
PAYROLL_MAKER_USER_ID 绑定实际工资制作人,否则业务只读。
旧单批次核算默认关闭;历史兼容需显式启用
PAYROLL_ALLOW_LEGACY_CALCULATION。生产启用和真实金额待验收。
This commit is contained in:
liuwenxin committed 2026-11-02 09:42:53 +08:00
1 parent 1b074576fe
commit 108bf87225
154 files changed
+9515 -645

No files matched your search

+12
View File
@@ -95,6 +95,18 @@ def calc_receipt(
本函数只做编排:锁行校验 → 模式预处理 → 输入装载 → 逐行折算 →
计提组成 → 落库,各段独立私有函数(口径修改只动对应段)。
"""
from app.core.config import get_settings
from app.services import payroll_calculation
receipt = session.get(Receipt, receipt_id)
if receipt is None:
raise BadRequestError("回款不存在")
if payroll_calculation.latest_input(session, receipt.business_id):
result = payroll_calculation.calculate(session, receipt.business_id,
receipt.receipt_date.strftime("%Y-%m"), operator=operator, meta=meta, reason=recalc_reason)
return CalcReceiptOut(ledger=_to_out(session.get(PerformanceLedger, result["ledger_ids"][0])), repeated=False)
if not get_settings().payroll_allow_legacy_calculation:
raise BadRequestError("请在业务详情的正式核算入口准备资料;旧单批次核算已停用")
is_recalc = recalc_reason is not None
action = "重算" if is_recalc else "核算"
with audit_service.audit(