feat(shipping-notice): 新增发货批次和任务管理功能,支持批次创建与任务处理

This commit is contained in:
hugo committed 2026-06-17 20:45:19 +08:00
1 parent 457f0f4e5e
commit 634dee4b81
81 files changed
+9088 -3625

No files matched your search

+362 -4
View File
@@ -11,11 +11,11 @@
}
],
"paths": {
"/tools/create_task": {
"/tools/create_batch": {
"post": {
"operationId": "create_task",
"summary": "创建发货任务 task",
"description": "创建发货任务 task",
"operationId": "create_batch",
"summary": "创建发货批次 batch(一次多文件上传的聚合容器)",
"description": "创建发货批次 batch(一次多文件上传的聚合容器)",
"parameters": [],
"requestBody": {
"required": true,
@@ -24,6 +24,62 @@
"schema": {
"type": "object",
"properties": {
"batch_no": {
"type": "string",
"description": "已存在的批次编号(可选)。传入时将直接复用该批次。"
},
"user_id": {
"type": "integer",
"description": "Hxops 用户 ID(可选)"
},
"conversation_id": {
"type": "string",
"description": "Dify 会话 ID,便于工作台关联"
},
"file_count": {
"type": "integer",
"description": "本批通知文件数量"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Tool response (status: ok|running|needs_human|failed). May include checkpoint, human_options, action_buttons.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
},
"/tools/create_task": {
"post": {
"operationId": "create_task",
"summary": "创建发货任务 task(可挂到某个 batch)",
"description": "创建发货任务 task(可挂到某个 batch)",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"batch_no": {
"type": "string",
"description": "发货批次编号(batch id),如 SB-20260617-ABCD1234"
},
"task_id": {
"type": "string",
"description": "已存在的发货任务编号(可选)。传入时将直接复用该任务,禁止重复创建。"
},
"user_id": {
"type": "integer",
"description": "Hxops 用户 ID(可选)"
@@ -42,6 +98,22 @@
"pdf"
]
},
"source_file_name": {
"type": "string",
"description": "原始通知文件名(多文件场景建议传)"
},
"source_file_type": {
"type": "string",
"description": "原始通知文件类型(多文件场景建议传)"
},
"batch_index": {
"type": "integer",
"description": "当前任务在批次中的顺序,从 1 开始"
},
"batch_total": {
"type": "integer",
"description": "当前批次总任务数"
},
"raw_content": {
"type": "string",
"description": "原始发货通知文本(可选,后续 parse 也可传入)"
@@ -108,6 +180,206 @@
}
}
},
"/tools/update_notice_fields": {
"post": {
"operationId": "update_notice_fields",
"summary": "更新解析后的发货通知单头字段,如客户、PO、交期、收货地",
"description": "更新解析后的发货通知单头字段,如客户、PO、交期、收货地",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"task_id": {
"type": "string",
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
},
"fields": {
"type": "object",
"description": "可更新字段:customer_name/customer_code/ship_to/po_number/required_date",
"additionalProperties": true
},
"comment": {
"type": "string",
"description": "修改备注(可选)"
}
},
"required": [
"task_id",
"fields"
]
}
}
}
},
"responses": {
"200": {
"description": "Tool response (status: ok|running|needs_human|failed). May include checkpoint, human_options, action_buttons.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
},
"/tools/update_notice_line": {
"post": {
"operationId": "update_notice_line",
"summary": "更新解析结果中的某一行,如 SKU、Reservation ID、数量、交期",
"description": "更新解析结果中的某一行,如 SKU、Reservation ID、数量、交期",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"task_id": {
"type": "string",
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
},
"line_index": {
"type": "integer",
"description": "行下标,从 0 开始"
},
"patch": {
"type": "object",
"description": "可更新字段:sku/reservation_id/quantity/qty/required_date/uom",
"additionalProperties": true
},
"comment": {
"type": "string",
"description": "修改备注(可选)"
}
},
"required": [
"task_id",
"line_index",
"patch"
]
}
}
}
},
"responses": {
"200": {
"description": "Tool response (status: ok|running|needs_human|failed). May include checkpoint, human_options, action_buttons.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
},
"/tools/add_notice_line": {
"post": {
"operationId": "add_notice_line",
"summary": "向解析结果新增一行发货需求",
"description": "向解析结果新增一行发货需求",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"task_id": {
"type": "string",
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
},
"line": {
"type": "object",
"description": "新增行,至少包含 sku 和 qty/quantity",
"additionalProperties": true
},
"comment": {
"type": "string",
"description": "修改备注(可选)"
}
},
"required": [
"task_id",
"line"
]
}
}
}
},
"responses": {
"200": {
"description": "Tool response (status: ok|running|needs_human|failed). May include checkpoint, human_options, action_buttons.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
},
"/tools/remove_notice_line": {
"post": {
"operationId": "remove_notice_line",
"summary": "删除解析结果中的某一行发货需求",
"description": "删除解析结果中的某一行发货需求",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"task_id": {
"type": "string",
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
},
"line_index": {
"type": "integer",
"description": "行下标,从 0 开始"
},
"comment": {
"type": "string",
"description": "修改备注(可选)"
}
},
"required": [
"task_id",
"line_index"
]
}
}
}
},
"responses": {
"200": {
"description": "Tool response (status: ok|running|needs_human|failed). May include checkpoint, human_options, action_buttons.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
},
"/tools/parse_inventory": {
"post": {
"operationId": "parse_inventory",
@@ -575,6 +847,92 @@
}
}
}
},
"/tools/get_batch_status": {
"post": {
"operationId": "get_batch_status",
"summary": "查询批次当前状态、任务列表与当前聚焦任务",
"description": "查询批次当前状态、任务列表与当前聚焦任务",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"batch_no": {
"type": "string",
"description": "发货批次编号(batch id),如 SB-20260617-ABCD1234"
}
},
"required": [
"batch_no"
]
}
}
}
},
"responses": {
"200": {
"description": "Tool response (status: ok|running|needs_human|failed). May include checkpoint, human_options, action_buttons.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
},
"/tools/switch_focus_task": {
"post": {
"operationId": "switch_focus_task",
"summary": "切换当前批次的聚焦任务",
"description": "切换当前批次的聚焦任务",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"batch_no": {
"type": "string",
"description": "发货批次编号(batch id),如 SB-20260617-ABCD1234"
},
"task_no": {
"type": "string",
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
},
"target_task_no": {
"type": "string",
"description": "发货任务编号(task id),如 SN-20260529-ABCD1234"
}
},
"required": [
"batch_no"
]
}
}
}
},
"responses": {
"200": {
"description": "Tool response (status: ok|running|needs_human|failed). May include checkpoint, human_options, action_buttons.",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
}
}