docs: 补充故障接口扫描数量返回

main
wangqiyang 3 days ago
parent c04a601335
commit 761d991327

@ -191,6 +191,31 @@ for i := 0; i < 10; i++ {
没有配置时默认 `10`,但现场可以按实际回路数量调整。 没有配置时默认 `10`,但现场可以按实际回路数量调整。
后端实时接口需要返回当前实际参与扫描的设备数,便于前端展示和现场核对当前扫描范围。
建议字段:
```json
{
"scan_device_count": 4
}
```
字段含义:
| 字段 | 说明 |
| --- | --- |
| `scan_device_count` | 本次按配置实际参与 0x17 轮询的设备/回路数量 |
如果后续需要区分“参与扫描数量”和“成功读取数量”,可以再增加:
```json
{
"scan_device_count": 4,
"scan_success_count": 3
}
```
## 后端改动点 ## 后端改动点
### 1. 调整 0x17 数据解析 ### 1. 调整 0x17 数据解析
@ -253,13 +278,31 @@ internal/module/m9zTtyApi/read.go
```json ```json
{ {
"scan_device_count": 4,
"Loops": [
{
"has_fault": true, "has_fault": true,
"fault_msg": "回路1短路故障", "fault_msg": "回路1短路故障",
"fault_code": "01", "fault_code": "01",
"faults": [] "faults": []
}
]
} }
``` ```
其中每个回路对象包含:
```json
{
"has_fault": true,
"fault_msg": "回路1短路故障",
"fault_code": "01",
"faults": []
}
```
顶层 `scan_device_count` 表示当前后端实际参与扫描的设备/回路数量。
同时把实时监控中的回路电流改为直接使用 0x17 的回路总电流字段,不再累加子模块电流。 同时把实时监控中的回路电流改为直接使用 0x17 的回路总电流字段,不再累加子模块电流。
### 4. 实时写入报警历史 ### 4. 实时写入报警历史
@ -302,6 +345,14 @@ for i := 0; i < loopCount; i++ {
`loopCount` 从配置读取,未配置默认 10。 `loopCount` 从配置读取,未配置默认 10。
实时接口返回值需要带上当前扫描数量:
```json
{
"scan_device_count": 10
}
```
涉及位置: 涉及位置:
```text ```text
@ -354,12 +405,19 @@ internal/module/m9zTtyApi/cron.go
读取字段: 读取字段:
```text ```text
scan_device_count
Loops[].has_fault Loops[].has_fault
Loops[].fault_msg Loops[].fault_msg
Loops[].fault_code Loops[].fault_code
Loops[].faults Loops[].faults
``` ```
前端可在当前故障区域或调试信息中展示当前扫描数量,例如:
```text
当前扫描设备数4
```
### 3. 报警预览保持历史列表 ### 3. 报警预览保持历史列表
页面: 页面:

Loading…
Cancel
Save