@dazitech/cli 3.1.0 → 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.
Files changed (65) hide show
  1. package/README.md +1 -1
  2. package/dist/clis/dazi-app.js +2 -2
  3. package/dist/clis/dazi-flow.js +2 -2
  4. package/dist/clis/dazi-onto.js +318 -40
  5. package/dist/clis/dazi.js +407 -185
  6. package/dist/docs/flow/flow-project-guide.md +1 -1
  7. package/dist/docs/guides/cli-reference.md +16 -3
  8. package/dist/docs/guides/troubleshooting.md +1 -1
  9. package/dist/docs/index.json +1 -13
  10. package/dist/docs/onto/dazi_script_sdk_reference.md +1 -1
  11. package/dist/docs/onto/dazi_script_seed_data_guide.md +1 -1
  12. package/dist/docs/onto/function-guide.md +6 -6
  13. 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 -169
  14. 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 +3 -2
  15. 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 -242
  16. 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 +12 -12
  17. package/dist/docs/onto//346/234/254/344/275/223/350/247/204/345/210/222/346/214/207/345/215/227.md +14 -13
  18. 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 +70 -15
  19. package/dist/examples/index.json +222 -6
  20. package/dist/examples/onto/README.md +34 -36
  21. package/dist/examples/onto/_templates/onto_preflight.ps1 +84 -0
  22. package/dist/examples/onto/index.json +53 -0
  23. package/dist/examples/onto/index.yaml +29 -0
  24. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/README.md +23 -0
  25. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/functions/save_test_arguments.ps1 +12 -11
  26. 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 +4 -4
  27. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/setup/profit_category_mount.py +1 -1
  28. package/dist/examples/onto//345/210/251/346/266/246/347/244/272/344/276/213/setup/profit_ontology_init.py +1 -1
  29. package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/README.md +24 -0
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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
  36. 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
  37. 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
  38. 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
  39. 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
  40. 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
  41. package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/functions/save_test_arguments.ps1 +42 -0
  42. 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
  43. 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
  44. 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
  45. 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
  46. 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
  47. 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
  48. 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
  49. 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
  50. 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
  51. 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
  52. 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
  53. 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
  54. package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/setup/equip_ops_category_mount.py +106 -0
  55. package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/setup/equip_ops_ontology_init.py +1077 -0
  56. package/dist/examples/onto//350/256/276/345/244/207/350/277/220/350/220/245/setup/equip_ops_seed_data.py +552 -0
  57. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/README.md +23 -0
  58. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/functions/save_test_arguments.ps1 +13 -12
  59. 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 +2 -2
  60. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/setup/sales_category_mount.py +1 -1
  61. package/dist/examples/onto//351/224/200/345/224/256/347/244/272/344/276/213/setup/sales_ontology_init.py +1 -1
  62. package/dist/prompts/index.json +1 -1
  63. package/dist/prompts/onto/planning-design.md +226 -104
  64. package/dist/prompts/onto/script-publish-run.md +8 -6
  65. package/package.json +1 -1
