diff --git a/apps/drug/views.py b/apps/drug/views.py index 38836df..e0eaad1 100644 --- a/apps/drug/views.py +++ b/apps/drug/views.py @@ -594,3 +594,22 @@ def print_select_drug_code(): obj = CreateBarcode() obj.create_drug_lobel_code(**new_dict) return jsonify(Utils.true_return(msg="打印完成")) + + +@drug_router.route("/calculate_volume_weight", methods=["POST"]) +@token_auth.login_required +def calculate_volume_weight(): + """ + 计算体积转化为质量 M = P * V + :param variety_id: 类别ID + :param input_volume: 输入体积 + :return: + """ + variety_id = request.values.get("variety_id") + input_volume = request.values.get("input_volume") + + medicament_variety_obj = BllMedicamentVariety().findEntity( + EntityMedicamentVariety.variety_id == variety_id) + + weight = float(input_volume) * float(medicament_variety_obj.density) + return jsonify(Utils.true_return(msg="完成", data={"weight": Utils.reserve_decimal(weight)})) diff --git a/db_logic/medicament.py b/db_logic/medicament.py index ed0ced3..28dd38f 100644 --- a/db_logic/medicament.py +++ b/db_logic/medicament.py @@ -572,7 +572,7 @@ class BllMedicament(Repository): select a.*,b.client_name from ( select name, english_name,bar_code,manufacturer,speci,remain,purity,production_date,shelf_life,expiration_date,put_in_date,put_in_user_name, - status,by_user_name,client_id + status,by_user_name,client_id, is_packing, is_label, is_aspect from rms_medicament {filter_base} ) a LEFT JOIN( select client_id,client_name from rms_client {filter_base1} diff --git a/models/medicament_models.py b/models/medicament_models.py index 8212b3d..ba34338 100644 --- a/models/medicament_models.py +++ b/models/medicament_models.py @@ -7,7 +7,7 @@ import sys sys.path.append('.') # from common.utils import Utils -from sqlalchemy import Column, String, Integer, Text, Float, inspect +from sqlalchemy import Column, String, Integer, Text, Float, inspect, SmallInteger from models.models_base import Base, get_uuid # from sqlalchemy.ext.declarative import declarative_base @@ -208,6 +208,10 @@ class EntityMedicamentVariety(Base): create_user_id = Column(String(50), comment="创建用户ID") create_user_name = Column(String(50), comment="创建用户名称") is_add = Column(Integer, comment="", default=0) + # 1是 0否 + is_packing = Column(SmallInteger, default=1, comment="包装是否完好 1是 0否") + is_label = Column(SmallInteger, default=1, comment="标签是否清晰 1是 0否") + is_aspect = Column(SmallInteger, default=1, comment="外观是否符合要求 1是 0否") remark1 = Column(String(50), comment='扩展字段1 func_type类型') remark2 = Column(String(50), comment='扩展字段2')