feat: 看板管理屏专属面板与追溯查询三合一 + AGV状态WS实时推送 + 数据库错误友好文案分层

This commit is contained in:
SunYF
2026-11-17 06:41:41 +08:00
parent 3b0fb2ea46
commit 5c9a7e32d2
59 changed files with 2302 additions and 789 deletions
@@ -20,6 +20,8 @@ import (
"bj_power_mes/ent/workorder"
"bj_power_mes/ent/workpieceprocess"
"bj_power_mes/internal/verr"
"github.com/zeromicro/go-zero/core/logx"
)
// ---------- 工艺流程(块3) ----------
@@ -445,6 +447,31 @@ if req.FlowId != nil {
ve.Add("flowId", fmt.Sprintf("工位%d 存在正在进行的工单(生产路线包含此工位),禁止修改绑定工艺", st.StationNo),
"请先将该工位的进行中工单完工或取消,再修改绑定工艺")
}
// 未退料闭环校验(2026-11-16 主控包项8):工位有尚未被 WMS 确认的退库单(PENDING)时,
// 禁止改/解绑工艺绑定——强制先走完「清点退料 → WMS 确认收货」。WMS 不可达时 fail-open
// (与 PLC 离线同口径:外部系统宕机不能永久卡死工位配置),仅记日志不硬拦。
if s.ctx.Wms != nil {
if returns, rErr := s.ctx.Wms.StationReturnList(ctx, st.StationNo); rErr != nil {
logx.Errorf("工位%d 改绑定前查询未确认退库单失败(放行):%v", st.StationNo, rErr)
} else {
pending := 0
for _, ro := range returns {
stt := ""
if ro != nil {
if v, ok := ro["status"]; ok && v != nil {
stt = fmt.Sprint(v)
}
}
if stt == "PENDING" {
pending++
}
}
if pending > 0 {
ve.Add("flowId", fmt.Sprintf("工位%d 有 %d 张未确认的退库单,禁止修改绑定工艺", st.StationNo, pending),
"请先清点退料并在 WMS 退库单收货确认后,再修改绑定工艺")
}
}
}
}
if n, _ := s.ctx.EntClient.PlcSendLog.Query().
Where(plcsendlog.Status("SENT"), plcsendlog.StationNo(st.StationNo)).Count(ctx); n > 0 {