From db7d37a98dea9a9dda1d99502d38c162679f041e Mon Sep 17 00:00:00 2001 From: tangxuan <2233783319@qq.com> Date: Wed, 29 Mar 2023 19:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=B2=E4=BD=93=E7=94=A8=E9=87=8F=E5=AF=86?= =?UTF-8?q?=E5=BA=A6=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db_logic/medicament.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/db_logic/medicament.py b/db_logic/medicament.py index e7a75ca..45c9468 100644 --- a/db_logic/medicament.py +++ b/db_logic/medicament.py @@ -387,7 +387,7 @@ class BllMedicament(Repository): client_code=entityClient.client_code, variety_id=entityDrug.variety_id, medicament_id=entityDrug.medicament_id, - price=entityDrug.price, + price=float(entityDrug.price) if entityDrug.price else 0, use_quantity=float(lastRemain) - float(entityDrug.remain if entityDrug.remain else 0), record_type=DrugRecordType.Return, record_remain=float(entityDrug.remain), @@ -397,6 +397,13 @@ class BllMedicament(Repository): create_user_name=entityUser.real_name, ) + # 液体用量数据保存 + medicament_variety_obj = BllMedicamentVariety().findEntity( + EntityMedicamentVariety.variety_id == entityDrug.variety_id) + if medicament_variety_obj.net_weight_unit == 'ml' and medicament_variety_obj.density: + use_volume = (float(lastRemain) - float( + entityDrug.remain if entityDrug.remain else 0)) / medicament_variety_obj.density + entityDrugRecord.use_volume = use_volume self.session.add(entityDrugRecord) entityVariety = BllMedicamentVariety().findEntity(entityDrug.variety_id) if(entityDrug.remain != 0):