feat: 新增收集式校验错误弹窗及工位报警语音播报
新增 ErrorListDialog 组件用于统一展示结构化校验错误信息,实现报错一次收全;新增工位报警语音播报功能,通过浏览器 SpeechSynthesis 播放本工位相关报警;调整物料类别及序列号字段文案,移除「其他」类别;新增工单实际开始字段及采集方式配置;优化 AGV 及 PlcSend 页签刷新逻辑;新增看板物料追溯及工位报警接口;删除 PLC 强制写 M 位及相关测试代码;同步数据库字段注释及补丁。
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package plc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -79,46 +78,3 @@ func TestDecodeBits(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestIsWritableMW 块 D 白名单:MW800~886 + 4096~4099 可写,其余拒绝。
|
||||
func TestIsWritableMW(t *testing.T) {
|
||||
ok := []int{800, 805, 886, 4096, 4099}
|
||||
bad := []int{799, 887, 900, 4095, 4100, 0, 4096 + 100, 10000}
|
||||
for _, a := range ok {
|
||||
if !IsWritableMW(a) {
|
||||
t.Fatalf("IsWritableMW(%d) = false, want true", a)
|
||||
}
|
||||
}
|
||||
for _, a := range bad {
|
||||
if IsWritableMW(a) {
|
||||
t.Fatalf("IsWritableMW(%d) = true, want false", a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestIsWritableMerkerByte 块 D:M 字节地址范围校验。
|
||||
func TestIsWritableMerkerByte(t *testing.T) {
|
||||
if !IsWritableMerkerByte(895) || !IsWritableMerkerByte(0) || !IsWritableMerkerByte(65535) {
|
||||
t.Fatal("合法 M 字节应放行")
|
||||
}
|
||||
if IsWritableMerkerByte(-1) || IsWritableMerkerByte(65536) {
|
||||
t.Fatal("越界 M 字节应拒绝")
|
||||
}
|
||||
}
|
||||
|
||||
// TestMockWriteBit 块 D:强制写 M 位(mock)写前/写后值正确。
|
||||
func TestMockWriteBit(t *testing.T) {
|
||||
m := newMockClient()
|
||||
// 初始无值
|
||||
before, after, err := m.WriteBit(context.Background(), 898, 2, true)
|
||||
if err != nil || before != false || after != true {
|
||||
t.Fatalf("WriteBit 置位: before=%v after=%v err=%v", before, after, err)
|
||||
}
|
||||
before, after, err = m.WriteBit(context.Background(), 898, 2, false)
|
||||
if err != nil || before != true || after != false {
|
||||
t.Fatalf("WriteBit 复位: before=%v after=%v err=%v", before, after, err)
|
||||
}
|
||||
// 非法位
|
||||
if _, _, err = m.WriteBit(context.Background(), 898, 8, true); err == nil {
|
||||
t.Fatal("bit=8 应报错")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user