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):