diff --git a/db_logic/medicament.py b/db_logic/medicament.py index 64f836c..954d87e 100644 --- a/db_logic/medicament.py +++ b/db_logic/medicament.py @@ -378,7 +378,7 @@ class BllMedicament(Repository): self.session.merge(entityDrug) drug = BllMedicament().findEntity(entityDrug.medicament_id) - lastRemain = float(drug.remain) + lastRemain = float(drug.remain) if drug.remain else 0 if entityClient.client_id not in client_list: entityDrugRecord = EntityMedicamentRecord( @@ -390,7 +390,7 @@ class BllMedicament(Repository): 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), + record_remain=float(entityDrug.remain) if entityDrug.remain else 0, is_empty=1 if(entityDrug.status == DrugStatus.Empty) else 0, create_date=Utils.get_str_datetime(), create_user_id=entityUser.user_id, @@ -414,7 +414,7 @@ class BllMedicament(Repository): self.session.merge(entityVariety) self.commitTrans() - remain_result = self.calculate_use_drug(drug, weight_remain=float(entityDrug.remain)) + remain_result = self.calculate_use_drug(drug, weight_remain=float(entityDrug.remain if entityDrug.remain else 0)) return remain_result # 药剂登记