diff --git a/README.md b/README.md index 7362847..e7ef03f 100644 --- a/README.md +++ b/README.md @@ -1 +1,9 @@ # RMS后台管理系统4.0 + +库存判断模块 +时间,人,终端,详情,序号 +点击详情界面 +展示试剂名称:输入量,库存量 + +手动入库模板需求 +根据输入名称搜索数据库内的分组试剂数据,点击分组数据后进行填充表单界面 diff --git a/apps/drug_template/views.py b/apps/drug_template/views.py index d2ea949..7cec796 100644 --- a/apps/drug_template/views.py +++ b/apps/drug_template/views.py @@ -51,7 +51,7 @@ def show_template(): # 添加容错,模板内容为空直接跳过 if i["template_content"] == 'null' or not i["template_content"]: continue - for a in eval(i["template_content"]): + for a in json.loads(i["template_content"]): all_export_cout += int(a.get("export_count", 0)) new_dic = { "all_export_count": all_export_cout, @@ -187,7 +187,8 @@ def add_tmp_info(): if not tmp_name: tmp_name = f'入库模板_{Utils.getFileName()}' if isinstance(tmp_content, str): - tmp_content = eval(tmp_content) + # tmp_content = eval(tmp_content) + tmp_content = json.loads(tmp_content) # total_count = 0 # for i in tmp_content: # total_count += int(i['export_count']) @@ -318,10 +319,14 @@ def get_file_list(): @tmp_router.route("/pring_bar_code", methods=["POST"]) @token_auth.login_required def print_code_data(): - start = request.values.get("start_code") - end = request.values.get("end_code") + template_id = request.values.get("template_id") + # start = request.values.get("start_code") + # end = request.values.get("end_code") + # temp_obj_list = BllMedicamentTemplate().findList(EntityMedicamentTemplate.template_id._in(template_id_list)).all() obj = CreateBarcode() - for i in range(int(start), int(end)): + print(template_id) + temp = BllMedicamentTemplate().findEntity(EntityMedicamentTemplate.template_id == template_id) + for i in range(int(temp.start_bar_code), int(temp.start_bar_code) + int(temp.bar_code_count)): obj.create_Code128_img(str(i)) return jsonify(Utils.true_return(msg="成功")) @@ -343,3 +348,10 @@ def print_code_data(): # return jsonify(Utils.true_return(data=Utils.msyql_table_model(data))) +# 获取分组后的试剂列表 +@tmp_router.route("/get_drug_group_list", methods=["POST"]) +@token_auth.login_required +def drug_group_list(): + data = BllMedicament().drug_group_info_list() + data_list = Utils.msyql_table_model(data) + return jsonify(Utils.true_return(data=data_list)) diff --git a/db_logic/medicament.py b/db_logic/medicament.py index 3746810..349a060 100644 --- a/db_logic/medicament.py +++ b/db_logic/medicament.py @@ -474,6 +474,18 @@ class BllMedicament(Repository): """ return self.execute(sql_all).fetchall() + # 手动输入入库模板时,获取分组后的试剂信息列表 + def drug_group_info_list(self): + sql_all = f""" + select + medicament_id, name as value, english_name, + cas_number, purity, production_date, + expiration_date, manufacturer,distributor,speci, + net_weight_unit, total from rms_medicament + group by `name`, speci, purity + """ + return self.execute(sql_all).fetchall() + def inster_log_shiji(self): import random name_list = ["砷", "硫酸", "氧化钠"]