- 新增过程巡检按步骤上报、数量不符上报、工位退料功能 - 增加工单工程编号三级归属字段 - 新增物料安全库存与缺货预警 - 新增附件管理、退库单管理模块 - 优化生产看板展示逻辑与前端页面文案 - 清理冗余的工艺路线相关代码与备份文件
607 lines
18 KiB
Go
607 lines
18 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"bj_power_mes/ent/linepoint"
|
|
"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"
|
|
)
|
|
|
|
// LinePointUpdate is the builder for updating LinePoint entities.
|
|
type LinePointUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *LinePointMutation
|
|
modifiers []func(*sql.UpdateBuilder)
|
|
}
|
|
|
|
// Where appends a list predicates to the LinePointUpdate builder.
|
|
func (_u *LinePointUpdate) Where(ps ...predicate.LinePoint) *LinePointUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetPointType sets the "pointType" field.
|
|
func (_u *LinePointUpdate) SetPointType(v string) *LinePointUpdate {
|
|
_u.mutation.SetPointType(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePointType sets the "pointType" field if the given value is not nil.
|
|
func (_u *LinePointUpdate) SetNillablePointType(v *string) *LinePointUpdate {
|
|
if v != nil {
|
|
_u.SetPointType(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetPointNo sets the "pointNo" field.
|
|
func (_u *LinePointUpdate) SetPointNo(v string) *LinePointUpdate {
|
|
_u.mutation.SetPointNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePointNo sets the "pointNo" field if the given value is not nil.
|
|
func (_u *LinePointUpdate) SetNillablePointNo(v *string) *LinePointUpdate {
|
|
if v != nil {
|
|
_u.SetPointNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetLabel sets the "label" field.
|
|
func (_u *LinePointUpdate) SetLabel(v string) *LinePointUpdate {
|
|
_u.mutation.SetLabel(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableLabel sets the "label" field if the given value is not nil.
|
|
func (_u *LinePointUpdate) SetNillableLabel(v *string) *LinePointUpdate {
|
|
if v != nil {
|
|
_u.SetLabel(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetSeq sets the "seq" field.
|
|
func (_u *LinePointUpdate) SetSeq(v int) *LinePointUpdate {
|
|
_u.mutation.ResetSeq()
|
|
_u.mutation.SetSeq(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableSeq sets the "seq" field if the given value is not nil.
|
|
func (_u *LinePointUpdate) SetNillableSeq(v *int) *LinePointUpdate {
|
|
if v != nil {
|
|
_u.SetSeq(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddSeq adds value to the "seq" field.
|
|
func (_u *LinePointUpdate) AddSeq(v int) *LinePointUpdate {
|
|
_u.mutation.AddSeq(v)
|
|
return _u
|
|
}
|
|
|
|
// SetStationNo sets the "stationNo" field.
|
|
func (_u *LinePointUpdate) SetStationNo(v int) *LinePointUpdate {
|
|
_u.mutation.ResetStationNo()
|
|
_u.mutation.SetStationNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStationNo sets the "stationNo" field if the given value is not nil.
|
|
func (_u *LinePointUpdate) SetNillableStationNo(v *int) *LinePointUpdate {
|
|
if v != nil {
|
|
_u.SetStationNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddStationNo adds value to the "stationNo" field.
|
|
func (_u *LinePointUpdate) AddStationNo(v int) *LinePointUpdate {
|
|
_u.mutation.AddStationNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetCurrentSn sets the "currentSn" field.
|
|
func (_u *LinePointUpdate) SetCurrentSn(v string) *LinePointUpdate {
|
|
_u.mutation.SetCurrentSn(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCurrentSn sets the "currentSn" field if the given value is not nil.
|
|
func (_u *LinePointUpdate) SetNillableCurrentSn(v *string) *LinePointUpdate {
|
|
if v != nil {
|
|
_u.SetCurrentSn(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetOrderNo sets the "orderNo" field.
|
|
func (_u *LinePointUpdate) SetOrderNo(v string) *LinePointUpdate {
|
|
_u.mutation.SetOrderNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOrderNo sets the "orderNo" field if the given value is not nil.
|
|
func (_u *LinePointUpdate) SetNillableOrderNo(v *string) *LinePointUpdate {
|
|
if v != nil {
|
|
_u.SetOrderNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetOccupied sets the "occupied" field.
|
|
func (_u *LinePointUpdate) SetOccupied(v bool) *LinePointUpdate {
|
|
_u.mutation.SetOccupied(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOccupied sets the "occupied" field if the given value is not nil.
|
|
func (_u *LinePointUpdate) SetNillableOccupied(v *bool) *LinePointUpdate {
|
|
if v != nil {
|
|
_u.SetOccupied(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updatedAt" field.
|
|
func (_u *LinePointUpdate) SetUpdatedAt(v time.Time) *LinePointUpdate {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// Mutation returns the LinePointMutation object of the builder.
|
|
func (_u *LinePointUpdate) Mutation() *LinePointMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *LinePointUpdate) 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 *LinePointUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *LinePointUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *LinePointUpdate) 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 *LinePointUpdate) defaults() {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
v := linepoint.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *LinePointUpdate) check() error {
|
|
if v, ok := _u.mutation.PointType(); ok {
|
|
if err := linepoint.PointTypeValidator(v); err != nil {
|
|
return &ValidationError{Name: "pointType", err: fmt.Errorf(`ent: validator failed for field "LinePoint.pointType": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.PointNo(); ok {
|
|
if err := linepoint.PointNoValidator(v); err != nil {
|
|
return &ValidationError{Name: "pointNo", err: fmt.Errorf(`ent: validator failed for field "LinePoint.pointNo": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Label(); ok {
|
|
if err := linepoint.LabelValidator(v); err != nil {
|
|
return &ValidationError{Name: "label", err: fmt.Errorf(`ent: validator failed for field "LinePoint.label": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.CurrentSn(); ok {
|
|
if err := linepoint.CurrentSnValidator(v); err != nil {
|
|
return &ValidationError{Name: "currentSn", err: fmt.Errorf(`ent: validator failed for field "LinePoint.currentSn": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.OrderNo(); ok {
|
|
if err := linepoint.OrderNoValidator(v); err != nil {
|
|
return &ValidationError{Name: "orderNo", err: fmt.Errorf(`ent: validator failed for field "LinePoint.orderNo": %w`, err)}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
|
func (_u *LinePointUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *LinePointUpdate {
|
|
_u.modifiers = append(_u.modifiers, modifiers...)
|
|
return _u
|
|
}
|
|
|
|
func (_u *LinePointUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(linepoint.Table, linepoint.Columns, sqlgraph.NewFieldSpec(linepoint.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.PointType(); ok {
|
|
_spec.SetField(linepoint.FieldPointType, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.PointNo(); ok {
|
|
_spec.SetField(linepoint.FieldPointNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Label(); ok {
|
|
_spec.SetField(linepoint.FieldLabel, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Seq(); ok {
|
|
_spec.SetField(linepoint.FieldSeq, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedSeq(); ok {
|
|
_spec.AddField(linepoint.FieldSeq, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.StationNo(); ok {
|
|
_spec.SetField(linepoint.FieldStationNo, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedStationNo(); ok {
|
|
_spec.AddField(linepoint.FieldStationNo, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.CurrentSn(); ok {
|
|
_spec.SetField(linepoint.FieldCurrentSn, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.OrderNo(); ok {
|
|
_spec.SetField(linepoint.FieldOrderNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Occupied(); ok {
|
|
_spec.SetField(linepoint.FieldOccupied, field.TypeBool, value)
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(linepoint.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{linepoint.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
// LinePointUpdateOne is the builder for updating a single LinePoint entity.
|
|
type LinePointUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *LinePointMutation
|
|
modifiers []func(*sql.UpdateBuilder)
|
|
}
|
|
|
|
// SetPointType sets the "pointType" field.
|
|
func (_u *LinePointUpdateOne) SetPointType(v string) *LinePointUpdateOne {
|
|
_u.mutation.SetPointType(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePointType sets the "pointType" field if the given value is not nil.
|
|
func (_u *LinePointUpdateOne) SetNillablePointType(v *string) *LinePointUpdateOne {
|
|
if v != nil {
|
|
_u.SetPointType(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetPointNo sets the "pointNo" field.
|
|
func (_u *LinePointUpdateOne) SetPointNo(v string) *LinePointUpdateOne {
|
|
_u.mutation.SetPointNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePointNo sets the "pointNo" field if the given value is not nil.
|
|
func (_u *LinePointUpdateOne) SetNillablePointNo(v *string) *LinePointUpdateOne {
|
|
if v != nil {
|
|
_u.SetPointNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetLabel sets the "label" field.
|
|
func (_u *LinePointUpdateOne) SetLabel(v string) *LinePointUpdateOne {
|
|
_u.mutation.SetLabel(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableLabel sets the "label" field if the given value is not nil.
|
|
func (_u *LinePointUpdateOne) SetNillableLabel(v *string) *LinePointUpdateOne {
|
|
if v != nil {
|
|
_u.SetLabel(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetSeq sets the "seq" field.
|
|
func (_u *LinePointUpdateOne) SetSeq(v int) *LinePointUpdateOne {
|
|
_u.mutation.ResetSeq()
|
|
_u.mutation.SetSeq(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableSeq sets the "seq" field if the given value is not nil.
|
|
func (_u *LinePointUpdateOne) SetNillableSeq(v *int) *LinePointUpdateOne {
|
|
if v != nil {
|
|
_u.SetSeq(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddSeq adds value to the "seq" field.
|
|
func (_u *LinePointUpdateOne) AddSeq(v int) *LinePointUpdateOne {
|
|
_u.mutation.AddSeq(v)
|
|
return _u
|
|
}
|
|
|
|
// SetStationNo sets the "stationNo" field.
|
|
func (_u *LinePointUpdateOne) SetStationNo(v int) *LinePointUpdateOne {
|
|
_u.mutation.ResetStationNo()
|
|
_u.mutation.SetStationNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStationNo sets the "stationNo" field if the given value is not nil.
|
|
func (_u *LinePointUpdateOne) SetNillableStationNo(v *int) *LinePointUpdateOne {
|
|
if v != nil {
|
|
_u.SetStationNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddStationNo adds value to the "stationNo" field.
|
|
func (_u *LinePointUpdateOne) AddStationNo(v int) *LinePointUpdateOne {
|
|
_u.mutation.AddStationNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetCurrentSn sets the "currentSn" field.
|
|
func (_u *LinePointUpdateOne) SetCurrentSn(v string) *LinePointUpdateOne {
|
|
_u.mutation.SetCurrentSn(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCurrentSn sets the "currentSn" field if the given value is not nil.
|
|
func (_u *LinePointUpdateOne) SetNillableCurrentSn(v *string) *LinePointUpdateOne {
|
|
if v != nil {
|
|
_u.SetCurrentSn(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetOrderNo sets the "orderNo" field.
|
|
func (_u *LinePointUpdateOne) SetOrderNo(v string) *LinePointUpdateOne {
|
|
_u.mutation.SetOrderNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOrderNo sets the "orderNo" field if the given value is not nil.
|
|
func (_u *LinePointUpdateOne) SetNillableOrderNo(v *string) *LinePointUpdateOne {
|
|
if v != nil {
|
|
_u.SetOrderNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetOccupied sets the "occupied" field.
|
|
func (_u *LinePointUpdateOne) SetOccupied(v bool) *LinePointUpdateOne {
|
|
_u.mutation.SetOccupied(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOccupied sets the "occupied" field if the given value is not nil.
|
|
func (_u *LinePointUpdateOne) SetNillableOccupied(v *bool) *LinePointUpdateOne {
|
|
if v != nil {
|
|
_u.SetOccupied(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updatedAt" field.
|
|
func (_u *LinePointUpdateOne) SetUpdatedAt(v time.Time) *LinePointUpdateOne {
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// Mutation returns the LinePointMutation object of the builder.
|
|
func (_u *LinePointUpdateOne) Mutation() *LinePointMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// Where appends a list predicates to the LinePointUpdate builder.
|
|
func (_u *LinePointUpdateOne) Where(ps ...predicate.LinePoint) *LinePointUpdateOne {
|
|
_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 *LinePointUpdateOne) Select(field string, fields ...string) *LinePointUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated LinePoint entity.
|
|
func (_u *LinePointUpdateOne) Save(ctx context.Context) (*LinePoint, error) {
|
|
_u.defaults()
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *LinePointUpdateOne) SaveX(ctx context.Context) *LinePoint {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *LinePointUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *LinePointUpdateOne) 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 *LinePointUpdateOne) defaults() {
|
|
if _, ok := _u.mutation.UpdatedAt(); !ok {
|
|
v := linepoint.UpdateDefaultUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_u *LinePointUpdateOne) check() error {
|
|
if v, ok := _u.mutation.PointType(); ok {
|
|
if err := linepoint.PointTypeValidator(v); err != nil {
|
|
return &ValidationError{Name: "pointType", err: fmt.Errorf(`ent: validator failed for field "LinePoint.pointType": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.PointNo(); ok {
|
|
if err := linepoint.PointNoValidator(v); err != nil {
|
|
return &ValidationError{Name: "pointNo", err: fmt.Errorf(`ent: validator failed for field "LinePoint.pointNo": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.Label(); ok {
|
|
if err := linepoint.LabelValidator(v); err != nil {
|
|
return &ValidationError{Name: "label", err: fmt.Errorf(`ent: validator failed for field "LinePoint.label": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.CurrentSn(); ok {
|
|
if err := linepoint.CurrentSnValidator(v); err != nil {
|
|
return &ValidationError{Name: "currentSn", err: fmt.Errorf(`ent: validator failed for field "LinePoint.currentSn": %w`, err)}
|
|
}
|
|
}
|
|
if v, ok := _u.mutation.OrderNo(); ok {
|
|
if err := linepoint.OrderNoValidator(v); err != nil {
|
|
return &ValidationError{Name: "orderNo", err: fmt.Errorf(`ent: validator failed for field "LinePoint.orderNo": %w`, err)}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
|
|
func (_u *LinePointUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *LinePointUpdateOne {
|
|
_u.modifiers = append(_u.modifiers, modifiers...)
|
|
return _u
|
|
}
|
|
|
|
func (_u *LinePointUpdateOne) sqlSave(ctx context.Context) (_node *LinePoint, err error) {
|
|
if err := _u.check(); err != nil {
|
|
return _node, err
|
|
}
|
|
_spec := sqlgraph.NewUpdateSpec(linepoint.Table, linepoint.Columns, sqlgraph.NewFieldSpec(linepoint.FieldID, field.TypeInt))
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "LinePoint.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, linepoint.FieldID)
|
|
for _, f := range fields {
|
|
if !linepoint.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
}
|
|
if f != linepoint.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.PointType(); ok {
|
|
_spec.SetField(linepoint.FieldPointType, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.PointNo(); ok {
|
|
_spec.SetField(linepoint.FieldPointNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Label(); ok {
|
|
_spec.SetField(linepoint.FieldLabel, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Seq(); ok {
|
|
_spec.SetField(linepoint.FieldSeq, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedSeq(); ok {
|
|
_spec.AddField(linepoint.FieldSeq, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.StationNo(); ok {
|
|
_spec.SetField(linepoint.FieldStationNo, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedStationNo(); ok {
|
|
_spec.AddField(linepoint.FieldStationNo, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.CurrentSn(); ok {
|
|
_spec.SetField(linepoint.FieldCurrentSn, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.OrderNo(); ok {
|
|
_spec.SetField(linepoint.FieldOrderNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.Occupied(); ok {
|
|
_spec.SetField(linepoint.FieldOccupied, field.TypeBool, value)
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(linepoint.FieldUpdatedAt, field.TypeTime, value)
|
|
}
|
|
_spec.AddModifiers(_u.modifiers...)
|
|
_node = &LinePoint{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{linepoint.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|