Commit 6bceb15e by Aeolus

update

parent 7780c010
......@@ -24,7 +24,7 @@ def run_machine_mac_upload():
json_data = request.get_json()
machine_no = json_data["machine_no"]
mac = json_data["mac"]
machine = Machine.query.filter_by(machine_no=machine_no, status=1).first()
if not machine:
return jsonify(MACHINE_NOT_EXIST_ERROR)
......@@ -39,7 +39,7 @@ def run_machine_power_upload():
json_data = request.get_json()
machine_no = json_data["machine_no"]
power = json_data["power"]
machine = Machine.query.filter_by(machine_no=machine_no, status=1).first()
if not machine:
return jsonify(MACHINE_NOT_EXIST_ERROR)
......@@ -54,7 +54,7 @@ def run_machine_hatch_number_upload():
json_data = request.get_json()
machine_no = json_data["machine_no"]
hatch_number = json_data["hatch_number"]
machine = Machine.query.filter_by(machine_no=machine_no, status=1).first()
if not machine:
return jsonify(MACHINE_NOT_EXIST_ERROR)
......@@ -69,11 +69,11 @@ def run_machine_hatch_data_upload():
json_data = request.get_json()
machine_no = json_data["machine_no"]
hatch_data = json_data["in_stock"]
machine = Machine.query.filter_by(machine_no=machine_no, status=1).first()
if not machine:
return jsonify(MACHINE_NOT_EXIST_ERROR)
Hatch.query.filter(Hatch.hatch_no.in_(hatch_data)).update({"status": 1})
db.session.commit()
Hatch.query.filter(Hatch.hatch_no.notin_(hatch_data)).update({"status": 2})
......@@ -85,9 +85,11 @@ def run_machine_hatch_data_upload():
def run_get_machine_no():
json_data = request.get_json()
qrcode_no = json_data["qrcode_no"]
machine = Machine.query.filter_by(qrcode_no=qrcode_no, status=1).first()
if machine:
if machine.machine_no == qrcode_no:
return BaseResponse(data={"machine_no": "0000000000"})
return BaseResponse(data={"machine_no": machine.machine_no})
else:
return jsonify(MACHINE_NOT_EXIST_ERROR)
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