Commit b01f5bd1 by Aeolus

update

parent 1cdf4683
...@@ -51,7 +51,7 @@ def run_hatch_list(): ...@@ -51,7 +51,7 @@ def run_hatch_list():
where_sql = " where 0=0" where_sql = " where 0=0"
else: else:
where_sql = """ where hatch.machine_no in ( select machine_no from admin_machine where where_sql = """ where hatch.machine_no in ( select machine_no from admin_machine where
admin_machine.user_id = {user_id} and admin_machine.status = 1) admin_machine.user_id = '{user_id}' and admin_machine.status = 1)
""".format(user_id=admin.id) """.format(user_id=admin.id)
if keyword: if keyword:
where_sql += """ where_sql += """
......
...@@ -51,7 +51,7 @@ def run_machine_list(): ...@@ -51,7 +51,7 @@ def run_machine_list():
where_sql = " where 0=0 " where_sql = " where 0=0 "
else: else:
where_sql = """ where machine.machine_no in ( select machine_no from admin_machine where where_sql = """ where machine.machine_no in ( select machine_no from admin_machine where
admin_machine.user_id = {user_id} and admin_machine.status = 1)""".format(user_id=admin.id) admin_machine.user_id = '{user_id}' and admin_machine.status = 1)""".format(user_id=admin.id)
if keyword: if keyword:
where_sql += """ where_sql += """
and CONCAT(machine.machine_no,ifnull(machine.qrcode_no,'')) LIKE '%{keyword}%' and CONCAT(machine.machine_no,ifnull(machine.qrcode_no,'')) LIKE '%{keyword}%'
...@@ -198,9 +198,9 @@ def get_machine_detail(): ...@@ -198,9 +198,9 @@ def get_machine_detail():
where_sql = " where 0=0 " where_sql = " where 0=0 "
else: else:
where_sql = """ where machine.machine_no in ( select machine_no from admin_machine where where_sql = """ where machine.machine_no in ( select machine_no from admin_machine where
admin_machine.user_id = {user_id} and admin_machine.status = 1) """.format(user_id=admin.id) admin_machine.user_id = '{user_id}' and admin_machine.status = 1) """.format(user_id=admin.id)
where_sql += " and machine.machine_no = {}".format(machine_no) where_sql += " and machine.machine_no = '{}'".format(machine_no)
result = db.session.execute(select_sql + from_sql + where_sql).fetchall() result = db.session.execute(select_sql + from_sql + where_sql).fetchall()
if not result or len(result) != 1: if not result or len(result) != 1:
......
...@@ -42,7 +42,7 @@ def run_place_list(): ...@@ -42,7 +42,7 @@ def run_place_list():
where_sql = " where 0=0 " where_sql = " where 0=0 "
else: else:
where_sql = """ where place.id in ( select place_id from admin_place where where_sql = """ where place.id in ( select place_id from admin_place where
admin_place.user_id = {} and admin_place.status = 1) """.format(admin.id) admin_place.user_id = '{}' and admin_place.status = 1) """.format(admin.id)
if keyword: if keyword:
where_sql += """ where_sql += """
......
...@@ -50,7 +50,7 @@ def run_production_list(): ...@@ -50,7 +50,7 @@ def run_production_list():
where_sql = " where 0=0" where_sql = " where 0=0"
else: else:
where_sql = """ where p.id in ( select production_id from admin_production where where_sql = """ where p.id in ( select production_id from admin_production where
admin_production.user_id = {} and admin_production.status = 1 admin_production.user_id = '{}' and admin_production.status = 1
)""".format(admin.id) )""".format(admin.id)
if keyword: if keyword:
where_sql += """ where_sql += """
...@@ -234,9 +234,9 @@ def get_production_detail(): ...@@ -234,9 +234,9 @@ def get_production_detail():
else: else:
where_sql = """ where p.id in ( where_sql = """ where p.id in (
select production_id from admin_production where select production_id from admin_production where
admin_production.user_id = {} and admin_production.status = 1 admin_production.user_id = '{}' and admin_production.status = 1
)""".format(admin.id) )""".format(admin.id)
where_sql += " and p.id={}".format(production_id) where_sql += " and p.id='{}'".format(production_id)
result = db.session.execute(select_sql + from_sql + where_sql).fetchall() result = db.session.execute(select_sql + from_sql + where_sql).fetchall()
if not result or len(result) != 1: if not result or len(result) != 1:
...@@ -280,7 +280,7 @@ def run_brand_list(): ...@@ -280,7 +280,7 @@ def run_brand_list():
else: else:
where_sql = """ where b.id in ( where_sql = """ where b.id in (
select brand_id from admin_brand where select brand_id from admin_brand where
admin_brand.user_id = {} and admin_brand.status = 1 admin_brand.user_id = '{}' and admin_brand.status = 1
)""".format(admin.id) )""".format(admin.id)
if keyword: if keyword:
where_sql += """ where_sql += """
...@@ -377,9 +377,9 @@ def get_brand_detail(): ...@@ -377,9 +377,9 @@ def get_brand_detail():
else: else:
where_sql = """ where b.id in ( where_sql = """ where b.id in (
select brand_id from admin_brand where select brand_id from admin_brand where
admin_brand.user_id = {} and admin_brand.status = 1 admin_brand.user_id = '{}' and admin_brand.status = 1
)""".format(admin.id) )""".format(admin.id)
where_sql += " and b.id ={}".format(brand_id) where_sql += " and b.id ='{}'".format(brand_id)
result = db.session.execute(select_sql + from_sql + where_sql).fetchall() result = db.session.execute(select_sql + from_sql + where_sql).fetchall()
if not result or len(result) != 1: if not result or len(result) != 1:
...@@ -414,7 +414,7 @@ def run_production_type_list(): ...@@ -414,7 +414,7 @@ def run_production_type_list():
where_sql = " where 0=0" where_sql = " where 0=0"
else: else:
where_sql = """ where p.id in ( select production_type_id from admin_production_type where where_sql = """ where p.id in ( select production_type_id from admin_production_type where
admin_production_type.user_id = {} and admin_production_type.status = 1 admin_production_type.user_id = '{}' and admin_production_type.status = 1
) )
""".format(admin.id) """.format(admin.id)
if keyword: if keyword:
...@@ -508,10 +508,10 @@ def get_production_type_detail(): ...@@ -508,10 +508,10 @@ def get_production_type_detail():
where_sql = " where 0=0" where_sql = " where 0=0"
else: else:
where_sql = """ where p.id in ( select production_type_id from admin_production_type where where_sql = """ where p.id in ( select production_type_id from admin_production_type where
admin_production_type.user_id = {} and admin_production_type.status = 1 admin_production_type.user_id = '{}' and admin_production_type.status = 1
) )
""".format(admin.id) """.format(admin.id)
where_sql += " and b.id ={}".format(production_type_id) where_sql += " and b.id ='{}'".format(production_type_id)
result = db.session.execute(select_sql + from_sql + where_sql).fetchall() result = db.session.execute(select_sql + from_sql + where_sql).fetchall()
if not result or len(result) != 1: if not result or len(result) != 1:
......
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