Dockerfile 部署
This commit is contained in:
@@ -435,6 +435,44 @@ def sync_receipts():
|
||||
except Exception as e:
|
||||
return jsonify({"success": False, "message": f"系统错误: {str(e)}"}), 500
|
||||
|
||||
@app.route('/api/sync_issue_receipts', methods=['POST'])
|
||||
def sync_issue_receipts():
|
||||
"""触发后台运行发料单明细增量抓取脚本"""
|
||||
global is_browser_busy
|
||||
import sys
|
||||
|
||||
if is_browser_busy:
|
||||
return jsonify({
|
||||
"success": False,
|
||||
"message": f"系统忙碌:当前正在执行 '{current_task_name}',请稍后再试。"
|
||||
}), 409
|
||||
|
||||
if str(BROWSER_LOGIN_DIR) not in sys.path:
|
||||
sys.path.insert(0, str(BROWSER_LOGIN_DIR))
|
||||
|
||||
def run_issue_receipt_sync():
|
||||
set_browser_busy("手动发料单明细增量同步")
|
||||
try:
|
||||
from fetch_issue_receipt_incremental import fetch_issue_receipt_incremental
|
||||
fetch_issue_receipt_incremental()
|
||||
except Exception as e:
|
||||
print(f"发料单明细增量同步失败: {e}")
|
||||
finally:
|
||||
release_browser()
|
||||
|
||||
try:
|
||||
threading.Thread(target=run_issue_receipt_sync, daemon=True).start()
|
||||
|
||||
return jsonify({
|
||||
"success": True,
|
||||
"message": "发料单明细增量抓取任务已在后台启动!请观察运行日志。",
|
||||
"logs": "任务已在后台运行..."
|
||||
})
|
||||
except ImportError:
|
||||
return jsonify({"success": False, "message": "找不到发料单增量抓取脚本或导入失败"}), 404
|
||||
except Exception as e:
|
||||
return jsonify({"success": False, "message": f"系统错误: {str(e)}"}), 500
|
||||
|
||||
@app.route('/api/sync_work_orders', methods=['POST'])
|
||||
def sync_work_orders():
|
||||
"""触发后台运行生产工单增量抓取脚本"""
|
||||
|
||||
Reference in New Issue
Block a user