feat: 重构 AGV 对接与在制品查询,新增 PLC 手动监控功能
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
"bj_power_workstation/internal/auth"
|
||||
"bj_power_workstation/internal/mes"
|
||||
"bj_power_workstation/internal/svc"
|
||||
@@ -57,8 +59,11 @@ func loginHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
fail(w, http.StatusUnauthorized, bizErr.Message)
|
||||
return
|
||||
}
|
||||
fail(w, http.StatusBadGateway, "MES 服务不可达:"+errString(err))
|
||||
return
|
||||
// MES 不可达(连接拒绝/超时/DNS 失败等):技术细节记日志,面向终端只给业务化提示,不外泄 dial tcp
|
||||
logx.Errorf("登录代理 MES /api/internal/station/login 不可达:user=%s stationNo=%d err=%v",
|
||||
strings.TrimSpace(req.Username), req.StationNo, err)
|
||||
fail(w, http.StatusBadGateway, "MES 服务不可达,请检查网络或联系管理员")
|
||||
return
|
||||
}
|
||||
// 方案 B:落盘工位登录态 JWT,作为后续报工/拧紧的可信身份锚点
|
||||
var loginResp struct {
|
||||
@@ -100,9 +105,11 @@ func logoutHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
_ = parseJSON(r, &req)
|
||||
// 退出前先统计「当前登录人」尚未成功上报的本地数据条数,供前端提醒本人处理
|
||||
pendingQueue, pendingTorque := int64(0), int64(0)
|
||||
deadQueue := int64(0)
|
||||
if ss, sErr := ctx.Store.GetStationSession(); sErr == nil && ss != nil {
|
||||
pendingQueue, _ = ctx.Store.PendingQueueCountForOperator(ss.UserID)
|
||||
pendingTorque, _ = ctx.Store.PendingTorqueCountForOperator(ss.UserID)
|
||||
deadQueue, _ = ctx.Store.DeadQueueCountForOperator(ss.UserID)
|
||||
}
|
||||
username := strings.TrimSpace(req.Username)
|
||||
if username != "" {
|
||||
@@ -121,6 +128,7 @@ func logoutHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
"pendingQueue": pendingQueue,
|
||||
"pendingTorque": pendingTorque,
|
||||
"pendingTotal": pendingQueue + pendingTorque,
|
||||
"deadTotal": deadQueue,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user