Files
bj_power/bj_power_mes/ent/callpool_update.go
T
SunYF f65a52d9e1 feat: 多系统新增扫码中间件与 AGV 对接,优化拧紧与退库流程
新增扫码中间件支持网络型扫码枪键盘注入,AGV 对接从 WMS 迁至 MES 统一管理;新增拧紧不合格人工处置与 PLC 对账机制,优化退库单关联与工位终端功能,同时清理旧 AGV 任务表,完善数据库与配置项。
2026-10-14 17:24:59 +08:00

779 lines
22 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_mes/ent/callpool"
"bj_power_mes/ent/predicate"
"context"
"errors"
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// CallPoolUpdate is the builder for updating CallPool entities.
type CallPoolUpdate struct {
config
hooks []Hook
mutation *CallPoolMutation
modifiers []func(*sql.UpdateBuilder)
}
// Where appends a list predicates to the CallPoolUpdate builder.
func (_u *CallPoolUpdate) Where(ps ...predicate.CallPool) *CallPoolUpdate {
_u.mutation.Where(ps...)
return _u
}
// SetStationNo sets the "stationNo" field.
func (_u *CallPoolUpdate) SetStationNo(v int) *CallPoolUpdate {
_u.mutation.ResetStationNo()
_u.mutation.SetStationNo(v)
return _u
}
// SetNillableStationNo sets the "stationNo" field if the given value is not nil.
func (_u *CallPoolUpdate) SetNillableStationNo(v *int) *CallPoolUpdate {
if v != nil {
_u.SetStationNo(*v)
}
return _u
}
// AddStationNo adds value to the "stationNo" field.
func (_u *CallPoolUpdate) AddStationNo(v int) *CallPoolUpdate {
_u.mutation.AddStationNo(v)
return _u
}
// SetMaterialCode sets the "materialCode" field.
func (_u *CallPoolUpdate) SetMaterialCode(v string) *CallPoolUpdate {
_u.mutation.SetMaterialCode(v)
return _u
}
// SetNillableMaterialCode sets the "materialCode" field if the given value is not nil.
func (_u *CallPoolUpdate) SetNillableMaterialCode(v *string) *CallPoolUpdate {
if v != nil {
_u.SetMaterialCode(*v)
}
return _u
}
// SetMaterialName sets the "materialName" field.
func (_u *CallPoolUpdate) SetMaterialName(v string) *CallPoolUpdate {
_u.mutation.SetMaterialName(v)
return _u
}
// SetNillableMaterialName sets the "materialName" field if the given value is not nil.
func (_u *CallPoolUpdate) SetNillableMaterialName(v *string) *CallPoolUpdate {
if v != nil {
_u.SetMaterialName(*v)
}
return _u
}
// SetUnit sets the "unit" field.
func (_u *CallPoolUpdate) SetUnit(v string) *CallPoolUpdate {
_u.mutation.SetUnit(v)
return _u
}
// SetNillableUnit sets the "unit" field if the given value is not nil.
func (_u *CallPoolUpdate) SetNillableUnit(v *string) *CallPoolUpdate {
if v != nil {
_u.SetUnit(*v)
}
return _u
}
// SetSnMode sets the "snMode" field.
func (_u *CallPoolUpdate) SetSnMode(v int) *CallPoolUpdate {
_u.mutation.ResetSnMode()
_u.mutation.SetSnMode(v)
return _u
}
// SetNillableSnMode sets the "snMode" field if the given value is not nil.
func (_u *CallPoolUpdate) SetNillableSnMode(v *int) *CallPoolUpdate {
if v != nil {
_u.SetSnMode(*v)
}
return _u
}
// AddSnMode adds value to the "snMode" field.
func (_u *CallPoolUpdate) AddSnMode(v int) *CallPoolUpdate {
_u.mutation.AddSnMode(v)
return _u
}
// SetReqQty sets the "reqQty" field.
func (_u *CallPoolUpdate) SetReqQty(v int) *CallPoolUpdate {
_u.mutation.ResetReqQty()
_u.mutation.SetReqQty(v)
return _u
}
// SetNillableReqQty sets the "reqQty" field if the given value is not nil.
func (_u *CallPoolUpdate) SetNillableReqQty(v *int) *CallPoolUpdate {
if v != nil {
_u.SetReqQty(*v)
}
return _u
}
// AddReqQty adds value to the "reqQty" field.
func (_u *CallPoolUpdate) AddReqQty(v int) *CallPoolUpdate {
_u.mutation.AddReqQty(v)
return _u
}
// SetAdjQty sets the "adjQty" field.
func (_u *CallPoolUpdate) SetAdjQty(v int) *CallPoolUpdate {
_u.mutation.ResetAdjQty()
_u.mutation.SetAdjQty(v)
return _u
}
// SetNillableAdjQty sets the "adjQty" field if the given value is not nil.
func (_u *CallPoolUpdate) SetNillableAdjQty(v *int) *CallPoolUpdate {
if v != nil {
_u.SetAdjQty(*v)
}
return _u
}
// AddAdjQty adds value to the "adjQty" field.
func (_u *CallPoolUpdate) AddAdjQty(v int) *CallPoolUpdate {
_u.mutation.AddAdjQty(v)
return _u
}
// SetSentQty sets the "sentQty" field.
func (_u *CallPoolUpdate) SetSentQty(v int) *CallPoolUpdate {
_u.mutation.ResetSentQty()
_u.mutation.SetSentQty(v)
return _u
}
// SetNillableSentQty sets the "sentQty" field if the given value is not nil.
func (_u *CallPoolUpdate) SetNillableSentQty(v *int) *CallPoolUpdate {
if v != nil {
_u.SetSentQty(*v)
}
return _u
}
// AddSentQty adds value to the "sentQty" field.
func (_u *CallPoolUpdate) AddSentQty(v int) *CallPoolUpdate {
_u.mutation.AddSentQty(v)
return _u
}
// SetReservedQty sets the "reservedQty" field.
func (_u *CallPoolUpdate) SetReservedQty(v int) *CallPoolUpdate {
_u.mutation.ResetReservedQty()
_u.mutation.SetReservedQty(v)
return _u
}
// SetNillableReservedQty sets the "reservedQty" field if the given value is not nil.
func (_u *CallPoolUpdate) SetNillableReservedQty(v *int) *CallPoolUpdate {
if v != nil {
_u.SetReservedQty(*v)
}
return _u
}
// AddReservedQty adds value to the "reservedQty" field.
func (_u *CallPoolUpdate) AddReservedQty(v int) *CallPoolUpdate {
_u.mutation.AddReservedQty(v)
return _u
}
// SetCrossDay sets the "crossDay" field.
func (_u *CallPoolUpdate) SetCrossDay(v bool) *CallPoolUpdate {
_u.mutation.SetCrossDay(v)
return _u
}
// SetNillableCrossDay sets the "crossDay" field if the given value is not nil.
func (_u *CallPoolUpdate) SetNillableCrossDay(v *bool) *CallPoolUpdate {
if v != nil {
_u.SetCrossDay(*v)
}
return _u
}
// SetPlanDates sets the "planDates" field.
func (_u *CallPoolUpdate) SetPlanDates(v string) *CallPoolUpdate {
_u.mutation.SetPlanDates(v)
return _u
}
// SetNillablePlanDates sets the "planDates" field if the given value is not nil.
func (_u *CallPoolUpdate) SetNillablePlanDates(v *string) *CallPoolUpdate {
if v != nil {
_u.SetPlanDates(*v)
}
return _u
}
// SetUpdatedAt sets the "updatedAt" field.
func (_u *CallPoolUpdate) SetUpdatedAt(v time.Time) *CallPoolUpdate {
_u.mutation.SetUpdatedAt(v)
return _u
}
// Mutation returns the CallPoolMutation object of the builder.
func (_u *CallPoolUpdate) Mutation() *CallPoolMutation {
return _u.mutation
}
// Save executes the query and returns the number of nodes affected by the update operation.
func (_u *CallPoolUpdate) Save(ctx context.Context) (int, error) {
_u.defaults()
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *CallPoolUpdate) SaveX(ctx context.Context) int {
affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return affected
}
// Exec executes the query.
func (_u *CallPoolUpdate) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *CallPoolUpdate) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_u *CallPoolUpdate) defaults() {
if _, ok := _u.mutation.UpdatedAt(); !ok {
v := callpool.UpdateDefaultUpdatedAt()
_u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_u *CallPoolUpdate) check() error {
if v, ok := _u.mutation.MaterialCode(); ok {
if err := callpool.MaterialCodeValidator(v); err != nil {
return &ValidationError{Name: "materialCode", err: fmt.Errorf(`ent: validator failed for field "CallPool.materialCode": %w`, err)}
}
}
if v, ok := _u.mutation.MaterialName(); ok {
if err := callpool.MaterialNameValidator(v); err != nil {
return &ValidationError{Name: "materialName", err: fmt.Errorf(`ent: validator failed for field "CallPool.materialName": %w`, err)}
}
}
if v, ok := _u.mutation.Unit(); ok {
if err := callpool.UnitValidator(v); err != nil {
return &ValidationError{Name: "unit", err: fmt.Errorf(`ent: validator failed for field "CallPool.unit": %w`, err)}
}
}
if v, ok := _u.mutation.PlanDates(); ok {
if err := callpool.PlanDatesValidator(v); err != nil {
return &ValidationError{Name: "planDates", err: fmt.Errorf(`ent: validator failed for field "CallPool.planDates": %w`, err)}
}
}
return nil
}
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (_u *CallPoolUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CallPoolUpdate {
_u.modifiers = append(_u.modifiers, modifiers...)
return _u
}
func (_u *CallPoolUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(callpool.Table, callpool.Columns, sqlgraph.NewFieldSpec(callpool.FieldID, field.TypeInt))
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.StationNo(); ok {
_spec.SetField(callpool.FieldStationNo, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedStationNo(); ok {
_spec.AddField(callpool.FieldStationNo, field.TypeInt, value)
}
if value, ok := _u.mutation.MaterialCode(); ok {
_spec.SetField(callpool.FieldMaterialCode, field.TypeString, value)
}
if value, ok := _u.mutation.MaterialName(); ok {
_spec.SetField(callpool.FieldMaterialName, field.TypeString, value)
}
if value, ok := _u.mutation.Unit(); ok {
_spec.SetField(callpool.FieldUnit, field.TypeString, value)
}
if value, ok := _u.mutation.SnMode(); ok {
_spec.SetField(callpool.FieldSnMode, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedSnMode(); ok {
_spec.AddField(callpool.FieldSnMode, field.TypeInt, value)
}
if value, ok := _u.mutation.ReqQty(); ok {
_spec.SetField(callpool.FieldReqQty, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedReqQty(); ok {
_spec.AddField(callpool.FieldReqQty, field.TypeInt, value)
}
if value, ok := _u.mutation.AdjQty(); ok {
_spec.SetField(callpool.FieldAdjQty, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedAdjQty(); ok {
_spec.AddField(callpool.FieldAdjQty, field.TypeInt, value)
}
if value, ok := _u.mutation.SentQty(); ok {
_spec.SetField(callpool.FieldSentQty, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedSentQty(); ok {
_spec.AddField(callpool.FieldSentQty, field.TypeInt, value)
}
if value, ok := _u.mutation.ReservedQty(); ok {
_spec.SetField(callpool.FieldReservedQty, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedReservedQty(); ok {
_spec.AddField(callpool.FieldReservedQty, field.TypeInt, value)
}
if value, ok := _u.mutation.CrossDay(); ok {
_spec.SetField(callpool.FieldCrossDay, field.TypeBool, value)
}
if value, ok := _u.mutation.PlanDates(); ok {
_spec.SetField(callpool.FieldPlanDates, field.TypeString, value)
}
if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(callpool.FieldUpdatedAt, field.TypeTime, value)
}
_spec.AddModifiers(_u.modifiers...)
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{callpool.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return 0, err
}
_u.mutation.done = true
return _node, nil
}
// CallPoolUpdateOne is the builder for updating a single CallPool entity.
type CallPoolUpdateOne struct {
config
fields []string
hooks []Hook
mutation *CallPoolMutation
modifiers []func(*sql.UpdateBuilder)
}
// SetStationNo sets the "stationNo" field.
func (_u *CallPoolUpdateOne) SetStationNo(v int) *CallPoolUpdateOne {
_u.mutation.ResetStationNo()
_u.mutation.SetStationNo(v)
return _u
}
// SetNillableStationNo sets the "stationNo" field if the given value is not nil.
func (_u *CallPoolUpdateOne) SetNillableStationNo(v *int) *CallPoolUpdateOne {
if v != nil {
_u.SetStationNo(*v)
}
return _u
}
// AddStationNo adds value to the "stationNo" field.
func (_u *CallPoolUpdateOne) AddStationNo(v int) *CallPoolUpdateOne {
_u.mutation.AddStationNo(v)
return _u
}
// SetMaterialCode sets the "materialCode" field.
func (_u *CallPoolUpdateOne) SetMaterialCode(v string) *CallPoolUpdateOne {
_u.mutation.SetMaterialCode(v)
return _u
}
// SetNillableMaterialCode sets the "materialCode" field if the given value is not nil.
func (_u *CallPoolUpdateOne) SetNillableMaterialCode(v *string) *CallPoolUpdateOne {
if v != nil {
_u.SetMaterialCode(*v)
}
return _u
}
// SetMaterialName sets the "materialName" field.
func (_u *CallPoolUpdateOne) SetMaterialName(v string) *CallPoolUpdateOne {
_u.mutation.SetMaterialName(v)
return _u
}
// SetNillableMaterialName sets the "materialName" field if the given value is not nil.
func (_u *CallPoolUpdateOne) SetNillableMaterialName(v *string) *CallPoolUpdateOne {
if v != nil {
_u.SetMaterialName(*v)
}
return _u
}
// SetUnit sets the "unit" field.
func (_u *CallPoolUpdateOne) SetUnit(v string) *CallPoolUpdateOne {
_u.mutation.SetUnit(v)
return _u
}
// SetNillableUnit sets the "unit" field if the given value is not nil.
func (_u *CallPoolUpdateOne) SetNillableUnit(v *string) *CallPoolUpdateOne {
if v != nil {
_u.SetUnit(*v)
}
return _u
}
// SetSnMode sets the "snMode" field.
func (_u *CallPoolUpdateOne) SetSnMode(v int) *CallPoolUpdateOne {
_u.mutation.ResetSnMode()
_u.mutation.SetSnMode(v)
return _u
}
// SetNillableSnMode sets the "snMode" field if the given value is not nil.
func (_u *CallPoolUpdateOne) SetNillableSnMode(v *int) *CallPoolUpdateOne {
if v != nil {
_u.SetSnMode(*v)
}
return _u
}
// AddSnMode adds value to the "snMode" field.
func (_u *CallPoolUpdateOne) AddSnMode(v int) *CallPoolUpdateOne {
_u.mutation.AddSnMode(v)
return _u
}
// SetReqQty sets the "reqQty" field.
func (_u *CallPoolUpdateOne) SetReqQty(v int) *CallPoolUpdateOne {
_u.mutation.ResetReqQty()
_u.mutation.SetReqQty(v)
return _u
}
// SetNillableReqQty sets the "reqQty" field if the given value is not nil.
func (_u *CallPoolUpdateOne) SetNillableReqQty(v *int) *CallPoolUpdateOne {
if v != nil {
_u.SetReqQty(*v)
}
return _u
}
// AddReqQty adds value to the "reqQty" field.
func (_u *CallPoolUpdateOne) AddReqQty(v int) *CallPoolUpdateOne {
_u.mutation.AddReqQty(v)
return _u
}
// SetAdjQty sets the "adjQty" field.
func (_u *CallPoolUpdateOne) SetAdjQty(v int) *CallPoolUpdateOne {
_u.mutation.ResetAdjQty()
_u.mutation.SetAdjQty(v)
return _u
}
// SetNillableAdjQty sets the "adjQty" field if the given value is not nil.
func (_u *CallPoolUpdateOne) SetNillableAdjQty(v *int) *CallPoolUpdateOne {
if v != nil {
_u.SetAdjQty(*v)
}
return _u
}
// AddAdjQty adds value to the "adjQty" field.
func (_u *CallPoolUpdateOne) AddAdjQty(v int) *CallPoolUpdateOne {
_u.mutation.AddAdjQty(v)
return _u
}
// SetSentQty sets the "sentQty" field.
func (_u *CallPoolUpdateOne) SetSentQty(v int) *CallPoolUpdateOne {
_u.mutation.ResetSentQty()
_u.mutation.SetSentQty(v)
return _u
}
// SetNillableSentQty sets the "sentQty" field if the given value is not nil.
func (_u *CallPoolUpdateOne) SetNillableSentQty(v *int) *CallPoolUpdateOne {
if v != nil {
_u.SetSentQty(*v)
}
return _u
}
// AddSentQty adds value to the "sentQty" field.
func (_u *CallPoolUpdateOne) AddSentQty(v int) *CallPoolUpdateOne {
_u.mutation.AddSentQty(v)
return _u
}
// SetReservedQty sets the "reservedQty" field.
func (_u *CallPoolUpdateOne) SetReservedQty(v int) *CallPoolUpdateOne {
_u.mutation.ResetReservedQty()
_u.mutation.SetReservedQty(v)
return _u
}
// SetNillableReservedQty sets the "reservedQty" field if the given value is not nil.
func (_u *CallPoolUpdateOne) SetNillableReservedQty(v *int) *CallPoolUpdateOne {
if v != nil {
_u.SetReservedQty(*v)
}
return _u
}
// AddReservedQty adds value to the "reservedQty" field.
func (_u *CallPoolUpdateOne) AddReservedQty(v int) *CallPoolUpdateOne {
_u.mutation.AddReservedQty(v)
return _u
}
// SetCrossDay sets the "crossDay" field.
func (_u *CallPoolUpdateOne) SetCrossDay(v bool) *CallPoolUpdateOne {
_u.mutation.SetCrossDay(v)
return _u
}
// SetNillableCrossDay sets the "crossDay" field if the given value is not nil.
func (_u *CallPoolUpdateOne) SetNillableCrossDay(v *bool) *CallPoolUpdateOne {
if v != nil {
_u.SetCrossDay(*v)
}
return _u
}
// SetPlanDates sets the "planDates" field.
func (_u *CallPoolUpdateOne) SetPlanDates(v string) *CallPoolUpdateOne {
_u.mutation.SetPlanDates(v)
return _u
}
// SetNillablePlanDates sets the "planDates" field if the given value is not nil.
func (_u *CallPoolUpdateOne) SetNillablePlanDates(v *string) *CallPoolUpdateOne {
if v != nil {
_u.SetPlanDates(*v)
}
return _u
}
// SetUpdatedAt sets the "updatedAt" field.
func (_u *CallPoolUpdateOne) SetUpdatedAt(v time.Time) *CallPoolUpdateOne {
_u.mutation.SetUpdatedAt(v)
return _u
}
// Mutation returns the CallPoolMutation object of the builder.
func (_u *CallPoolUpdateOne) Mutation() *CallPoolMutation {
return _u.mutation
}
// Where appends a list predicates to the CallPoolUpdate builder.
func (_u *CallPoolUpdateOne) Where(ps ...predicate.CallPool) *CallPoolUpdateOne {
_u.mutation.Where(ps...)
return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (_u *CallPoolUpdateOne) Select(field string, fields ...string) *CallPoolUpdateOne {
_u.fields = append([]string{field}, fields...)
return _u
}
// Save executes the query and returns the updated CallPool entity.
func (_u *CallPoolUpdateOne) Save(ctx context.Context) (*CallPool, error) {
_u.defaults()
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *CallPoolUpdateOne) SaveX(ctx context.Context) *CallPool {
node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return node
}
// Exec executes the query on the entity.
func (_u *CallPoolUpdateOne) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *CallPoolUpdateOne) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_u *CallPoolUpdateOne) defaults() {
if _, ok := _u.mutation.UpdatedAt(); !ok {
v := callpool.UpdateDefaultUpdatedAt()
_u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_u *CallPoolUpdateOne) check() error {
if v, ok := _u.mutation.MaterialCode(); ok {
if err := callpool.MaterialCodeValidator(v); err != nil {
return &ValidationError{Name: "materialCode", err: fmt.Errorf(`ent: validator failed for field "CallPool.materialCode": %w`, err)}
}
}
if v, ok := _u.mutation.MaterialName(); ok {
if err := callpool.MaterialNameValidator(v); err != nil {
return &ValidationError{Name: "materialName", err: fmt.Errorf(`ent: validator failed for field "CallPool.materialName": %w`, err)}
}
}
if v, ok := _u.mutation.Unit(); ok {
if err := callpool.UnitValidator(v); err != nil {
return &ValidationError{Name: "unit", err: fmt.Errorf(`ent: validator failed for field "CallPool.unit": %w`, err)}
}
}
if v, ok := _u.mutation.PlanDates(); ok {
if err := callpool.PlanDatesValidator(v); err != nil {
return &ValidationError{Name: "planDates", err: fmt.Errorf(`ent: validator failed for field "CallPool.planDates": %w`, err)}
}
}
return nil
}
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (_u *CallPoolUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *CallPoolUpdateOne {
_u.modifiers = append(_u.modifiers, modifiers...)
return _u
}
func (_u *CallPoolUpdateOne) sqlSave(ctx context.Context) (_node *CallPool, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(callpool.Table, callpool.Columns, sqlgraph.NewFieldSpec(callpool.FieldID, field.TypeInt))
id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "CallPool.id" for update`)}
}
_spec.Node.ID.Value = id
if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, callpool.FieldID)
for _, f := range fields {
if !callpool.ValidColumn(f) {
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
if f != callpool.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, f)
}
}
}
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.StationNo(); ok {
_spec.SetField(callpool.FieldStationNo, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedStationNo(); ok {
_spec.AddField(callpool.FieldStationNo, field.TypeInt, value)
}
if value, ok := _u.mutation.MaterialCode(); ok {
_spec.SetField(callpool.FieldMaterialCode, field.TypeString, value)
}
if value, ok := _u.mutation.MaterialName(); ok {
_spec.SetField(callpool.FieldMaterialName, field.TypeString, value)
}
if value, ok := _u.mutation.Unit(); ok {
_spec.SetField(callpool.FieldUnit, field.TypeString, value)
}
if value, ok := _u.mutation.SnMode(); ok {
_spec.SetField(callpool.FieldSnMode, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedSnMode(); ok {
_spec.AddField(callpool.FieldSnMode, field.TypeInt, value)
}
if value, ok := _u.mutation.ReqQty(); ok {
_spec.SetField(callpool.FieldReqQty, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedReqQty(); ok {
_spec.AddField(callpool.FieldReqQty, field.TypeInt, value)
}
if value, ok := _u.mutation.AdjQty(); ok {
_spec.SetField(callpool.FieldAdjQty, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedAdjQty(); ok {
_spec.AddField(callpool.FieldAdjQty, field.TypeInt, value)
}
if value, ok := _u.mutation.SentQty(); ok {
_spec.SetField(callpool.FieldSentQty, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedSentQty(); ok {
_spec.AddField(callpool.FieldSentQty, field.TypeInt, value)
}
if value, ok := _u.mutation.ReservedQty(); ok {
_spec.SetField(callpool.FieldReservedQty, field.TypeInt, value)
}
if value, ok := _u.mutation.AddedReservedQty(); ok {
_spec.AddField(callpool.FieldReservedQty, field.TypeInt, value)
}
if value, ok := _u.mutation.CrossDay(); ok {
_spec.SetField(callpool.FieldCrossDay, field.TypeBool, value)
}
if value, ok := _u.mutation.PlanDates(); ok {
_spec.SetField(callpool.FieldPlanDates, field.TypeString, value)
}
if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(callpool.FieldUpdatedAt, field.TypeTime, value)
}
_spec.AddModifiers(_u.modifiers...)
_node = &CallPool{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{callpool.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
_u.mutation.done = true
return _node, nil
}