Files
bj_power/bj_power_mes/ent/dock.go
T
SunYF 1f7a42fc38 refactor(mes): 移除工位接驳台绑定逻辑,改为独立dock主数据
- 移除station表的hasDock、dockCode字段及相关代码
- 新增dock表注释及关联逻辑,支持一个工位绑定多个接驳台
- 更新工位相关的seed、logic、schema及前端代码,适配新的接驳台管理方式
- 新增SQL注释固化脚本,完善MES表注释
2026-10-08 13:09:53 +08:00

186 lines
5.9 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"`
// 当前是否有托盘
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.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.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("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