596 lines
18 KiB
Go
596 lines
18 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"bj_power_wms/ent/predicate"
|
|
"bj_power_wms/ent/semifinished"
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// SemiFinishedUpdate is the builder for updating SemiFinished entities.
|
|
type SemiFinishedUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *SemiFinishedMutation
|
|
}
|
|
|
|
// Where appends a list predicates to the SemiFinishedUpdate builder.
|
|
func (_u *SemiFinishedUpdate) Where(ps ...predicate.SemiFinished) *SemiFinishedUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetSn sets the "sn" field.
|
|
func (_u *SemiFinishedUpdate) SetSn(v string) *SemiFinishedUpdate {
|
|
_u.mutation.SetSn(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableSn sets the "sn" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdate) SetNillableSn(v *string) *SemiFinishedUpdate {
|
|
if v != nil {
|
|
_u.SetSn(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetMaterialCode sets the "material_code" field.
|
|
func (_u *SemiFinishedUpdate) SetMaterialCode(v string) *SemiFinishedUpdate {
|
|
_u.mutation.SetMaterialCode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMaterialCode sets the "material_code" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdate) SetNillableMaterialCode(v *string) *SemiFinishedUpdate {
|
|
if v != nil {
|
|
_u.SetMaterialCode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetCompletedProcess sets the "completed_process" field.
|
|
func (_u *SemiFinishedUpdate) SetCompletedProcess(v string) *SemiFinishedUpdate {
|
|
_u.mutation.SetCompletedProcess(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCompletedProcess sets the "completed_process" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdate) SetNillableCompletedProcess(v *string) *SemiFinishedUpdate {
|
|
if v != nil {
|
|
_u.SetCompletedProcess(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearCompletedProcess clears the value of the "completed_process" field.
|
|
func (_u *SemiFinishedUpdate) ClearCompletedProcess() *SemiFinishedUpdate {
|
|
_u.mutation.ClearCompletedProcess()
|
|
return _u
|
|
}
|
|
|
|
// SetQuantity sets the "quantity" field.
|
|
func (_u *SemiFinishedUpdate) SetQuantity(v int) *SemiFinishedUpdate {
|
|
_u.mutation.ResetQuantity()
|
|
_u.mutation.SetQuantity(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableQuantity sets the "quantity" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdate) SetNillableQuantity(v *int) *SemiFinishedUpdate {
|
|
if v != nil {
|
|
_u.SetQuantity(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddQuantity adds value to the "quantity" field.
|
|
func (_u *SemiFinishedUpdate) AddQuantity(v int) *SemiFinishedUpdate {
|
|
_u.mutation.AddQuantity(v)
|
|
return _u
|
|
}
|
|
|
|
// SetZoneCode sets the "zone_code" field.
|
|
func (_u *SemiFinishedUpdate) SetZoneCode(v string) *SemiFinishedUpdate {
|
|
_u.mutation.SetZoneCode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableZoneCode sets the "zone_code" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdate) SetNillableZoneCode(v *string) *SemiFinishedUpdate {
|
|
if v != nil {
|
|
_u.SetZoneCode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearZoneCode clears the value of the "zone_code" field.
|
|
func (_u *SemiFinishedUpdate) ClearZoneCode() *SemiFinishedUpdate {
|
|
_u.mutation.ClearZoneCode()
|
|
return _u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_u *SemiFinishedUpdate) SetStatus(v string) *SemiFinishedUpdate {
|
|
_u.mutation.SetStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdate) SetNillableStatus(v *string) *SemiFinishedUpdate {
|
|
if v != nil {
|
|
_u.SetStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetOrderNo sets the "order_no" field.
|
|
func (_u *SemiFinishedUpdate) SetOrderNo(v string) *SemiFinishedUpdate {
|
|
_u.mutation.SetOrderNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOrderNo sets the "order_no" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdate) SetNillableOrderNo(v *string) *SemiFinishedUpdate {
|
|
if v != nil {
|
|
_u.SetOrderNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearOrderNo clears the value of the "order_no" field.
|
|
func (_u *SemiFinishedUpdate) ClearOrderNo() *SemiFinishedUpdate {
|
|
_u.mutation.ClearOrderNo()
|
|
return _u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_u *SemiFinishedUpdate) SetCreatedAt(v int64) *SemiFinishedUpdate {
|
|
_u.mutation.ResetCreatedAt()
|
|
_u.mutation.SetCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdate) SetNillableCreatedAt(v *int64) *SemiFinishedUpdate {
|
|
if v != nil {
|
|
_u.SetCreatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddCreatedAt adds value to the "created_at" field.
|
|
func (_u *SemiFinishedUpdate) AddCreatedAt(v int64) *SemiFinishedUpdate {
|
|
_u.mutation.AddCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *SemiFinishedUpdate) SetUpdatedAt(v int64) *SemiFinishedUpdate {
|
|
_u.mutation.ResetUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdate) SetNillableUpdatedAt(v *int64) *SemiFinishedUpdate {
|
|
if v != nil {
|
|
_u.SetUpdatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddUpdatedAt adds value to the "updated_at" field.
|
|
func (_u *SemiFinishedUpdate) AddUpdatedAt(v int64) *SemiFinishedUpdate {
|
|
_u.mutation.AddUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// Mutation returns the SemiFinishedMutation object of the builder.
|
|
func (_u *SemiFinishedUpdate) Mutation() *SemiFinishedMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *SemiFinishedUpdate) Save(ctx context.Context) (int, error) {
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *SemiFinishedUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *SemiFinishedUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *SemiFinishedUpdate) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func (_u *SemiFinishedUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
|
_spec := sqlgraph.NewUpdateSpec(semifinished.Table, semifinished.Columns, sqlgraph.NewFieldSpec(semifinished.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.Sn(); ok {
|
|
_spec.SetField(semifinished.FieldSn, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.MaterialCode(); ok {
|
|
_spec.SetField(semifinished.FieldMaterialCode, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.CompletedProcess(); ok {
|
|
_spec.SetField(semifinished.FieldCompletedProcess, field.TypeString, value)
|
|
}
|
|
if _u.mutation.CompletedProcessCleared() {
|
|
_spec.ClearField(semifinished.FieldCompletedProcess, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Quantity(); ok {
|
|
_spec.SetField(semifinished.FieldQuantity, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedQuantity(); ok {
|
|
_spec.AddField(semifinished.FieldQuantity, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.ZoneCode(); ok {
|
|
_spec.SetField(semifinished.FieldZoneCode, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ZoneCodeCleared() {
|
|
_spec.ClearField(semifinished.FieldZoneCode, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Status(); ok {
|
|
_spec.SetField(semifinished.FieldStatus, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.OrderNo(); ok {
|
|
_spec.SetField(semifinished.FieldOrderNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.OrderNoCleared() {
|
|
_spec.ClearField(semifinished.FieldOrderNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
|
_spec.SetField(semifinished.FieldCreatedAt, field.TypeInt64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedCreatedAt(); ok {
|
|
_spec.AddField(semifinished.FieldCreatedAt, field.TypeInt64, value)
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(semifinished.FieldUpdatedAt, field.TypeInt64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedUpdatedAt(); ok {
|
|
_spec.AddField(semifinished.FieldUpdatedAt, field.TypeInt64, value)
|
|
}
|
|
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{semifinished.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
// SemiFinishedUpdateOne is the builder for updating a single SemiFinished entity.
|
|
type SemiFinishedUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *SemiFinishedMutation
|
|
}
|
|
|
|
// SetSn sets the "sn" field.
|
|
func (_u *SemiFinishedUpdateOne) SetSn(v string) *SemiFinishedUpdateOne {
|
|
_u.mutation.SetSn(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableSn sets the "sn" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdateOne) SetNillableSn(v *string) *SemiFinishedUpdateOne {
|
|
if v != nil {
|
|
_u.SetSn(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetMaterialCode sets the "material_code" field.
|
|
func (_u *SemiFinishedUpdateOne) SetMaterialCode(v string) *SemiFinishedUpdateOne {
|
|
_u.mutation.SetMaterialCode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMaterialCode sets the "material_code" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdateOne) SetNillableMaterialCode(v *string) *SemiFinishedUpdateOne {
|
|
if v != nil {
|
|
_u.SetMaterialCode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetCompletedProcess sets the "completed_process" field.
|
|
func (_u *SemiFinishedUpdateOne) SetCompletedProcess(v string) *SemiFinishedUpdateOne {
|
|
_u.mutation.SetCompletedProcess(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCompletedProcess sets the "completed_process" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdateOne) SetNillableCompletedProcess(v *string) *SemiFinishedUpdateOne {
|
|
if v != nil {
|
|
_u.SetCompletedProcess(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearCompletedProcess clears the value of the "completed_process" field.
|
|
func (_u *SemiFinishedUpdateOne) ClearCompletedProcess() *SemiFinishedUpdateOne {
|
|
_u.mutation.ClearCompletedProcess()
|
|
return _u
|
|
}
|
|
|
|
// SetQuantity sets the "quantity" field.
|
|
func (_u *SemiFinishedUpdateOne) SetQuantity(v int) *SemiFinishedUpdateOne {
|
|
_u.mutation.ResetQuantity()
|
|
_u.mutation.SetQuantity(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableQuantity sets the "quantity" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdateOne) SetNillableQuantity(v *int) *SemiFinishedUpdateOne {
|
|
if v != nil {
|
|
_u.SetQuantity(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddQuantity adds value to the "quantity" field.
|
|
func (_u *SemiFinishedUpdateOne) AddQuantity(v int) *SemiFinishedUpdateOne {
|
|
_u.mutation.AddQuantity(v)
|
|
return _u
|
|
}
|
|
|
|
// SetZoneCode sets the "zone_code" field.
|
|
func (_u *SemiFinishedUpdateOne) SetZoneCode(v string) *SemiFinishedUpdateOne {
|
|
_u.mutation.SetZoneCode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableZoneCode sets the "zone_code" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdateOne) SetNillableZoneCode(v *string) *SemiFinishedUpdateOne {
|
|
if v != nil {
|
|
_u.SetZoneCode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearZoneCode clears the value of the "zone_code" field.
|
|
func (_u *SemiFinishedUpdateOne) ClearZoneCode() *SemiFinishedUpdateOne {
|
|
_u.mutation.ClearZoneCode()
|
|
return _u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_u *SemiFinishedUpdateOne) SetStatus(v string) *SemiFinishedUpdateOne {
|
|
_u.mutation.SetStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdateOne) SetNillableStatus(v *string) *SemiFinishedUpdateOne {
|
|
if v != nil {
|
|
_u.SetStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetOrderNo sets the "order_no" field.
|
|
func (_u *SemiFinishedUpdateOne) SetOrderNo(v string) *SemiFinishedUpdateOne {
|
|
_u.mutation.SetOrderNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOrderNo sets the "order_no" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdateOne) SetNillableOrderNo(v *string) *SemiFinishedUpdateOne {
|
|
if v != nil {
|
|
_u.SetOrderNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearOrderNo clears the value of the "order_no" field.
|
|
func (_u *SemiFinishedUpdateOne) ClearOrderNo() *SemiFinishedUpdateOne {
|
|
_u.mutation.ClearOrderNo()
|
|
return _u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_u *SemiFinishedUpdateOne) SetCreatedAt(v int64) *SemiFinishedUpdateOne {
|
|
_u.mutation.ResetCreatedAt()
|
|
_u.mutation.SetCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdateOne) SetNillableCreatedAt(v *int64) *SemiFinishedUpdateOne {
|
|
if v != nil {
|
|
_u.SetCreatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddCreatedAt adds value to the "created_at" field.
|
|
func (_u *SemiFinishedUpdateOne) AddCreatedAt(v int64) *SemiFinishedUpdateOne {
|
|
_u.mutation.AddCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_u *SemiFinishedUpdateOne) SetUpdatedAt(v int64) *SemiFinishedUpdateOne {
|
|
_u.mutation.ResetUpdatedAt()
|
|
_u.mutation.SetUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
|
func (_u *SemiFinishedUpdateOne) SetNillableUpdatedAt(v *int64) *SemiFinishedUpdateOne {
|
|
if v != nil {
|
|
_u.SetUpdatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddUpdatedAt adds value to the "updated_at" field.
|
|
func (_u *SemiFinishedUpdateOne) AddUpdatedAt(v int64) *SemiFinishedUpdateOne {
|
|
_u.mutation.AddUpdatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// Mutation returns the SemiFinishedMutation object of the builder.
|
|
func (_u *SemiFinishedUpdateOne) Mutation() *SemiFinishedMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// Where appends a list predicates to the SemiFinishedUpdate builder.
|
|
func (_u *SemiFinishedUpdateOne) Where(ps ...predicate.SemiFinished) *SemiFinishedUpdateOne {
|
|
_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 *SemiFinishedUpdateOne) Select(field string, fields ...string) *SemiFinishedUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated SemiFinished entity.
|
|
func (_u *SemiFinishedUpdateOne) Save(ctx context.Context) (*SemiFinished, error) {
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *SemiFinishedUpdateOne) SaveX(ctx context.Context) *SemiFinished {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *SemiFinishedUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *SemiFinishedUpdateOne) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func (_u *SemiFinishedUpdateOne) sqlSave(ctx context.Context) (_node *SemiFinished, err error) {
|
|
_spec := sqlgraph.NewUpdateSpec(semifinished.Table, semifinished.Columns, sqlgraph.NewFieldSpec(semifinished.FieldID, field.TypeInt))
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "SemiFinished.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, semifinished.FieldID)
|
|
for _, f := range fields {
|
|
if !semifinished.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
}
|
|
if f != semifinished.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.Sn(); ok {
|
|
_spec.SetField(semifinished.FieldSn, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.MaterialCode(); ok {
|
|
_spec.SetField(semifinished.FieldMaterialCode, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.CompletedProcess(); ok {
|
|
_spec.SetField(semifinished.FieldCompletedProcess, field.TypeString, value)
|
|
}
|
|
if _u.mutation.CompletedProcessCleared() {
|
|
_spec.ClearField(semifinished.FieldCompletedProcess, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Quantity(); ok {
|
|
_spec.SetField(semifinished.FieldQuantity, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedQuantity(); ok {
|
|
_spec.AddField(semifinished.FieldQuantity, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.ZoneCode(); ok {
|
|
_spec.SetField(semifinished.FieldZoneCode, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ZoneCodeCleared() {
|
|
_spec.ClearField(semifinished.FieldZoneCode, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Status(); ok {
|
|
_spec.SetField(semifinished.FieldStatus, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.OrderNo(); ok {
|
|
_spec.SetField(semifinished.FieldOrderNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.OrderNoCleared() {
|
|
_spec.ClearField(semifinished.FieldOrderNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
|
_spec.SetField(semifinished.FieldCreatedAt, field.TypeInt64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedCreatedAt(); ok {
|
|
_spec.AddField(semifinished.FieldCreatedAt, field.TypeInt64, value)
|
|
}
|
|
if value, ok := _u.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(semifinished.FieldUpdatedAt, field.TypeInt64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedUpdatedAt(); ok {
|
|
_spec.AddField(semifinished.FieldUpdatedAt, field.TypeInt64, value)
|
|
}
|
|
_node = &SemiFinished{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{semifinished.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|