856 lines
26 KiB
Go
856 lines
26 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|||
|
|
|
||
|
|
package ent
|
||
|
|
|
||
|
|
import (
|
||
|
|
"bj_power_wms/ent/outboundorder"
|
||
|
|
"bj_power_wms/ent/predicate"
|
||
|
|
"context"
|
||
|
|
"errors"
|
||
|
|
"fmt"
|
||
|
|
|
||
|
|
"entgo.io/ent/dialect/sql"
|
||
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||
|
|
"entgo.io/ent/schema/field"
|
||
|
|
)
|
||
|
|
|
||
|
|
// OutboundOrderUpdate is the builder for updating OutboundOrder entities.
|
||
|
|
type OutboundOrderUpdate struct {
|
||
|
|
config
|
||
|
|
hooks []Hook
|
||
|
|
mutation *OutboundOrderMutation
|
||
|
|
}
|
||
|
|
|
||
|
|
// Where appends a list predicates to the OutboundOrderUpdate builder.
|
||
|
|
func (_u *OutboundOrderUpdate) Where(ps ...predicate.OutboundOrder) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.Where(ps...)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetOutboundNo sets the "outbound_no" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetOutboundNo(v string) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.SetOutboundNo(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableOutboundNo sets the "outbound_no" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableOutboundNo(v *string) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetOutboundNo(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetOutboundType sets the "outbound_type" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetOutboundType(v string) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.SetOutboundType(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableOutboundType sets the "outbound_type" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableOutboundType(v *string) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetOutboundType(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetOrderNo sets the "order_no" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetOrderNo(v string) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.SetOrderNo(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableOrderNo sets the "order_no" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableOrderNo(v *string) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetOrderNo(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearOrderNo clears the value of the "order_no" field.
|
||
|
|
func (_u *OutboundOrderUpdate) ClearOrderNo() *OutboundOrderUpdate {
|
||
|
|
_u.mutation.ClearOrderNo()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetMaterialCode sets the "material_code" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetMaterialCode(v string) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.SetMaterialCode(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableMaterialCode sets the "material_code" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableMaterialCode(v *string) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetMaterialCode(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetMaterialName sets the "material_name" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetMaterialName(v string) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.SetMaterialName(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableMaterialName sets the "material_name" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableMaterialName(v *string) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetMaterialName(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearMaterialName clears the value of the "material_name" field.
|
||
|
|
func (_u *OutboundOrderUpdate) ClearMaterialName() *OutboundOrderUpdate {
|
||
|
|
_u.mutation.ClearMaterialName()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetManageMode sets the "manage_mode" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetManageMode(v int) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.ResetManageMode()
|
||
|
|
_u.mutation.SetManageMode(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableManageMode sets the "manage_mode" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableManageMode(v *int) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetManageMode(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddManageMode adds value to the "manage_mode" field.
|
||
|
|
func (_u *OutboundOrderUpdate) AddManageMode(v int) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.AddManageMode(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetBatchNo sets the "batch_no" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetBatchNo(v string) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.SetBatchNo(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableBatchNo sets the "batch_no" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableBatchNo(v *string) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetBatchNo(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearBatchNo clears the value of the "batch_no" field.
|
||
|
|
func (_u *OutboundOrderUpdate) ClearBatchNo() *OutboundOrderUpdate {
|
||
|
|
_u.mutation.ClearBatchNo()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetZoneCode sets the "zone_code" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetZoneCode(v string) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.SetZoneCode(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableZoneCode sets the "zone_code" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableZoneCode(v *string) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetZoneCode(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearZoneCode clears the value of the "zone_code" field.
|
||
|
|
func (_u *OutboundOrderUpdate) ClearZoneCode() *OutboundOrderUpdate {
|
||
|
|
_u.mutation.ClearZoneCode()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetQuantity sets the "quantity" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetQuantity(v int) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.ResetQuantity()
|
||
|
|
_u.mutation.SetQuantity(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableQuantity sets the "quantity" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableQuantity(v *int) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetQuantity(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddQuantity adds value to the "quantity" field.
|
||
|
|
func (_u *OutboundOrderUpdate) AddQuantity(v int) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.AddQuantity(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetOperator sets the "operator" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetOperator(v string) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.SetOperator(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableOperator sets the "operator" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableOperator(v *string) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetOperator(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearOperator clears the value of the "operator" field.
|
||
|
|
func (_u *OutboundOrderUpdate) ClearOperator() *OutboundOrderUpdate {
|
||
|
|
_u.mutation.ClearOperator()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetReviewer sets the "reviewer" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetReviewer(v string) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.SetReviewer(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableReviewer sets the "reviewer" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableReviewer(v *string) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetReviewer(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearReviewer clears the value of the "reviewer" field.
|
||
|
|
func (_u *OutboundOrderUpdate) ClearReviewer() *OutboundOrderUpdate {
|
||
|
|
_u.mutation.ClearReviewer()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetTargetDock sets the "target_dock" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetTargetDock(v string) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.SetTargetDock(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableTargetDock sets the "target_dock" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableTargetDock(v *string) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetTargetDock(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearTargetDock clears the value of the "target_dock" field.
|
||
|
|
func (_u *OutboundOrderUpdate) ClearTargetDock() *OutboundOrderUpdate {
|
||
|
|
_u.mutation.ClearTargetDock()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetRemark sets the "remark" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetRemark(v string) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.SetRemark(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableRemark sets the "remark" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableRemark(v *string) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetRemark(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearRemark clears the value of the "remark" field.
|
||
|
|
func (_u *OutboundOrderUpdate) ClearRemark() *OutboundOrderUpdate {
|
||
|
|
_u.mutation.ClearRemark()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetCreatedAt sets the "created_at" field.
|
||
|
|
func (_u *OutboundOrderUpdate) SetCreatedAt(v int64) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.ResetCreatedAt()
|
||
|
|
_u.mutation.SetCreatedAt(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdate) SetNillableCreatedAt(v *int64) *OutboundOrderUpdate {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetCreatedAt(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddCreatedAt adds value to the "created_at" field.
|
||
|
|
func (_u *OutboundOrderUpdate) AddCreatedAt(v int64) *OutboundOrderUpdate {
|
||
|
|
_u.mutation.AddCreatedAt(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// Mutation returns the OutboundOrderMutation object of the builder.
|
||
|
|
func (_u *OutboundOrderUpdate) Mutation() *OutboundOrderMutation {
|
||
|
|
return _u.mutation
|
||
|
|
}
|
||
|
|
|
||
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
||
|
|
func (_u *OutboundOrderUpdate) 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 *OutboundOrderUpdate) SaveX(ctx context.Context) int {
|
||
|
|
affected, err := _u.Save(ctx)
|
||
|
|
if err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
return affected
|
||
|
|
}
|
||
|
|
|
||
|
|
// Exec executes the query.
|
||
|
|
func (_u *OutboundOrderUpdate) Exec(ctx context.Context) error {
|
||
|
|
_, err := _u.Save(ctx)
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
// ExecX is like Exec, but panics if an error occurs.
|
||
|
|
func (_u *OutboundOrderUpdate) ExecX(ctx context.Context) {
|
||
|
|
if err := _u.Exec(ctx); err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (_u *OutboundOrderUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||
|
|
_spec := sqlgraph.NewUpdateSpec(outboundorder.Table, outboundorder.Columns, sqlgraph.NewFieldSpec(outboundorder.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.OutboundNo(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldOutboundNo, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.OutboundType(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldOutboundType, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.OrderNo(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldOrderNo, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.OrderNoCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldOrderNo, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.MaterialCode(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldMaterialCode, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.MaterialName(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldMaterialName, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.MaterialNameCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldMaterialName, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.ManageMode(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldManageMode, field.TypeInt, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.AddedManageMode(); ok {
|
||
|
|
_spec.AddField(outboundorder.FieldManageMode, field.TypeInt, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.BatchNo(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldBatchNo, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.BatchNoCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldBatchNo, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.ZoneCode(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldZoneCode, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.ZoneCodeCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldZoneCode, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.Quantity(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldQuantity, field.TypeInt, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.AddedQuantity(); ok {
|
||
|
|
_spec.AddField(outboundorder.FieldQuantity, field.TypeInt, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.Operator(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldOperator, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.OperatorCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldOperator, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.Reviewer(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldReviewer, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.ReviewerCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldReviewer, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.TargetDock(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldTargetDock, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.TargetDockCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldTargetDock, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.Remark(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldRemark, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.RemarkCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldRemark, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldCreatedAt, field.TypeInt64, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.AddedCreatedAt(); ok {
|
||
|
|
_spec.AddField(outboundorder.FieldCreatedAt, field.TypeInt64, value)
|
||
|
|
}
|
||
|
|
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||
|
|
err = &NotFoundError{outboundorder.Label}
|
||
|
|
} else if sqlgraph.IsConstraintError(err) {
|
||
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||
|
|
}
|
||
|
|
return 0, err
|
||
|
|
}
|
||
|
|
_u.mutation.done = true
|
||
|
|
return _node, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// OutboundOrderUpdateOne is the builder for updating a single OutboundOrder entity.
|
||
|
|
type OutboundOrderUpdateOne struct {
|
||
|
|
config
|
||
|
|
fields []string
|
||
|
|
hooks []Hook
|
||
|
|
mutation *OutboundOrderMutation
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetOutboundNo sets the "outbound_no" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetOutboundNo(v string) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.SetOutboundNo(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableOutboundNo sets the "outbound_no" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableOutboundNo(v *string) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetOutboundNo(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetOutboundType sets the "outbound_type" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetOutboundType(v string) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.SetOutboundType(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableOutboundType sets the "outbound_type" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableOutboundType(v *string) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetOutboundType(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetOrderNo sets the "order_no" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetOrderNo(v string) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.SetOrderNo(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableOrderNo sets the "order_no" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableOrderNo(v *string) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetOrderNo(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearOrderNo clears the value of the "order_no" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) ClearOrderNo() *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.ClearOrderNo()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetMaterialCode sets the "material_code" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetMaterialCode(v string) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.SetMaterialCode(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableMaterialCode sets the "material_code" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableMaterialCode(v *string) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetMaterialCode(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetMaterialName sets the "material_name" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetMaterialName(v string) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.SetMaterialName(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableMaterialName sets the "material_name" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableMaterialName(v *string) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetMaterialName(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearMaterialName clears the value of the "material_name" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) ClearMaterialName() *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.ClearMaterialName()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetManageMode sets the "manage_mode" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetManageMode(v int) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.ResetManageMode()
|
||
|
|
_u.mutation.SetManageMode(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableManageMode sets the "manage_mode" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableManageMode(v *int) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetManageMode(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddManageMode adds value to the "manage_mode" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) AddManageMode(v int) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.AddManageMode(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetBatchNo sets the "batch_no" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetBatchNo(v string) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.SetBatchNo(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableBatchNo sets the "batch_no" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableBatchNo(v *string) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetBatchNo(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearBatchNo clears the value of the "batch_no" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) ClearBatchNo() *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.ClearBatchNo()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetZoneCode sets the "zone_code" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetZoneCode(v string) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.SetZoneCode(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableZoneCode sets the "zone_code" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableZoneCode(v *string) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetZoneCode(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearZoneCode clears the value of the "zone_code" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) ClearZoneCode() *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.ClearZoneCode()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetQuantity sets the "quantity" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetQuantity(v int) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.ResetQuantity()
|
||
|
|
_u.mutation.SetQuantity(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableQuantity sets the "quantity" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableQuantity(v *int) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetQuantity(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddQuantity adds value to the "quantity" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) AddQuantity(v int) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.AddQuantity(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetOperator sets the "operator" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetOperator(v string) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.SetOperator(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableOperator sets the "operator" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableOperator(v *string) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetOperator(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearOperator clears the value of the "operator" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) ClearOperator() *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.ClearOperator()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetReviewer sets the "reviewer" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetReviewer(v string) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.SetReviewer(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableReviewer sets the "reviewer" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableReviewer(v *string) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetReviewer(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearReviewer clears the value of the "reviewer" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) ClearReviewer() *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.ClearReviewer()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetTargetDock sets the "target_dock" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetTargetDock(v string) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.SetTargetDock(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableTargetDock sets the "target_dock" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableTargetDock(v *string) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetTargetDock(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearTargetDock clears the value of the "target_dock" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) ClearTargetDock() *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.ClearTargetDock()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetRemark sets the "remark" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetRemark(v string) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.SetRemark(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableRemark sets the "remark" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableRemark(v *string) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetRemark(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// ClearRemark clears the value of the "remark" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) ClearRemark() *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.ClearRemark()
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetCreatedAt sets the "created_at" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetCreatedAt(v int64) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.ResetCreatedAt()
|
||
|
|
_u.mutation.SetCreatedAt(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SetNillableCreatedAt(v *int64) *OutboundOrderUpdateOne {
|
||
|
|
if v != nil {
|
||
|
|
_u.SetCreatedAt(*v)
|
||
|
|
}
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// AddCreatedAt adds value to the "created_at" field.
|
||
|
|
func (_u *OutboundOrderUpdateOne) AddCreatedAt(v int64) *OutboundOrderUpdateOne {
|
||
|
|
_u.mutation.AddCreatedAt(v)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// Mutation returns the OutboundOrderMutation object of the builder.
|
||
|
|
func (_u *OutboundOrderUpdateOne) Mutation() *OutboundOrderMutation {
|
||
|
|
return _u.mutation
|
||
|
|
}
|
||
|
|
|
||
|
|
// Where appends a list predicates to the OutboundOrderUpdate builder.
|
||
|
|
func (_u *OutboundOrderUpdateOne) Where(ps ...predicate.OutboundOrder) *OutboundOrderUpdateOne {
|
||
|
|
_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 *OutboundOrderUpdateOne) Select(field string, fields ...string) *OutboundOrderUpdateOne {
|
||
|
|
_u.fields = append([]string{field}, fields...)
|
||
|
|
return _u
|
||
|
|
}
|
||
|
|
|
||
|
|
// Save executes the query and returns the updated OutboundOrder entity.
|
||
|
|
func (_u *OutboundOrderUpdateOne) Save(ctx context.Context) (*OutboundOrder, error) {
|
||
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
||
|
|
}
|
||
|
|
|
||
|
|
// SaveX is like Save, but panics if an error occurs.
|
||
|
|
func (_u *OutboundOrderUpdateOne) SaveX(ctx context.Context) *OutboundOrder {
|
||
|
|
node, err := _u.Save(ctx)
|
||
|
|
if err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
return node
|
||
|
|
}
|
||
|
|
|
||
|
|
// Exec executes the query on the entity.
|
||
|
|
func (_u *OutboundOrderUpdateOne) Exec(ctx context.Context) error {
|
||
|
|
_, err := _u.Save(ctx)
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
// ExecX is like Exec, but panics if an error occurs.
|
||
|
|
func (_u *OutboundOrderUpdateOne) ExecX(ctx context.Context) {
|
||
|
|
if err := _u.Exec(ctx); err != nil {
|
||
|
|
panic(err)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (_u *OutboundOrderUpdateOne) sqlSave(ctx context.Context) (_node *OutboundOrder, err error) {
|
||
|
|
_spec := sqlgraph.NewUpdateSpec(outboundorder.Table, outboundorder.Columns, sqlgraph.NewFieldSpec(outboundorder.FieldID, field.TypeInt))
|
||
|
|
id, ok := _u.mutation.ID()
|
||
|
|
if !ok {
|
||
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "OutboundOrder.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, outboundorder.FieldID)
|
||
|
|
for _, f := range fields {
|
||
|
|
if !outboundorder.ValidColumn(f) {
|
||
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||
|
|
}
|
||
|
|
if f != outboundorder.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.OutboundNo(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldOutboundNo, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.OutboundType(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldOutboundType, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.OrderNo(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldOrderNo, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.OrderNoCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldOrderNo, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.MaterialCode(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldMaterialCode, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.MaterialName(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldMaterialName, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.MaterialNameCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldMaterialName, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.ManageMode(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldManageMode, field.TypeInt, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.AddedManageMode(); ok {
|
||
|
|
_spec.AddField(outboundorder.FieldManageMode, field.TypeInt, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.BatchNo(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldBatchNo, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.BatchNoCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldBatchNo, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.ZoneCode(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldZoneCode, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.ZoneCodeCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldZoneCode, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.Quantity(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldQuantity, field.TypeInt, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.AddedQuantity(); ok {
|
||
|
|
_spec.AddField(outboundorder.FieldQuantity, field.TypeInt, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.Operator(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldOperator, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.OperatorCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldOperator, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.Reviewer(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldReviewer, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.ReviewerCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldReviewer, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.TargetDock(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldTargetDock, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.TargetDockCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldTargetDock, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.Remark(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldRemark, field.TypeString, value)
|
||
|
|
}
|
||
|
|
if _u.mutation.RemarkCleared() {
|
||
|
|
_spec.ClearField(outboundorder.FieldRemark, field.TypeString)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
||
|
|
_spec.SetField(outboundorder.FieldCreatedAt, field.TypeInt64, value)
|
||
|
|
}
|
||
|
|
if value, ok := _u.mutation.AddedCreatedAt(); ok {
|
||
|
|
_spec.AddField(outboundorder.FieldCreatedAt, field.TypeInt64, value)
|
||
|
|
}
|
||
|
|
_node = &OutboundOrder{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{outboundorder.Label}
|
||
|
|
} else if sqlgraph.IsConstraintError(err) {
|
||
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||
|
|
}
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
_u.mutation.done = true
|
||
|
|
return _node, nil
|
||
|
|
}
|