feat: 完成 issue #82 [树脂] 抽取树脂点位字典

This commit is contained in:
2026-08-05 04:44:58 +08:00
parent 8108a316b2
commit 05bcb3b2f5
4 changed files with 19 additions and 3 deletions
+14
View File
@@ -24,6 +24,14 @@ EXPECTED_COLUMNS = [
"sampleRate", "qualityCode", "opcNode", "protocol",
]
# 对齐内核 schema.VALID_PROTOCOLS / VALID_UNITS(含树脂模板扩展量纲 rpm / mmol/g)
VALID_PROTOCOLS = {"opcua", "s7", "modbus", "weighing", "energy", "simulator"}
VALID_UNITS = {
"℃", "kPa", "MPa", "m³/h", "m3/h", "%", "kg", "t", "t/h", "m³", "m3",
"A", "V", "Hz", "kW", "kWh", "Pa", "bar", "mm", "L", "L/min", "m/s",
"rpm", "mmol/g",
}
# PRD 5.5 iAOP-cockpit-layout-v1 允许的 widget 类型
ALLOWED_WIDGETS = {
"process_view", "trend", "kpi_card", "alarm_panel", "nl_query",
@@ -49,6 +57,12 @@ def main() -> int:
for i, row in enumerate(rows[1:], 2):
if len(row) != len(EXPECTED_COLUMNS):
failures.append(f"CSV 第 {i} 行列数异常:{len(row)}")
continue
unit, protocol = row[3].strip(), row[8].strip()
if unit not in VALID_UNITS:
failures.append(f"CSV 第 {i} 行非法量纲: '{unit}'(对齐内核 schema.VALID_UNITS)")
if protocol and protocol not in VALID_PROTOCOLS:
failures.append(f"CSV 第 {i} 行非法协议: '{protocol}'(对齐内核 schema.VALID_PROTOCOLS)")
# 2) YAML 资产可解析
for rel in ("rag-kb/kb.resin.template.yaml",