This commit is contained in:
2026-07-30 10:30:50 +08:00
parent cf6d708566
commit 853c478657
85 changed files with 4711 additions and 1052 deletions
+381 -74
View File
@@ -872,6 +872,55 @@
}
}
},
"/api/products/from-task/{task_id}": {
"post": {
"tags": [
"进销存",
"产品管理"
],
"summary": "Create Product From Task",
"description": "从模具分析任务创建进销存成品,回写 stp_files.product_id(P2-1)",
"operationId": "create_product_from_task_api_products_from_task__task_id__post",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "task_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Task Id"
}
}
],
"responses": {
"201": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProductResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/products/{product_id}": {
"put": {
"tags": [
@@ -3267,6 +3316,54 @@
}
}
},
"/api/purchase-demands/calculate": {
"post": {
"tags": [
"进销存",
"采购需求推导"
],
"summary": "Calculate Purchase Demands",
"description": "根据销售订单 ID 列表,自动推导采购需求(BOM 展开 → 库存对比 → 供应商推荐)",
"operationId": "calculate_purchase_demands_api_purchase_demands_calculate_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PurchaseDemandCalculateRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PurchaseDemandResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"OAuth2PasswordBearer": []
}
]
}
},
"/api/dashboard": {
"get": {
"tags": [
@@ -4161,6 +4258,91 @@
]
}
},
"/api/batch-upload": {
"post": {
"summary": "Batch Upload",
"description": "批量上传多个 STP 文件,每个文件创建独立分析任务,用 batch_id 聚合。",
"operationId": "batch_upload_api_batch_upload_post",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/Body_batch_upload_api_batch_upload_post"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"OAuth2PasswordBearer": []
}
]
}
},
"/api/batch/{batch_id}": {
"get": {
"summary": "Get Batch Status",
"description": "聚合查询批量任务进度",
"operationId": "get_batch_status_api_batch__batch_id__get",
"security": [
{
"OAuth2PasswordBearer": []
}
],
"parameters": [
{
"name": "batch_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Batch Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/status/{task_id}": {
"post": {
"summary": "Get Status",
@@ -4235,80 +4417,6 @@
}
}
},
"/api/result/{task_id}": {
"post": {
"summary": "Result Page",
"description": "结果详情页面",
"operationId": "result_page_api_result__task_id__post",
"parameters": [
{
"name": "task_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Task Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
},
"get": {
"summary": "Result Page",
"description": "结果详情页面",
"operationId": "result_page_api_result__task_id__get",
"parameters": [
{
"name": "task_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Task Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/history": {
"get": {
"summary": "Get File History",
@@ -4651,6 +4759,48 @@
},
"components": {
"schemas": {
"Body_batch_upload_api_batch_upload_post": {
"properties": {
"files": {
"items": {
"type": "string",
"contentMediaType": "application/octet-stream"
},
"type": "array",
"title": "Files"
},
"material": {
"type": "string",
"title": "Material",
"default": "ABS"
},
"draft_angle": {
"type": "number",
"title": "Draft Angle",
"default": 2.0
},
"shrinkage_rate": {
"type": "number",
"title": "Shrinkage Rate",
"default": 0.5
},
"parting_precision": {
"type": "number",
"title": "Parting Precision",
"default": 0.1
},
"cavity_match": {
"type": "integer",
"title": "Cavity Match",
"default": 95
}
},
"type": "object",
"required": [
"files"
],
"title": "Body_batch_upload_api_batch_upload_post"
},
"Body_login_api_auth_login_post": {
"properties": {
"grant_type": {
@@ -6811,6 +6961,163 @@
],
"title": "ProductionMaterialPlanItemResponse"
},
"PurchaseDemandCalculateRequest": {
"properties": {
"sales_order_ids": {
"items": {
"type": "integer"
},
"type": "array",
"minItems": 1,
"title": "Sales Order Ids",
"description": "销售订单ID列表"
}
},
"type": "object",
"required": [
"sales_order_ids"
],
"title": "PurchaseDemandCalculateRequest",
"description": "计算采购需求的请求体"
},
"PurchaseDemandItemResponse": {
"properties": {
"material_id": {
"type": "integer",
"title": "Material Id"
},
"material_sku": {
"type": "string",
"title": "Material Sku"
},
"material_name": {
"type": "string",
"title": "Material Name"
},
"required_quantity": {
"type": "string",
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"title": "Required Quantity",
"description": "BOM 需求量"
},
"available_quantity": {
"type": "string",
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"title": "Available Quantity",
"description": "当前库存量"
},
"shortage_quantity": {
"type": "string",
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"title": "Shortage Quantity",
"description": "缺口数量 = required - available"
},
"unit_cost": {
"type": "string",
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"title": "Unit Cost",
"description": "物料单价"
},
"estimated_cost": {
"type": "string",
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"title": "Estimated Cost",
"description": "预计采购金额 = shortage × unit_cost"
},
"suggested_supplier_id": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Suggested Supplier Id",
"description": "建议供应商ID"
},
"suggested_supplier_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Suggested Supplier Name",
"description": "建议供应商名称"
},
"supplier_lead_time": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Supplier Lead Time",
"description": "供应商交货周期(天)"
}
},
"type": "object",
"required": [
"material_id",
"material_sku",
"material_name",
"required_quantity",
"available_quantity",
"shortage_quantity",
"unit_cost",
"estimated_cost"
],
"title": "PurchaseDemandItemResponse",
"description": "单个物料的采购建议"
},
"PurchaseDemandResponse": {
"properties": {
"items": {
"items": {
"$ref": "#/components/schemas/PurchaseDemandItemResponse"
},
"type": "array",
"title": "Items"
},
"total_estimated_cost": {
"type": "string",
"pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
"title": "Total Estimated Cost",
"description": "预计采购总金额",
"default": "0"
},
"shortage_count": {
"type": "integer",
"title": "Shortage Count",
"description": "缺货物料种类数",
"default": 0
},
"source_order_ids": {
"items": {
"type": "integer"
},
"type": "array",
"title": "Source Order Ids",
"description": "来源销售订单ID"
},
"source_order_nos": {
"items": {
"type": "string"
},
"type": "array",
"title": "Source Order Nos",
"description": "来源销售订单编号"
}
},
"type": "object",
"title": "PurchaseDemandResponse",
"description": "采购需求计算结果"
},
"PurchaseOrderCreate": {
"properties": {
"supplier_id": {