危化品数据库接口bug修复;

删除试剂接口
duizhaopin
apan 2 years ago
parent 29494e15c0
commit 2669912f90

@ -154,7 +154,7 @@ def get_drug_manage():
# 编辑数据
@drug_router.route("/update", methods=["GET", "POST"])
@token_auth.login_required
def drug_add_update():
def drug_update():
finds_list = [
"name", "english_name", "bar_code", "cas_number",
"purity", "shelf_life", "production_date", "expiration_date",
@ -177,6 +177,19 @@ def drug_add_update():
return jsonify(Utils.true_return(msg="条码不能重复"))
return jsonify(Utils.true_return(msg="试剂id不能为空"))
# 编辑数据
@drug_router.route("/del", methods=["GET", "POST"])
@token_auth.login_required
def drug_del():
drug_id = request.values.get("medicament_id")
try:
BllMedicament().delete(EntityMedicament.medicament_id==drug_id)
return jsonify(Utils.true_return())
except Exception:
return jsonify(Utils.except_return(msg="删除失败"))
# 流转记录
@drug_router.route("/get_durg_record", methods=["GET", "POST"])
@token_auth.login_required

@ -21,9 +21,11 @@ class BllDangerous(Repository):
filter_base = ""
if seach_word:
seach_word = f"'%{seach_word}%'"
filter_base += f" name like {seach_word} or english_name like {seach_word}"
filter_base += f" name like {seach_word} or english_name like {seach_word} "
if filter_base:
filter_base = f" where {filter_base} "
sql_all = f"""
select * from rms_msds {filter_base}
select * from rms_dangerous {filter_base}
"""
try:
count_number = len(self.execute(sql_all).fetchall())

@ -114,3 +114,23 @@ class BllMedicamentVariety(Repository):
# new_data = dict(data_dict, **med)
# new_data_list.append(new_data)
# return new_data_list
# def inster_type_drug(self):
# name_list = ["氧化钠", "砷", "硫酸"]
# for i in name_list:
# obj = EntityMedicamentVariety(
# name=i,
# purity='国标',
# inventory_warning_value=10,
# shelf_life_warning_value=10,
# use_days_warning_value=10,
# empty_count=0,
# use_count=0,
# normal_count=10,
# total_count=10,
# create_date=Utils.get_str_datetime(),
# create_user_id='4cea74ee-0d8b-11ed-943e-f47b094925e1'
# )
# self.insert(obj)
# if __name__ == '__main__':
# BllMedicamentVariety().inster_type_drug()

@ -23,7 +23,9 @@ class BllMsDs(Repository):
filter_base = ""
if seach_word:
seach_word = f"'%{seach_word}%'"
filter_base += f" name like {seach_word} or english_name like {seach_word}"
filter_base += f" name like {seach_word} or english_name like {seach_word} "
if filter_base:
filter_base = f" where {filter_base} "
sql_all = f"""
select * from rms_msds {filter_base}
"""

Loading…
Cancel
Save