diff --git a/apps/drug_template/views.py b/apps/drug_template/views.py index a6f8ebf..57df52d 100644 --- a/apps/drug_template/views.py +++ b/apps/drug_template/views.py @@ -39,6 +39,9 @@ def show_template(): new_data_list = [] for i in data: all_export_cout=0 + # 添加容错,模板内容为空直接跳过 + if i["template_content"] == 'null' or not i["template_content"]: + continue for a in eval(i["template_content"]): all_export_cout += int(a.get("export_count", 0)) new_dic = { @@ -156,6 +159,10 @@ def add_tmp_info(): start_bar_code = max_barcode try: + if not tmp_content or tmp_content == 'null': + return jsonify(Utils.false_return(msg="模板内容有误")) + if not tmp_name: + tmp_name = f'入库模板_{Utils.getFileName()}' if isinstance(tmp_content, str): tmp_content = eval(tmp_content) # total_count = 0