fix(pl): 未打标计划按生效时间判断是否走客户品类额度规则。
安排前版本为空时不再一律当成旧规则,归档和实际调整与安排判定保持一致。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3f62af430f
commit
f9d031bacb
1 file changed
+6
-4
@@ -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
|
||||
):
|
||||
|
||||
Reference in new issue
Block a user