feat(T+): 完成数据贯通与自动接入闭环
打通 T+ 快照、业务、发货、回款和核算准备链路,保留来源差异并提供待补状态。 新增业务自动接入任务、跨平台读取服务托管、权限复核、来源关联和前端核对页面。 补充迁移、隔离集成测试、浏览器模拟验收及角色授权边界修复。
这个提交包含在:
1 父节点
3efe72c344
当前提交
1e53792ad6
151 个文件已更改
+8842
-401
没有与搜索条件相匹配的文件
@@ -37,6 +37,11 @@ def detail(session, business_id):
|
||||
|
||||
|
||||
def setup(session, business_id, payload, operator, meta=None):
|
||||
source_business = session.get(Business, business_id)
|
||||
if source_business and source_business.integration_json:
|
||||
from app.services.business_source import prepare
|
||||
|
||||
return prepare(session, business_id, payload, operator, meta)
|
||||
with audit_service.audit(
|
||||
session,
|
||||
operator=operator,
|
||||
@@ -121,15 +126,21 @@ def setup(session, business_id, payload, operator, meta=None):
|
||||
}
|
||||
)
|
||||
receipts = list(session.scalars(select(Receipt).where(Receipt.business_id == business_id)))
|
||||
if any(r.is_barter for r in receipts):
|
||||
raise BadRequestError("抵顶特殊绩效继续线下处理,不进入普通FIFO核算")
|
||||
# 用户 2026-11-03:抵顶按普通业务计算,特殊应得绩效线下核实,
|
||||
# 不自动乘80%,也不因抵顶标记阻断整个客户的正常平账。
|
||||
if current:
|
||||
previous_costs = {s["line_id"]: s for s in current.data_json["shipments"]}
|
||||
for ship in ships:
|
||||
old = previous_costs.get(ship["line_id"])
|
||||
if old and (old["cost_total"] != ship["cost_total"] or old["date"] != ship["date"]):
|
||||
raise BadRequestError("原发货月份指导成本已封存,不得随后续回款更改")
|
||||
handovers = [h.model_dump(mode="json") for h in payload.handovers]
|
||||
if old:
|
||||
old_unit_cost = old.get("unit_cost")
|
||||
if (old["cost_total"] != ship["cost_total"] or old["date"] != ship["date"]
|
||||
or old_unit_cost is None or Decimal(str(old_unit_cost)) != Decimal(ship["unit_cost"])):
|
||||
raise BadRequestError("原发货月份指导成本已封存,不得随后续回款更改")
|
||||
if current and "handovers" not in payload.model_fields_set:
|
||||
handovers = current.data_json.get("facts", {}).get("handovers", [])
|
||||
else:
|
||||
handovers = [h.model_dump(mode="json") for h in payload.handovers]
|
||||
if any(h["business_key"] != key for h in handovers):
|
||||
raise BadRequestError("交接记录不属于本业务")
|
||||
values = {
|
||||
|
||||
在新工单中引用
屏蔽一个用户