{"openapi":"3.1.0","info":{"title":"物资精准装载核算系统","description":"三维约束装载核算与排布方案系统；对外开放接口前缀 /api/open/v1。","version":"1.0.0"},"paths":{"/api/materials":{"get":{"summary":"List Materials","operationId":"list_materials_api_materials_get","parameters":[{"name":"keyword","in":"query","required":false,"schema":{"type":"string","default":"","title":"Keyword"}},{"name":"category","in":"query","required":false,"schema":{"type":"string","default":"","title":"Category"}},{"name":"form","in":"query","required":false,"schema":{"type":"string","default":"","title":"Form"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"","title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Create Material","operationId":"create_material_api_materials_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"P"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/materials/{mid}":{"put":{"summary":"Update Material","operationId":"update_material_api_materials__mid__put","parameters":[{"name":"mid","in":"path","required":true,"schema":{"type":"integer","title":"Mid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"P"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Material","operationId":"delete_material_api_materials__mid__delete","parameters":[{"name":"mid","in":"path","required":true,"schema":{"type":"integer","title":"Mid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/materials/template":{"get":{"summary":"Material Template","operationId":"material_template_api_materials_template_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/materials/import":{"post":{"summary":"Import Materials","operationId":"import_materials_api_materials_import_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_materials_api_materials_import_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/carriers":{"get":{"summary":"List Carriers","operationId":"list_carriers_api_carriers_get","parameters":[{"name":"keyword","in":"query","required":false,"schema":{"type":"string","default":"","title":"Keyword"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"","title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Create Carrier","operationId":"create_carrier_api_carriers_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"P"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/carriers/{cid}":{"put":{"summary":"Update Carrier","operationId":"update_carrier_api_carriers__cid__put","parameters":[{"name":"cid","in":"path","required":true,"schema":{"type":"integer","title":"Cid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"P"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Carrier","operationId":"delete_carrier_api_carriers__cid__delete","parameters":[{"name":"cid","in":"path","required":true,"schema":{"type":"integer","title":"Cid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/carriers/template":{"get":{"summary":"Carrier Template","operationId":"carrier_template_api_carriers_template_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/carriers/import":{"post":{"summary":"Import Carriers","operationId":"import_carriers_api_carriers_import_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_carriers_api_carriers_import_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks":{"get":{"summary":"List Tasks","operationId":"list_tasks_api_tasks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"summary":"Create Task","operationId":"create_task_api_tasks_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"P"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/import-list":{"post":{"summary":"Import Task List","description":"批量导入核算清单（列：物资编码、数量）。","operationId":"import_task_list_api_tasks_import_list_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_task_list_api_tasks_import_list_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/{tid}/run":{"post":{"summary":"Run Task","operationId":"run_task_api_tasks__tid__run_post","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"integer","title":"Tid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/{tid}":{"get":{"summary":"Get Task","operationId":"get_task_api_tasks__tid__get","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"integer","title":"Tid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/plans/{plan_id}":{"get":{"summary":"Get Plan","operationId":"get_plan_api_plans__plan_id__get","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"integer","title":"Plan Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/plans/{plan_id}/export/docx":{"get":{"summary":"Export Docx","operationId":"export_docx_api_plans__plan_id__export_docx_get","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"integer","title":"Plan Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/plans/{plan_id}/export/xlsx":{"get":{"summary":"Export Xlsx","operationId":"export_xlsx_api_plans__plan_id__export_xlsx_get","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"integer","title":"Plan Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rules":{"get":{"summary":"List Rules","operationId":"list_rules_api_rules_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/rules/{rid}":{"put":{"summary":"Update Rule","operationId":"update_rule_api_rules__rid__put","parameters":[{"name":"rid","in":"path","required":true,"schema":{"type":"integer","title":"Rid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"P"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rule-versions":{"get":{"summary":"List Versions","operationId":"list_versions_api_rule_versions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"summary":"Manual Snapshot","operationId":"manual_snapshot_api_rule_versions_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"P"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rule-versions/compare":{"get":{"summary":"Compare Versions","operationId":"compare_versions_api_rule_versions_compare_get","parameters":[{"name":"a","in":"query","required":true,"schema":{"type":"integer","title":"A"}},{"name":"b","in":"query","required":true,"schema":{"type":"integer","title":"B"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rule-versions/{vid}":{"get":{"summary":"Get Version","operationId":"get_version_api_rule_versions__vid__get","parameters":[{"name":"vid","in":"path","required":true,"schema":{"type":"integer","title":"Vid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/rule-versions/{vid}/rollback":{"post":{"summary":"Rollback Version","operationId":"rollback_version_api_rule_versions__vid__rollback_post","parameters":[{"name":"vid","in":"path","required":true,"schema":{"type":"integer","title":"Vid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/hazard-matrix":{"get":{"summary":"Get Hazard Matrix","operationId":"get_hazard_matrix_api_hazard_matrix_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"put":{"summary":"Update Hazard Matrix","operationId":"update_hazard_matrix_api_hazard_matrix_put","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"P"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/config":{"get":{"summary":"Get Config","operationId":"get_config_api_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"put":{"summary":"Put Config","operationId":"put_config_api_config_put","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"P"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/logs":{"get":{"summary":"List Logs","operationId":"list_logs_api_logs_get","parameters":[{"name":"action","in":"query","required":false,"schema":{"type":"string","default":"","title":"Action"}},{"name":"level","in":"query","required":false,"schema":{"type":"string","default":"","title":"Level"}},{"name":"keyword","in":"query","required":false,"schema":{"type":"string","default":"","title":"Keyword"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/logs/files":{"get":{"summary":"List Log Files","description":"按日归档的运行日志/错误日志文件清单（保留 90 天）。","operationId":"list_log_files_api_logs_files_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/logs/file":{"get":{"summary":"Read Log File","description":"读取运行日志/错误日志内容（date=current 或 YYYY-MM-DD，倒序返回）。","operationId":"read_log_file_api_logs_file_get","parameters":[{"name":"type","in":"query","required":false,"schema":{"type":"string","default":"app","title":"Type"}},{"name":"date","in":"query","required":false,"schema":{"type":"string","default":"current","title":"Date"}},{"name":"keyword","in":"query","required":false,"schema":{"type":"string","default":"","title":"Keyword"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":300,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/system/backup":{"post":{"summary":"Backup","description":"数据备份导出：SQLite 直接备份库文件；其余数据库导出 JSON 快照。","operationId":"backup_api_system_backup_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/system/info":{"get":{"summary":"System Info","operationId":"system_info_api_system_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/healthz":{"get":{"summary":"Healthz","operationId":"healthz_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/open/v1/health":{"get":{"tags":["开放接口 /api/open/v1"],"summary":"健康检查","operationId":"health_api_open_v1_health_get","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"开放接口 Token","title":"X-Api-Key"},"description":"开放接口 Token"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/open/v1/materials":{"get":{"tags":["开放接口 /api/open/v1"],"summary":"查询物资参数库","operationId":"materials_api_open_v1_materials_get","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"开放接口 Token","title":"X-Api-Key"},"description":"开放接口 Token"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/open/v1/carriers":{"get":{"tags":["开放接口 /api/open/v1"],"summary":"查询载体参数库","operationId":"carriers_api_open_v1_carriers_get","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"开放接口 Token","title":"X-Api-Key"},"description":"开放接口 Token"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/open/v1/rules":{"get":{"tags":["开放接口 /api/open/v1"],"summary":"查询当前生效规则","operationId":"rules_api_open_v1_rules_get","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"开放接口 Token","title":"X-Api-Key"},"description":"开放接口 Token"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/open/v1/tasks":{"post":{"tags":["开放接口 /api/open/v1"],"summary":"提交核算任务并立即求解","operationId":"submit_task_api_open_v1_tasks_post","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"开放接口 Token","title":"X-Api-Key"},"description":"开放接口 Token"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenTaskIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/open/v1/plans/{plan_id}":{"get":{"tags":["开放接口 /api/open/v1"],"summary":"查询核算方案（含每件坐标与朝向）","operationId":"plan_detail_api_open_v1_plans__plan_id__get","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"integer","title":"Plan Id"}},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"开放接口 Token","title":"X-Api-Key"},"description":"开放接口 Token"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/open/v1/plans/{plan_id}/export":{"get":{"tags":["开放接口 /api/open/v1"],"summary":"导出方案单/明细（word|excel）","operationId":"export_api_open_v1_plans__plan_id__export_get","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"integer","title":"Plan Id"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","pattern":"^(word|excel)$","default":"word","title":"Format"}},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"开放接口 Token","title":"X-Api-Key"},"description":"开放接口 Token"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_import_carriers_api_carriers_import_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_import_carriers_api_carriers_import_post"},"Body_import_materials_api_materials_import_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_import_materials_api_materials_import_post"},"Body_import_task_list_api_tasks_import_list_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_import_task_list_api_tasks_import_list_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"OpenItem":{"properties":{"material_code":{"type":"string","title":"Material Code","description":"物资编码"},"qty":{"type":"integer","exclusiveMinimum":0.0,"title":"Qty","description":"核算数量"}},"type":"object","required":["material_code","qty"],"title":"OpenItem"},"OpenTaskIn":{"properties":{"name":{"type":"string","title":"Name","description":"任务名称","default":"外部系统核算任务"},"items":{"items":{"$ref":"#/components/schemas/OpenItem"},"type":"array","title":"Items","description":"物资清单"},"carrier_codes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Carrier Codes","description":"候选载体编码；为空则使用全部启用载体"}},"type":"object","required":["items"],"title":"OpenTaskIn"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}