From 1bd22d5837e4cad193e5a054cc36f184a9b7440d Mon Sep 17 00:00:00 2001 From: tangxuan <2233783319@qq.com> Date: Mon, 3 Apr 2023 14:41:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=9C=AA=E8=8E=B7=E5=BE=97?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db_logic/medicament.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db_logic/medicament.py b/db_logic/medicament.py index 28dd38f..846a1c1 100644 --- a/db_logic/medicament.py +++ b/db_logic/medicament.py @@ -965,6 +965,8 @@ class BllMedicament(Repository): # 从分类表中获取时间年份 medicament_variety_obj = BllMedicamentVariety().findEntity( EntityMedicamentVariety.variety_id == drug_entry.variety_id) + if not medicament_variety_obj: + return add_year = int(medicament_variety_obj.remark5) if medicament_variety_obj.remark5 else 1 date_now = datetime.datetime.now() add_expiration_date = (date_now + relativedelta(years=add_year)).strftime("%Y-%m-%d %H:%M:%S")