@@ -0,0 +1,735 @@
1
+ # 化工设备运营分析本体方案
2
+
3
+ **文档 ID**: `dazi_test/equipment-ops-analysis`
4
+
5
+ > 表/Cube/对象命名遵循 [本体命名规范](../../../../../资源/docs/onto/本体命名规范_物理表Cube与对象.md)。
6
+ > 对照参考(只读):[销售示例 plans](../../销售示例/plans/规划示例_产品销售本体规划方案.md)、[利润示例 plans](../../利润示例/plans/规划示例_利润分析本体方案.md)(均在 `资源/examples/onto/`)
7
+
8
+ ---
9
+
10
+ ## 一、空间概述
11
+
12
+ | 项目 | 说明 |
13
+ | -------- | ---- |
14
+ | 空间 ID | `space_cate_test01` |
15
+ | 空间名称 | 分类测试01 |
16
+ | 规划日期 | 2026-06-06 |
17
+ | 实现单元 | `项目/DAZI_TEST/本体/ontos/设备运营/` |
18
+
19
+ ### 1.1 业务背景
20
+
21
+ 化工生产以**连续或间歇装置**为核心资产,设备可用性、负荷与能耗直接决定产能与安全。本方案构建**化工设备运营分析本体**,以业务语言描述「装置区」「工艺单元」「设备」「停机事件」「维保记录」及其关系,支撑:
22
+
23
+ - **运营总览**:在运设备数、综合开动率、计划内/外停机时长
24
+ - **OEE 分析**:可用率 × 性能率 × 质量率(按设备/单元/装置汇总)
25
+ - **停机归因**:按故障类型、停机原因、责任部门展开
26
+ - **维保管理**:计划维保达成率、维保工时与成本
27
+ - **能耗强度**:单位产量能耗、装置能效对标(化工特色)
28
+ - **趋势与对标**:同比/环比、装置间/单元间横向对比
29
+ - **异常聚焦**:故障频次 Top N、长停机设备预警
30
+
31
+ ### 1.2 核心业务问题
32
+
33
+ | 问题 | 说明 |
34
+ | ---- | ---- |
35
+ | 装置开不开得起来 | 可用率、计划停机 vs 非计划停机 |
36
+ | 跑满没有 | 性能率、负荷率、设计产能利用率 |
37
+ | 质量是否拖累 OEE | 质量率、不合格批次关联(本方案以汇总质量率字段承载) |
38
+ | 停在哪、为何停 | 停机事件明细、故障代码结构 |
39
+ | 维保是否到位 | 计划维保 vs 实际完成、逾期维保 |
40
+ | 能耗是否异常 | 单吨/单批次能耗、与同类型设备对标 |
41
+ | 哪台设备是短板 | Top 故障设备、MTBF/MTTR 概览 |
42
+
43
+ ### 1.3 与参照示例的差异说明
44
+
45
+ | 维度 | 销售示例 | 利润示例 | 本方案(化工设备运营) |
46
+ | ---- | -------- | -------- | ---------------------- |
47
+ | 核心锚点 | 订单/客户/产品 | 科目/分录/预算 | **设备/装置/停机/维保** |
48
+ | 主事实粒度 | 订单行 | 凭证行 | **设备日运行汇总 + 停机事件行** |
49
+ | 核心 KPI | 销售额、渠道占比 | 收入、成本、利润率 | **OEE、可用率、MTBF、能耗强度** |
50
+ | 组织维度 | 区域/渠道 | 成本中心 | **厂区 → 工艺单元 → 设备** |
51
+ | 对比分析 | 同比销售 | 预实对比 | **计划运行 vs 实际运行、装置对标** |
52
+ | 行业特征 | 通用零售 | 制造财务 GL | **化工装置、连续生产、能源消耗** |
53
+ | 函数设计 | 销售结构/Top 产品 | 科目/利润项结构 | **OEE/停机/维保/能耗专项** |
54
+
55
+ > **共存说明**:本空间可能与销售/利润域共用 `dim_date`;init **仅**创建/注册本域表,若 `dim_date` 已存在则 **ensure** 不重复建表。
56
+
57
+ ---
58
+
59
+ ## 二、物理层设计
60
+
61
+ ### 2.0 时间维:dim_date(强制)
62
+
63
+ **用途**:全空间共享日历;事实表通过 **`date_key`** 关联。
64
+
65
+ | 字段名 | 类型 | 显示名 | 说明 |
66
+ | ------ | ---- | ------ | ---- |
67
+ | **date_key** | Int32 | 日期键 | YYYYMMDD,主键 |
68
+ | calendar_date | Date | 自然日 | |
69
+ | year | Int16 | 公历年 | |
70
+ | quarter | Int8 | 季度 | 1–4 |
71
+ | month | Int8 | 月 | 1–12 |
72
+ | week_of_year | Int8 | 周 | |
73
+ | day_of_week | Int8 | 星期 | |
74
+ | is_weekend | UInt8 | 是否周末 | 0/1 |
75
+ | year_month | String | 年月 | 如 2025-06 |
76
+
77
+ **排序键**:`ORDER BY (date_key)` · **引擎**:`MergeTree()`
78
+
79
+ ### 2.1 维度表:dim_plant(厂区/装置区)
80
+
81
+ **用途**:化工生产厂区或大型装置区主数据。
82
+
83
+ | 字段名 | 类型 | 显示名 | 说明 |
84
+ | ------ | ---- | ------ | ---- |
85
+ | plant_id | String | 厂区 ID | 主键 |
86
+ | plant_code | String | 厂区编码 | |
87
+ | plant_name | String | 厂区名称 | 如 乙烯装置区 |
88
+ | company_code | String | 公司代码 | |
89
+ | plant_type | String | 装置类型 | 炼油/烯烃/芳烃/精细化工 |
90
+ | location | String | 地理位置 | |
91
+ | design_capacity | Float64 | 设计产能 | 吨/年或标方/年 |
92
+ | capacity_unit | String | 产能单位 | 吨/标方 |
93
+ | status | String | 状态 | 运行/检修/停产 |
94
+ | created_at | DateTime | 创建时间 | |
95
+
96
+ **排序键**:`ORDER BY (plant_code)`
97
+
98
+ ### 2.2 维度表:dim_process_unit(工艺单元)
99
+
100
+ **用途**:装置内工艺单元(蒸馏、反应、压缩等工段)。
101
+
102
+ | 字段名 | 类型 | 显示名 | 说明 |
103
+ | ------ | ---- | ------ | ---- |
104
+ | unit_id | String | 单元 ID | 主键 |
105
+ | unit_code | String | 单元编码 | |
106
+ | unit_name | String | 单元名称 | 如 裂解炉区 |
107
+ | plant_id | String | 所属厂区 | 关联 dim_plant |
108
+ | plant_name | String | 厂区名称 | 冗余 |
109
+ | unit_type | String | 单元类型 | 反应/分离/换热/公用工程 |
110
+ | criticality | String | 关键等级 | A/B/C |
111
+ | status | String | 状态 | |
112
+ | created_at | DateTime | 创建时间 | |
113
+
114
+ **排序键**:`ORDER BY (plant_id, unit_code)`
115
+
116
+ ### 2.3 维度表:dim_equipment_type(设备类型)
117
+
118
+ **用途**:设备分类主数据(泵、压缩机、反应釜、塔器等)。
119
+
120
+ | 字段名 | 类型 | 显示名 | 说明 |
121
+ | ------ | ---- | ------ | ---- |
122
+ | equip_type_id | String | 类型 ID | 主键 |
123
+ | equip_type_code | String | 类型编码 | |
124
+ | equip_type_name | String | 类型名称 | |
125
+ | category | String | 大类 | 动设备/静设备/仪表/电气 |
126
+ | parent_type_id | String | 上级类型 | 自关联 |
127
+ | type_level | Int32 | 层级 | |
128
+ | is_leaf | Boolean | 末级 | |
129
+ | status | String | 状态 | |
130
+ | created_at | DateTime | 创建时间 | |
131
+
132
+ **排序键**:`ORDER BY (equip_type_code)`
133
+
134
+ ### 2.4 维度表:dim_equipment(设备主数据)
135
+
136
+ **用途**:单台设备台账;OEE 与停机分析的核心维度。
137
+
138
+ | 字段名 | 类型 | 显示名 | 说明 |
139
+ | ------ | ---- | ------ | ---- |
140
+ | equipment_id | String | 设备 ID | 主键 |
141
+ | equipment_code | String | 设备位号 | 如 P-101A |
142
+ | equipment_name | String | 设备名称 | |
143
+ | equip_type_id | String | 设备类型 | 关联 dim_equipment_type |
144
+ | equip_type_name | String | 类型名称 | 冗余 |
145
+ | category | String | 设备大类 | 冗余 |
146
+ | plant_id | String | 所属厂区 | 关联 dim_plant |
147
+ | plant_name | String | 厂区名称 | 冗余 |
148
+ | unit_id | String | 所属单元 | 关联 dim_process_unit |
149
+ | unit_name | String | 单元名称 | 冗余 |
150
+ | manufacturer | String | 制造商 | |
151
+ | model | String | 型号 | |
152
+ | install_date | Date | 投运日期 | |
153
+ | design_capacity | Float64 | 设计能力 | |
154
+ | capacity_unit | String | 能力单位 | t/h、m³/h 等 |
155
+ | criticality | String | 关键等级 | A/B/C |
156
+ | production_mode | String | 生产模式 | 连续/间歇 |
157
+ | status | String | 状态 | 运行/备用/检修/报废 |
158
+ | created_at | DateTime | 创建时间 | |
159
+
160
+ **排序键**:`ORDER BY (plant_id, unit_id, equipment_code)`
161
+
162
+ ### 2.5 维度表:dim_downtime_reason(停机原因)
163
+
164
+ **用途**:停机/故障原因码表。
165
+
166
+ | 字段名 | 类型 | 显示名 | 说明 |
167
+ | ------ | ---- | ------ | ---- |
168
+ | reason_id | String | 原因 ID | 主键 |
169
+ | reason_code | String | 原因编码 | |
170
+ | reason_name | String | 原因名称 | |
171
+ | reason_category | String | 原因大类 | 机械/电气/仪表/工艺/计划检修/外部 |
172
+ | is_planned | UInt8 | 是否计划停机 | 0/1 |
173
+ | parent_reason_id | String | 上级原因 | 自关联 |
174
+ | status | String | 状态 | |
175
+ | created_at | DateTime | 创建时间 | |
176
+
177
+ **排序键**:`ORDER BY (reason_code)`
178
+
179
+ ### 2.6 事实表:fact_equipment_daily_ops(设备日运行汇总)
180
+
181
+ **用途**:每台设备每日运行 KPI 汇总;OEE 计算主源。
182
+
183
+ | 字段名 | 类型 | 显示名 | 说明 |
184
+ | ------ | ---- | ------ | ---- |
185
+ | ops_id | String | 汇总 ID | 主键 |
186
+ | **date_key** | Int32 | 日期键 | 关联 dim_date |
187
+ | calendar_date | Date | 统计日期 | |
188
+ | equipment_id | String | 设备 ID | 关联 dim_equipment |
189
+ | equipment_code | String | 设备位号 | 冗余 |
190
+ | equipment_name | String | 设备名称 | 冗余 |
191
+ | plant_id | String | 厂区 ID | 冗余 |
192
+ | plant_name | String | 厂区名称 | 冗余 |
193
+ | unit_id | String | 单元 ID | 冗余 |
194
+ | unit_name | String | 单元名称 | 冗余 |
195
+ | equip_type_id | String | 设备类型 | 冗余 |
196
+ | category | String | 设备大类 | 冗余 |
197
+ | calendar_minutes | Float64 | 日历时间 | 分钟,通常 1440 |
198
+ | planned_downtime_min | Float64 | 计划停机 | 分钟 |
199
+ | unplanned_downtime_min | Float64 | 非计划停机 | 分钟 |
200
+ | runtime_min | Float64 | 运行时间 | 分钟 |
201
+ | idle_min | Float64 | 待机时间 | 分钟 |
202
+ | planned_output_qty | Float64 | 计划产量 | |
203
+ | actual_output_qty | Float64 | 实际产量 | |
204
+ | qualified_output_qty | Float64 | 合格产量 | |
205
+ | output_unit | String | 产量单位 | 吨/批次 |
206
+ | ideal_cycle_rate | Float64 | 理想节拍 | 单位/分钟 |
207
+ | energy_consumption | Float64 | 能耗 | kWh 或 GJ |
208
+ | energy_unit | String | 能耗单位 | |
209
+ | shift_code | String | 班次 | 早/中/晚/全天 |
210
+ | data_source | String | 数据来源 | DCS/MES/手工 |
211
+ | created_at | DateTime | 创建时间 | |
212
+
213
+ **排序键**:`ORDER BY (date_key, equipment_id, shift_code)`
214
+
215
+ **OEE 口径(seed 与函数统一)**:
216
+
217
+ | 指标 | 公式 | 说明 |
218
+ | ---- | ---- | ---- |
219
+ | 可用率 availability | runtime_min / (calendar_minutes - planned_downtime_min) | 分母为计划运行时间 |
220
+ | 性能率 performance | (actual_output_qty / runtime_min) / ideal_cycle_rate | runtime_min>0 时计算 |
221
+ | 质量率 quality | qualified_output_qty / actual_output_qty | actual_output_qty>0 时计算 |
222
+ | OEE | availability × performance × quality | 0–1 |
223
+
224
+ ### 2.7 事实表:fact_downtime_event(停机事件明细)
225
+
226
+ **用途**:单次停机/故障事件流水。
227
+
228
+ | 字段名 | 类型 | 显示名 | 说明 |
229
+ | ------ | ---- | ------ | ---- |
230
+ | event_id | String | 事件 ID | 主键 |
231
+ | **date_key** | Int32 | 日期键 | 关联 dim_date(事件开始日) |
232
+ | equipment_id | String | 设备 ID | 关联 dim_equipment |
233
+ | equipment_code | String | 设备位号 | 冗余 |
234
+ | equipment_name | String | 设备名称 | 冗余 |
235
+ | plant_id | String | 厂区 ID | 冗余 |
236
+ | unit_id | String | 单元 ID | 冗余 |
237
+ | reason_id | String | 停机原因 | 关联 dim_downtime_reason |
238
+ | reason_code | String | 原因编码 | 冗余 |
239
+ | reason_name | String | 原因名称 | 冗余 |
240
+ | reason_category | String | 原因大类 | 冗余 |
241
+ | is_planned | UInt8 | 是否计划停机 | 0/1 |
242
+ | start_time | DateTime | 开始时间 | |
243
+ | end_time | DateTime | 结束时间 | |
244
+ | duration_min | Float64 | 停机时长 | 分钟 |
245
+ | impact_level | String | 影响等级 | 高/中/低 |
246
+ | responsible_dept | String | 责任部门 | 机动/电气/仪表/生产 |
247
+ | description | String | 事件描述 | |
248
+ | created_at | DateTime | 创建时间 | |
249
+
250
+ **排序键**:`ORDER BY (date_key, equipment_id, start_time)`
251
+
252
+ ### 2.8 事实表:fact_maintenance_record(维保记录)
253
+
254
+ **用途**:计划与实际维保作业记录。
255
+
256
+ | 字段名 | 类型 | 显示名 | 说明 |
257
+ | ------ | ---- | ------ | ---- |
258
+ | maint_id | String | 维保 ID | 主键 |
259
+ | **date_key** | Int32 | 日期键 | 关联 dim_date(计划或完成日) |
260
+ | equipment_id | String | 设备 ID | 关联 dim_equipment |
261
+ | equipment_code | String | 设备位号 | 冗余 |
262
+ | plant_id | String | 厂区 ID | 冗余 |
263
+ | unit_id | String | 单元 ID | 冗余 |
264
+ | maint_type | String | 维保类型 | 预防/预测/故障维修/大修 |
265
+ | plan_date | Date | 计划日期 | |
266
+ | actual_date | Date | 实际完成日期 | 可空 |
267
+ | plan_hours | Float64 | 计划工时 | |
268
+ | actual_hours | Float64 | 实际工时 | |
269
+ | plan_cost | Float64 | 计划费用 | |
270
+ | actual_cost | Float64 | 实际费用 | |
271
+ | status | String | 状态 | 计划/进行中/完成/逾期 |
272
+ | is_on_schedule | UInt8 | 是否按期 | 1=按期完成 |
273
+ | vendor | String | 维保单位 | |
274
+ | description | String | 作业内容 | |
275
+ | created_at | DateTime | 创建时间 | |
276
+
277
+ **排序键**:`ORDER BY (date_key, equipment_id, maint_id)`
278
+
279
+ ### 2.9 事实表:fact_equipment_plan(设备运行计划)
280
+
281
+ **用途**:计划运行时间/产量,用于计划 vs 实际对比。
282
+
283
+ | 字段名 | 类型 | 显示名 | 说明 |
284
+ | ------ | ---- | ------ | ---- |
285
+ | plan_id | String | 计划 ID | 主键 |
286
+ | **date_key** | Int32 | 日期键 | 关联 dim_date |
287
+ | equipment_id | String | 设备 ID | 关联 dim_equipment |
288
+ | equipment_code | String | 设备位号 | 冗余 |
289
+ | plant_id | String | 厂区 ID | 冗余 |
290
+ | unit_id | String | 单元 ID | 冗余 |
291
+ | plan_version | String | 计划版本 | 如 2026月度计划 |
292
+ | fiscal_year | Int32 | 计划年度 | |
293
+ | fiscal_month | Int32 | 计划月份 | 1–12 |
294
+ | planned_runtime_min | Float64 | 计划运行时间 | 分钟 |
295
+ | planned_output_qty | Float64 | 计划产量 | |
296
+ | planned_energy | Float64 | 计划能耗 | |
297
+ | output_unit | String | 产量单位 | |
298
+ | status | String | 状态 | 草稿/已发布 |
299
+ | created_at | DateTime | 创建时间 | |
300
+
301
+ **排序键**:`ORDER BY (fiscal_year, fiscal_month, equipment_id, plan_id)`
302
+
303
+ ---
304
+
305
+ ## 三、表间关系设计
306
+
307
+ **关系模型**:
308
+
309
+ ```text
310
+ dim_date
311
+ (date_key PK)
312
+
313
+ ┌───────────────────────┼───────────────────────┐
314
+ │ date_key │ │ date_key
315
+ │ │ │
316
+ dim_plant ◄── dim_process_unit ◄── dim_equipment ◄── dim_equipment_type
317
+ (plant_id) (unit_id) (equipment_id) (equip_type_id)
318
+ ▲ ▲ ▲
319
+ │ │ │
320
+ │ │ fact_equipment_daily_ops
321
+ │ │ (日运行汇总)
322
+ │ │ │
323
+ │ │ fact_downtime_event ──► dim_downtime_reason
324
+ │ │ (停机事件) (reason_id)
325
+ │ │
326
+ │ │ fact_maintenance_record
327
+ │ │ (维保记录)
328
+ │ │
329
+ └───────────────┴──── fact_equipment_plan
330
+ (运行计划)
331
+ ```
332
+
333
+ **关系清单(16 条)**:
334
+
335
+ | 关系 ID | **347 分类** | 类型 | 从表 | 到表 | join_keys | 说明 |
336
+ | ------- | ------------ | ---- | ---- | ---- | --------- | ---- |
337
+ | rel_ops_date | **时间关联** | many_to_one | fact_equipment_daily_ops | dim_date | date_key → date_key | 日运行→日历 |
338
+ | rel_downtime_date | **时间关联** | many_to_one | fact_downtime_event | dim_date | date_key → date_key | 停机→日历 |
339
+ | rel_maint_date | **时间关联** | many_to_one | fact_maintenance_record | dim_date | date_key → date_key | 维保→日历 |
340
+ | rel_plan_date | **时间关联** | many_to_one | fact_equipment_plan | dim_date | date_key → date_key | 计划→日历 |
341
+ | rel_unit_plant | **主数据关联** | many_to_one | dim_process_unit | dim_plant | plant_id → plant_id | 单元→厂区 |
342
+ | rel_equip_type | **主数据关联** | many_to_one | dim_equipment | dim_equipment_type | equip_type_id → equip_type_id | 设备→类型 |
343
+ | rel_equip_plant | **主数据关联** | many_to_one | dim_equipment | dim_plant | plant_id → plant_id | 设备→厂区 |
344
+ | rel_equip_unit | **主数据关联** | many_to_one | dim_equipment | dim_process_unit | unit_id → unit_id | 设备→单元 |
345
+ | rel_ops_equip | **主数据关联** | many_to_one | fact_equipment_daily_ops | dim_equipment | equipment_id → equipment_id | 日运行→设备 |
346
+ | rel_downtime_equip | **主数据关联** | many_to_one | fact_downtime_event | dim_equipment | equipment_id → equipment_id | 停机→设备 |
347
+ | rel_downtime_reason | **主数据关联** | many_to_one | fact_downtime_event | dim_downtime_reason | reason_id → reason_id | 停机→原因 |
348
+ | rel_maint_equip | **主数据关联** | many_to_one | fact_maintenance_record | dim_equipment | equipment_id → equipment_id | 维保→设备 |
349
+ | rel_plan_equip | **主数据关联** | many_to_one | fact_equipment_plan | dim_equipment | equipment_id → equipment_id | 计划→设备 |
350
+ | rel_equip_type_parent | **层级自关联** | many_to_one | dim_equipment_type | dim_equipment_type | parent_type_id → equip_type_id | 类型树 |
351
+ | rel_reason_parent | **层级自关联** | many_to_one | dim_downtime_reason | dim_downtime_reason | parent_reason_id → reason_id | 原因树 |
352
+ | rel_plan_vs_ops | **预实关联** | many_to_one | fact_equipment_plan | fact_equipment_daily_ops | equipment_id + date_key → equipment_id + date_key | 计划对比实际(逻辑关联,实施用 JOIN) |
353
+
354
+ ---
355
+
356
+ ## 四、Cube 层设计
357
+
358
+ ### 4.0 Cube 清单
359
+
360
+ | Cube | 类别 | **347 分类** | 事实源 | 支撑对象 |
361
+ | ---- | ---- | ------------ | ------ | -------- |
362
+ | **OperationCube** | Process | **流程型** | fact_equipment_daily_ops | OperationSnapshot, EquipmentAnalysis |
363
+ | **EquipmentCube** | Subject | **主体型** | fact_equipment_daily_ops | Equipment |
364
+ | **PlantCube** | Subject | **主体型** | fact_equipment_daily_ops | Plant |
365
+ | **ProcessUnitCube** | Subject | **主体型** | fact_equipment_daily_ops | ProcessUnit |
366
+ | **DowntimeCube** | Process | **流程型** | fact_downtime_event | DowntimeEvent |
367
+ | **MaintenanceCube** | Process | **流程型** | fact_maintenance_record | MaintenanceRecord |
368
+ | **PlanVsActualCube** | Comparison | **对比型** | fact_equipment_plan + fact_equipment_daily_ops | PlanAnalysis |
369
+
370
+ ### 4.1 OperationCube(Process · 日运行主 Cube)
371
+
372
+ **事实源**:`fact_equipment_daily_ops`
373
+
374
+ **维度**:ops_id, date_key, calendar_date, year, month, equipment_id, equipment_code, equipment_name, plant_id, plant_name, unit_id, unit_name, equip_type_id, category, shift_code
375
+
376
+ **度量**:
377
+
378
+ | 度量名 | 列名 | 聚合 | 说明 |
379
+ | ------ | ---- | ---- | ---- |
380
+ | calendar_minutes_total | calendar_minutes | sum | 日历时间合计 |
381
+ | planned_downtime_total | planned_downtime_min | sum | 计划停机合计 |
382
+ | unplanned_downtime_total | unplanned_downtime_min | sum | 非计划停机合计 |
383
+ | runtime_total | runtime_min | sum | 运行时间合计 |
384
+ | actual_output_total | actual_output_qty | sum | 实际产量 |
385
+ | qualified_output_total | qualified_output_qty | sum | 合格产量 |
386
+ | energy_total | energy_consumption | sum | 能耗合计 |
387
+ | ops_days | ops_id | count | 汇总行数 |
388
+
389
+ **派生度量**:
390
+
391
+ | 度量名 | 表达式(示意) | 说明 |
392
+ | ------ | -------------- | ---- |
393
+ | availability | runtime_total / (calendar_minutes_total - planned_downtime_total) | 可用率 |
394
+ | performance | (actual_output_total / runtime_total) / avg(ideal_cycle_rate) | 性能率(按聚合层重算) |
395
+ | quality | qualified_output_total / actual_output_total | 质量率 |
396
+ | oee | availability * performance * quality | 综合效率 |
397
+ | load_rate | runtime_total / (calendar_minutes_total - planned_downtime_total) | 负荷率 |
398
+ | energy_per_output | energy_total / actual_output_total | 单位产量能耗 |
399
+
400
+ ### 4.2 EquipmentCube(Subject · 设备运营)
401
+
402
+ **目的**:Equipment 对象 bind_source
403
+
404
+ **维度**:equipment_id, equipment_code, equipment_name, equip_type_id, equip_type_name, category, plant_id, plant_name, unit_id, unit_name, criticality, production_mode, year, month
405
+
406
+ **度量**:runtime_total, unplanned_downtime_total, actual_output_total, energy_total, ops_days
407
+
408
+ **派生度量**:availability, performance, quality, oee, energy_per_output, mtbf_hours(示意:runtime_total / downtime_event_count,函数层 JOIN 停机表)
409
+
410
+ ### 4.3 PlantCube(Subject · 厂区)
411
+
412
+ **维度**:plant_id, plant_name, plant_type, year, month
413
+
414
+ **度量**:runtime_total, unplanned_downtime_total, actual_output_total, energy_total
415
+
416
+ **派生度量**:availability, oee, energy_per_output
417
+
418
+ ### 4.4 ProcessUnitCube(Subject · 工艺单元)
419
+
420
+ **维度**:unit_id, unit_name, unit_type, plant_id, plant_name, criticality, year, month
421
+
422
+ **度量**:runtime_total, unplanned_downtime_total, actual_output_total, energy_total
423
+
424
+ **派生度量**:availability, oee, load_rate
425
+
426
+ ### 4.5 DowntimeCube(Process · 停机事件)
427
+
428
+ **事实源**:`fact_downtime_event`
429
+
430
+ **维度**:event_id, date_key, equipment_id, equipment_code, plant_id, unit_id, reason_id, reason_code, reason_name, reason_category, is_planned, responsible_dept, year, month
431
+
432
+ **度量**:
433
+
434
+ | 度量名 | 列名 | 聚合 | 说明 |
435
+ | ------ | ---- | ---- | ---- |
436
+ | downtime_minutes | duration_min | sum | 停机时长 |
437
+ | event_count | event_id | count | 事件次数 |
438
+
439
+ **派生度量**:avg_downtime = downtime_minutes / event_count
440
+
441
+ ### 4.6 MaintenanceCube(Process · 维保)
442
+
443
+ **事实源**:`fact_maintenance_record`
444
+
445
+ **维度**:maint_id, date_key, equipment_id, plant_id, unit_id, maint_type, status, year, month
446
+
447
+ **度量**:plan_hours, actual_hours, plan_cost, actual_cost, maint_count(count maint_id)
448
+
449
+ **派生度量**:schedule_rate = sumIf(1, is_on_schedule=1) / maint_count;cost_variance = actual_cost - plan_cost
450
+
451
+ ### 4.7 PlanVsActualCube(Comparison · 计划 vs 实际)
452
+
453
+ **目的**:运行计划对比读模型
454
+
455
+ **维度**:fiscal_year, fiscal_month, equipment_id, equipment_code, plant_id, unit_id, plan_version
456
+
457
+ **度量**:planned_runtime_min, planned_output_qty, planned_energy(来自 plan);actual_runtime_min, actual_output_qty, actual_energy(来自 OperationCube 聚合);variance_runtime, variance_output, execution_rate(派生)
458
+
459
+ ---
460
+
461
+ ## 五、本体层设计
462
+
463
+ ### 5.1 对象类型(10 种)
464
+
465
+ | code | 分类 | **347 分类** | 名称 | bind_source | 主物理支撑 |
466
+ | ---- | ---- | ------------ | ---- | ----------- | ---------- |
467
+ | Plant | Master | **主数据** | 厂区/装置区 | PlantCube | dim_plant |
468
+ | ProcessUnit | Master | **主数据** | 工艺单元 | ProcessUnitCube | dim_process_unit |
469
+ | EquipmentType | Master | **主数据** | 设备类型 | — | dim_equipment_type |
470
+ | Equipment | Master | **主数据** | 设备 | EquipmentCube | dim_equipment |
471
+ | DowntimeReason | Reference | **参考** | 停机原因 | — | dim_downtime_reason |
472
+ | OperationSnapshot | Transaction | **事务** | 日运行汇总 | OperationCube | fact_equipment_daily_ops |
473
+ | DowntimeEvent | Transaction | **事务** | 停机事件 | DowntimeCube | fact_downtime_event |
474
+ | MaintenanceRecord | Transaction | **事务** | 维保记录 | MaintenanceCube | fact_maintenance_record |
475
+ | EquipmentAnalysis | Analytical | **分析** | 设备运营分析 | OperationCube | fact_equipment_daily_ops |
476
+ | PlanAnalysis | Analytical | **分析** | 计划对比分析 | PlanVsActualCube | fact_equipment_plan + fact_equipment_daily_ops |
477
+
478
+ ### 5.2 对象属性(节选)
479
+
480
+ #### Equipment(设备)
481
+
482
+ | 属性 code | 名称 | semantic_role | qualified_name |
483
+ | --------- | ---- | ------------- | -------------- |
484
+ | id | 设备 ID | dimension | EquipmentCube.equipment_id |
485
+ | code | 设备位号 | dimension | EquipmentCube.equipment_code |
486
+ | name | 设备名称 | dimension | EquipmentCube.equipment_name |
487
+ | category | 设备大类 | dimension | EquipmentCube.category |
488
+ | criticality | 关键等级 | dimension | EquipmentCube.criticality |
489
+ | runtime | 运行时间 | measure | EquipmentCube.runtime_total |
490
+ | availability | 可用率 | measure | EquipmentCube.availability |
491
+ | oee | 综合效率 | measure | EquipmentCube.oee |
492
+ | energy_per_output | 单位产量能耗 | measure | EquipmentCube.energy_per_output |
493
+
494
+ #### DowntimeEvent(停机事件)
495
+
496
+ | 属性 code | 名称 | semantic_role | qualified_name |
497
+ | --------- | ---- | ------------- | -------------- |
498
+ | id | 事件 ID | dimension | DowntimeCube.event_id |
499
+ | duration | 停机时长 | measure | DowntimeCube.downtime_minutes |
500
+ | reason | 原因名称 | dimension | DowntimeCube.reason_name |
501
+ | is_planned | 是否计划 | dimension | DowntimeCube.is_planned |
502
+
503
+ #### Plant(厂区)
504
+
505
+ | 属性 code | 名称 | semantic_role | qualified_name |
506
+ | --------- | ---- | ------------- | -------------- |
507
+ | id | 厂区 ID | dimension | PlantCube.plant_id |
508
+ | name | 厂区名称 | dimension | PlantCube.plant_name |
509
+ | oee | 装置 OEE | measure | PlantCube.oee |
510
+ | availability | 可用率 | measure | PlantCube.availability |
511
+
512
+ ### 5.3 链接类型(16 种)
513
+
514
+ | 链接 code | **347 分类** | 名称 | from | to | 说明 |
515
+ | --------- | ------------ | ---- | ---- | -- | ---- |
516
+ | unit_belongs_plant | **归属关系** | 单元归属厂区 | ProcessUnit | Plant | 组织层级 |
517
+ | equipment_belongs_plant | **归属关系** | 设备归属厂区 | Equipment | Plant | |
518
+ | equipment_belongs_unit | **归属关系** | 设备归属单元 | Equipment | ProcessUnit | |
519
+ | equipment_has_type | **归属关系** | 设备属于类型 | Equipment | EquipmentType | |
520
+ | snapshot_for_equipment | **归属关系** | 日运行归属设备 | OperationSnapshot | Equipment | |
521
+ | downtime_on_equipment | **归属关系** | 停机发生于设备 | DowntimeEvent | Equipment | |
522
+ | downtime_has_reason | **归属关系** | 停机对应原因 | DowntimeEvent | DowntimeReason | |
523
+ | maint_for_equipment | **归属关系** | 维保针对设备 | MaintenanceRecord | Equipment | |
524
+ | equip_type_has_parent | **层级关系** | 类型上级 | EquipmentType | EquipmentType | 类型树 |
525
+ | reason_has_parent | **层级关系** | 原因上级 | DowntimeReason | DowntimeReason | 原因树 |
526
+ | plan_compared_to_actual | **对比关系** | 计划对比实际 | PlanAnalysis | EquipmentAnalysis | 预实分析 |
527
+ | analysis_by_equipment | **分析归因** | 分析归因设备 | EquipmentAnalysis | Equipment | |
528
+ | analysis_by_plant | **分析归因** | 分析归因厂区 | EquipmentAnalysis | Plant | |
529
+ | analysis_by_unit | **分析归因** | 分析归因单元 | EquipmentAnalysis | ProcessUnit | |
530
+ | analysis_by_downtime | **分析归因** | 分析归因停机 | EquipmentAnalysis | DowntimeEvent | 停机驱动 |
531
+ | analysis_by_maintenance | **分析归因** | 分析归因维保 | EquipmentAnalysis | MaintenanceRecord | 维保影响 |
532
+
533
+ ---
534
+
535
+ ## 六、本体函数设计
536
+
537
+ ### 6.1 函数清单
538
+
539
+ | 函数 ID | **347 分类** | 功能 | 参数 |
540
+ | ------- | ------------ | ---- | ---- |
541
+ | equip_ops.fn.get_summary | **总览分析** | 设备运营总览 | start_date, end_date, plant_id(可选) |
542
+ | equip_ops.fn.oee_analysis | **总览分析** | OEE 分解(可用/性能/质量) | start_date, end_date, equipment_id(可选), group_by |
543
+ | equip_ops.fn.availability_analysis | **结构分析** | 可用率与停机结构 | start_date, end_date, plant_id(可选) |
544
+ | equip_ops.fn.downtime_breakdown | **结构分析** | 停机原因结构 | start_date, end_date, reason_level, plant_id(可选) |
545
+ | equip_ops.fn.yoy_analysis | **趋势分析** | 同比分析 | start_date, end_date, metric, plant_id(可选) |
546
+ | equip_ops.fn.mom_analysis | **趋势分析** | 环比分析 | start_date, end_date, metric, unit_id(可选) |
547
+ | equip_ops.fn.top_fault_equipment | **结构分析** | 故障 TOP 设备 | start_date, end_date, limit, plant_id(可选) |
548
+ | equip_ops.fn.maintenance_compliance | **组织分析** | 维保达成分析 | start_date, end_date, plant_id(可选) |
549
+ | equip_ops.fn.energy_intensity | **结构分析** | 能耗强度分析 | start_date, end_date, group_by, plant_id(可选) |
550
+ | equip_ops.fn.plan_vs_actual | **预实分析** | 运行计划对比 | fiscal_year, fiscal_month, plan_version, plant_id(可选) |
551
+ | equip_ops.fn.unit_comparison | **组织分析** | 工艺单元对标 | start_date, end_date, metric, plant_id |
552
+
553
+ ### 6.2 函数示例:equip_ops.fn.get_summary
554
+
555
+ **功能**:期间设备运营总览
556
+
557
+ **返回值**:
558
+
559
+ | 字段名 | 类型 | 说明 |
560
+ | ------ | ---- | ---- |
561
+ | equipment_count | Int | 纳入统计设备数 |
562
+ | avg_availability | Float64 | 平均可用率 |
563
+ | avg_oee | Float64 | 平均 OEE |
564
+ | total_runtime_hours | Float64 | 总运行小时 |
565
+ | total_unplanned_downtime_hours | Float64 | 非计划停机小时 |
566
+ | total_output_qty | Float64 | 总产量 |
567
+ | total_energy | Float64 | 总能耗 |
568
+ | energy_per_output | Float64 | 单位产量能耗 |
569
+ | downtime_event_count | Int | 停机事件次数 |
570
+
571
+ ### 6.3 函数示例:equip_ops.fn.oee_analysis
572
+
573
+ **功能**:OEE 三分解及分组汇总
574
+
575
+ **参数**:`group_by` = `equipment` | `unit` | `plant` | `equip_type`
576
+
577
+ **返回值**:group_id, group_name, availability, performance, quality, oee, runtime_hours, output_qty
578
+
579
+ ### 6.4 函数示例:equip_ops.fn.downtime_breakdown
580
+
581
+ **功能**:按停机原因层级展开结构与占比
582
+
583
+ **返回值**:reason_code, reason_name, reason_category, is_planned, downtime_hours, event_count, share_pct
584
+
585
+ ### 6.5 测试参数(test_arguments)
586
+
587
+ | 函数 ID | 默认 arguments 要点 |
588
+ | ------- | ------------------- |
589
+ | equip_ops.fn.get_summary | start_date=2025-01-01, end_date=2026-06-30 |
590
+ | equip_ops.fn.oee_analysis | 同上, group_by=plant |
591
+ | equip_ops.fn.availability_analysis | 同上 |
592
+ | equip_ops.fn.downtime_breakdown | reason_level=2 |
593
+ | equip_ops.fn.yoy_analysis | metric=oee |
594
+ | equip_ops.fn.mom_analysis | metric=availability |
595
+ | equip_ops.fn.top_fault_equipment | limit=10 |
596
+ | equip_ops.fn.maintenance_compliance | 2025-01-01 ~ 2026-06-30 |
597
+ | equip_ops.fn.energy_intensity | group_by=plant |
598
+ | equip_ops.fn.plan_vs_actual | fiscal_year=2026, fiscal_month=6, plan_version=2026月度计划 |
599
+ | equip_ops.fn.unit_comparison | metric=oee, plant_id(如有) |
600
+
601
+ ---
602
+
603
+ ## 七、实施计划
604
+
605
+ ### 7.1 阶段一:物理层
606
+
607
+ | 步骤 | 任务 | 说明 |
608
+ | ---- | ---- | ---- |
609
+ | 1 | **dim_date** | 共用或 ensure |
610
+ | 2 | dim_plant | 厂区维 |
611
+ | 3 | dim_process_unit | 工艺单元维 |
612
+ | 4 | dim_equipment_type | 设备类型维 |
613
+ | 5 | dim_equipment | 设备台账 |
614
+ | 6 | dim_downtime_reason | 停机原因维 |
615
+ | 7 | fact_equipment_daily_ops | 含 **date_key** |
616
+ | 8 | fact_downtime_event | 含 **date_key** |
617
+ | 9 | fact_maintenance_record | 含 **date_key** |
618
+ | 10 | fact_equipment_plan | 含 **date_key** |
619
+ | 11 | **TABLE_REGISTRY** + `register_with_meta` | |
620
+ | 12 | **表间关系(16 条)** | 含 4 条 fact→dim_date |
621
+
622
+ ### 7.2 阶段二:Cube 层
623
+
624
+ | 步骤 | 任务 |
625
+ | ---- | ---- |
626
+ | 13 | 注册 **7 个 Cube** |
627
+ | 14 | 派生度量 availability/performance/quality/oee/energy_per_output |
628
+
629
+ ### 7.3 阶段三:本体层
630
+
631
+ | 步骤 | 任务 |
632
+ | ---- | ---- |
633
+ | 15 | define_object_type(10 种) |
634
+ | 16 | bind_source |
635
+ | 17 | define_property |
636
+ | 18 | define_link_type(16 种) |
637
+ | 19 | sync_metric_refs |
638
+ | 20 | **CATEGORY_REGISTRY** + `apply_registry`(独立 category_mount 脚本) |
639
+
640
+ ### 7.4 阶段四:函数与数据
641
+
642
+ | 步骤 | 任务 |
643
+ | ---- | ---- |
644
+ | 21 | `equip_ops_ontology_init.py` + `equip_ops_seed_data.py` |
645
+ | 22 | 11 个 `equip_ops_fn_*.py` |
646
+ | 23 | publish + run → save-test-arguments |
647
+ | 24 | `equip_ops_category_mount.py` 最后执行 |
648
+
649
+ ---
650
+
651
+ ## 八、风险与验收
652
+
653
+ ### 8.1 风险
654
+
655
+ | 等级 | 风险 | 缓解措施 |
656
+ | ---- | ---- | -------- |
657
+ | 中 | OEE 口径与 DCS/MES 不一致 | 规划与 seed 统一公式;函数注释写明口径 |
658
+ | 中 | 计划停机计入可用率分母 | seed 区分 planned/unplanned;函数与 Cube 一致 |
659
+ | 中 | 多班次同日多行重复计量 | ops_id 含 shift;汇总函数按 equipment+date 去重或 sum |
660
+ | 低 | 多域共用 space_id | init 仅创建本域表 |
661
+ | 低 | 能耗单位不统一 | seed 固定 energy_unit;强度函数按单位过滤 |
662
+
663
+ ### 8.2 验收标准
664
+
665
+ | 验收项 | 标准 |
666
+ | ------ | ---- |
667
+ | dim_date | 可查询;fact 的 date_key 可 JOIN |
668
+ | 维度表 | 5 张(plant/unit/equip_type/equipment/downtime_reason)可查询 |
669
+ | fact_equipment_daily_ops | OEE 手工 SQL 与 get_summary 一致 |
670
+ | fact_downtime_event | 停机时长汇总与 downtime_breakdown 一致 |
671
+ | **表间关系** | **16 条** |
672
+ | Cube | **7 个** + 派生度量 |
673
+ | 对象 | 10 种 + 分类;16 种链接 |
674
+ | 函数 | get_summary、oee_analysis、downtime_breakdown 可运行 |
675
+
676
+ ---
677
+
678
+ ## 附录 B:347 分类挂载对照表(CATEGORY_REGISTRY)
679
+
680
+ ### B.1 物理表(table)
681
+
682
+ | 347 分类 | 表名 |
683
+ | -------- | ---- |
684
+ | 时间维 | dim_date |
685
+ | 维度表 | dim_plant, dim_process_unit, dim_equipment_type, dim_equipment, dim_downtime_reason |
686
+ | 事实表 | fact_equipment_daily_ops, fact_downtime_event, fact_maintenance_record, fact_equipment_plan |
687
+
688
+ ### B.2 Cube
689
+
690
+ | 347 分类 | Cube 名 |
691
+ | -------- | ------- |
692
+ | 流程型 | OperationCube, DowntimeCube, MaintenanceCube |
693
+ | 主体型 | EquipmentCube, PlantCube, ProcessUnitCube |
694
+ | 对比型 | PlanVsActualCube |
695
+
696
+ ### B.3 对象类型
697
+
698
+ | 347 分类 | 对象 code |
699
+ | -------- | --------- |
700
+ | 主数据 | Plant, ProcessUnit, EquipmentType, Equipment |
701
+ | 参考 | DowntimeReason |
702
+ | 事务 | OperationSnapshot, DowntimeEvent, MaintenanceRecord |
703
+ | 分析 | EquipmentAnalysis, PlanAnalysis |
704
+
705
+ ### B.4 链接类型
706
+
707
+ | 347 分类 | 链接 code |
708
+ | -------- | --------- |
709
+ | 归属关系 | unit_belongs_plant, equipment_belongs_plant, equipment_belongs_unit, equipment_has_type, snapshot_for_equipment, downtime_on_equipment, downtime_has_reason, maint_for_equipment |
710
+ | 层级关系 | equip_type_has_parent, reason_has_parent |
711
+ | 对比关系 | plan_compared_to_actual |
712
+ | 分析归因 | analysis_by_equipment, analysis_by_plant, analysis_by_unit, analysis_by_downtime, analysis_by_maintenance |
713
+
714
+ ### B.5 函数
715
+
716
+ | 347 分类 | 函数 ID |
717
+ | -------- | ------- |
718
+ | 总览分析 | equip_ops.fn.get_summary, equip_ops.fn.oee_analysis |
719
+ | 趋势分析 | equip_ops.fn.yoy_analysis, equip_ops.fn.mom_analysis |
720
+ | 结构分析 | equip_ops.fn.availability_analysis, equip_ops.fn.downtime_breakdown, equip_ops.fn.top_fault_equipment, equip_ops.fn.energy_intensity |
721
+ | 预实分析 | equip_ops.fn.plan_vs_actual |
722
+ | 组织分析 | equip_ops.fn.maintenance_compliance, equip_ops.fn.unit_comparison |
723
+
724
+ ---
725
+
726
+ ## 附录:规划完整性自检清单
727
+
728
+ - [ ] 业务场景:化工设备运营域边界、OEE/停机/维保/能耗目标已写清
729
+ - [ ] 物理层:dim_date(含 date_key)、5 张维度表、4 张事实表
730
+ - [ ] 表间关系:16 条(含 dim_date 关联、层级自关联、预实关联)
731
+ - [ ] Cube 层:7 个 Cube(含 PlanVsActualCube)、派生度量
732
+ - [ ] 本体层:10 种对象类型、16 种链接类型
733
+ - [ ] 函数设计:11 个函数(含 test_arguments 要点)
734
+ - [ ] 347 分类:附录 B 完整
735
+ - [ ] 与参照示例差异说明:已填写(§1.3)