- kpi_definitions entity1 新增3条派生KPI(456/457/458, formula/threshold/unit齐全) - 新增 scripts/kpi_bep_deriver.py: 从 voucher_details 按财务口径聚合 (5001销售收入/5602管理费 YTD月均, 渠补率政策84.61%) → 计算保本销售额/ 覆盖率/缺口 → upsert kpi_values source_type='derived' 幂等 + 同步yellow/red预警 - cron 06:35 注册(紧随 collector 06:30); 自动选最近完整月(8月未结账自动回退7月) - kpis.py get_kpi: F_BEP_* 派生KPI按静态阈值文本判红黄绿(66.9→黄), 不走target比率 - 阈值经财务Bot 2026-09-08裁决: COVER >=100绿 50~100黄 <50红; GAP <=0绿 <=50黄 >50红
35 lines
2.1 KiB
SQL
35 lines
2.1 KiB
SQL
-- CMA BEP(保本点) 派生KPI定义 — cma-bep-kpi-20260908
|
|
-- 陕西酣客 entity_id=1,仅新增,不回退现有逻辑
|
|
-- 口径: 财务Bot权威文件 陕西酣客_保本点分析_2026年1-7月.md
|
|
-- 渠补率=84.61%(厂家政策,571103/5001累计验证84.05%~84.61%区间)
|
|
-- 边际贡献率=1-渠补率=15.39%
|
|
-- 保本销售额=月均管理费(5602借方,含折旧) ÷ 15.39% → 26.2万/15.39% = 170.3万
|
|
-- 覆盖率=月均销售(5001贷方)÷保本销售额 → 113.5/170.3 = 66.7%
|
|
|
|
INSERT INTO kpi_definitions
|
|
(entity_id, kpi_code, kpi_name, dimension, category, formula, formula_desc,
|
|
data_source_type, data_source, data_owner, frequency, unit, target_value,
|
|
target_calc_type, threshold_green, threshold_yellow, threshold_red,
|
|
kpi_level, status, bot_source, epic, created_by)
|
|
VALUES
|
|
(1, 'F_BEP_REVENUE', '保本销售额', 'finance', 'profitability',
|
|
'round(月固定成本/边际贡献率,1)',
|
|
'账面口径=月管理费(5602借方月均,含折旧)÷(1-渠补率84.61%); 中性参考值, 越高需更多销售覆盖',
|
|
'derived', 'BEP派生器 kpi_bep_deriver.py(voucher_details 5602月均)', '财务部', 'monthly', '万元', 0,
|
|
'ratio', NULL, NULL, NULL,
|
|
'strategic', 'active', 'finance-bot', 'Epic2', 1),
|
|
|
|
(1, 'F_BEP_COVER', '保本覆盖率', 'finance', 'profitability',
|
|
'round(实际月销/保本销售额*100,1)',
|
|
'实际月销(5001贷方月均)÷保本销售额; 正向指标: >=100绿 >=85黄 <85红; 66.7%=账面口径当前态(2026-07)',
|
|
'derived', 'BEP派生器 kpi_bep_deriver.py(voucher_details 5001月均)', '财务部', 'monthly', '%', 100,
|
|
'ratio', '>=100', '>=85', '<85',
|
|
'strategic', 'active', 'finance-bot', 'Epic2', 1),
|
|
|
|
(1, 'F_BEP_GAP', '保本缺口', 'finance', 'profitability',
|
|
'round((保本销售额-实际月销)/保本销售额*100,1)',
|
|
'反向指标(缺口越小越好): <=0绿(已保本) <=15黄 >15红; 当前约33%=月销距保本差33%',
|
|
'derived', 'BEP派生器 kpi_bep_deriver.py(voucher_details 5001月均)', '财务部', 'monthly', '%', 0,
|
|
'ratio', '<=0', '<=15', '>15',
|
|
'strategic', 'active', 'finance-bot', 'Epic2', 1);
|