Files
bj_power/bj_power_mes/ent/agvvehiclestate.go
T

161 lines
5.5 KiB
Go
Raw Normal View History

// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_mes/ent/agvvehiclestate"
"fmt"
"strings"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// AgvVehicleState AGV 载货状态台账:按 agv_code 逐台记录有托盘/空车,取货/卸货确认与人工维护写入,派车防撞校验消费。
type AgvVehicleState struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// 车辆编号(RCS robotCode/agvCode;RCS 未分车时=DEFAULT 未知车辆)
AgvCode string `json:"agv_code,omitempty"`
// 载货状态:true=有托盘(载货) false=空车
HasPallet bool `json:"has_pallet,omitempty"`
// 状态来源:AUTO_LOAD取货确认/AUTO_UNLOAD卸货确认/MANUAL人工维护
Source string `json:"source,omitempty"`
// 最近更新人
UpdatedBy string `json:"updated_by,omitempty"`
// 最近更新时间 unix秒
UpdatedAt int64 `json:"updated_at,omitempty"`
// 备注(人工修改原因等)
Remark string `json:"remark,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*AgvVehicleState) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case agvvehiclestate.FieldHasPallet:
values[i] = new(sql.NullBool)
case agvvehiclestate.FieldID, agvvehiclestate.FieldUpdatedAt:
values[i] = new(sql.NullInt64)
case agvvehiclestate.FieldAgvCode, agvvehiclestate.FieldSource, agvvehiclestate.FieldUpdatedBy, agvvehiclestate.FieldRemark:
values[i] = new(sql.NullString)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the AgvVehicleState fields.
func (_m *AgvVehicleState) 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 agvvehiclestate.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 agvvehiclestate.FieldAgvCode:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field agv_code", values[i])
} else if value.Valid {
_m.AgvCode = value.String
}
case agvvehiclestate.FieldHasPallet:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field has_pallet", values[i])
} else if value.Valid {
_m.HasPallet = value.Bool
}
case agvvehiclestate.FieldSource:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field source", values[i])
} else if value.Valid {
_m.Source = value.String
}
case agvvehiclestate.FieldUpdatedBy:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field updated_by", values[i])
} else if value.Valid {
_m.UpdatedBy = value.String
}
case agvvehiclestate.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
_m.UpdatedAt = value.Int64
}
case agvvehiclestate.FieldRemark:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field remark", values[i])
} else if value.Valid {
_m.Remark = value.String
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the AgvVehicleState.
// This includes values selected through modifiers, order, etc.
func (_m *AgvVehicleState) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this AgvVehicleState.
// Note that you need to call AgvVehicleState.Unwrap() before calling this method if this AgvVehicleState
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *AgvVehicleState) Update() *AgvVehicleStateUpdateOne {
return NewAgvVehicleStateClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the AgvVehicleState 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 *AgvVehicleState) Unwrap() *AgvVehicleState {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: AgvVehicleState is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *AgvVehicleState) String() string {
var builder strings.Builder
builder.WriteString("AgvVehicleState(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("agv_code=")
builder.WriteString(_m.AgvCode)
builder.WriteString(", ")
builder.WriteString("has_pallet=")
builder.WriteString(fmt.Sprintf("%v", _m.HasPallet))
builder.WriteString(", ")
builder.WriteString("source=")
builder.WriteString(_m.Source)
builder.WriteString(", ")
builder.WriteString("updated_by=")
builder.WriteString(_m.UpdatedBy)
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(fmt.Sprintf("%v", _m.UpdatedAt))
builder.WriteString(", ")
builder.WriteString("remark=")
builder.WriteString(_m.Remark)
builder.WriteByte(')')
return builder.String()
}
// AgvVehicleStates is a parsable slice of AgvVehicleState.
type AgvVehicleStates []*AgvVehicleState