Commit ba0f3f50 by 冯佳佳

update

parent 6f125435
...@@ -291,7 +291,23 @@ def run_tally_over(): ...@@ -291,7 +291,23 @@ def run_tally_over():
json_data = request.get_json() json_data = request.get_json()
machine_no = json_data['machine_no'] machine_no = json_data['machine_no']
hatch_no = json_data['hatch_no'] hatch_no = json_data['hatch_no']
tally_type = json_data["type"] # 补货类型 1全部缺货锁 2打开指定仓号
user_id = g.user.id user_id = g.user.id
if tally_type == 1:
for i in hatch_no:
tally_record = TallyRecord.query.filter(TallyRecord.user_no == g.user.user_no,
TallyRecord.machine_no == machine_no,
TallyRecord.hatch_no == i,
TallyRecord.status == 1).order_by(TallyRecord.id.desc()).first()
if tally_record:
tally_record.status = 2
db.session.add(tally_record)
db.session.commit()
hatch = Hatch.query.filter_by(machine_no=machine_no, hatch_no=hatch_no, status=2).update({"status": 1})
db.session.commit()
elif tally_type == 2:
tally_record = TallyRecord.query.filter(TallyRecord.user_no == g.user.user_no, TallyRecord.machine_no == machine_no, tally_record = TallyRecord.query.filter(TallyRecord.user_no == g.user.user_no, TallyRecord.machine_no == machine_no,
TallyRecord.hatch_no == hatch_no, TallyRecord.hatch_no == hatch_no,
TallyRecord.status == 1).order_by(TallyRecord.id.desc()).first() TallyRecord.status == 1).order_by(TallyRecord.id.desc()).first()
...@@ -303,6 +319,8 @@ def run_tally_over(): ...@@ -303,6 +319,8 @@ def run_tally_over():
hatch.status = 1 hatch.status = 1
db.session.add(hatch) db.session.add(hatch)
db.session.commit() db.session.commit()
else:
pass
return BaseResponse() return BaseResponse()
......
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