From 978fa494b614361da4dbd526b8a32e3af41f5390 Mon Sep 17 00:00:00 2001 From: apan Date: Fri, 29 Jul 2022 16:09:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A8=A1=E6=9D=BF=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/drug_template/views.py | 7 +++++++ 1 file changed, 7 insertions(+) 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