feat: 新增工序签字功能,移除移料指令模块
新增操作工/检验员工序签字功能,支持工艺步骤配置签字要求;删除移料指令相关代码,将移料页签重命名为产线点位(上料/下料);新增成品入库功能及相关权限;优化备料单状态、质量状态逻辑,新增批次序号字段;修复AGV取消后备料单回退状态问题。
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"bj_power_workstation/internal/svc"
|
||||
)
|
||||
|
||||
// ============ 产线点位 / 上位机移料 / 叫料(代理 MES 内部 API) ============
|
||||
// ============ 产线点位 / 叫料(代理 MES 内部 API) ============
|
||||
// MES 侧对应接口均以 X-API-TOKEN 保护(/api/internal/line/*),本服务用配置 token 转发,
|
||||
// 前端只与本服务交互(JWT 登录)。MES 响应体原样透传({code,message,data})。
|
||||
|
||||
@@ -34,78 +34,6 @@ func linePointsHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// lineMovesHandler GET /api/line/moves?status=&sn=&limit=(移料指令列表)
|
||||
func lineMovesHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
q := url.Values{}
|
||||
for _, k := range []string{"status", "sn", "limit"} {
|
||||
if v := strings.TrimSpace(r.URL.Query().Get(k)); v != "" {
|
||||
q.Set(k, v)
|
||||
}
|
||||
}
|
||||
body, _, err := ctx.Mes.Get("/api/internal/line/moves", q)
|
||||
mesJSON(w, body, err)
|
||||
}
|
||||
}
|
||||
|
||||
// lineMoveHandler POST /api/line/move(下发移料指令:起点位 → 目标点位)
|
||||
// 请求体原样转发:{sn, fromPoint, toPoint, orderNo}
|
||||
func lineMoveHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
payload, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
fail(w, http.StatusBadRequest, "请求体读取失败")
|
||||
return
|
||||
}
|
||||
var probe struct {
|
||||
Sn string `json:"sn"`
|
||||
FromPoint string `json:"fromPoint"`
|
||||
ToPoint string `json:"toPoint"`
|
||||
}
|
||||
_ = json.Unmarshal(payload, &probe)
|
||||
if probe.Sn == "" || probe.FromPoint == "" || probe.ToPoint == "" {
|
||||
fail(w, http.StatusBadRequest, "工件SN、起点位、目标点位必填")
|
||||
return
|
||||
}
|
||||
body, _, err := ctx.Mes.Post("/api/internal/line/move", json.RawMessage(payload))
|
||||
mesJSON(w, body, err)
|
||||
}
|
||||
}
|
||||
|
||||
// lineArriveHandler POST /api/line/move/arrive(工件到位:回写台账并闭环指令)
|
||||
func lineArriveHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
payload, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
fail(w, http.StatusBadRequest, "请求体读取失败")
|
||||
return
|
||||
}
|
||||
var probe struct {
|
||||
CmdNo string `json:"cmdNo"`
|
||||
}
|
||||
_ = json.Unmarshal(payload, &probe)
|
||||
if probe.CmdNo == "" {
|
||||
fail(w, http.StatusBadRequest, "缺少指令号 cmdNo")
|
||||
return
|
||||
}
|
||||
body, _, err := ctx.Mes.Post("/api/internal/line/move/arrive", json.RawMessage(payload))
|
||||
mesJSON(w, body, err)
|
||||
}
|
||||
}
|
||||
|
||||
// lineAckHandler POST /api/line/move/ack(PLC 应答:通常由 PLC 侧调用,终端手动应答也走这里)
|
||||
func lineAckHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
payload, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
fail(w, http.StatusBadRequest, "请求体读取失败")
|
||||
return
|
||||
}
|
||||
body, _, err := ctx.Mes.Post("/api/internal/line/move/ack", json.RawMessage(payload))
|
||||
mesJSON(w, body, err)
|
||||
}
|
||||
}
|
||||
|
||||
// lineOccupyHandler POST /api/line/occupy(点位人工记账:IN 上料 / OUT 下料)
|
||||
// 请求体:{pointNo, sn, orderNo, action} —— operator 由本服务补当前登录人。
|
||||
func lineOccupyHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
|
||||
@@ -48,12 +48,8 @@ func RegisterHandlers(server *rest.Server, ctx *svc.ServiceContext) {
|
||||
{Method: http.MethodPost, Path: "/api/sync/flush", Handler: syncFlushHandler(ctx)},
|
||||
{Method: http.MethodGet, Path: "/api/sync/stats", Handler: syncStatsHandler(ctx)},
|
||||
|
||||
// 产线点位 / 上位机移料 / 叫料(代理 MES 内部 API)
|
||||
// 产线点位 / 叫料(代理 MES 内部 API)
|
||||
{Method: http.MethodGet, Path: "/api/line/points", Handler: linePointsHandler(ctx)},
|
||||
{Method: http.MethodGet, Path: "/api/line/moves", Handler: lineMovesHandler(ctx)},
|
||||
{Method: http.MethodPost, Path: "/api/line/move", Handler: lineMoveHandler(ctx)},
|
||||
{Method: http.MethodPost, Path: "/api/line/move/arrive", Handler: lineArriveHandler(ctx)},
|
||||
{Method: http.MethodPost, Path: "/api/line/move/ack", Handler: lineAckHandler(ctx)},
|
||||
{Method: http.MethodPost, Path: "/api/line/occupy", Handler: lineOccupyHandler(ctx)},
|
||||
{Method: http.MethodPost, Path: "/api/line/call-material", Handler: lineCallMaterialHandler(ctx)},
|
||||
{Method: http.MethodGet, Path: "/api/material-requests", Handler: materialRequestsHandler(ctx)},
|
||||
|
||||
Reference in New Issue
Block a user