feat: 退料闭环定稿(损耗台账/备料清单/退料AGV自动派车/剩余量参考)+ 工位托盘守卫
- MES 新增损耗台账 loss_ledger,差异确认损耗接口 ConfirmReceiveLoss(按工单归集) - 备料清单 preparation:MES 按 日计划×工单×工位×物料 实时计算,WMS 只读展示 PreparationList - 退料闭环:N5 工位托盘守卫(未完成禁止退料)、退料 AGV 自动派车(JBT21 空位判定 + 托盘回收链路)、退料参考剩余量接口(应剩余=实备-已耗-已退-已损) - 新增 AGV 车辆状态表 agv_vehicle_state 及查询 - 整合接驳台/叫料池/库存锁既有闭环,清理 sql 目录注释生成脚本与 catalog,更新文档
This commit is contained in:
@@ -590,8 +590,8 @@ func (s *Service) buildAgv(ctx context.Context) AgvStats {
|
||||
if err != nil || len(reqs) == 0 {
|
||||
// 无任务时给出两台待命 AGV,3D 场景不至于空场
|
||||
out.Robots = []AgvRobot{
|
||||
{Code: "AGV-01", Status: "idle", Battery: 88, FromDock: "DOCK21", ToDock: "", Progress: 0},
|
||||
{Code: "AGV-02", Status: "idle", Battery: 76, FromDock: "DOCK21", ToDock: "", Progress: 0},
|
||||
{Code: "AGV-01", Status: "idle", Battery: 88, FromDock: "JBT21", ToDock: "", Progress: 0},
|
||||
{Code: "AGV-02", Status: "idle", Battery: 76, FromDock: "JBT21", ToDock: "", Progress: 0},
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -604,7 +604,7 @@ func (s *Service) buildAgv(ctx context.Context) AgvStats {
|
||||
Code: "AGV-" + pad2(i+1),
|
||||
Status: agvStatusFromRequest(r.Status),
|
||||
Battery: 90 - i*12,
|
||||
FromDock: "DOCK21",
|
||||
FromDock: "JBT21",
|
||||
ToDock: r.TargetDock,
|
||||
TaskNo: r.RequestNo,
|
||||
Carrier: carrier,
|
||||
@@ -633,14 +633,11 @@ func agvStatusFromRequest(status string) string {
|
||||
// 看板点位态(主线 C1~C15 / 接驳台 G1L..G10R + JBT21 / 在途路径指令)
|
||||
// ============================================================
|
||||
|
||||
// dockCodeToLabel PLC/Dock 表编码(DOCK01..21)→ 布局说明命名(G1L..G10R / JBT21)。
|
||||
// 2026-11-03 拍板:左右按操作员朝向区分——上排奇数工位 左=L(奇数台);下排偶数工位 2/4/6/8/10
|
||||
// 操作员面向主线,左手边=地图右(偶数台=L)。与 dock.side 字段、seed、迁移补丁同一口径。
|
||||
func dockCodeToLabel(code string) string {
|
||||
// dockCodeToCode PLC/Dock 表编码(DOCK01..20)→ 看板稳定点位码(G1L..G10R)。
|
||||
// 左右互换(2026-11-03 拍板):工位 2/4/6/8/10(下排)左右名称互换——偶数工位 地图左台=GxR、地图右台=GxL;
|
||||
// 奇数工位维持 地图左台=GxL、地图右台=GxR。与 dock.side 字段、seed、迁移补丁同一口径。
|
||||
func dockCodeToCode(code string) string {
|
||||
c := strings.ToUpper(strings.TrimSpace(code))
|
||||
if c == "DOCK21" || c == "JBT21" {
|
||||
return "JBT21"
|
||||
}
|
||||
if !strings.HasPrefix(c, "DOCK") {
|
||||
return c
|
||||
}
|
||||
@@ -650,12 +647,29 @@ func dockCodeToLabel(code string) string {
|
||||
}
|
||||
st := (n + 1) / 2
|
||||
suffix := "R"
|
||||
if n%2 == st%2 { // 台序奇偶与工位奇偶同 → 操作员左手边
|
||||
if n%2 == st%2 { // 台序奇偶与工位奇偶同 → 左(L)
|
||||
suffix = "L"
|
||||
}
|
||||
return fmt.Sprintf("G%d%s", st, suffix)
|
||||
}
|
||||
|
||||
// dockCnLabel 稳定点位码 → 中文显示名(G2R→工位2右;JBT21→库房接驳台)。
|
||||
func dockCnLabel(code string) string {
|
||||
c := strings.ToUpper(strings.TrimSpace(code))
|
||||
if c == "JBT21" {
|
||||
return "库房接驳台"
|
||||
}
|
||||
if strings.HasPrefix(c, "G") && len(c) >= 3 && (strings.HasSuffix(c, "L") || strings.HasSuffix(c, "R")) {
|
||||
st := strings.TrimSuffix(strings.TrimPrefix(c, "G"), string(c[len(c)-1]))
|
||||
side := "右"
|
||||
if strings.HasSuffix(c, "L") {
|
||||
side = "左"
|
||||
}
|
||||
return "工位" + st + side
|
||||
}
|
||||
return code
|
||||
}
|
||||
|
||||
// buildPoints 看板点位态:主线 15 位 + 接驳台 21 位(PLC 一次位块读)+ 在途路径指令(MW 一次块读)。
|
||||
// PLC 读取失败只降级本块(返回 Mock=true 空态),不影响整屏快照。
|
||||
func (s *Service) buildPoints(ctx context.Context) FrontPoints {
|
||||
@@ -668,9 +682,10 @@ func (s *Service) buildPoints(ctx context.Context) FrontPoints {
|
||||
out.Main = append(out.Main, FrontPoint{Code: fmt.Sprintf("C%d", i+1), Has: bitAt(bits, 12+i)})
|
||||
}
|
||||
for i := 0; i < 20; i++ {
|
||||
out.Dock = append(out.Dock, FrontPoint{Code: dockCodeToLabel(fmt.Sprintf("DOCK%02d", i+1)), Has: bitAt(bits, 27+i)})
|
||||
code := dockCodeToCode(fmt.Sprintf("DOCK%02d", i+1))
|
||||
out.Dock = append(out.Dock, FrontPoint{Code: code, Label: dockCnLabel(code), Has: bitAt(bits, 27+i)})
|
||||
}
|
||||
out.Dock = append(out.Dock, FrontPoint{Code: "JBT21", Has: bitAt(bits, 47)})
|
||||
out.Dock = append(out.Dock, FrontPoint{Code: "JBT21", Label: "库房接驳台", Has: bitAt(bits, 47)})
|
||||
// 在途路径指令:一次批量读 MW800..MW887(44 个路由寄存器),非 0 即在途
|
||||
if vals, err := s.ctx.PLC.ReadMWBlock(ctx, 800, 88); err == nil {
|
||||
for _, addr := range plc.AllRouteAddrs() {
|
||||
|
||||
Reference in New Issue
Block a user