feat(shipping-notice): 新增货代客户管理功能,支持客户导入、识别证据管理与客户确认

This commit is contained in:
hugo committed 2026-07-16 08:16:19 +08:00
1 parent b595e157e9
commit 4fbaed2b4c
176 files changed
+14011 -994

No files matched your search

@@ -72,7 +72,7 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
if not server.endswith("/api/shipping-notice"):
server = f"{server}/api/shipping-notice" if server else "/api/shipping-notice"
task_id = _str_prop("发货任务编号(task id),如 SN-20260529-ABCD1234")
task_id = _str_prop("发货任务引用:技术任务号 SN-20260529-ABCD1234 或业务号 WYC26071501")
batch_id = _str_prop("发货批次编号(batch id),如 SB-20260617-ABCD1234")
runtime_context = _str_prop(
"HXOPS 注入的完整 agent_runtime_context JSON 字符串;必须原样透传,禁止由 LLM 构造或修改"
@@ -89,7 +89,7 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
"不包含由后台任务统一续跑的主推进工具,也不包含 RPA 回调。"
"推进类 Tool 的统一约束如下:必须依赖 HXOPS 状态机校验,必须基于唯一 task_id 推进;"
"模糊指代不能直接推进,必须先通过 reference_context、get_task_status 或其他 HXOPS Tool 解析到唯一任务。"
"submit_decision、match_inventory、generate_shipment_excel、upload_to_freight、retry_task、confirm_inventory_source"
"submit_decision、match_inventory、generate_shipment_excel、upload_to_freight、retry_task、confirm_inventory_source、confirm_customer"
" 这类推进动作都必须根据 HXOPS Tool 返回结果解释,不能脱离 Tool 返回自行编造状态。"
"若 Tool 返回 needs_human 或 failed,不得自行改写成完成、成功上传或已处理完毕。"
"如果响应包含 action_buttons,Dify 只解释当前状态、业务原因和影响,"
@@ -159,8 +159,10 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
"sku": _str_prop("SKU/料号"),
"qty": {"type": "number", "exclusiveMinimum": 0},
"reservation_id": _str_prop("可为空,缺失时 Task 停在补字段门禁"),
"hub_code": _str_prop("可为空,缺失时 Task 停在补字段门禁"),
"source_type": _str_prop("可为空,缺失时 Task 停在补字段门禁"),
"source_type": _str_prop(
"可选订单路由线索;仅在原文有可靠证据时填写,"
"不代表任务通知来源或已确认的库存连接器类型"
),
},
"additionalProperties": True,
},
@@ -190,7 +192,10 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
required=["agent_runtime_context", "input_snapshot_hash", "schema_version", "orders"],
description=(
"只接受 get_order_extraction_context 的同一快照。HXOPS 仅在分类、SKU/Qty 置信度及原文证据均达标,"
"且无阻断冲突/修订决策时自动建单;Reservation ID、Hub Code、Source Type 允许缺失。"
"且无阻断冲突/修订决策时自动建单;Reservation ID 允许缺失,"
"订单行 Source Type 是可选路由线索。"
"响应以持久化结果分别返回 created_count、opened_existing_count、pending_count、"
"non_shipping_count;auto_created_count 仅为兼容字段且等于 created_count。"
),
),
"/tools/parse_notice": _post_op(
@@ -230,7 +235,10 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
"line_index": _int_prop("行下标,从 0 开始"),
"patch": {
"type": "object",
"description": "可更新字段:sku/reservation_id/quantity/qty/required_date/uom/hub_code/source_type",
"description": (
"可更新字段:sku/reservation_id/quantity/qty/required_date/uom/source_type;"
"source_type 仅作为可选订单路由线索"
),
"additionalProperties": True,
},
"comment": _str_prop("修改备注(可选)"),
@@ -291,12 +299,25 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
},
required=["task_id", "source_code"],
description=(
"库存源门禁:稳定身份须同时具备 source_code、source_type、site_id、warehouse_id,"
"库存连接器门禁:稳定身份须同时具备 source_code、connector_type、site_id、warehouse_id,"
"且 routing_fingerprint 与当前配置版本一致。"
"Tool API 使用集成密钥鉴权,确认人审计由宿主会话内部链路写入,不接受外部 user_id。"
"若返回 needs_human,说明身份未完整解析或需先完成解析确认。"
),
),
"/tools/confirm_customer": _post_op(
"confirm_customer",
"在客户人工检查点确认标准客户(仅提交 customer_id)",
{
"task_id": task_id,
"customer_id": _int_prop("用户从 HXOPS 标准客户列表中明确选择的客户 ID"),
},
required=["task_id", "customer_id"],
description=(
"仅在 customer_review 检查点且用户已经明确选择标准客户后调用。"
"禁止根据邮件中的不稳定客户名称自行猜测 customer_id;客户确认成功后由 HXOPS 决定后续流程。"
),
),
"/tools/submit_decision": _post_op(
"submit_decision",
"人工复核决策。task_id 与 conversation_id 至少传一个;用户确认时禁止 create_task。决策提交后由后台任务统一续跑。",
@@ -332,13 +353,13 @@ def build_dify_openapi_spec(base_url: str) -> dict[str, Any]:
),
"/tools/get_task_status": _post_op(
"get_task_status",
"查询任务当前状态与 human_options;响应含 inventory_source_* 独立字段与候选结构",
"查询任务当前状态与 human_options;响应含库存连接器独立字段与候选结构",
{
"task_id": task_id,
"conversation_id": _str_prop("Dify 会话 ID"),
},
description=(
"返回 inventory_source_code、inventory_source_type、inventory_site_id、"
"返回 inventory_source_code、inventory_connector_type、inventory_site_id、"
"inventory_warehouse_id、inventory_source_status(unresolved|ambiguous|resolved|"
"user_confirmed|invalid|conflicted)、inventory_source_method、"
"inventory_source_config_version、inventory_routing_fingerprint、"