float余量无值异常处理

duizhaopin
tangxuan 2 years ago
parent 88f1fbe2eb
commit ad8ef1a930

@ -378,7 +378,7 @@ class BllMedicament(Repository):
self.session.merge(entityDrug) self.session.merge(entityDrug)
drug = BllMedicament().findEntity(entityDrug.medicament_id) 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: if entityClient.client_id not in client_list:
entityDrugRecord = EntityMedicamentRecord( entityDrugRecord = EntityMedicamentRecord(
@ -390,7 +390,7 @@ class BllMedicament(Repository):
price=float(entityDrug.price) if entityDrug.price else 0, price=float(entityDrug.price) if entityDrug.price else 0,
use_quantity=float(lastRemain) - float(entityDrug.remain if entityDrug.remain else 0), use_quantity=float(lastRemain) - float(entityDrug.remain if entityDrug.remain else 0),
record_type=DrugRecordType.Return, 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, is_empty=1 if(entityDrug.status == DrugStatus.Empty) else 0,
create_date=Utils.get_str_datetime(), create_date=Utils.get_str_datetime(),
create_user_id=entityUser.user_id, create_user_id=entityUser.user_id,
@ -414,7 +414,7 @@ class BllMedicament(Repository):
self.session.merge(entityVariety) self.session.merge(entityVariety)
self.commitTrans() 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 return remain_result
# 药剂登记 # 药剂登记

Loading…
Cancel
Save