feat: 重构 AGV 对接与在制品查询,新增 PLC 手动监控功能
This commit is contained in:
@@ -125,20 +125,20 @@ func DispatchAgvInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// AgvCallbackHandler POST /api/spi/agv/callback 海康 RCS SPI 任务状态回调(文档 2.2.1)。
|
||||
// AgvCallbackHandler POST /api/spi/agv/agvCallbackService/agvCallback 海康 RCS-Lite SPI 任务状态回调(文档 2.2.1)。
|
||||
// 回调体含 taskCode(当前任务单号) 与 method(start/outbin/end/cancel),据此驱动任务状态。
|
||||
// 注意:RCS 回调不带我方鉴权头,生产环境必须以防火墙/IP 白名单隔离该端点(待与 RCS 方确认鉴权方式)。
|
||||
func AgvCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var body struct {
|
||||
RobotTaskCode string `json:"robotTaskCode"`
|
||||
TaskStatus string `json:"taskStatus"`
|
||||
Method string `json:"method"`
|
||||
TaskCode string `json:"taskCode"`
|
||||
Method string `json:"method"`
|
||||
}
|
||||
if err := httpx.ParseJSON(r, &body); err != nil {
|
||||
httpx.BadRequest(w, "回调报文解析失败")
|
||||
return
|
||||
}
|
||||
if err := logic.New(svcCtx).ApplyAgvCallback(r.Context(), body.RobotTaskCode, body.TaskStatus, body.Method); err != nil {
|
||||
if err := logic.New(svcCtx).ApplyAgvCallback(r.Context(), body.TaskCode, body.Method); err != nil {
|
||||
httpx.Fail(w, 3307, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package production
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"bj_power_mes/common/httpx"
|
||||
@@ -10,8 +11,10 @@ import (
|
||||
"bj_power_mes/internal/svc"
|
||||
)
|
||||
|
||||
// 接驳台主数据(真源在 MES,2026-09-21 自 WMS 迁入):系统预置只读,不提供增删改。
|
||||
// 接驳台主数据(真源在 MES,2026-09-21 自 WMS 迁入)。
|
||||
// 工位维护 / 排产推荐 / AGV 通讯均查本表;仓库不再维护接驳台、也不给接驳台派任务。
|
||||
// 2026-10-17(块 E.2)开放维护:接驳台并入「产线管理」页 tab3,提供增/改/删/启停。
|
||||
// has_pallet / pallet_ref 为 PLC 传感器实时占用态,不属人工维护字段,CRUD 一律不触碰。
|
||||
|
||||
// dockRow 接驳台返回 DTO(显式 json 标签,避免 ent omitempty 吞掉 hasPallet=false)。
|
||||
type dockRow struct {
|
||||
@@ -88,7 +91,7 @@ func ListDocksMaintHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
|
||||
// ListDocksInternalHandler GET /api/internal/docks 供 WMS 拉取接驳台主数据
|
||||
// (WMS 出库目标工位下拉 / AGV 页接驳台列表;dock 真源已迁 MES)。X-API-TOKEN 保护。
|
||||
// (WMS 出库目标工位下拉;dock 真源已迁 MES)。X-API-TOKEN 保护。
|
||||
func ListDocksInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
list, err := svcCtx.EntClient.Dock.Query().Order(dock.ByDockCode()).All(r.Context())
|
||||
@@ -103,3 +106,159 @@ func ListDocksInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
httpx.Ok(w, map[string]any{"list": rows})
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- 接驳台维护(块 E.2:并入产线管理页,开放增/改/删/启停) ----------
|
||||
|
||||
// dockEditReq 接驳台维护请求体(id=0 为新增;has_pallet/pallet_ref 为 PLC 实时态,不接受人工维护)。
|
||||
type dockEditReq struct {
|
||||
ID int `json:"id"`
|
||||
DockCode string `json:"dockCode"`
|
||||
Name string `json:"name"`
|
||||
DockType string `json:"dockType"`
|
||||
StationNo int `json:"stationNo"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
var dockCodeRe = regexp.MustCompile(`^[A-Z0-9]{2,16}$`)
|
||||
|
||||
// validateDock 校验维护字段:编码唯一、类型/工位/状态合法。失败时已写响应,返回 ok=false。
|
||||
func validateDock(w http.ResponseWriter, ctx *svc.ServiceContext, r *http.Request, req dockEditReq) (code string, stationNo int, ok bool) {
|
||||
code = strings.ToUpper(strings.TrimSpace(req.DockCode))
|
||||
name := strings.TrimSpace(req.Name)
|
||||
typ := strings.TrimSpace(req.DockType)
|
||||
status := strings.TrimSpace(req.Status)
|
||||
if status == "" {
|
||||
status = "ENABLED"
|
||||
}
|
||||
if !dockCodeRe.MatchString(code) {
|
||||
httpx.Fail(w, 3114, "接驳台编码必填,仅支持大写字母与数字(2~16 位),如 DOCK05")
|
||||
return "", 0, false
|
||||
}
|
||||
if name == "" {
|
||||
httpx.Fail(w, 3114, "接驳台名称必填")
|
||||
return "", 0, false
|
||||
}
|
||||
switch typ {
|
||||
case "line", "store", "other":
|
||||
default:
|
||||
httpx.Fail(w, 3114, "非法的接驳台类型(仅支持:产线 / 库房 / 其他)")
|
||||
return "", 0, false
|
||||
}
|
||||
switch status {
|
||||
case "ENABLED", "DISABLED":
|
||||
default:
|
||||
httpx.Fail(w, 3114, "非法的启用状态(仅支持:启用 / 停用)")
|
||||
return "", 0, false
|
||||
}
|
||||
if typ == "line" {
|
||||
if req.StationNo < 1 || req.StationNo > 12 {
|
||||
httpx.Fail(w, 3114, "产线类接驳台必须绑定工位(工位号 1~12)")
|
||||
return "", 0, false
|
||||
}
|
||||
stationNo = req.StationNo
|
||||
}
|
||||
// 编码唯一(大小写不敏感;编辑时排除自身)
|
||||
q := ctx.EntClient.Dock.Query().Where(dock.DockCodeEqualFold(code))
|
||||
if req.ID > 0 {
|
||||
q = q.Where(dock.IDNEQ(req.ID))
|
||||
}
|
||||
exist, err := q.Exist(r.Context())
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3115, "校验编码重复失败:"+err.Error())
|
||||
return "", 0, false
|
||||
}
|
||||
if exist {
|
||||
httpx.Fail(w, 3115, "接驳台编码已存在:"+code)
|
||||
return "", 0, false
|
||||
}
|
||||
return code, stationNo, true
|
||||
}
|
||||
|
||||
// SaveDockHandler POST /docks 新增或修改接驳台(id=0 为新增)。
|
||||
func SaveDockHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req dockEditReq
|
||||
if err := httpx.ParseJSON(r, &req); err != nil {
|
||||
httpx.BadRequest(w, "请求体解析失败")
|
||||
return
|
||||
}
|
||||
code, stationNo, ok := validateDock(w, svcCtx, r, req)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
name := strings.TrimSpace(req.Name)
|
||||
typ := strings.TrimSpace(req.DockType)
|
||||
status := strings.TrimSpace(req.Status)
|
||||
if status == "" {
|
||||
status = "ENABLED"
|
||||
}
|
||||
var d *ent.Dock
|
||||
if req.ID > 0 {
|
||||
updated, err := svcCtx.EntClient.Dock.UpdateOneID(req.ID).
|
||||
SetDockCode(code).SetName(name).SetDockType(typ).SetStationNo(stationNo).SetStatus(status).Save(r.Context())
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3115, "修改接驳台失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
d = updated
|
||||
} else {
|
||||
created, err := svcCtx.EntClient.Dock.Create().
|
||||
SetDockCode(code).SetName(name).SetDockType(typ).SetStationNo(stationNo).SetStatus(status).Save(r.Context())
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3115, "新增接驳台失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
d = created
|
||||
}
|
||||
httpx.Ok(w, dockRowOf(d))
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteDockHandler DELETE /docks/:id 删除接驳台(接驳台为主数据,删除前确认无引用)。
|
||||
func DeleteDockHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
id := pathID(r)
|
||||
if id <= 0 {
|
||||
httpx.BadRequest(w, "非法的接驳台 ID")
|
||||
return
|
||||
}
|
||||
exist, err := svcCtx.EntClient.Dock.Query().Where(dock.IDEQ(id)).Exist(r.Context())
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3116, "查询接驳台失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
if !exist {
|
||||
httpx.Fail(w, 3116, "接驳台不存在或已删除")
|
||||
return
|
||||
}
|
||||
if err := svcCtx.EntClient.Dock.DeleteOneID(id).Exec(r.Context()); err != nil {
|
||||
httpx.Fail(w, 3116, "删除接驳台失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, map[string]any{"id": id})
|
||||
}
|
||||
}
|
||||
|
||||
// SetDockStatusHandler POST /docks/status 启用/停用接驳台(body {id,status})。
|
||||
func SetDockStatusHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req struct {
|
||||
ID int `json:"id"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
if err := httpx.ParseJSON(r, &req); err != nil || req.ID <= 0 {
|
||||
httpx.BadRequest(w, "参数错误")
|
||||
return
|
||||
}
|
||||
if req.Status != "ENABLED" && req.Status != "DISABLED" {
|
||||
httpx.BadRequest(w, "非法的启用状态(仅支持:启用 / 停用)")
|
||||
return
|
||||
}
|
||||
d, err := svcCtx.EntClient.Dock.UpdateOneID(req.ID).SetStatus(req.Status).Save(r.Context())
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3117, "更新接驳台状态失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, dockRowOf(d))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
package production
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"bj_power_mes/common/httpx"
|
||||
"bj_power_mes/internal/logic"
|
||||
"bj_power_mes/internal/plc"
|
||||
"bj_power_mes/internal/svc"
|
||||
)
|
||||
|
||||
// ---------- PLC 手动监控(新菜单:produce.plc.monitor;不另设操作权限码) ----------
|
||||
|
||||
// PlcMonitorBitsHandler GET /plc/monitor/bits 读取 48 位点位状态(打开页面刷新一次,不轮询)。
|
||||
func PlcMonitorBitsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := logic.New(svcCtx).PlcMonitorBits(r.Context())
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3301, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, data)
|
||||
}
|
||||
}
|
||||
|
||||
// PlcMonitorMWHandler GET /plc/monitor/mw 读取 §4.4 全部 MW 当前值并解析源→目标(非0 即在途指令)。
|
||||
func PlcMonitorMWHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := logic.New(svcCtx).PlcMonitorMW(r.Context())
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3302, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, data)
|
||||
}
|
||||
}
|
||||
|
||||
// PlcMonitorTargetsHandler GET /plc/monitor/targets?srcType=G&src=1 返回某源允许的合法目标(动态过滤下拉)。
|
||||
func PlcMonitorTargetsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
q := r.URL.Query()
|
||||
st, ok := plc.ParseSrcType(q.Get("srcType"))
|
||||
if !ok {
|
||||
httpx.Fail(w, 3303, "非法的源类型")
|
||||
return
|
||||
}
|
||||
src := atoiDefault(q.Get("src"), 0)
|
||||
httpx.Ok(w, plc.MonitorTargets(st, src))
|
||||
}
|
||||
}
|
||||
|
||||
// PlcMonitorPreviewHandler GET /plc/monitor/preview?srcType=G&src=1&tgtType=C&tgt=5 计算 MW 地址 + 写入值。
|
||||
func PlcMonitorPreviewHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
q := r.URL.Query()
|
||||
st, ok1 := plc.ParseSrcType(q.Get("srcType"))
|
||||
tt, ok2 := plc.ParseSrcType(q.Get("tgtType"))
|
||||
src := atoiDefault(q.Get("src"), 0)
|
||||
tgt := atoiDefault(q.Get("tgt"), 0)
|
||||
if !ok1 || !ok2 {
|
||||
httpx.Fail(w, 3304, "非法的源/目标类型")
|
||||
return
|
||||
}
|
||||
mw, value, ok := plc.LookupRoute(st, src, tgt, tt)
|
||||
res := logic.MonitorPreview{Ok: ok, MW: mw, Value: value}
|
||||
if ok {
|
||||
res.SrcCode = string(st) + strconv.Itoa(src)
|
||||
res.TgtCode = string(tt) + strconv.Itoa(tgt)
|
||||
} else {
|
||||
res.Reason = "非法的源/目标组合(不在 §4.4 路由表内)"
|
||||
}
|
||||
httpx.Ok(w, res)
|
||||
}
|
||||
}
|
||||
|
||||
// PlcMonitorManualWriteHandler POST /plc/monitor/manual-write 手动下发路径指令(含互斥校验 + 操作日志)。
|
||||
func PlcMonitorManualWriteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req logic.ManualWriteReq
|
||||
if err := httpx.ParseJSON(r, &req); err != nil {
|
||||
httpx.BadRequest(w, "请求体解析失败")
|
||||
return
|
||||
}
|
||||
res, err := logic.New(svcCtx).PlcMonitorManualWrite(r.Context(), req, operator(r, ""))
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3305, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, res)
|
||||
}
|
||||
}
|
||||
|
||||
// PlcMonitorForceBitHandler POST /plc/monitor/force-bit 强制置/复位单个 M 位(危险操作,需二次确认 + 操作日志)。
|
||||
func PlcMonitorForceBitHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req logic.ForceBitReq
|
||||
if err := httpx.ParseJSON(r, &req); err != nil {
|
||||
httpx.BadRequest(w, "请求体解析失败")
|
||||
return
|
||||
}
|
||||
res, err := logic.New(svcCtx).PlcMonitorForceBit(r.Context(), req, operator(r, ""))
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3306, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, res)
|
||||
}
|
||||
}
|
||||
|
||||
// PlcMonitorWriteMwHandler POST /plc/monitor/write-mw 强制写 MW(危险操作,需二次确认 + 白名单校验 + 操作日志)。
|
||||
func PlcMonitorWriteMwHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req logic.ForceMWReq
|
||||
if err := httpx.ParseJSON(r, &req); err != nil {
|
||||
httpx.BadRequest(w, "请求体解析失败")
|
||||
return
|
||||
}
|
||||
res, err := logic.New(svcCtx).PlcMonitorWriteMw(r.Context(), req, operator(r, ""))
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3307, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, res)
|
||||
}
|
||||
}
|
||||
|
||||
// PlcPositionCheckHandler GET /plc/monitor/position-check 核对工件位置(MES 记录 vs PLC 实际托盘位)。
|
||||
func PlcPositionCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := logic.New(svcCtx).PlcPositionCheck(r.Context())
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3308, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, data)
|
||||
}
|
||||
}
|
||||
|
||||
// PlcPositionCorrectHandler POST /plc/monitor/position-correct 纠正工件位置(记录有、PLC 实际无 → 清为不在工位)。
|
||||
func PlcPositionCorrectHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req logic.CorrectPositionReq
|
||||
if err := httpx.ParseJSON(r, &req); err != nil {
|
||||
httpx.BadRequest(w, "请求体解析失败")
|
||||
return
|
||||
}
|
||||
if err := logic.New(svcCtx).PlcPositionCorrect(r.Context(), req, operator(r, "")); err != nil {
|
||||
httpx.Fail(w, 3309, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OkMessage(w, "已纠正", nil)
|
||||
}
|
||||
}
|
||||
|
||||
// PlcEndPointOccupiedHandler GET /plc/monitor/end-points 列出末端下料检测位(G11/G12)占用记录(取件释放用)。
|
||||
func PlcEndPointOccupiedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := logic.New(svcCtx).ListEndPointOccupied(r.Context())
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3310, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.Ok(w, map[string]any{"list": data})
|
||||
}
|
||||
}
|
||||
|
||||
// PlcReleaseEndPointHandler POST /plc/monitor/release-end-point 人工确认末端取件,释放 G11/G12 点位占用。
|
||||
func PlcReleaseEndPointHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req logic.ReleaseEndPointReq
|
||||
if err := httpx.ParseJSON(r, &req); err != nil {
|
||||
httpx.BadRequest(w, "请求体解析失败")
|
||||
return
|
||||
}
|
||||
if err := logic.New(svcCtx).ReleaseEndPoint(r.Context(), req, operator(r, "")); err != nil {
|
||||
httpx.Fail(w, 3311, err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OkMessage(w, "已释放", nil)
|
||||
}
|
||||
}
|
||||
@@ -249,14 +249,14 @@ func OrderQueryInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- 工位终端 0/13 虚拟工位内部接口(第五步 5.2/5.4) ----------
|
||||
// ---------- 工位终端内部接口(上下线面板 / 在制品展示) ----------
|
||||
|
||||
// InProcessInternalHandler 在制品列表(工位终端「在制品默认展示」/上下线面板)。
|
||||
// GET ?stationNo=(<=0 全部;0=上线位, 13=下线位, 其余为物理工位),返回 {list}。
|
||||
// GET ?stationNo=(>0=停在该工位)/ ?scope=(pending=待流转 / end-pending=末端待取件)/ ?orderNo=(模糊),返回 {list}。
|
||||
func InProcessInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
stationNo := atoiDefault(r.URL.Query().Get("stationNo"), 0)
|
||||
data, err := logic.New(svcCtx).WorkpiecesInProcess(r.Context(), stationNo, r.URL.Query().Get("orderNo"))
|
||||
data, err := logic.New(svcCtx).WorkpiecesInProcess(r.Context(), stationNo, r.URL.Query().Get("orderNo"), r.URL.Query().Get("scope"))
|
||||
if err != nil {
|
||||
httpx.Fail(w, 2006, err.Error())
|
||||
return
|
||||
@@ -265,7 +265,7 @@ func InProcessInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// OnlineWorkpieceInternalHandler 工件进线建档(工位终端上线位 StationNo=0)。
|
||||
// OnlineWorkpieceInternalHandler 工件进线建档(工位终端上线面板提交)。
|
||||
// POST OnlineReq{sn,orderNo,workOrderId,processSeq};operator 从 query 兜底(内部接口无 JWT)。
|
||||
func OnlineWorkpieceInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -284,7 +284,7 @@ func OnlineWorkpieceInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc
|
||||
}
|
||||
}
|
||||
|
||||
// DoneWorkpieceInternalHandler 工件完工入库(工位终端下线位 StationNo=13)。
|
||||
// DoneWorkpieceInternalHandler 工件完工入库(工位终端下线面板提交)。
|
||||
// POST DoneReq{sn,batchItems,serialItems};完工内部自动回流 WMS 成品库存。
|
||||
func DoneWorkpieceInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -302,7 +302,7 @@ func DoneWorkpieceInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// OrderUsageInternalHandler 工单单台用料(工位终端上线位「领料确认」按工单工艺组合的物料清单展示应领料)。
|
||||
// OrderUsageInternalHandler 工单单台用料(工位终端上线面板「领料确认」按工单工艺组合的物料清单展示应领料)。
|
||||
// GET ?orderNo=,返回 []logic.UsageRow。物料清单已删除:用料唯一来源 = 工单工艺组合×工艺物料清单。
|
||||
func OrderUsageInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -376,12 +376,12 @@ func SuggestedDockCodesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
|
||||
// InProcessHandler GET /workpieces/in-process 跨天在制品视图(停在各工位未完工工件)
|
||||
// stationNo 可选:0=上线位, 13=下线位, 其余为物理工位;不传或<=0 返回全部。
|
||||
// stationNo 可选:>0=停在该工位;scope 可选:pending=待流转 / end-pending=末端待取件;皆不传返回全部。
|
||||
// orderNo 可选:按工单号模糊过滤(客户第12条「记录查看加一项看工单号查询」)。
|
||||
func InProcessHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
stationNo, _ := strconv.Atoi(r.URL.Query().Get("stationNo"))
|
||||
data, err := logic.New(svcCtx).WorkpiecesInProcess(r.Context(), stationNo, r.URL.Query().Get("orderNo"))
|
||||
data, err := logic.New(svcCtx).WorkpiecesInProcess(r.Context(), stationNo, r.URL.Query().Get("orderNo"), r.URL.Query().Get("scope"))
|
||||
if err != nil {
|
||||
httpx.Fail(w, 3001, err.Error())
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user