refactor: 重构产线工位与备料流程,移除冗余字段
1. 移除工单、工件、日排产中的冗余工位组合/接驳台字段 2. 新增工位接驳台编码字段与唯一约束,关联WMS接驳台主数据 3. 重构日排产为工位产量分配模式,替代原接驳台列表 4. 新增备料单工位级字段与分批出库支持 5. 移除定时同步可生产数量,改为WMS实时拉取接口 6. 过滤操作日志,排除登录/退出相关日志 7. 调整仪表盘工序展示逻辑为今日派工路线 8. 新增接驳台维护菜单与基础数据
This commit is contained in:
@@ -155,3 +155,47 @@ func lineCallMaterialHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
mesJSON(w, resp, err)
|
||||
}
|
||||
}
|
||||
|
||||
// materialRequestsHandler GET /api/material-requests 代理 MES /api/internal/material-requests
|
||||
// 工位终端按当前登录工位过滤「待接料」行(stationNo 由前端带入)。
|
||||
func materialRequestsHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
q := url.Values{}
|
||||
for _, k := range []string{"stationNo", "status", "orderNo", "planDate", "materialCode", "targetDock"} {
|
||||
if v := strings.TrimSpace(r.URL.Query().Get(k)); v != "" {
|
||||
q.Set(k, v)
|
||||
}
|
||||
}
|
||||
body, _, err := ctx.Mes.Get("/api/internal/material-requests", q)
|
||||
mesJSON(w, body, err)
|
||||
}
|
||||
}
|
||||
|
||||
// materialReceiveHandler POST /api/material-request/receive 代理 MES /api/internal/station/receive-material
|
||||
// 主入口:工人扫码接料(扫描备料单号确认)。operator 由本服务补当前登录人。
|
||||
func materialReceiveHandler(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 req map[string]any
|
||||
if err := json.Unmarshal(payload, &req); err != nil {
|
||||
fail(w, http.StatusBadRequest, "请求体解析失败")
|
||||
return
|
||||
}
|
||||
if req["requestNo"] == nil || req["requestNo"] == "" {
|
||||
fail(w, http.StatusBadRequest, "缺少备料单号")
|
||||
return
|
||||
}
|
||||
if req["operator"] == nil || req["operator"] == "" {
|
||||
if u := currentUsername(r); u != "" {
|
||||
req["operator"] = u
|
||||
}
|
||||
}
|
||||
body, _ := json.Marshal(req)
|
||||
resp, _, err := ctx.Mes.Post("/api/internal/station/receive-material", json.RawMessage(body))
|
||||
mesJSON(w, resp, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ func RegisterHandlers(server *rest.Server, ctx *svc.ServiceContext) {
|
||||
{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)},
|
||||
{Method: http.MethodPost, Path: "/api/material-request/receive", Handler: materialReceiveHandler(ctx)},
|
||||
|
||||
// 巡检 / 应急呼叫 / 数量不符 / 退料(代理 MES 内部 API)
|
||||
{Method: http.MethodPost, Path: "/api/inspection/submit", Handler: inspectionSubmitHandler(ctx)},
|
||||
|
||||
Reference in New Issue
Block a user