From f9d031bacb60ee9a8ce499605aa01a7fd4667717 Mon Sep 17 00:00:00 2001 From: wuzilong <704541015@qq.com> Date: Wed, 18 Nov 2026 13:50:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(pl):=20=E6=9C=AA=E6=89=93=E6=A0=87=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E6=8C=89=E7=94=9F=E6=95=88=E6=97=B6=E9=97=B4=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=98=AF=E5=90=A6=E8=B5=B0=E5=AE=A2=E6=88=B7=E5=93=81?= =?UTF-8?q?=E7=B1=BB=E9=A2=9D=E5=BA=A6=E8=A7=84=E5=88=99=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 安排前版本为空时不再一律当成旧规则,归档和实际调整与安排判定保持一致。 Co-authored-by: Cursor --- backend/app/services/pl_quota_business.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/app/services/pl_quota_business.py b/backend/app/services/pl_quota_business.py index 4a6832b29..1673b7839 100644 --- a/backend/app/services/pl_quota_business.py +++ b/backend/app/services/pl_quota_business.py @@ -121,17 +121,19 @@ def apply_plan_quota(db, user, plan, action, payload=None): sourceNote=getattr(payload, 'quota_source_note', None)) from app.services.pl_quota_waiver import assert_waived_sources, quota_cert_waived from app.services.pl_cert_quota_rule_config_service import ( + plan_applies_customer_category_rule, plan_skips_archive_cert_quota, - plan_uses_customer_category, ) + tenant_no = getattr(user, 'tenant_no', None) or '' + customer_rule = plan_applies_customer_category_rule(db, tenant_no, plan) # 新规则:齐备仅放行安排/改派预占;归档与实际调整必须真证结转。 # 切点前首次安排:归档/实调不校证件(无需齐备);齐备仍可跳过安排预占。 skip_actions = ('reserve', 'resize') - if not plan_uses_customer_category(plan): + if not customer_rule: skip_actions = ('reserve', 'resize', 'settle', 'actual_adjust') grandfather_archive_skip = ( action in ('settle', 'actual_adjust') - and plan_skips_archive_cert_quota(plan, db, getattr(user, 'tenant_no', None)) + and plan_skips_archive_cert_quota(plan, db, tenant_no) ) if grandfather_archive_skip: return {'operationId': ledger_id, 'usageIds': [], 'waived': True, 'skippedCertQuota': True} @@ -140,7 +142,7 @@ def apply_plan_quota(db, user, plan, action, payload=None): assert_waived_sources(db, user, plan, lock=True) return {'operationId': ledger_id, 'usageIds': [], 'waived': True} if ( - plan_uses_customer_category(plan) + customer_rule and action in ('settle', 'actual_adjust') and int(getattr(plan, 'quota_cert_pending_fulfill', 0) or 0) == 1 ):