refactor(mes): 移除工位接驳台绑定逻辑,改为独立dock主数据

- 移除station表的hasDock、dockCode字段及相关代码
- 新增dock表注释及关联逻辑,支持一个工位绑定多个接驳台
- 更新工位相关的seed、logic、schema及前端代码,适配新的接驳台管理方式
- 新增SQL注释固化脚本,完善MES表注释
This commit is contained in:
SunYF
2026-10-08 13:09:53 +08:00
parent 7c7c16ee6d
commit 1f7a42fc38
132 changed files with 2799 additions and 1090 deletions
+22 -2
View File
@@ -463,7 +463,8 @@ type zoneBatchGenReq struct {
PosEnd int `json:"posEnd"`
Level int `json:"level"` // 3=批量生成层(level3) 4=批量生成位置号(level4,默认,需指定已存在的层)
Preview bool `json:"preview"`
Layers []zoneBatchLayerName `json:"layers"` // level=3 提交时携带预览表中(可能手改过的)层名称,非空则优先采用
Layers []zoneBatchLayerName `json:"layers"` // level=3 提交时携带预览表中(可能手改过的)层名称,非空则优先采用
Positions []zoneBatchPosName `json:"positions"` // level=4 提交时携带预览表中(可能手改过的)位置名称,非空则优先采用
}
// zoneBatchLayerName 批量生成层:前端预览后手改的层名称(layerNo→layerName)
@@ -472,6 +473,12 @@ type zoneBatchLayerName struct {
LayerName string `json:"layerName"`
}
// zoneBatchPosName 批量生成位置号:前端预览后手改的位置名称(positionNo→positionName)
type zoneBatchPosName struct {
PositionNo string `json:"positionNo"`
PositionName string `json:"positionName"`
}
// batchGenerateHandler 批量生成库位节点:选区域→货架→范围,先预览后提交。
// level=3:只生成「层」节点(按层范围);level=4(默认):在「已存在的具体层」下生成「位置号」节点。
// 批量生成只生成自己这一级,绝不自动创建父级;已存在的节点跳过不重复建。
@@ -610,6 +617,15 @@ func batchGenerateHandler(ctx *svc.ServiceContext) http.HandlerFunc {
}
// 提交:仅在选定层下创建不存在的位置号(层必须已存在,不再自动创建父级层)
// 手改位置名称优先:前端预览后可点击位置名称修改,提交时按 positionNo 带回
nameByPos := make(map[string]string, len(req.Positions))
for _, pn := range req.Positions {
no := strings.TrimSpace(pn.PositionNo)
nm := strings.TrimSpace(pn.PositionName)
if no != "" && nm != "" {
nameByPos[no] = nm
}
}
created, skipped := 0, 0
for _, p := range poss {
ps := strconv.Itoa(p)
@@ -619,10 +635,14 @@ func batchGenerateHandler(ctx *svc.ServiceContext) http.HandlerFunc {
skipped++
continue
}
name := req.ShelfNo + "架" + layerNo + "层" + ps + "位"
if v, ok := nameByPos[ps]; ok {
name = v
}
if _, err := ctx.EntClient.Zone.Create().
SetLevel(4).SetCode(ps).SetParentCode(layerNo).
SetZoneCode(zoneCode).SetShelfNo(req.ShelfNo).SetLayerNo(layerNo).SetPositionNo(ps).
SetName(req.ShelfNo + "架" + layerNo + "层" + ps + "位").SetStatus("启用").Save(ctx0()); err != nil {
SetName(name).SetStatus("启用").Save(ctx0()); err != nil {
fail(w, http.StatusInternalServerError, "创建位置失败: "+err.Error())
return
}