feat: edc-web 支持车检器序列号输入与显示

- 自动化测试区域新增「车检器序列号」输入框
- 回车键自动触发「开始」按钮
- /api/automation/start 接收 detector_serial,写入 tb_pending_detector
- 测试操作页 + 测试信息页(全部/B2/B4)显示序列号,空时显示 '-'
- 页面加载和测试结束后焦点自动回到序列号输入框(全选),方便连续测试
This commit is contained in:
wangfq
2026-06-15 10:02:51 +08:00
parent 4ac6cbb2fe
commit 521cbe4107
6 changed files with 73 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ from app.models import (
get_wave_records,
clear_serialnet_records,
insert_log,
set_pending_detector_serial,
)
bp = Blueprint("test_op", __name__)
@@ -89,10 +90,15 @@ def api_automation_start():
data = request.get_json()
dnt_id = data.get("dnt_id")
count = int(data.get("count", 1))
detector_serial = (data.get("detector_serial") or "").strip()
device = get_device_by_id(dnt_id)
target = f"{device['serial']}" if device else f"dnt_id={dnt_id}"
# 存储待插入的车检器序列号
if detector_serial:
set_pending_detector_serial(dnt_id, detector_serial)
# 清除旧记录,然后插入第一条 0xB0
clear_serialnet_records(dnt_id)
record_id = insert_serialnet(dnt_id, COMMANDS["B0"])