diff --git a/apps/drug_form/views.py b/apps/drug_form/views.py index d23e034..b87caa7 100644 --- a/apps/drug_form/views.py +++ b/apps/drug_form/views.py @@ -54,14 +54,19 @@ def add_update_drug_form(): setattr(obj, 'is_del', 0) bll_obj.update(obj) else: - obj = EntityMedicamentExtend() - for i in finds: - setattr(obj, i, request.values.get(i)) - sort_index = bll_obj.execute( - "select max(sort_index) sort_index from rms_medicament_extend").fetchone() - setattr(obj, "sort_index", int(sort_index.sort_index or '0') + 1) - bll_obj.insert(obj) - return jsonify(Utils.true_return()) + count_num = bll_obj.execute( + "select count(id) count_num from rms_medicament_extend").fetchone() + if count_num.count_num < 30: + obj = EntityMedicamentExtend() + for i in finds: + setattr(obj, i, request.values.get(i)) + sort_index = bll_obj.execute( + "select max(sort_index) sort_index from rms_medicament_extend").fetchone() + setattr(obj, "sort_index", int(sort_index.sort_index or '0') + 1) + bll_obj.insert(obj) + return jsonify(Utils.true_return()) + else: + return jsonify(Utils.false_return()) @drug_form_router.route("/del", methods=["GET", "POST"]) @token_auth.login_required