feat: 实现 PLC↔MES 对账功能(#8),包含终端触发与系统触发逻辑
新增功能: 1. 新增 PLC 客户端接口 QueryStationPallet,支持 mock 与真实 PLC 寄存器读取 2. 新增对账检测逻辑,覆盖 11 个工位(G1~G10 + C15) 3. 事件驱动触发:终端 T2/T3/T5 触发单工位检测,T4 报工命中则阻断;T6/T7 系统触发全量检测并落预警中心 4. 新增路由、handler、logic、测试用例及帮助文档,完成对账全链路实现
This commit is contained in:
@@ -275,11 +275,11 @@ func OnlineWorkpieceInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc
|
||||
return
|
||||
}
|
||||
LogImpersonation(svcCtx, r, r.URL.Query().Get("operator"), "/api/internal/workpiece/online")
|
||||
if msg, err := logic.New(svcCtx).OnlineWorkpiece(r.Context(), req, StationOp(r, r.URL.Query().Get("operator"))); err != nil {
|
||||
if msg, mm, err := logic.New(svcCtx).OnlineWorkpiece(r.Context(), req, StationOp(r, r.URL.Query().Get("operator"))); err != nil {
|
||||
httpx.Fail(w, 2007, err.Error())
|
||||
return
|
||||
} else {
|
||||
httpx.OkMessage(w, msg, nil)
|
||||
httpx.OkMessage(w, msg, mm)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ func OnlineWorkpieceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
httpx.BadRequest(w, "请求体解析失败")
|
||||
return
|
||||
}
|
||||
if msg, err := logic.New(svcCtx).OnlineWorkpiece(r.Context(), req, operator(r, "")); err != nil {
|
||||
if msg, mm, err := logic.New(svcCtx).OnlineWorkpiece(r.Context(), req, operator(r, "")); err != nil {
|
||||
httpx.Fail(w, 3301, err.Error())
|
||||
return
|
||||
} else {
|
||||
httpx.OkMessage(w, msg, nil)
|
||||
httpx.OkMessage(w, msg, mm)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user