feat: 移除工位模板、AGV 链路增强与产品BOM/混产模板完善
- 移除工位模板体系(handler/logic 全删),同步路由与 seed - AGV 链路增强:点位锁、车辆状态、退料派车调整,新增海康 RCS Postman 调试集合 - MES 产品BOM/混产模板完善:新增 ProductBOMDialog 组件,调整 handler/logic;日排产达成对比调整 - WMS 业务完善:出入库、检验、备料、退料、成品入库、缺料代报等 handler 与前端页面调整 - 前端通用:双端新增 RemotePageSelect 组件,统一 nextStep 规则/帮助文档/布局/请求拦截 - 文档:更新产线API/案例/部署手册/问题记录等
This commit is contained in:
@@ -48,8 +48,8 @@ func (s *Service) ListMixTemplates(ctx context.Context) ([]map[string]any, error
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SaveMixTemplate 新增/编辑混产模板(圈定哪几个成品可混线生产)。
|
||||
// 新建并启用时自动设为「当前产线在用模板」——用户口中的「保存当前绑定为模板」。
|
||||
// SaveMixTemplate 新增/编辑混产模板(圈定哪几个产品可混线生产)。
|
||||
// 新建并启用时自动设为「当前产线在用模板」。
|
||||
func (s *Service) SaveMixTemplate(ctx context.Context, id int, name, productCodes, remark, status, operator string) error {
|
||||
name = strings.TrimSpace(name)
|
||||
if name == "" {
|
||||
@@ -64,7 +64,7 @@ func (s *Service) SaveMixTemplate(ctx context.Context, id int, name, productCode
|
||||
}
|
||||
}
|
||||
if len(clean) < 2 {
|
||||
return fmt.Errorf("混产模板至少需要 2 个成品(单产品不需要混产模板)")
|
||||
return fmt.Errorf("混产模板至少需要 2 个产品(单产品不需要混产模板)")
|
||||
}
|
||||
if status == "" {
|
||||
status = "ACTIVE"
|
||||
@@ -169,9 +169,11 @@ func (s *Service) ProductInActiveMixTemplate(ctx context.Context, productCode st
|
||||
// LineClearanceItem 清线确认单的一行。
|
||||
type LineClearanceItem struct {
|
||||
Key string `json:"key"` // 稳定 key,前端逐项打勾回传
|
||||
Label string `json:"label"` // 人话说明
|
||||
Label string `json:"label"` // 人话说明:为什么挡住
|
||||
Count int `json:"count"` // 实测数量(0=已清)
|
||||
Cleared bool `json:"cleared"` // 人工确认放行(PLC 离线等场景)
|
||||
How string `json:"how"` // 怎么解决:去哪个页面做什么(2026-11-17 透明化,不再是黑盒墙)
|
||||
Route string `json:"route"` // 前端路由:点「去处理」直接跳转
|
||||
}
|
||||
|
||||
// LineClearanceResult 清线检查结果(needClearance=false 表示同模板切换,免清线)。
|
||||
@@ -214,28 +216,40 @@ func (s *Service) CheckLineClearance(ctx context.Context, productCode string, co
|
||||
type probe struct {
|
||||
key string
|
||||
label string
|
||||
how string // 怎么解决(人话,点名道姓到页面和动作)
|
||||
route string // 前端路由,点「去处理」直达
|
||||
count func() (int, error)
|
||||
}
|
||||
probes := []probe{
|
||||
{"workpiece", "工位上还有在制工件(请先完工/暂存退库)", func() (int, error) {
|
||||
return s.ctx.EntClient.Workpiece.Query().Where(workpiece.AtStationNoGT(0)).Count(ctx)
|
||||
}},
|
||||
{"residual", "叫料池还有已发/占用中的余料(请先退库冲正)", func() (int, error) {
|
||||
return s.ctx.EntClient.CallPool.Query().
|
||||
Where(callpool.Or(callpool.SentQtyGT(0), callpool.ReservedQtyGT(0))).Count(ctx)
|
||||
}},
|
||||
{"pallet", "产线点位台账还有托盘占用(请先清空托盘)", func() (int, error) {
|
||||
return s.ctx.EntClient.LinePoint.Query().
|
||||
Where(linepoint.Or(linepoint.CurrentSnNEQ(""), linepoint.Occupied(true))).Count(ctx)
|
||||
}},
|
||||
{"plc", "PLC 还有未完成的下发指令(请核对位置并处理;离线时可人工确认放行并留痕)", func() (int, error) {
|
||||
return s.ctx.EntClient.PlcSendLog.Query().
|
||||
Where(plcsendlog.StatusIn("SENT", "PENDING")).Count(ctx)
|
||||
}},
|
||||
{"agv", "还有 AGV 在途/到位待令任务(请先结束或取消)", func() (int, error) {
|
||||
return s.ctx.EntClient.AgvTask.Query().
|
||||
Where(agvtask.StatusIn("PENDING", "1", "2", "ARRIVED")).Count(ctx)
|
||||
}},
|
||||
{"workpiece", "工位上还有在制工件",
|
||||
"到「在制品追踪」页把这些工件完工或暂存退库,台面清空后再回来点确认", "/wip",
|
||||
func() (int, error) {
|
||||
return s.ctx.EntClient.Workpiece.Query().Where(workpiece.AtStationNoGT(0)).Count(ctx)
|
||||
}},
|
||||
{"residual", "工位还有未用完的料",
|
||||
"到工位终端做「退料」把余料退回库房,或在「生产退料」页确认/取消待处理退料单", "/transfer-return",
|
||||
func() (int, error) {
|
||||
return s.ctx.EntClient.CallPool.Query().
|
||||
Where(callpool.Or(callpool.SentQtyGT(0), callpool.ReservedQtyGT(0))).Count(ctx)
|
||||
}},
|
||||
{"pallet", "产线点位上还有托盘占位",
|
||||
"用「人工派车 → 托盘回库」把托盘拉回库房,或到「产线管理」核实点位台账后清空", "/agv-manual",
|
||||
func() (int, error) {
|
||||
return s.ctx.EntClient.LinePoint.Query().
|
||||
Where(linepoint.Or(linepoint.CurrentSnNEQ(""), linepoint.Occupied(true))).Count(ctx)
|
||||
}},
|
||||
{"plc", "PLC 还有没执行完的指令",
|
||||
"到「工位下发」页核对这些指令是否已到位;确实清完再回来勾确认。PLC 离线时可现场目视确认后勾选放行(会留痕)", "/plc-send",
|
||||
func() (int, error) {
|
||||
return s.ctx.EntClient.PlcSendLog.Query().
|
||||
Where(plcsendlog.StatusIn("SENT", "PENDING")).Count(ctx)
|
||||
}},
|
||||
{"agv", "还有 AGV 任务没结束",
|
||||
"到「AGV管理」页把这些任务结束或取消(非本系统的任务可用「取消海康任务」按任务号取消)", "/agv",
|
||||
func() (int, error) {
|
||||
return s.ctx.EntClient.AgvTask.Query().
|
||||
Where(agvtask.StatusIn("PENDING", "1", "2", "ARRIVED")).Count(ctx)
|
||||
}},
|
||||
}
|
||||
unresolved := []string{}
|
||||
for _, p := range probes {
|
||||
@@ -244,7 +258,7 @@ func (s *Service) CheckLineClearance(ctx context.Context, productCode string, co
|
||||
// fail-close:查不清就当没清完,绝不放行
|
||||
return nil, fmt.Errorf("清线检查「%s」失败,禁止继续:%v", p.label, e)
|
||||
}
|
||||
item := LineClearanceItem{Key: p.key, Label: p.label, Count: n, Cleared: confirmedSet[p.key]}
|
||||
item := LineClearanceItem{Key: p.key, Label: p.label, Count: n, Cleared: confirmedSet[p.key], How: p.how, Route: p.route}
|
||||
res.Items = append(res.Items, item)
|
||||
if n > 0 && !item.Cleared {
|
||||
unresolved = append(unresolved, fmt.Sprintf("%s(%d 项)", p.label, n))
|
||||
|
||||
Reference in New Issue
Block a user