197 lines
6.5 KiB
Go
197 lines
6.5 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|||
|
|
|
||
|
|
package ent
|
||
|
|
|
||
|
|
import (
|
||
|
|
"bj_power_mes/ent/linepoint"
|
||
|
|
"fmt"
|
||
|
|
"strings"
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"entgo.io/ent"
|
||
|
|
"entgo.io/ent/dialect/sql"
|
||
|
|
)
|
||
|
|
|
||
|
|
// LinePoint is the model entity for the LinePoint schema.
|
||
|
|
type LinePoint struct {
|
||
|
|
config `json:"-"`
|
||
|
|
// ID of the ent.
|
||
|
|
ID int `json:"id,omitempty"`
|
||
|
|
// STATION工位/CACHE缓存位/DOCK接驳台/END端头
|
||
|
|
PointType string `json:"pointType,omitempty"`
|
||
|
|
// 点位编号:1~12 / C1~C8 / 1-R1 / END-L
|
||
|
|
PointNo string `json:"pointNo,omitempty"`
|
||
|
|
// 点位名称
|
||
|
|
Label string `json:"label,omitempty"`
|
||
|
|
// 传送带顺序(左→右,用于相邻缓存位判定)
|
||
|
|
Seq int `json:"seq,omitempty"`
|
||
|
|
// 所属工位号(DOCK/CACHE 归属;0=无)
|
||
|
|
StationNo int `json:"stationNo,omitempty"`
|
||
|
|
// 当前存放工件SN(空=空闲)
|
||
|
|
CurrentSn string `json:"currentSn,omitempty"`
|
||
|
|
// 当前工件所属工单号
|
||
|
|
OrderNo string `json:"orderNo,omitempty"`
|
||
|
|
// 是否占用
|
||
|
|
Occupied bool `json:"occupied,omitempty"`
|
||
|
|
// UpdatedAt holds the value of the "updatedAt" field.
|
||
|
|
UpdatedAt time.Time `json:"updatedAt,omitempty"`
|
||
|
|
selectValues sql.SelectValues
|
||
|
|
}
|
||
|
|
|
||
|
|
// scanValues returns the types for scanning values from sql.Rows.
|
||
|
|
func (*LinePoint) scanValues(columns []string) ([]any, error) {
|
||
|
|
values := make([]any, len(columns))
|
||
|
|
for i := range columns {
|
||
|
|
switch columns[i] {
|
||
|
|
case linepoint.FieldOccupied:
|
||
|
|
values[i] = new(sql.NullBool)
|
||
|
|
case linepoint.FieldID, linepoint.FieldSeq, linepoint.FieldStationNo:
|
||
|
|
values[i] = new(sql.NullInt64)
|
||
|
|
case linepoint.FieldPointType, linepoint.FieldPointNo, linepoint.FieldLabel, linepoint.FieldCurrentSn, linepoint.FieldOrderNo:
|
||
|
|
values[i] = new(sql.NullString)
|
||
|
|
case linepoint.FieldUpdatedAt:
|
||
|
|
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 LinePoint fields.
|
||
|
|
func (_m *LinePoint) 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 linepoint.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 linepoint.FieldPointType:
|
||
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||
|
|
return fmt.Errorf("unexpected type %T for field pointType", values[i])
|
||
|
|
} else if value.Valid {
|
||
|
|
_m.PointType = value.String
|
||
|
|
}
|
||
|
|
case linepoint.FieldPointNo:
|
||
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||
|
|
return fmt.Errorf("unexpected type %T for field pointNo", values[i])
|
||
|
|
} else if value.Valid {
|
||
|
|
_m.PointNo = value.String
|
||
|
|
}
|
||
|
|
case linepoint.FieldLabel:
|
||
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||
|
|
return fmt.Errorf("unexpected type %T for field label", values[i])
|
||
|
|
} else if value.Valid {
|
||
|
|
_m.Label = value.String
|
||
|
|
}
|
||
|
|
case linepoint.FieldSeq:
|
||
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||
|
|
return fmt.Errorf("unexpected type %T for field seq", values[i])
|
||
|
|
} else if value.Valid {
|
||
|
|
_m.Seq = int(value.Int64)
|
||
|
|
}
|
||
|
|
case linepoint.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 linepoint.FieldCurrentSn:
|
||
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||
|
|
return fmt.Errorf("unexpected type %T for field currentSn", values[i])
|
||
|
|
} else if value.Valid {
|
||
|
|
_m.CurrentSn = value.String
|
||
|
|
}
|
||
|
|
case linepoint.FieldOrderNo:
|
||
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||
|
|
return fmt.Errorf("unexpected type %T for field orderNo", values[i])
|
||
|
|
} else if value.Valid {
|
||
|
|
_m.OrderNo = value.String
|
||
|
|
}
|
||
|
|
case linepoint.FieldOccupied:
|
||
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
||
|
|
return fmt.Errorf("unexpected type %T for field occupied", values[i])
|
||
|
|
} else if value.Valid {
|
||
|
|
_m.Occupied = value.Bool
|
||
|
|
}
|
||
|
|
case linepoint.FieldUpdatedAt:
|
||
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||
|
|
return fmt.Errorf("unexpected type %T for field updatedAt", values[i])
|
||
|
|
} else if value.Valid {
|
||
|
|
_m.UpdatedAt = 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 LinePoint.
|
||
|
|
// This includes values selected through modifiers, order, etc.
|
||
|
|
func (_m *LinePoint) Value(name string) (ent.Value, error) {
|
||
|
|
return _m.selectValues.Get(name)
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update returns a builder for updating this LinePoint.
|
||
|
|
// Note that you need to call LinePoint.Unwrap() before calling this method if this LinePoint
|
||
|
|
// was returned from a transaction, and the transaction was committed or rolled back.
|
||
|
|
func (_m *LinePoint) Update() *LinePointUpdateOne {
|
||
|
|
return NewLinePointClient(_m.config).UpdateOne(_m)
|
||
|
|
}
|
||
|
|
|
||
|
|
// Unwrap unwraps the LinePoint 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 *LinePoint) Unwrap() *LinePoint {
|
||
|
|
_tx, ok := _m.config.driver.(*txDriver)
|
||
|
|
if !ok {
|
||
|
|
panic("ent: LinePoint is not a transactional entity")
|
||
|
|
}
|
||
|
|
_m.config.driver = _tx.drv
|
||
|
|
return _m
|
||
|
|
}
|
||
|
|
|
||
|
|
// String implements the fmt.Stringer.
|
||
|
|
func (_m *LinePoint) String() string {
|
||
|
|
var builder strings.Builder
|
||
|
|
builder.WriteString("LinePoint(")
|
||
|
|
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||
|
|
builder.WriteString("pointType=")
|
||
|
|
builder.WriteString(_m.PointType)
|
||
|
|
builder.WriteString(", ")
|
||
|
|
builder.WriteString("pointNo=")
|
||
|
|
builder.WriteString(_m.PointNo)
|
||
|
|
builder.WriteString(", ")
|
||
|
|
builder.WriteString("label=")
|
||
|
|
builder.WriteString(_m.Label)
|
||
|
|
builder.WriteString(", ")
|
||
|
|
builder.WriteString("seq=")
|
||
|
|
builder.WriteString(fmt.Sprintf("%v", _m.Seq))
|
||
|
|
builder.WriteString(", ")
|
||
|
|
builder.WriteString("stationNo=")
|
||
|
|
builder.WriteString(fmt.Sprintf("%v", _m.StationNo))
|
||
|
|
builder.WriteString(", ")
|
||
|
|
builder.WriteString("currentSn=")
|
||
|
|
builder.WriteString(_m.CurrentSn)
|
||
|
|
builder.WriteString(", ")
|
||
|
|
builder.WriteString("orderNo=")
|
||
|
|
builder.WriteString(_m.OrderNo)
|
||
|
|
builder.WriteString(", ")
|
||
|
|
builder.WriteString("occupied=")
|
||
|
|
builder.WriteString(fmt.Sprintf("%v", _m.Occupied))
|
||
|
|
builder.WriteString(", ")
|
||
|
|
builder.WriteString("updatedAt=")
|
||
|
|
builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
|
||
|
|
builder.WriteByte(')')
|
||
|
|
return builder.String()
|
||
|
|
}
|
||
|
|
|
||
|
|
// LinePoints is a parsable slice of LinePoint.
|
||
|
|
type LinePoints []*LinePoint
|