feat: 完成产线MES系统全流程功能迭代与优化

本提交完成了多个核心模块的功能完善与业务对齐:
1. 工位终端:固定工位配置、移除自选工位逻辑、适配配置化工位号
2. MES核心:重构工位组合逻辑、新增工单/流程状态管理、补全报工/追溯逻辑
3. WMS客户端:新增修改密码功能、优化帮助弹窗逻辑
4. 文档与权限:补充完整操作手册、统一菜单名称与权限描述
5. 修复多业务校验:排产数量校验、工单状态校验、工位绑定规则
This commit is contained in:
SunYF
2026-08-31 12:58:28 +08:00
parent a3145a8bd6
commit ae4c292487
53 changed files with 1475 additions and 912 deletions
@@ -31,10 +31,11 @@ type SqliteConfig struct {
Path string `json:",default=workstation.db"`
}
// StationConfig 工位配置:可从配置文件指定固定工位号(1~12),留空则由终端自选
// StationConfig 工位配置:启动时由 yaml 加载到内存,固定本终端工位号(1~12)。
// 一个工位一个终端,终端不允许修改工位;变更工位只能改配置并重启服务。
type StationConfig struct {
Code string `json:",optional"` // 固定工位号(如 "3");留空则由终端自选 1~12
ScrewCount int `json:",default=10"` // 本工位需拧紧的螺丝颗数(进度 9/10 用)
StationNo int `json:",default=1"` // 固定工位号(1~12),启动时校验范围
ScrewCount int `json:",default=10"` // 本工位需拧紧的螺丝颗数(进度 9/10 用)
}
// PdfCacheConfig 工艺文件 PDF 本地预缓存目录
@@ -5,10 +5,7 @@ import (
"strings"
"time"
"bj_power_workstation/internal/auth"
"bj_power_workstation/internal/svc"
"golang.org/x/crypto/bcrypt"
)
func healthHandler(ctx *svc.ServiceContext) http.HandlerFunc {
@@ -60,11 +57,11 @@ func loginHandler(ctx *svc.ServiceContext) http.HandlerFunc {
}
// configHandler GET /api/config 返回工位配置:
// 固定工位号 stationNoStation.Code 为空则前端可自选 1~12)、本工位需拧紧的螺丝颗数。
// 固定工位号 stationNo1~12,由 yaml 配置在启动时加载,终端不可修改)、本工位需拧紧的螺丝颗数。
func configHandler(ctx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ok(w, map[string]any{
"stationNo": atoi(ctx.Config.Station.Code, 0),
"stationNo": ctx.Config.Station.StationNo,
"screwCount": ctx.Config.Station.ScrewCount,
})
}
@@ -34,17 +34,21 @@ func taskCurrentHandler(ctx *svc.ServiceContext) http.HandlerFunc {
}
}
// workloadHandler 代理 MES GET /api/internal/station/workload?operator=&from=&to=(块6)。
// 工位终端「我的工作量」查询当前登录人数据MES 响应体原样透传。
// workloadHandler 代理 MES GET /api/internal/station/workload?operator=&stationNo=&from=&to=(块6)。
// 工位终端「我的工作量」查询当前登录人全部工位的工作,stationNo 为空=全部工位MES 响应体原样透传。
func workloadHandler(ctx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
operator := strings.TrimSpace(r.URL.Query().Get("operator"))
stationNo := strings.TrimSpace(r.URL.Query().Get("stationNo"))
from := strings.TrimSpace(r.URL.Query().Get("from"))
to := strings.TrimSpace(r.URL.Query().Get("to"))
params := url.Values{}
if operator != "" {
params.Set("operator", operator)
}
if stationNo != "" {
params.Set("stationNo", stationNo)
}
if from != "" {
params.Set("from", from)
}
@@ -28,11 +28,9 @@ type MockSource struct {
dockCode string // 模拟枪挂载的工位
}
// NewMockSource dockCode 为空时回落到 DOCK01
func NewMockSource(db *store.Store, mc *mes.Client, dockCode string) *MockSource {
if dockCode == "" {
dockCode = "DOCK01"
}
// NewMockSource 模拟枪挂载在固定工位(stationNo 1~12),DOCK 编码为 DOCK01~DOCK12
func NewMockSource(db *store.Store, mc *mes.Client, stationNo int) *MockSource {
dockCode := fmt.Sprintf("DOCK%02d", stationNo)
return &MockSource{db: db, mes: mc, dockCode: dockCode}
}