- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统 - 为BomItem实体添加relatedStandard字段及相关CRUD方法 - 为InspectionRecord实体添加reportNo、materialCode、materialName等字段 - 更新ent schema确保新字段的验证和默认值设置 - 添加必要的数据库迁移和字段映射逻辑
1028 lines
31 KiB
Go
1028 lines
31 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"bj_power_wms/ent/inboundorder"
|
|
"bj_power_wms/ent/predicate"
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// InboundOrderUpdate is the builder for updating InboundOrder entities.
|
|
type InboundOrderUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *InboundOrderMutation
|
|
}
|
|
|
|
// Where appends a list predicates to the InboundOrderUpdate builder.
|
|
func (_u *InboundOrderUpdate) Where(ps ...predicate.InboundOrder) *InboundOrderUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetInboundNo sets the "inbound_no" field.
|
|
func (_u *InboundOrderUpdate) SetInboundNo(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetInboundNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableInboundNo sets the "inbound_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableInboundNo(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetInboundNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetInboundType sets the "inbound_type" field.
|
|
func (_u *InboundOrderUpdate) SetInboundType(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetInboundType(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableInboundType sets the "inbound_type" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableInboundType(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetInboundType(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetMaterialCode sets the "material_code" field.
|
|
func (_u *InboundOrderUpdate) SetMaterialCode(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetMaterialCode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMaterialCode sets the "material_code" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableMaterialCode(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetMaterialCode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetMaterialName sets the "material_name" field.
|
|
func (_u *InboundOrderUpdate) SetMaterialName(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetMaterialName(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMaterialName sets the "material_name" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableMaterialName(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetMaterialName(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearMaterialName clears the value of the "material_name" field.
|
|
func (_u *InboundOrderUpdate) ClearMaterialName() *InboundOrderUpdate {
|
|
_u.mutation.ClearMaterialName()
|
|
return _u
|
|
}
|
|
|
|
// SetManageMode sets the "manage_mode" field.
|
|
func (_u *InboundOrderUpdate) SetManageMode(v int) *InboundOrderUpdate {
|
|
_u.mutation.ResetManageMode()
|
|
_u.mutation.SetManageMode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableManageMode sets the "manage_mode" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableManageMode(v *int) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetManageMode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddManageMode adds value to the "manage_mode" field.
|
|
func (_u *InboundOrderUpdate) AddManageMode(v int) *InboundOrderUpdate {
|
|
_u.mutation.AddManageMode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetBatchNo sets the "batch_no" field.
|
|
func (_u *InboundOrderUpdate) SetBatchNo(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetBatchNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableBatchNo sets the "batch_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableBatchNo(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetBatchNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearBatchNo clears the value of the "batch_no" field.
|
|
func (_u *InboundOrderUpdate) ClearBatchNo() *InboundOrderUpdate {
|
|
_u.mutation.ClearBatchNo()
|
|
return _u
|
|
}
|
|
|
|
// SetZoneCode sets the "zone_code" field.
|
|
func (_u *InboundOrderUpdate) SetZoneCode(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetZoneCode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableZoneCode sets the "zone_code" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableZoneCode(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetZoneCode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearZoneCode clears the value of the "zone_code" field.
|
|
func (_u *InboundOrderUpdate) ClearZoneCode() *InboundOrderUpdate {
|
|
_u.mutation.ClearZoneCode()
|
|
return _u
|
|
}
|
|
|
|
// SetShelfNo sets the "shelf_no" field.
|
|
func (_u *InboundOrderUpdate) SetShelfNo(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetShelfNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableShelfNo sets the "shelf_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableShelfNo(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetShelfNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearShelfNo clears the value of the "shelf_no" field.
|
|
func (_u *InboundOrderUpdate) ClearShelfNo() *InboundOrderUpdate {
|
|
_u.mutation.ClearShelfNo()
|
|
return _u
|
|
}
|
|
|
|
// SetLayerNo sets the "layer_no" field.
|
|
func (_u *InboundOrderUpdate) SetLayerNo(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetLayerNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableLayerNo sets the "layer_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableLayerNo(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetLayerNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearLayerNo clears the value of the "layer_no" field.
|
|
func (_u *InboundOrderUpdate) ClearLayerNo() *InboundOrderUpdate {
|
|
_u.mutation.ClearLayerNo()
|
|
return _u
|
|
}
|
|
|
|
// SetPositionNo sets the "position_no" field.
|
|
func (_u *InboundOrderUpdate) SetPositionNo(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetPositionNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePositionNo sets the "position_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillablePositionNo(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetPositionNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearPositionNo clears the value of the "position_no" field.
|
|
func (_u *InboundOrderUpdate) ClearPositionNo() *InboundOrderUpdate {
|
|
_u.mutation.ClearPositionNo()
|
|
return _u
|
|
}
|
|
|
|
// SetQuantity sets the "quantity" field.
|
|
func (_u *InboundOrderUpdate) SetQuantity(v int) *InboundOrderUpdate {
|
|
_u.mutation.ResetQuantity()
|
|
_u.mutation.SetQuantity(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableQuantity sets the "quantity" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableQuantity(v *int) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetQuantity(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddQuantity adds value to the "quantity" field.
|
|
func (_u *InboundOrderUpdate) AddQuantity(v int) *InboundOrderUpdate {
|
|
_u.mutation.AddQuantity(v)
|
|
return _u
|
|
}
|
|
|
|
// SetOperator sets the "operator" field.
|
|
func (_u *InboundOrderUpdate) SetOperator(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetOperator(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOperator sets the "operator" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableOperator(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetOperator(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearOperator clears the value of the "operator" field.
|
|
func (_u *InboundOrderUpdate) ClearOperator() *InboundOrderUpdate {
|
|
_u.mutation.ClearOperator()
|
|
return _u
|
|
}
|
|
|
|
// SetRemark sets the "remark" field.
|
|
func (_u *InboundOrderUpdate) SetRemark(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetRemark(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRemark sets the "remark" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableRemark(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetRemark(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRemark clears the value of the "remark" field.
|
|
func (_u *InboundOrderUpdate) ClearRemark() *InboundOrderUpdate {
|
|
_u.mutation.ClearRemark()
|
|
return _u
|
|
}
|
|
|
|
// SetInspectionNo sets the "inspection_no" field.
|
|
func (_u *InboundOrderUpdate) SetInspectionNo(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetInspectionNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableInspectionNo sets the "inspection_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableInspectionNo(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetInspectionNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetOwnershipType sets the "ownership_type" field.
|
|
func (_u *InboundOrderUpdate) SetOwnershipType(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetOwnershipType(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOwnershipType sets the "ownership_type" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableOwnershipType(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetOwnershipType(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetOwnershipNo sets the "ownership_no" field.
|
|
func (_u *InboundOrderUpdate) SetOwnershipNo(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetOwnershipNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOwnershipNo sets the "ownership_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableOwnershipNo(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetOwnershipNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearOwnershipNo clears the value of the "ownership_no" field.
|
|
func (_u *InboundOrderUpdate) ClearOwnershipNo() *InboundOrderUpdate {
|
|
_u.mutation.ClearOwnershipNo()
|
|
return _u
|
|
}
|
|
|
|
// SetQualityStatus sets the "quality_status" field.
|
|
func (_u *InboundOrderUpdate) SetQualityStatus(v string) *InboundOrderUpdate {
|
|
_u.mutation.SetQualityStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableQualityStatus sets the "quality_status" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableQualityStatus(v *string) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetQualityStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearQualityStatus clears the value of the "quality_status" field.
|
|
func (_u *InboundOrderUpdate) ClearQualityStatus() *InboundOrderUpdate {
|
|
_u.mutation.ClearQualityStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_u *InboundOrderUpdate) SetCreatedAt(v int64) *InboundOrderUpdate {
|
|
_u.mutation.ResetCreatedAt()
|
|
_u.mutation.SetCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdate) SetNillableCreatedAt(v *int64) *InboundOrderUpdate {
|
|
if v != nil {
|
|
_u.SetCreatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddCreatedAt adds value to the "created_at" field.
|
|
func (_u *InboundOrderUpdate) AddCreatedAt(v int64) *InboundOrderUpdate {
|
|
_u.mutation.AddCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// Mutation returns the InboundOrderMutation object of the builder.
|
|
func (_u *InboundOrderUpdate) Mutation() *InboundOrderMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *InboundOrderUpdate) 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 *InboundOrderUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *InboundOrderUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *InboundOrderUpdate) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func (_u *InboundOrderUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
|
_spec := sqlgraph.NewUpdateSpec(inboundorder.Table, inboundorder.Columns, sqlgraph.NewFieldSpec(inboundorder.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.InboundNo(); ok {
|
|
_spec.SetField(inboundorder.FieldInboundNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.InboundType(); ok {
|
|
_spec.SetField(inboundorder.FieldInboundType, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.MaterialCode(); ok {
|
|
_spec.SetField(inboundorder.FieldMaterialCode, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.MaterialName(); ok {
|
|
_spec.SetField(inboundorder.FieldMaterialName, field.TypeString, value)
|
|
}
|
|
if _u.mutation.MaterialNameCleared() {
|
|
_spec.ClearField(inboundorder.FieldMaterialName, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ManageMode(); ok {
|
|
_spec.SetField(inboundorder.FieldManageMode, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedManageMode(); ok {
|
|
_spec.AddField(inboundorder.FieldManageMode, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.BatchNo(); ok {
|
|
_spec.SetField(inboundorder.FieldBatchNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.BatchNoCleared() {
|
|
_spec.ClearField(inboundorder.FieldBatchNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ZoneCode(); ok {
|
|
_spec.SetField(inboundorder.FieldZoneCode, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ZoneCodeCleared() {
|
|
_spec.ClearField(inboundorder.FieldZoneCode, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ShelfNo(); ok {
|
|
_spec.SetField(inboundorder.FieldShelfNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ShelfNoCleared() {
|
|
_spec.ClearField(inboundorder.FieldShelfNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.LayerNo(); ok {
|
|
_spec.SetField(inboundorder.FieldLayerNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.LayerNoCleared() {
|
|
_spec.ClearField(inboundorder.FieldLayerNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.PositionNo(); ok {
|
|
_spec.SetField(inboundorder.FieldPositionNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.PositionNoCleared() {
|
|
_spec.ClearField(inboundorder.FieldPositionNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Quantity(); ok {
|
|
_spec.SetField(inboundorder.FieldQuantity, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedQuantity(); ok {
|
|
_spec.AddField(inboundorder.FieldQuantity, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.Operator(); ok {
|
|
_spec.SetField(inboundorder.FieldOperator, field.TypeString, value)
|
|
}
|
|
if _u.mutation.OperatorCleared() {
|
|
_spec.ClearField(inboundorder.FieldOperator, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Remark(); ok {
|
|
_spec.SetField(inboundorder.FieldRemark, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RemarkCleared() {
|
|
_spec.ClearField(inboundorder.FieldRemark, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.InspectionNo(); ok {
|
|
_spec.SetField(inboundorder.FieldInspectionNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.OwnershipType(); ok {
|
|
_spec.SetField(inboundorder.FieldOwnershipType, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.OwnershipNo(); ok {
|
|
_spec.SetField(inboundorder.FieldOwnershipNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.OwnershipNoCleared() {
|
|
_spec.ClearField(inboundorder.FieldOwnershipNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.QualityStatus(); ok {
|
|
_spec.SetField(inboundorder.FieldQualityStatus, field.TypeString, value)
|
|
}
|
|
if _u.mutation.QualityStatusCleared() {
|
|
_spec.ClearField(inboundorder.FieldQualityStatus, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
|
_spec.SetField(inboundorder.FieldCreatedAt, field.TypeInt64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedCreatedAt(); ok {
|
|
_spec.AddField(inboundorder.FieldCreatedAt, field.TypeInt64, value)
|
|
}
|
|
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
err = &NotFoundError{inboundorder.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return 0, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
// InboundOrderUpdateOne is the builder for updating a single InboundOrder entity.
|
|
type InboundOrderUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *InboundOrderMutation
|
|
}
|
|
|
|
// SetInboundNo sets the "inbound_no" field.
|
|
func (_u *InboundOrderUpdateOne) SetInboundNo(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetInboundNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableInboundNo sets the "inbound_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableInboundNo(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetInboundNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetInboundType sets the "inbound_type" field.
|
|
func (_u *InboundOrderUpdateOne) SetInboundType(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetInboundType(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableInboundType sets the "inbound_type" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableInboundType(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetInboundType(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetMaterialCode sets the "material_code" field.
|
|
func (_u *InboundOrderUpdateOne) SetMaterialCode(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetMaterialCode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMaterialCode sets the "material_code" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableMaterialCode(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetMaterialCode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetMaterialName sets the "material_name" field.
|
|
func (_u *InboundOrderUpdateOne) SetMaterialName(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetMaterialName(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableMaterialName sets the "material_name" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableMaterialName(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetMaterialName(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearMaterialName clears the value of the "material_name" field.
|
|
func (_u *InboundOrderUpdateOne) ClearMaterialName() *InboundOrderUpdateOne {
|
|
_u.mutation.ClearMaterialName()
|
|
return _u
|
|
}
|
|
|
|
// SetManageMode sets the "manage_mode" field.
|
|
func (_u *InboundOrderUpdateOne) SetManageMode(v int) *InboundOrderUpdateOne {
|
|
_u.mutation.ResetManageMode()
|
|
_u.mutation.SetManageMode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableManageMode sets the "manage_mode" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableManageMode(v *int) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetManageMode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddManageMode adds value to the "manage_mode" field.
|
|
func (_u *InboundOrderUpdateOne) AddManageMode(v int) *InboundOrderUpdateOne {
|
|
_u.mutation.AddManageMode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetBatchNo sets the "batch_no" field.
|
|
func (_u *InboundOrderUpdateOne) SetBatchNo(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetBatchNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableBatchNo sets the "batch_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableBatchNo(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetBatchNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearBatchNo clears the value of the "batch_no" field.
|
|
func (_u *InboundOrderUpdateOne) ClearBatchNo() *InboundOrderUpdateOne {
|
|
_u.mutation.ClearBatchNo()
|
|
return _u
|
|
}
|
|
|
|
// SetZoneCode sets the "zone_code" field.
|
|
func (_u *InboundOrderUpdateOne) SetZoneCode(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetZoneCode(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableZoneCode sets the "zone_code" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableZoneCode(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetZoneCode(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearZoneCode clears the value of the "zone_code" field.
|
|
func (_u *InboundOrderUpdateOne) ClearZoneCode() *InboundOrderUpdateOne {
|
|
_u.mutation.ClearZoneCode()
|
|
return _u
|
|
}
|
|
|
|
// SetShelfNo sets the "shelf_no" field.
|
|
func (_u *InboundOrderUpdateOne) SetShelfNo(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetShelfNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableShelfNo sets the "shelf_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableShelfNo(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetShelfNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearShelfNo clears the value of the "shelf_no" field.
|
|
func (_u *InboundOrderUpdateOne) ClearShelfNo() *InboundOrderUpdateOne {
|
|
_u.mutation.ClearShelfNo()
|
|
return _u
|
|
}
|
|
|
|
// SetLayerNo sets the "layer_no" field.
|
|
func (_u *InboundOrderUpdateOne) SetLayerNo(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetLayerNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableLayerNo sets the "layer_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableLayerNo(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetLayerNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearLayerNo clears the value of the "layer_no" field.
|
|
func (_u *InboundOrderUpdateOne) ClearLayerNo() *InboundOrderUpdateOne {
|
|
_u.mutation.ClearLayerNo()
|
|
return _u
|
|
}
|
|
|
|
// SetPositionNo sets the "position_no" field.
|
|
func (_u *InboundOrderUpdateOne) SetPositionNo(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetPositionNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillablePositionNo sets the "position_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillablePositionNo(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetPositionNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearPositionNo clears the value of the "position_no" field.
|
|
func (_u *InboundOrderUpdateOne) ClearPositionNo() *InboundOrderUpdateOne {
|
|
_u.mutation.ClearPositionNo()
|
|
return _u
|
|
}
|
|
|
|
// SetQuantity sets the "quantity" field.
|
|
func (_u *InboundOrderUpdateOne) SetQuantity(v int) *InboundOrderUpdateOne {
|
|
_u.mutation.ResetQuantity()
|
|
_u.mutation.SetQuantity(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableQuantity sets the "quantity" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableQuantity(v *int) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetQuantity(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddQuantity adds value to the "quantity" field.
|
|
func (_u *InboundOrderUpdateOne) AddQuantity(v int) *InboundOrderUpdateOne {
|
|
_u.mutation.AddQuantity(v)
|
|
return _u
|
|
}
|
|
|
|
// SetOperator sets the "operator" field.
|
|
func (_u *InboundOrderUpdateOne) SetOperator(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetOperator(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOperator sets the "operator" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableOperator(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetOperator(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearOperator clears the value of the "operator" field.
|
|
func (_u *InboundOrderUpdateOne) ClearOperator() *InboundOrderUpdateOne {
|
|
_u.mutation.ClearOperator()
|
|
return _u
|
|
}
|
|
|
|
// SetRemark sets the "remark" field.
|
|
func (_u *InboundOrderUpdateOne) SetRemark(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetRemark(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableRemark sets the "remark" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableRemark(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetRemark(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearRemark clears the value of the "remark" field.
|
|
func (_u *InboundOrderUpdateOne) ClearRemark() *InboundOrderUpdateOne {
|
|
_u.mutation.ClearRemark()
|
|
return _u
|
|
}
|
|
|
|
// SetInspectionNo sets the "inspection_no" field.
|
|
func (_u *InboundOrderUpdateOne) SetInspectionNo(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetInspectionNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableInspectionNo sets the "inspection_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableInspectionNo(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetInspectionNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetOwnershipType sets the "ownership_type" field.
|
|
func (_u *InboundOrderUpdateOne) SetOwnershipType(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetOwnershipType(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOwnershipType sets the "ownership_type" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableOwnershipType(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetOwnershipType(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// SetOwnershipNo sets the "ownership_no" field.
|
|
func (_u *InboundOrderUpdateOne) SetOwnershipNo(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetOwnershipNo(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableOwnershipNo sets the "ownership_no" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableOwnershipNo(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetOwnershipNo(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearOwnershipNo clears the value of the "ownership_no" field.
|
|
func (_u *InboundOrderUpdateOne) ClearOwnershipNo() *InboundOrderUpdateOne {
|
|
_u.mutation.ClearOwnershipNo()
|
|
return _u
|
|
}
|
|
|
|
// SetQualityStatus sets the "quality_status" field.
|
|
func (_u *InboundOrderUpdateOne) SetQualityStatus(v string) *InboundOrderUpdateOne {
|
|
_u.mutation.SetQualityStatus(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableQualityStatus sets the "quality_status" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableQualityStatus(v *string) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetQualityStatus(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearQualityStatus clears the value of the "quality_status" field.
|
|
func (_u *InboundOrderUpdateOne) ClearQualityStatus() *InboundOrderUpdateOne {
|
|
_u.mutation.ClearQualityStatus()
|
|
return _u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_u *InboundOrderUpdateOne) SetCreatedAt(v int64) *InboundOrderUpdateOne {
|
|
_u.mutation.ResetCreatedAt()
|
|
_u.mutation.SetCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_u *InboundOrderUpdateOne) SetNillableCreatedAt(v *int64) *InboundOrderUpdateOne {
|
|
if v != nil {
|
|
_u.SetCreatedAt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddCreatedAt adds value to the "created_at" field.
|
|
func (_u *InboundOrderUpdateOne) AddCreatedAt(v int64) *InboundOrderUpdateOne {
|
|
_u.mutation.AddCreatedAt(v)
|
|
return _u
|
|
}
|
|
|
|
// Mutation returns the InboundOrderMutation object of the builder.
|
|
func (_u *InboundOrderUpdateOne) Mutation() *InboundOrderMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// Where appends a list predicates to the InboundOrderUpdate builder.
|
|
func (_u *InboundOrderUpdateOne) Where(ps ...predicate.InboundOrder) *InboundOrderUpdateOne {
|
|
_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 *InboundOrderUpdateOne) Select(field string, fields ...string) *InboundOrderUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated InboundOrder entity.
|
|
func (_u *InboundOrderUpdateOne) Save(ctx context.Context) (*InboundOrder, error) {
|
|
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *InboundOrderUpdateOne) SaveX(ctx context.Context) *InboundOrder {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *InboundOrderUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *InboundOrderUpdateOne) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func (_u *InboundOrderUpdateOne) sqlSave(ctx context.Context) (_node *InboundOrder, err error) {
|
|
_spec := sqlgraph.NewUpdateSpec(inboundorder.Table, inboundorder.Columns, sqlgraph.NewFieldSpec(inboundorder.FieldID, field.TypeInt))
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "InboundOrder.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, inboundorder.FieldID)
|
|
for _, f := range fields {
|
|
if !inboundorder.ValidColumn(f) {
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
}
|
|
if f != inboundorder.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.InboundNo(); ok {
|
|
_spec.SetField(inboundorder.FieldInboundNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.InboundType(); ok {
|
|
_spec.SetField(inboundorder.FieldInboundType, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.MaterialCode(); ok {
|
|
_spec.SetField(inboundorder.FieldMaterialCode, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.MaterialName(); ok {
|
|
_spec.SetField(inboundorder.FieldMaterialName, field.TypeString, value)
|
|
}
|
|
if _u.mutation.MaterialNameCleared() {
|
|
_spec.ClearField(inboundorder.FieldMaterialName, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ManageMode(); ok {
|
|
_spec.SetField(inboundorder.FieldManageMode, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedManageMode(); ok {
|
|
_spec.AddField(inboundorder.FieldManageMode, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.BatchNo(); ok {
|
|
_spec.SetField(inboundorder.FieldBatchNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.BatchNoCleared() {
|
|
_spec.ClearField(inboundorder.FieldBatchNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ZoneCode(); ok {
|
|
_spec.SetField(inboundorder.FieldZoneCode, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ZoneCodeCleared() {
|
|
_spec.ClearField(inboundorder.FieldZoneCode, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.ShelfNo(); ok {
|
|
_spec.SetField(inboundorder.FieldShelfNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.ShelfNoCleared() {
|
|
_spec.ClearField(inboundorder.FieldShelfNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.LayerNo(); ok {
|
|
_spec.SetField(inboundorder.FieldLayerNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.LayerNoCleared() {
|
|
_spec.ClearField(inboundorder.FieldLayerNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.PositionNo(); ok {
|
|
_spec.SetField(inboundorder.FieldPositionNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.PositionNoCleared() {
|
|
_spec.ClearField(inboundorder.FieldPositionNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Quantity(); ok {
|
|
_spec.SetField(inboundorder.FieldQuantity, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedQuantity(); ok {
|
|
_spec.AddField(inboundorder.FieldQuantity, field.TypeInt, value)
|
|
}
|
|
if value, ok := _u.mutation.Operator(); ok {
|
|
_spec.SetField(inboundorder.FieldOperator, field.TypeString, value)
|
|
}
|
|
if _u.mutation.OperatorCleared() {
|
|
_spec.ClearField(inboundorder.FieldOperator, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.Remark(); ok {
|
|
_spec.SetField(inboundorder.FieldRemark, field.TypeString, value)
|
|
}
|
|
if _u.mutation.RemarkCleared() {
|
|
_spec.ClearField(inboundorder.FieldRemark, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.InspectionNo(); ok {
|
|
_spec.SetField(inboundorder.FieldInspectionNo, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.OwnershipType(); ok {
|
|
_spec.SetField(inboundorder.FieldOwnershipType, field.TypeString, value)
|
|
}
|
|
if value, ok := _u.mutation.OwnershipNo(); ok {
|
|
_spec.SetField(inboundorder.FieldOwnershipNo, field.TypeString, value)
|
|
}
|
|
if _u.mutation.OwnershipNoCleared() {
|
|
_spec.ClearField(inboundorder.FieldOwnershipNo, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.QualityStatus(); ok {
|
|
_spec.SetField(inboundorder.FieldQualityStatus, field.TypeString, value)
|
|
}
|
|
if _u.mutation.QualityStatusCleared() {
|
|
_spec.ClearField(inboundorder.FieldQualityStatus, field.TypeString)
|
|
}
|
|
if value, ok := _u.mutation.CreatedAt(); ok {
|
|
_spec.SetField(inboundorder.FieldCreatedAt, field.TypeInt64, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedCreatedAt(); ok {
|
|
_spec.AddField(inboundorder.FieldCreatedAt, field.TypeInt64, value)
|
|
}
|
|
_node = &InboundOrder{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{inboundorder.Label}
|
|
} else if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
_u.mutation.done = true
|
|
return _node, nil
|
|
}
|