@dazitech/cli 3.0.9 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/clis/dazi-app.js +2 -2
- package/dist/clis/dazi-flow.js +2 -2
- package/dist/clis/dazi-onto.js +324 -41
- package/dist/clis/dazi.js +407 -185
- package/dist/docs/flow/flow-project-guide.md +1 -1
- package/dist/docs/guides/cli-reference.md +16 -3
- package/dist/docs/guides/troubleshooting.md +3 -3
- package/dist/docs/index.json +3 -15
- package/dist/docs/onto/dazi_script_sdk_reference.md +246 -244
- package/dist/docs/onto/dazi_script_seed_data_guide.md +1 -1
- package/dist/docs/onto/function-guide.md +123 -123
- package/dist/docs/onto//346/234/254/344/275/223/345/210/206/347/261/273/350/247/204/345/210/222/344/270/216SDK/346/211/251/345/261/225/346/226/271/346/241/210.md +169 -168
- package/dist/docs/onto//346/234/254/344/275/223/345/221/275/345/220/215/350/247/204/350/214/203_/347/211/251/347/220/206/350/241/250Cube/344/270/216/345/257/271/350/261/241.md +403 -402
- package/dist/docs/onto//346/234/254/344/275/223/345/274/200/345/217/221/344/274/230/345/214/226/346/200/273/347/273/223.md +257 -0
- package/dist/docs/onto//346/234/254/344/275/223/350/204/232/346/234/254/347/274/226/345/206/231/346/214/207/345/215/227.md +339 -311
- package/dist/docs/onto//346/234/254/344/275/223/350/247/204/345/210/222/346/214/207/345/215/227.md +305 -281
- package/dist/docs/onto//350/204/232/346/234/254/350/277/220/350/241/214/345/270/270/350/247/201/351/224/231/350/257/257/345/244/204/347/220/206.md +297 -0
- package/dist/examples/index.json +222 -6
- package/dist/examples/onto/README.md +34 -36
- package/dist/examples/onto/_templates/onto_preflight.ps1 +84 -0
- package/dist/examples/onto/index.json +53 -0
- package/dist/examples/onto/index.yaml +29 -0
- package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/README.md +23 -0
- package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/save_test_arguments.ps1 +12 -11
- package/dist/{docs/onto → examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/plans}//350/247/204/345/210/222/347/244/272/344/276/213_/345/210/251/346/266/246/345/210/206/346/236/220/346/234/254/344/275/223/346/226/271/346/241/210.md +37 -35
- package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/setup/profit_category_mount.py +85 -0
- package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/setup/profit_ontology_init.py +3 -66
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/README.md +24 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/equip_ops_fn_availability_analysis.py +84 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/equip_ops_fn_downtime_breakdown.py +119 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/equip_ops_fn_energy_intensity.py +98 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/equip_ops_fn_get_summary.py +125 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/equip_ops_fn_maintenance_compliance.py +77 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/equip_ops_fn_mom_analysis.py +118 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/equip_ops_fn_oee_analysis.py +126 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/equip_ops_fn_plan_vs_actual.py +105 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/equip_ops_fn_top_fault_equipment.py +104 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/equip_ops_fn_unit_comparison.py +120 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/equip_ops_fn_yoy_analysis.py +115 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/save_test_arguments.ps1 +42 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/test_arguments/equip_ops.fn.availability_analysis.json +7 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/test_arguments/equip_ops.fn.downtime_breakdown.json +8 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/test_arguments/equip_ops.fn.energy_intensity.json +8 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/test_arguments/equip_ops.fn.get_summary.json +7 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/test_arguments/equip_ops.fn.maintenance_compliance.json +7 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/test_arguments/equip_ops.fn.mom_analysis.json +8 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/test_arguments/equip_ops.fn.oee_analysis.json +8 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/test_arguments/equip_ops.fn.plan_vs_actual.json +8 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/test_arguments/equip_ops.fn.top_fault_equipment.json +8 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/test_arguments/equip_ops.fn.unit_comparison.json +8 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/test_arguments/equip_ops.fn.yoy_analysis.json +8 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/plans//345/214/226/345/267/245/350/256/276/345/244/207/350/277/220/350/220/245/345/210/206/346/236/220/346/234/254/344/275/223/346/226/271/346/241/210.md +735 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/setup/equip_ops_category_mount.py +106 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/setup/equip_ops_ontology_init.py +1077 -0
- package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/setup/equip_ops_seed_data.py +552 -0
- package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/README.md +23 -0
- package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/save_test_arguments.ps1 +13 -12
- package/dist/{docs/onto → examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/plans}//350/247/204/345/210/222/347/244/272/344/276/213_/344/272/247/345/223/201/351/224/200/345/224/256/346/234/254/344/275/223/350/247/204/345/210/222/346/226/271/346/241/210.md +34 -34
- package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/setup/sales_category_mount.py +82 -0
- package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/setup/sales_ontology_init.py +3 -54
- package/dist/prompts/index.json +8 -1
- package/dist/prompts/onto/function-design.md +73 -73
- package/dist/prompts/onto/planning-design.md +226 -0
- package/dist/prompts/onto/script-publish-run.md +231 -208
- package/package.json +1 -1
- package/dist/docs/onto//350/204/232/346/234/254/350/277/220/350/241/214/347/272/240/351/224/231_/345/225/206/345/212/241/346/210/220/346/234/254/346/226/271/346/241/210/345/274/200/345/217/221/350/277/207/347/250/213.md +0 -213
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# onto_preflight.ps1 — 本体实施门禁(规划 ↔ 函数文件 ↔ 平台注册)
|
|
2
|
+
# 用法(在 dazi-work 根目录):
|
|
3
|
+
# .\项目\<业务>\本体\ontos\<实现>\functions\onto_preflight.ps1
|
|
4
|
+
# 或复制到 functions/ 后修改下方 $spaceId、$itemRel
|
|
5
|
+
|
|
6
|
+
param(
|
|
7
|
+
[string]$SpaceId = "space__misc_01",
|
|
8
|
+
[string]$ItemRel = "项目/DAZI_TEST/本体/ontos/销售本体示例"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
$ErrorActionPreference = "Stop"
|
|
12
|
+
$functionsDir = Join-Path $PSScriptRoot "."
|
|
13
|
+
$plansDir = Join-Path (Split-Path $PSScriptRoot -Parent) "plans"
|
|
14
|
+
|
|
15
|
+
Write-Host "=== 本体 preflight ===" -ForegroundColor Cyan
|
|
16
|
+
Write-Host "空间: $SpaceId"
|
|
17
|
+
Write-Host "实现: $ItemRel"
|
|
18
|
+
|
|
19
|
+
$exitCode = 0
|
|
20
|
+
|
|
21
|
+
# 1. functions/*.py 数量
|
|
22
|
+
$pyFiles = @(Get-ChildItem -Path $functionsDir -Filter "*.py" -File | Where-Object { $_.Name -notmatch "^_" })
|
|
23
|
+
$pyCount = $pyFiles.Count
|
|
24
|
+
Write-Host "`n[1] functions/*.py 数量: $pyCount"
|
|
25
|
+
|
|
26
|
+
# 2. 平台 function list
|
|
27
|
+
Write-Host "[2] 拉取 function list ..."
|
|
28
|
+
$fnListRaw = & dazi onto function list --space $SpaceId --json 2>&1
|
|
29
|
+
if ($LASTEXITCODE -ne 0) {
|
|
30
|
+
Write-Host " ✗ function list 失败" -ForegroundColor Red
|
|
31
|
+
exit 1
|
|
32
|
+
}
|
|
33
|
+
# 去掉 __JSON_SUMMARY__ 行后解析
|
|
34
|
+
$jsonLines = ($fnListRaw | Where-Object { $_ -notmatch '__JSON_SUMMARY__' }) -join "`n"
|
|
35
|
+
$fnList = $jsonLines | ConvertFrom-Json
|
|
36
|
+
$listCount = @($fnList).Count
|
|
37
|
+
Write-Host " 平台已注册: $listCount"
|
|
38
|
+
|
|
39
|
+
if ($pyCount -ne $listCount) {
|
|
40
|
+
Write-Host " ✗ 文件数 ($pyCount) ≠ 平台注册数 ($listCount)" -ForegroundColor Red
|
|
41
|
+
$exitCode = 1
|
|
42
|
+
} else {
|
|
43
|
+
Write-Host " ✓ 文件数与平台注册数一致" -ForegroundColor Green
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# 3. 规划函数表行数(粗略:plans/*.md 中含 .fn. 的行)
|
|
47
|
+
$planFnCount = 0
|
|
48
|
+
if (Test-Path $plansDir) {
|
|
49
|
+
$planFiles = Get-ChildItem -Path $plansDir -Filter "*.md" -File
|
|
50
|
+
foreach ($pf in $planFiles) {
|
|
51
|
+
$content = Get-Content $pf.FullName -Raw -Encoding UTF8
|
|
52
|
+
$matches = [regex]::Matches($content, '\w+\.fn\.\w+')
|
|
53
|
+
$planFnCount += $matches.Count
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if ($planFnCount -gt 0) {
|
|
57
|
+
Write-Host "`n[3] plans 中 .fn. 引用约: $planFnCount"
|
|
58
|
+
if ($planFnCount -ne $pyCount) {
|
|
59
|
+
Write-Host " ⚠ 规划引用数 ($planFnCount) ≠ functions/*.py ($pyCount)" -ForegroundColor Yellow
|
|
60
|
+
} else {
|
|
61
|
+
Write-Host " ✓ 与 functions/*.py 数量一致" -ForegroundColor Green
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
Write-Host "`n[3] 跳过 plans 计数(无 plans/*.md 或未找到 .fn.)" -ForegroundColor Yellow
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# 4. 本地 publish-preview 静态预检(每个函数)
|
|
68
|
+
Write-Host "`n[4] 本体函数 publish-preview 静态预检 ..."
|
|
69
|
+
foreach ($py in $pyFiles) {
|
|
70
|
+
$rel = "$ItemRel/functions/$($py.Name)"
|
|
71
|
+
Write-Host " → $($py.Name)"
|
|
72
|
+
& dazi onto script publish-preview $rel --space $SpaceId 2>&1 | Out-Host
|
|
73
|
+
if ($LASTEXITCODE -ne 0) {
|
|
74
|
+
Write-Host " ✗ $($py.Name) 预检失败" -ForegroundColor Red
|
|
75
|
+
$exitCode = 1
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if ($exitCode -eq 0) {
|
|
80
|
+
Write-Host "`n=== preflight 通过 ===" -ForegroundColor Green
|
|
81
|
+
} else {
|
|
82
|
+
Write-Host "`n=== preflight 未通过 ===" -ForegroundColor Red
|
|
83
|
+
}
|
|
84
|
+
exit $exitCode
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0",
|
|
3
|
+
"updatedAt": "2026-06-06",
|
|
4
|
+
"defaultReadOrder": [],
|
|
5
|
+
"examples": [
|
|
6
|
+
{
|
|
7
|
+
"id": "sales",
|
|
8
|
+
"dir": "销售示例",
|
|
9
|
+
"title": "产品销售分析",
|
|
10
|
+
"domain": [
|
|
11
|
+
"销售",
|
|
12
|
+
"订单",
|
|
13
|
+
"产品",
|
|
14
|
+
"渠道",
|
|
15
|
+
"SKU",
|
|
16
|
+
"客户"
|
|
17
|
+
],
|
|
18
|
+
"planPrimary": "plans/规划示例_产品销售本体规划方案.md",
|
|
19
|
+
"featured": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "profit",
|
|
23
|
+
"dir": "利润示例",
|
|
24
|
+
"title": "利润 / GL 分析",
|
|
25
|
+
"domain": [
|
|
26
|
+
"利润",
|
|
27
|
+
"科目",
|
|
28
|
+
"预算",
|
|
29
|
+
"GL",
|
|
30
|
+
"成本中心",
|
|
31
|
+
"预实"
|
|
32
|
+
],
|
|
33
|
+
"planPrimary": "plans/规划示例_利润分析本体方案.md",
|
|
34
|
+
"featured": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "equip-ops",
|
|
38
|
+
"dir": "设备运营",
|
|
39
|
+
"title": "化工设备运营分析",
|
|
40
|
+
"domain": [
|
|
41
|
+
"设备",
|
|
42
|
+
"OEE",
|
|
43
|
+
"停机",
|
|
44
|
+
"维保",
|
|
45
|
+
"能耗",
|
|
46
|
+
"工厂",
|
|
47
|
+
"运营"
|
|
48
|
+
],
|
|
49
|
+
"planPrimary": "plans/化工设备运营分析本体方案.md",
|
|
50
|
+
"featured": true
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
updatedAt: "2026-06-07"
|
|
3
|
+
|
|
4
|
+
# 规划 / 脚本阶段须至少阅读 defaultReadOrder 中一个完整示例(README + plans 主文档)
|
|
5
|
+
defaultReadOrder:
|
|
6
|
+
- 销售示例
|
|
7
|
+
- 设备运营
|
|
8
|
+
|
|
9
|
+
examples:
|
|
10
|
+
- id: sales
|
|
11
|
+
dir: 销售示例
|
|
12
|
+
title: 产品销售分析
|
|
13
|
+
domain: [销售, 订单, 产品, 渠道, SKU, 客户]
|
|
14
|
+
planPrimary: plans/规划示例_产品销售本体规划方案.md
|
|
15
|
+
featured: true
|
|
16
|
+
|
|
17
|
+
- id: profit
|
|
18
|
+
dir: 利润示例
|
|
19
|
+
title: 利润 / GL 分析
|
|
20
|
+
domain: [利润, 科目, 预算, GL, 成本中心, 预实]
|
|
21
|
+
planPrimary: plans/规划示例_利润分析本体方案.md
|
|
22
|
+
featured: true
|
|
23
|
+
|
|
24
|
+
- id: equip-ops
|
|
25
|
+
dir: 设备运营
|
|
26
|
+
title: 化工设备运营分析
|
|
27
|
+
domain: [设备, OEE, 停机, 维保, 能耗, 工厂, 运营]
|
|
28
|
+
planPrimary: plans/化工设备运营分析本体方案.md
|
|
29
|
+
featured: true
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 利润示例 · GL / 利润分析
|
|
2
|
+
|
|
3
|
+
## 基本信息
|
|
4
|
+
|
|
5
|
+
| 字段 | 内容 |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| 数据空间 | 以示例脚本内 `space_id` 为准(复制后改 README) |
|
|
8
|
+
| 示例 ID | `profit`(见 `../index.yaml` / `index.json`) |
|
|
9
|
+
|
|
10
|
+
## 目录
|
|
11
|
+
|
|
12
|
+
| 路径 | 说明 |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| [plans/规划示例_利润分析本体方案.md](./plans/规划示例_利润分析本体方案.md) | **规划正文** |
|
|
15
|
+
| `setup/` | `profit_ontology_init.py`、`profit_seed_data.py`、`profit_category_mount.py` |
|
|
16
|
+
| `functions/` | 7 个 `profit_fn_*.py`、`test_arguments/` |
|
|
17
|
+
|
|
18
|
+
## 使用
|
|
19
|
+
|
|
20
|
+
- **规划阶段**:通读 `plans/*.md`;与 [销售示例](../销售示例/) 对照时写清差异说明
|
|
21
|
+
- **实施阶段**:init **不含** `apply_registry`;分类在 `profit_category_mount.py`(最后执行)
|
|
22
|
+
|
|
23
|
+
规范指南:`资源/docs/onto/本体规划指南.md`
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
# 用法:在 dazi-work 根目录执行 .\项目\DAZI_TEST\本体\ontos\利润分析示例\functions\save_test_arguments.ps1
|
|
4
4
|
|
|
5
5
|
$spaceId = "space__misc_01"
|
|
6
|
-
$itemPath = "项目/DAZI_TEST/本体/ontos/利润分析示例/functions"
|
|
7
6
|
|
|
8
7
|
$functions = @(
|
|
9
8
|
@{fn_id="profit.fn.get_summary"; file="profit.fn.get_summary.json"},
|
|
@@ -16,23 +15,25 @@ $functions = @(
|
|
|
16
15
|
)
|
|
17
16
|
|
|
18
17
|
Write-Host "获取函数列表..."
|
|
19
|
-
$
|
|
18
|
+
$fnListRaw = & dazi onto function list --space $spaceId --json 2>&1
|
|
19
|
+
$jsonLines = ($fnListRaw | Where-Object { $_ -notmatch '__JSON_SUMMARY__' }) -join "`n"
|
|
20
|
+
$fnList = $jsonLines | ConvertFrom-Json
|
|
20
21
|
|
|
21
22
|
foreach ($fn in $functions) {
|
|
22
23
|
$fnId = $fn.fn_id
|
|
23
24
|
$fileName = $fn.file
|
|
24
25
|
$jsonPath = "$PSScriptRoot/test_arguments/$fileName"
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
if (-not (Test-Path $jsonPath)) {
|
|
28
|
+
Write-Host "跳过 $fnId:找不到 $jsonPath"
|
|
29
|
+
continue
|
|
28
30
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Write-Host "函数 $fnId 未找到,请先发布函数"
|
|
31
|
+
|
|
32
|
+
Write-Host "保存 $fnId ..."
|
|
33
|
+
& dazi onto function save-test-arguments --function-id $fnId --space $spaceId --arguments-json-file $jsonPath
|
|
34
|
+
if ($LASTEXITCODE -ne 0) {
|
|
35
|
+
Write-Host " ✗ 保存失败" -ForegroundColor Red
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
Write-Host "完成"
|
|
39
|
+
Write-Host "完成"
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
**文档 ID**: `onto/planning-example-profit`
|
|
4
4
|
|
|
5
|
+
> **只读参照**:本文档供学习 GL 域规划**结构**与验收口径,**不得**整篇复制为本项目 `plans/` 充数。新建实现须在 `plans/` **独立撰写**,并含「与参照示例的差异说明」章节(见 [本体规划指南 · 任务模式](./本体规划指南.md#任务模式与反模式))。
|
|
6
|
+
|
|
5
7
|
> 表/Cube/对象命名遵循 [本体命名规范](./本体命名规范_物理表Cube与对象.md)。
|
|
6
|
-
> 工程模式参考:[
|
|
8
|
+
> 工程模式参考:[销售示例 plans](../../销售示例/plans/规划示例_产品销售本体规划方案.md)
|
|
7
9
|
|
|
8
10
|
**占位符**(复制到工作区 `plans/` 后替换为实际值):
|
|
9
11
|
|
|
@@ -59,7 +61,7 @@
|
|
|
59
61
|
|
|
60
62
|
**物理表清单**(命名见 [命名规范 §2](./本体命名规范_物理表Cube与对象.md#2-物理表类别与前缀)):
|
|
61
63
|
|
|
62
|
-
| 表名 | 前缀类别 |
|
|
64
|
+
| 表名 | 前缀类别 | **平台分类** | 显示名 | 说明 | 角色 |
|
|
63
65
|
| ---- | -------- | ------------ | ------ | ---- | ---- |
|
|
64
66
|
| **`dim_date`** | 时间维(**强制**) | **时间维** | 日期维表 | 与 sales 域共用;PK **`date_key`** | 时间维 |
|
|
65
67
|
| `dim_account` | dim | **维度表** | 科目维表 | 会计科目主数据 | dim |
|
|
@@ -68,13 +70,13 @@
|
|
|
68
70
|
| **`fact_budget_entry`** | fact | **事实表** | 预算明细 | 预算行粒度编制数据;含 **date_key** | fact |
|
|
69
71
|
|
|
70
72
|
> 规划原则:先定义 **Account、JournalEntry、BudgetLine** 等业务对象与链接,再反推 Cube 与物理表。旧版 `profit_analysis_fact`(订单粒度)**不作为主模型**。
|
|
71
|
-
> init 脚本 `资源/examples/onto/利润示例/setup/profit_ontology_init.py` 顶部 **`TABLE_REGISTRY`** 与上表及 §3.x 字段 **显示名/说明** 一一对应,经 `s.tables.register_with_meta` 注册;**`CATEGORY_REGISTRY`** 见 [附录 B](#附录-
|
|
73
|
+
> init 脚本 `资源/examples/onto/利润示例/setup/profit_ontology_init.py` 顶部 **`TABLE_REGISTRY`** 与上表及 §3.x 字段 **显示名/说明** 一一对应,经 `s.tables.register_with_meta` 注册;**`CATEGORY_REGISTRY`** 见 [附录 B](#附录-b平台-分类挂载对照表category_registry),由 **`profit_category_mount.py`** 在流程最后执行(init **不含**分类挂载)。
|
|
72
74
|
|
|
73
75
|
## 三、物理层设计
|
|
74
76
|
|
|
75
77
|
### 3.0 时间维:dim_date(强制)
|
|
76
78
|
|
|
77
|
-
与销售域共用;字段定义见 [
|
|
79
|
+
与销售域共用;字段定义见 [销售示例 §3.0](../../销售示例/plans/规划示例_产品销售本体规划方案.md#30-时间维dim_date强制)。分录 **`date_key = toYYYYMMDD(posting_date)`**;预算行可用 **`toYYYYMMDD(toDate(concat(toString(fiscal_year), '-', lpad(toString(fiscal_period), 2, '0'), '-01')))`** 或 period 末代表日,规划须写清口径。
|
|
78
80
|
|
|
79
81
|
### 3.1 维度表:dim_account
|
|
80
82
|
|
|
@@ -203,7 +205,7 @@
|
|
|
203
205
|
|
|
204
206
|
**关系清单(8 条)**:
|
|
205
207
|
|
|
206
|
-
| 关系 ID |
|
|
208
|
+
| 关系 ID | **平台分类** | 类型 | 从表 | 到表 | join_keys | 说明 |
|
|
207
209
|
| ------- | ------------ | ---- | ---- | ---- | --------- | ---- |
|
|
208
210
|
| rel_journal_date | **时间关联** | many_to_one | fact_gl_journal_entry | dim_date | date_key → date_key | 分录关联日历 |
|
|
209
211
|
| rel_budget_date | **时间关联** | many_to_one | fact_budget_entry | dim_date | date_key → date_key | 预算关联日历 |
|
|
@@ -244,16 +246,16 @@ s.tables.add_relationship(
|
|
|
244
246
|
|
|
245
247
|
### 4.0 Cube 清单与类别
|
|
246
248
|
|
|
247
|
-
| Cube | 类别 |
|
|
249
|
+
| Cube | 类别 | **平台分类** | 事实源 | 时间维 | 支撑对象 |
|
|
248
250
|
| ---- | ---- | ------------ | ------ | ------ | -------- |
|
|
249
251
|
| **ActualCube** | Process | **流程型** | fact_gl_journal_entry | dim_date + fiscal_* | JournalEntry, ProfitAnalysis |
|
|
250
252
|
| **AccountActualCube** | Subject | **主体型** | fact_gl_journal_entry | 同上 | Account |
|
|
251
253
|
| **CostCenterActualCube** | Subject | **主体型** | fact_gl_journal_entry | 同上 | CostCenter |
|
|
252
254
|
| **BudgetCube** | Process | **流程型** | fact_budget_entry | 同上 | BudgetLine, BudgetAnalysis |
|
|
253
|
-
| **TimeActualCube** | Subject | **主体型** | fact_gl_journal_entry | 同上 | (时间切片;**init
|
|
255
|
+
| **TimeActualCube** | Subject | **主体型** | fact_gl_journal_entry | 同上 | (时间切片;**init 已注册**,命名规范建议后续并入 Process) |
|
|
254
256
|
| **BudgetVsActualCube** | Comparison | **对比型** | fact_budget_entry + fact_gl_journal_entry | fiscal_year/period | BudgetAnalysis(预实;**规划目标,init 待补**) |
|
|
255
257
|
|
|
256
|
-
>
|
|
258
|
+
> 命名规范 §4.2 建议时间增强不单独建 Cube;当前示例 init 仍含 **TimeActualCube** 并归 **主体型**,后续可合并进 ActualCube 后从注册表移除。
|
|
257
259
|
|
|
258
260
|
### 4.1 ActualCube(Process · 实际发生主 Cube)
|
|
259
261
|
|
|
@@ -322,7 +324,7 @@ s.tables.add_relationship(
|
|
|
322
324
|
|
|
323
325
|
### 5.1 对象类型(6 种)
|
|
324
326
|
|
|
325
|
-
| code | 分类 |
|
|
327
|
+
| code | 分类 | **平台分类** | 名称 | bind_source | 主物理支撑 |
|
|
326
328
|
| ---- | ---- | ------------ | ---- | ------------- | ---------- |
|
|
327
329
|
| Account | Master | **主数据** | 会计科目 | AccountActualCube | dim_account |
|
|
328
330
|
| CostCenter | Master | **主数据** | 成本中心 | CostCenterActualCube | dim_cost_center |
|
|
@@ -376,7 +378,7 @@ s.tables.add_relationship(
|
|
|
376
378
|
|
|
377
379
|
### 5.3 链接类型(10 种)
|
|
378
380
|
|
|
379
|
-
| 链接 code |
|
|
381
|
+
| 链接 code | **平台分类** | 名称 | from | to | 说明 |
|
|
380
382
|
| ------------------------------ | ------------ | ---------------- | -------------- | -------------- | ---------------- |
|
|
381
383
|
| entry_belongs_account | **归属关系** | 分录归属科目 | JournalEntry | Account | 分录行对应科目 |
|
|
382
384
|
| entry_belongs_cost_center | **归属关系** | 分录归属成本中心 | JournalEntry | CostCenter | 分录行对应组织 |
|
|
@@ -407,7 +409,7 @@ s.tables.add_relationship(
|
|
|
407
409
|
|
|
408
410
|
### 6.1 函数清单
|
|
409
411
|
|
|
410
|
-
| 函数 ID |
|
|
412
|
+
| 函数 ID | **平台分类** | 功能 | 参数 |
|
|
411
413
|
| ---------------------------- | ------------ | ------------ | ------------------------------------------------------------------ |
|
|
412
414
|
| profit.fn.get_summary | **总览分析** | 利润总览 | start_date, end_date, cost_center_id(可选) |
|
|
413
415
|
| profit.fn.yoy_analysis | **趋势分析** | 同比分析 | start_date, end_date, pl_category(可选) |
|
|
@@ -517,22 +519,22 @@ s.tables.add_relationship(
|
|
|
517
519
|
| 12 | define_property(约 42 个) |
|
|
518
520
|
| 13 | define_link_type(10 种) |
|
|
519
521
|
| 14 | sync_metric_refs |
|
|
520
|
-
| 15 | **CATEGORY_REGISTRY** + `s.categories.apply_registry`(347 对齐) |
|
|
521
522
|
|
|
522
|
-
### 7.4
|
|
523
|
+
### 7.4 阶段四:灌数、函数与分类(中)
|
|
523
524
|
|
|
524
525
|
| 步骤 | 任务 |
|
|
525
526
|
| ---- | ---- |
|
|
526
|
-
| 15 |
|
|
527
|
-
| 16 | 7 个 profit_fn_*.py |
|
|
528
|
-
| 17 |
|
|
527
|
+
| 15 | seed 灌数:**dim_date** + 维表 + fact(写入 date_key) |
|
|
528
|
+
| 16 | 7 个 `profit_fn_*.py`:**publish --register-function-id** |
|
|
529
|
+
| 17 | `function run` + **`save-test-arguments`** |
|
|
530
|
+
| 18 | **`profit_category_mount.py`**:`CATEGORY_REGISTRY` + `apply_registry`(**最后**,类灌数) |
|
|
529
531
|
|
|
530
|
-
### 7.5
|
|
532
|
+
### 7.5 实施阶段参考(须 plans 已定稿后)
|
|
531
533
|
|
|
532
|
-
| 来源
|
|
533
|
-
|
|
|
534
|
-
| `资源/examples/onto/利润示例/` |
|
|
535
|
-
| [
|
|
534
|
+
| 来源 | 用途 | 注意 |
|
|
535
|
+
| ---- | ---- | ---- |
|
|
536
|
+
| `资源/examples/onto/利润示例/` | 对照 API 写法或复制后按 **本实现 plans** 改造 | **禁止**无 plans 直接复制 init |
|
|
537
|
+
| [销售示例](../../销售示例/plans/规划示例_产品销售本体规划方案.md) | 跨域工程模式只读对照 | 表结构与函数逻辑不同 |
|
|
536
538
|
|
|
537
539
|
**seed 数据建议**:
|
|
538
540
|
|
|
@@ -566,7 +568,7 @@ s.tables.add_relationship(
|
|
|
566
568
|
| **表间关系** | **8 条** |
|
|
567
569
|
| Cube | **5 个** + 派生度量 |
|
|
568
570
|
| 对象 | 6 种 + 分类;10 种链接 |
|
|
569
|
-
|
|
|
571
|
+
| **平台侧栏分类** | 侧栏分类名与附录 B 一致;`category_mount` 重跑幂等 |
|
|
570
572
|
| 函数 | get_summary、budget_vs_actual、account_breakdown 可运行 |
|
|
571
573
|
| 数据 | 种子灌入后预实差异可解释 |
|
|
572
574
|
|
|
@@ -586,13 +588,13 @@ s.tables.add_relationship(
|
|
|
586
588
|
|
|
587
589
|
---
|
|
588
590
|
|
|
589
|
-
## 附录 B
|
|
591
|
+
## 附录 B:平台分类挂载对照表(CATEGORY_REGISTRY)
|
|
590
592
|
|
|
591
|
-
与 `利润示例/setup/
|
|
593
|
+
与 `利润示例/setup/profit_category_mount.py` 顶部 **`CATEGORY_REGISTRY`** 一一对应(见 [本体分类规划与SDK扩展方案](./本体分类规划与SDK扩展方案.md))。**init 不含分类挂载**;本附录在 **全部函数 publish 后** 由 `category_mount` 脚本执行。
|
|
592
594
|
|
|
593
595
|
### B.1 物理表(table)
|
|
594
596
|
|
|
595
|
-
|
|
|
597
|
+
| 平台分类 | 表名 |
|
|
596
598
|
| -------- | ---- |
|
|
597
599
|
| 维度表 | dim_account, dim_cost_center |
|
|
598
600
|
| 事实表 | fact_gl_journal_entry, fact_budget_entry |
|
|
@@ -601,14 +603,14 @@ s.tables.add_relationship(
|
|
|
601
603
|
|
|
602
604
|
### B.2 Cube(cube)
|
|
603
605
|
|
|
604
|
-
|
|
|
606
|
+
| 平台分类 | Cube |
|
|
605
607
|
| -------- | ---- |
|
|
606
608
|
| 流程型 | ActualCube, BudgetCube |
|
|
607
609
|
| 主体型 | AccountActualCube, CostCenterActualCube, TimeActualCube |
|
|
608
610
|
|
|
609
611
|
### B.3 对象类型(object)
|
|
610
612
|
|
|
611
|
-
|
|
|
613
|
+
| 平台分类 | code |
|
|
612
614
|
| -------- | ---- |
|
|
613
615
|
| 主数据 | Account, CostCenter |
|
|
614
616
|
| 事务 | JournalEntry, BudgetLine |
|
|
@@ -616,7 +618,7 @@ s.tables.add_relationship(
|
|
|
616
618
|
|
|
617
619
|
### B.4 表间关系(relation)
|
|
618
620
|
|
|
619
|
-
|
|
|
621
|
+
| 平台分类 | 从表 → 到表 |
|
|
620
622
|
| -------- | ----------- |
|
|
621
623
|
| 时间关联 | fact_gl_journal_entry → dim_date;fact_budget_entry → dim_date |
|
|
622
624
|
| 主数据关联 | fact_gl_journal_entry → dim_account / dim_cost_center;fact_budget_entry → dim_account / dim_cost_center |
|
|
@@ -624,7 +626,7 @@ s.tables.add_relationship(
|
|
|
624
626
|
|
|
625
627
|
### B.5 链接类型(link)
|
|
626
628
|
|
|
627
|
-
|
|
|
629
|
+
| 平台分类 | link code |
|
|
628
630
|
| -------- | --------- |
|
|
629
631
|
| 归属关系 | entry_belongs_account, entry_belongs_cost_center, budget_for_account, budget_for_cost_center |
|
|
630
632
|
| 分析归因 | analysis_by_account, analysis_by_cost_center, account_contributes_profit, cost_center_contributes_profit |
|
|
@@ -633,9 +635,9 @@ s.tables.add_relationship(
|
|
|
633
635
|
|
|
634
636
|
### B.6 本体函数(function)
|
|
635
637
|
|
|
636
|
-
init
|
|
638
|
+
函数在 `functions/` 中 **publish 注册**;`profit_category_mount.py` 在 **init + seed + 全部函数 publish 之后** 统一 `apply_registry`(含 function 段,`skip_missing=True` 可重跑)。建议分类:
|
|
637
639
|
|
|
638
|
-
|
|
|
640
|
+
| 平台分类 | function_id |
|
|
639
641
|
| -------- | ----------- |
|
|
640
642
|
| 总览分析 | profit.fn.get_summary |
|
|
641
643
|
| 趋势分析 | profit.fn.yoy_analysis, profit.fn.mom_analysis |
|
|
@@ -658,7 +660,7 @@ init **不**注册函数;`apply_registry(..., skip_missing=True)` 跳过未发
|
|
|
658
660
|
| 4 | Cube 层 | ☑(**5 个**,§4.0) |
|
|
659
661
|
| 5 | 对象 + 分类 | ☑(§5.1、§5.4) |
|
|
660
662
|
| 6–10 | 同指南 | ☑ |
|
|
661
|
-
| 6a–6e |
|
|
663
|
+
| 6a–6e | 平台侧栏分类 | ☑(附录 B + `profit_category_mount.py`) |
|
|
662
664
|
|
|
663
665
|
---
|
|
664
666
|
|
|
@@ -668,13 +670,13 @@ init **不**注册函数;`apply_registry(..., skip_missing=True)` 跳过未发
|
|
|
668
670
|
| ---- | ---- |
|
|
669
671
|
| 本体命名规范 | [本体命名规范_物理表Cube与对象.md](./本体命名规范_物理表Cube与对象.md) |
|
|
670
672
|
| 本体规划指南 | [本体规划指南.md](./本体规划指南.md) |
|
|
671
|
-
|
|
|
673
|
+
| 销售示例 | [规划示例_产品销售本体规划方案.md](../../销售示例/plans/规划示例_产品销售本体规划方案.md) |
|
|
672
674
|
| **内置脚本示例** | `资源/examples/onto/利润示例/`(`dazi examples sync`;表名迁移中) |
|
|
673
|
-
|
|
|
675
|
+
| 分类方案 | [本体分类规划与 SDK 扩展方案](./本体分类规划与SDK扩展方案.md) |
|
|
674
676
|
|
|
675
677
|
---
|
|
676
678
|
|
|
677
|
-
**方案版本**:v2.
|
|
679
|
+
**方案版本**:v2.3(分类挂载迁至 `profit_category_mount.py`,类灌数)
|
|
678
680
|
**创建日期**:(定稿日)
|
|
679
681
|
**适用**:复制到 `<item-path>/plans/`;`<space-id>` 以该实现单元 `README.md` 为准
|
|
680
682
|
**状态**:规划示例(公共模板)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""利润分析本体 — 平台分类挂载(CATEGORY_REGISTRY)
|
|
2
|
+
|
|
3
|
+
与灌数脚本类似,**独立步骤、放在实施流程最后**:
|
|
4
|
+
init → seed → 发布全部函数 → **本脚本**。
|
|
5
|
+
|
|
6
|
+
放置:资源/examples/onto/利润示例/setup/profit_category_mount.py
|
|
7
|
+
发布:dazi onto script publish <item-path>/setup/profit_category_mount.py --space <space-id> --type setup
|
|
8
|
+
规划对照:资源/examples/onto/利润示例/plans/规划示例_利润分析本体方案.md 附录 B
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
|
|
13
|
+
# 与规划附录 B 一一对应;category 值必须是平台标准分类中文名
|
|
14
|
+
CATEGORY_REGISTRY = {
|
|
15
|
+
"table": {
|
|
16
|
+
"维度表": ["dim_account", "dim_cost_center"],
|
|
17
|
+
"事实表": ["fact_gl_journal_entry", "fact_budget_entry"],
|
|
18
|
+
},
|
|
19
|
+
"cube": {
|
|
20
|
+
"流程型": ["ActualCube", "BudgetCube"],
|
|
21
|
+
"主体型": ["AccountActualCube", "CostCenterActualCube", "TimeActualCube"],
|
|
22
|
+
},
|
|
23
|
+
"object": {
|
|
24
|
+
"主数据": ["Account", "CostCenter"],
|
|
25
|
+
"事务": ["JournalEntry", "BudgetLine"],
|
|
26
|
+
"分析": ["ProfitAnalysis", "BudgetAnalysis"],
|
|
27
|
+
},
|
|
28
|
+
"relation": {
|
|
29
|
+
"时间关联": [
|
|
30
|
+
("fact_gl_journal_entry", "dim_date"),
|
|
31
|
+
("fact_budget_entry", "dim_date"),
|
|
32
|
+
],
|
|
33
|
+
"主数据关联": [
|
|
34
|
+
("fact_gl_journal_entry", "dim_account"),
|
|
35
|
+
("fact_gl_journal_entry", "dim_cost_center"),
|
|
36
|
+
("fact_budget_entry", "dim_account"),
|
|
37
|
+
("fact_budget_entry", "dim_cost_center"),
|
|
38
|
+
],
|
|
39
|
+
"层级自关联": [("dim_account", "dim_account")],
|
|
40
|
+
},
|
|
41
|
+
"link": {
|
|
42
|
+
"归属关系": [
|
|
43
|
+
"entry_belongs_account",
|
|
44
|
+
"entry_belongs_cost_center",
|
|
45
|
+
"budget_for_account",
|
|
46
|
+
"budget_for_cost_center",
|
|
47
|
+
],
|
|
48
|
+
"分析归因": [
|
|
49
|
+
"analysis_by_account",
|
|
50
|
+
"analysis_by_cost_center",
|
|
51
|
+
"account_contributes_profit",
|
|
52
|
+
"cost_center_contributes_profit",
|
|
53
|
+
],
|
|
54
|
+
"层级关系": ["account_has_parent"],
|
|
55
|
+
"对比关系": ["budget_compared_to_actual"],
|
|
56
|
+
},
|
|
57
|
+
"function": {
|
|
58
|
+
"总览分析": ["profit.fn.get_summary"],
|
|
59
|
+
"趋势分析": ["profit.fn.yoy_analysis", "profit.fn.mom_analysis"],
|
|
60
|
+
"结构分析": ["profit.fn.account_breakdown", "profit.fn.top_accounts"],
|
|
61
|
+
"预实分析": ["profit.fn.budget_vs_actual"],
|
|
62
|
+
"组织分析": ["profit.fn.cost_center_profit"],
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def main():
|
|
68
|
+
space_id = "space__misc_01"
|
|
69
|
+
s = space.get(space_id)
|
|
70
|
+
|
|
71
|
+
output.print("=== 利润分析 — 平台分类挂载 ===")
|
|
72
|
+
output.print(f"空间: {space_id}")
|
|
73
|
+
|
|
74
|
+
cat_counts = s.categories.apply_registry(CATEGORY_REGISTRY, skip_missing=True)
|
|
75
|
+
for kind, cnt in cat_counts.items():
|
|
76
|
+
if cnt:
|
|
77
|
+
output.print(f"OK 分类[{kind}] 挂载 {cnt} 项")
|
|
78
|
+
|
|
79
|
+
summary = {
|
|
80
|
+
"ok": True,
|
|
81
|
+
"space_id": space_id,
|
|
82
|
+
"category_mounts": cat_counts,
|
|
83
|
+
}
|
|
84
|
+
output.success("平台分类挂载完成")
|
|
85
|
+
output.print("__JSON_SUMMARY__" + json.dumps(summary, ensure_ascii=True, default=str))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""利润分析本体初始化脚本 — space__misc_01
|
|
1
|
+
"""利润分析本体初始化脚本 — space__misc_01
|
|
2
2
|
|
|
3
3
|
初始化内容:
|
|
4
4
|
1. 创建物理表(科目表、成本中心维表、实际分录表、预算表)
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
4. 注册Cube(5个)及派生度量
|
|
8
8
|
5. 定义对象类型(6种)、绑定数据源、属性、链接
|
|
9
9
|
6. 同步指标引用
|
|
10
|
-
7.
|
|
10
|
+
7. 平台分类挂载见 profit_category_mount.py(init/seed/函数 publish 之后执行)
|
|
11
11
|
|
|
12
12
|
放置:资源/examples/onto/利润示例/setup/profit_ontology_init.py(复制到项目 ontos/<实现名>/setup/)
|
|
13
13
|
发布:dazi onto script publish <item-path>/setup/profit_ontology_init.py --space <space-id> --type setup
|
|
14
|
-
规划对照:资源/
|
|
14
|
+
规划对照:资源/examples/onto/利润示例/plans/规划示例_利润分析本体方案.md
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
17
|
import json
|
|
@@ -105,60 +105,6 @@ TABLE_REGISTRY = {
|
|
|
105
105
|
},
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
# 与 347 + 附录 B 对齐;category 值必须是 347 标准中文名
|
|
109
|
-
CATEGORY_REGISTRY = {
|
|
110
|
-
"table": {
|
|
111
|
-
"维度表": ["dim_account", "dim_cost_center"],
|
|
112
|
-
"事实表": ["fact_gl_journal_entry", "fact_budget_entry"],
|
|
113
|
-
},
|
|
114
|
-
"cube": {
|
|
115
|
-
"流程型": ["ActualCube", "BudgetCube"],
|
|
116
|
-
"主体型": ["AccountActualCube", "CostCenterActualCube", "TimeActualCube"],
|
|
117
|
-
},
|
|
118
|
-
"object": {
|
|
119
|
-
"主数据": ["Account", "CostCenter"],
|
|
120
|
-
"事务": ["JournalEntry", "BudgetLine"],
|
|
121
|
-
"分析": ["ProfitAnalysis", "BudgetAnalysis"],
|
|
122
|
-
},
|
|
123
|
-
"relation": {
|
|
124
|
-
"时间关联": [
|
|
125
|
-
("fact_gl_journal_entry", "dim_date"),
|
|
126
|
-
("fact_budget_entry", "dim_date"),
|
|
127
|
-
],
|
|
128
|
-
"主数据关联": [
|
|
129
|
-
("fact_gl_journal_entry", "dim_account"),
|
|
130
|
-
("fact_gl_journal_entry", "dim_cost_center"),
|
|
131
|
-
("fact_budget_entry", "dim_account"),
|
|
132
|
-
("fact_budget_entry", "dim_cost_center"),
|
|
133
|
-
],
|
|
134
|
-
"层级自关联": [("dim_account", "dim_account")],
|
|
135
|
-
},
|
|
136
|
-
"link": {
|
|
137
|
-
"归属关系": [
|
|
138
|
-
"entry_belongs_account",
|
|
139
|
-
"entry_belongs_cost_center",
|
|
140
|
-
"budget_for_account",
|
|
141
|
-
"budget_for_cost_center",
|
|
142
|
-
],
|
|
143
|
-
"分析归因": [
|
|
144
|
-
"analysis_by_account",
|
|
145
|
-
"analysis_by_cost_center",
|
|
146
|
-
"account_contributes_profit",
|
|
147
|
-
"cost_center_contributes_profit",
|
|
148
|
-
],
|
|
149
|
-
"层级关系": ["account_has_parent"],
|
|
150
|
-
"对比关系": ["budget_compared_to_actual"],
|
|
151
|
-
},
|
|
152
|
-
"function": {
|
|
153
|
-
"总览分析": ["profit.fn.get_summary"],
|
|
154
|
-
"趋势分析": ["profit.fn.yoy_analysis", "profit.fn.mom_analysis"],
|
|
155
|
-
"结构分析": ["profit.fn.account_breakdown", "profit.fn.top_accounts"],
|
|
156
|
-
"预实分析": ["profit.fn.budget_vs_actual"],
|
|
157
|
-
"组织分析": ["profit.fn.cost_center_profit"],
|
|
158
|
-
},
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
108
|
def main():
|
|
163
109
|
space_id = "space__misc_01"
|
|
164
110
|
s = space.get(space_id)
|
|
@@ -654,14 +600,6 @@ def main():
|
|
|
654
600
|
s.sync_metric_refs()
|
|
655
601
|
output.print("OK sync_metric_refs")
|
|
656
602
|
|
|
657
|
-
# 10. 347 对齐分类
|
|
658
|
-
output.print("\n[10/10] 配置对象分类(347 对齐)...")
|
|
659
|
-
|
|
660
|
-
cat_counts = s.categories.apply_registry(CATEGORY_REGISTRY, skip_missing=True)
|
|
661
|
-
for kind, cnt in cat_counts.items():
|
|
662
|
-
if cnt:
|
|
663
|
-
output.print(f"OK 分类[{kind}] 挂载 {cnt} 项")
|
|
664
|
-
|
|
665
603
|
summary = {
|
|
666
604
|
"ok": True,
|
|
667
605
|
"space_id": space_id,
|
|
@@ -671,7 +609,6 @@ def main():
|
|
|
671
609
|
"object_types": 6,
|
|
672
610
|
"properties": 42,
|
|
673
611
|
"link_types": 10,
|
|
674
|
-
"category_mounts": cat_counts,
|
|
675
612
|
}
|
|
676
613
|
|
|
677
614
|
output.print("\n=== 利润分析本体初始化完成 ===")
|