diff --git a/apps/drug/views.py b/apps/drug/views.py index e20eeba..3024012 100644 --- a/apps/drug/views.py +++ b/apps/drug/views.py @@ -164,13 +164,15 @@ def drug_add_update(): ] medicament_id = request.values.get("medicament_id") bar_code = request.values.get("bar_code") - medicament_obj = BllMedicament().findEntity(medicament_id) + medicament_obj = BllMedicament().findEntity( + EntityMedicament.medicament_id == medicament_id) if medicament_id: obj = BllMedicament().findEntity(EntityMedicament.bar_code == bar_code) if obj.medicament_id == medicament_obj.medicament_id: for i in finds_list: setattr(medicament_obj, i, request.values.get(i)) BllMedicament().update(medicament_obj) + return jsonify(Utils.true_return(msg="修改成功")) else: return jsonify(Utils.true_return(msg="条码不能重复")) return jsonify(Utils.true_return(msg="试剂id不能为空")) @@ -178,6 +180,7 @@ def drug_add_update(): # 流转记录 @drug_router.route("/get_durg_record", methods=["GET", "POST"]) @token_auth.login_required +@token_auth.login_required def get_durg_record(): page = int(request.values.get("page", 1)) page_size = int(request.values.get("page_size", 10)) @@ -192,7 +195,7 @@ def get_durg_record(): ################################# # 分配禁用用户 @drug_router.route("/user_ban_list", methods=["GET", "POST"]) -# @token_auth.login_required +@token_auth.login_required def drug_ban_user_list(): seach_user = request.values.get("seach_user") page = int(request.values.get("page", 1)) @@ -203,7 +206,7 @@ def drug_ban_user_list(): # 确认禁用 @drug_router.route("/user_ban_confirm", methods=["GET", "POST"]) -# @token_auth.login_required +@token_auth.login_required def drug_ban_user_confirm(): user_id = request.values.get("user_id") drug_id = request.values.get("drug_id") @@ -215,6 +218,7 @@ def drug_ban_user_confirm(): # 获取用户禁用试剂列表 @drug_router.route("/user_ban_drug_list", methods=["GET", "POST"]) +@token_auth.login_required def get_user_ban_drug_list(): user_id = request.values.get("user_id") data_list = BllUserMedicament().get_user_drug_name(user_id) @@ -222,6 +226,7 @@ def get_user_ban_drug_list(): # 取消禁用试剂 @drug_router.route("/user_ban_relieve", methods=["GET", "POST"]) +@token_auth.login_required def user_ban_relieve(): user_id = request.values.get("user_id") drug_list = request.values.get("drug_list") @@ -235,6 +240,7 @@ def user_ban_relieve(): # msds数据展示 @drug_router.route("/msds_db_list", methods=["GET", "POST"]) +@token_auth.login_required def get_msds_list(): seach_word = request.values.get("seach_word") page = int(request.values.get("page", 1)) @@ -246,6 +252,7 @@ def get_msds_list(): # 危化品数据展示 @drug_router.route("/dangerous_db_list", methods=["GET", "POST"]) +@token_auth.login_required def get_dangerous_list(): seach_word = request.values.get("seach_word") page = int(request.values.get("page", 1)) diff --git a/demo.py b/demo.py index 5503d04..4e310d2 100644 --- a/demo.py +++ b/demo.py @@ -318,4 +318,26 @@ def get_month(num): month_list.sort() return month_list -print(get_month(48)) \ No newline at end of file +print(get_month(48)) + +""" + +medicament_id: 157b7dd1-0e46-11ed-b1ca-f47b094925e1 +name: 硫酸 +english_name: +bar_code: 10001 +cas_number: 4214234 +purity: 国标 +shelf_life: 10 +production_date: 2022-07-28 15:22:48 +expiration_date: 2023-07-28 15:22:48 +use_days_warning_value: 432414 +shelf_life_warning_value: 42134214 +inventory_warning_value: 432141 +speci: +net_weight_unit: g +net_weight: 100 +is_supervise: 1 +is_weigh: 1 + +""" \ No newline at end of file