Commit fd2e218f by Aeolus

解锁仓功能

parent 284c35e0
......@@ -208,3 +208,26 @@ def tool_hatch_no_lock():
db.session.commit()
return jsonify(BASE_RESPONSE().to_dict())
@route_tool.route('/hatch_no_unlock', methods=["POST"])
def tool_hatch_no_unlock():
json_data = request.get_json()
mac_no = json_data.get('mac_no', None)
hatch_no = json_data.get('hatch_no', None)
if not mac_no or not hatch_no:
return jsonify({'code': -1, 'msg': 'params error'})
machine_info = Machine.query.filter_by(mac_no=mac_no).first()
if not machine_info:
return jsonify(MACHINE_NOT_EXIST_ERROR)
power_info = Power.query.filter_by(machine_id=machine_info.id, hatch_no=hatch_no).first()
if power_info:
power_info.status = 2
db.session.add(power_info)
db.session.commit()
return jsonify(BASE_RESPONSE().to_dict())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment