Files
bj_power/bj_power_mes/ent/dock.go
T
SunYF 42bcf395d2 feat: AGV三段链安全机制、补料/损耗/下班闭环、接驳台左右互换
AGV 调度:
- 任务重构为 GO_LOAD/TRANSPORT/EMPTY_RETURN/FREE 三段链,到位即停(ARRIVED)需人工确认装卸
- 自由调度单点步进,每段强制弹"请确保路径畅通无杂物";托盘回收独立工作台
- 接驳台 PLC 传感器检测到托盘即自动卸货放行,传感器故障由人工按钮兜底(无轮询)
- 车辆状态只读展示(海康3.1.7 queryAgvStatus),调度仍由 RCS 负责

物料闭环:
- 补料管理(SHORTAGE):工位申请 + 主管审批调增叫料池额度,与借料/差异补发三轨并行
- 损耗台账(loss_ledger):退料实际 < 理论必填原因、后审核,工单不记损耗
- 退料强制指定左/右接驳台,WMS 库管可代工位退料

下班闭环:
- 工位终端自检接驳台剩余物料后下班;库管收货 + 托盘拉走后事件驱动自动结班
- 退出登录未下班仅作安全提示(不强制拦截、不新增责任审批)

接驳台左右按操作员朝向建模(dock.side 字段),废除"奇左偶右"隐式约定;
看板标签 / seed / 迁移补丁 / 布局文档统一为中文左/右。

产线布局说明:C1 前线头 AGV 点、C15 后线尾 AGV 点、外部 O1/O2/O3 散点,
清理修订痕迹为最终态描述。
2026-11-03 18:29:31 +08:00

197 lines
6.3 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.
// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_mes/ent/dock"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// Dock 接驳台主数据:DOCK01~DOCK20(产线,DOCKn↔工位n)+ DOCK21(库房收货)。
type Dock struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// 接驳台编码 DOCK01..21
DockCode string `json:"dockCode,omitempty"`
// 接驳台名称
Name string `json:"name,omitempty"`
// 类型 line产线/store库房/other其他
DockType string `json:"dockType,omitempty"`
// 关联工位号(与工位1:1,非产线为0)
StationNo int `json:"stationNo,omitempty"`
// 左右:left=操作员左手边/right=右手边(按操作员朝向区分,下排工位与地图左右相反)
Side string `json:"side,omitempty"`
// 当前是否有托盘
HasPallet bool `json:"hasPallet,omitempty"`
// 托盘关联(出库单号/备料单号)
PalletRef string `json:"palletRef,omitempty"`
// Status holds the value of the "status" field.
Status string `json:"status,omitempty"`
// CreatedAt holds the value of the "createdAt" field.
CreatedAt time.Time `json:"createdAt,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Dock) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case dock.FieldHasPallet:
values[i] = new(sql.NullBool)
case dock.FieldID, dock.FieldStationNo:
values[i] = new(sql.NullInt64)
case dock.FieldDockCode, dock.FieldName, dock.FieldDockType, dock.FieldSide, dock.FieldPalletRef, dock.FieldStatus:
values[i] = new(sql.NullString)
case dock.FieldCreatedAt:
values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Dock fields.
func (_m *Dock) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case dock.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
_m.ID = int(value.Int64)
case dock.FieldDockCode:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field dockCode", values[i])
} else if value.Valid {
_m.DockCode = value.String
}
case dock.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
_m.Name = value.String
}
case dock.FieldDockType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field dockType", values[i])
} else if value.Valid {
_m.DockType = value.String
}
case dock.FieldStationNo:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field stationNo", values[i])
} else if value.Valid {
_m.StationNo = int(value.Int64)
}
case dock.FieldSide:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field side", values[i])
} else if value.Valid {
_m.Side = value.String
}
case dock.FieldHasPallet:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field hasPallet", values[i])
} else if value.Valid {
_m.HasPallet = value.Bool
}
case dock.FieldPalletRef:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field palletRef", values[i])
} else if value.Valid {
_m.PalletRef = value.String
}
case dock.FieldStatus:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field status", values[i])
} else if value.Valid {
_m.Status = value.String
}
case dock.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field createdAt", values[i])
} else if value.Valid {
_m.CreatedAt = value.Time
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the Dock.
// This includes values selected through modifiers, order, etc.
func (_m *Dock) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this Dock.
// Note that you need to call Dock.Unwrap() before calling this method if this Dock
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *Dock) Update() *DockUpdateOne {
return NewDockClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the Dock entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (_m *Dock) Unwrap() *Dock {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: Dock is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *Dock) String() string {
var builder strings.Builder
builder.WriteString("Dock(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("dockCode=")
builder.WriteString(_m.DockCode)
builder.WriteString(", ")
builder.WriteString("name=")
builder.WriteString(_m.Name)
builder.WriteString(", ")
builder.WriteString("dockType=")
builder.WriteString(_m.DockType)
builder.WriteString(", ")
builder.WriteString("stationNo=")
builder.WriteString(fmt.Sprintf("%v", _m.StationNo))
builder.WriteString(", ")
builder.WriteString("side=")
builder.WriteString(_m.Side)
builder.WriteString(", ")
builder.WriteString("hasPallet=")
builder.WriteString(fmt.Sprintf("%v", _m.HasPallet))
builder.WriteString(", ")
builder.WriteString("palletRef=")
builder.WriteString(_m.PalletRef)
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(_m.Status)
builder.WriteString(", ")
builder.WriteString("createdAt=")
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
// Docks is a parsable slice of Dock.
type Docks []*Dock