feat: 新增收集式校验错误弹窗及工位报警语音播报
新增 ErrorListDialog 组件用于统一展示结构化校验错误信息,实现报错一次收全;新增工位报警语音播报功能,通过浏览器 SpeechSynthesis 播放本工位相关报警;调整物料类别及序列号字段文案,移除「其他」类别;新增工单实际开始字段及采集方式配置;优化 AGV 及 PlcSend 页签刷新逻辑;新增看板物料追溯及工位报警接口;删除 PLC 强制写 M 位及相关测试代码;同步数据库字段注释及补丁。
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"bj_power_workstation/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
// stationAlertsHandler GET /api/alerts/station?stationNo=&minutes=
|
||||
// 代理 MES GET /api/internal/station/alerts(谁受影响谁播报,2026-10-20)。
|
||||
// 终端前端 30 秒轮询本工位相关报警;MES 不可达/业务拒绝静默返回空列表,不影响作业。
|
||||
func stationAlertsHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
stationNo := atoi(strings.TrimSpace(r.URL.Query().Get("stationNo")), 0)
|
||||
minutes := atoi(strings.TrimSpace(r.URL.Query().Get("minutes")), 10)
|
||||
if stationNo <= 0 {
|
||||
ok(w, []any{})
|
||||
return
|
||||
}
|
||||
body, _, err := ctx.Mes.Get("/api/internal/station/alerts", url.Values{
|
||||
"stationNo": {strconv.Itoa(stationNo)},
|
||||
"minutes": {strconv.Itoa(minutes)},
|
||||
})
|
||||
if err != nil {
|
||||
// MES 不可达:静默返回空,终端语音播报不因后端抖动而报错刷屏
|
||||
logx.Errorf("工位报警查询 MES 不可达,静默跳过: %v", err)
|
||||
ok(w, []any{})
|
||||
return
|
||||
}
|
||||
if msg := mesRespCode(body); msg != "" {
|
||||
logx.Errorf("工位报警查询 MES 业务拒绝,静默跳过: %s", msg)
|
||||
ok(w, []any{})
|
||||
return
|
||||
}
|
||||
passJSON(w, body)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user