Files
bj_power/bj_power_workstation/internal/handler/routes.go
T
SunYF d609ff8a9e refactor: 重构工艺工序相关命名与数据模型
1.  全局替换"工序"为"工艺"统一术语,包括页面文案、枚举、注释
2.  重构工单与工件工艺数据模型:
    - 新增工艺组合表flow_material作为备料/齐套唯一源头
    - 新增工位状态表station_state支持自主停单/恢复接单
    - 移除station_process派工表,改用工单工艺组合作为路线唯一源头
    - 替换processCode为flowId作为工艺关联标识
    - 重构工件当前进度字段为currentStationNo
3.  删除冗余的静态备份资源文件
4.  调整物料选择组件默认启用仅显示激活物料
5.  优化工单创建/编辑逻辑,新增工艺组合校验与保存
2026-09-22 11:32:29 +08:00

78 lines
4.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package handler
import (
"net/http"
"bj_power_workstation/internal/auth"
"bj_power_workstation/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, ctx *svc.ServiceContext) {
// 免鉴权:健康检查 / 登录 / 工位配置
server.AddRoutes(
[]rest.Route{
{Method: http.MethodGet, Path: "/api/health", Handler: healthHandler(ctx)},
{Method: http.MethodPost, Path: "/api/auth/login", Handler: loginHandler(ctx)},
{Method: http.MethodGet, Path: "/api/config", Handler: configHandler(ctx)},
// 工艺文件免鉴权直链(query 传名,支持日期子目录;供 iframe/window.open
{Method: http.MethodGet, Path: "/pdfview", Handler: pdfViewHandler(ctx)},
// 前端静态托管
{Method: http.MethodGet, Path: "/", Handler: indexHandler(ctx.WebFS)},
{Method: http.MethodGet, Path: "/assets/:file", Handler: assetHandler(ctx.WebFS)},
},
)
// 登录鉴权中间件:白名单 /api/health、/api/auth/login、/api/config、/pdfopen/*
server.Use(auth.Interceptor(ctx.Config.Auth.AccessSecret, ctx.Config.Auth.AccessExpire))
// 业务接口(均需登录 JWT;PDF 代理除外——原样转发文件流)
server.AddRoutes(
[]rest.Route{
{Method: http.MethodGet, Path: "/api/task/current", Handler: taskCurrentHandler(ctx)},
{Method: http.MethodGet, Path: "/api/bind/panel", Handler: bindPanelHandler(ctx)},
{Method: http.MethodPost, Path: "/api/bind/record", Handler: bindRecordHandler(ctx)},
{Method: http.MethodPost, Path: "/api/bind/remove", Handler: bindRemoveHandler(ctx)},
{Method: http.MethodGet, Path: "/api/workload", Handler: workloadHandler(ctx)},
{Method: http.MethodGet, Path: "/api/stations", Handler: stationsHandler(ctx)},
{Method: http.MethodPost, Path: "/api/station/pause", Handler: stationPauseHandler(ctx)},
{Method: http.MethodGet, Path: "/api/station/state", Handler: stationStateHandler(ctx)},
{Method: http.MethodGet, Path: "/api/pdf", Handler: pdfQueryHandler(ctx)},
{Method: http.MethodGet, Path: "/pdfopen/:name", Handler: pdfOpenHandler(ctx)},
{Method: http.MethodGet, Path: "/api/tightening/list", Handler: tighteningListHandler(ctx)},
{Method: http.MethodPost, Path: "/api/tightening/record", Handler: tighteningRecordHandler(ctx)},
{Method: http.MethodPost, Path: "/api/report/process-done", Handler: processDoneHandler(ctx)},
{Method: http.MethodPost, Path: "/api/report/temp-store", Handler: tempStoreHandler(ctx)},
{Method: http.MethodPost, Path: "/api/station/logout", Handler: logoutHandler(ctx)},
{Method: http.MethodPost, Path: "/api/sync/flush", Handler: syncFlushHandler(ctx)},
{Method: http.MethodGet, Path: "/api/sync/stats", Handler: syncStatsHandler(ctx)},
// 产线点位 / 上位机移料 / 叫料(代理 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)},
{Method: http.MethodPost, Path: "/api/material-request/receive", Handler: materialReceiveHandler(ctx)},
// 巡检 / 应急呼叫 / 数量不符 / 退料(代理 MES 内部 API)
{Method: http.MethodPost, Path: "/api/inspection/submit", Handler: inspectionSubmitHandler(ctx)},
{Method: http.MethodPost, Path: "/api/emergency/call", Handler: emergencyCallHandler(ctx)},
{Method: http.MethodPost, Path: "/api/qty-report", Handler: qtyReportHandler(ctx)},
{Method: http.MethodPost, Path: "/api/return-material", Handler: returnMaterialHandler(ctx)},
{Method: http.MethodPost, Path: "/api/inspection/upload", Handler: inspectionUploadHandler(ctx)},
// 在制品 / 0-13 上下线建档完工 / BOM 领料 / 追溯(代理 MES 内部 API)
{Method: http.MethodGet, Path: "/api/wip", Handler: wipHandler(ctx)},
{Method: http.MethodGet, Path: "/api/bom", Handler: bomHandler(ctx)},
{Method: http.MethodGet, Path: "/api/order/query", Handler: orderQueryHandler(ctx)},
{Method: http.MethodGet, Path: "/api/trace", Handler: traceHandler(ctx)},
{Method: http.MethodPost, Path: "/api/workpiece/online", Handler: onlineHandler(ctx)},
{Method: http.MethodPost, Path: "/api/workpiece/done", Handler: doneHandler(ctx)},
},
)
}