Files
bj_power/bj_power_wms/ent/outboundorder_create.go
T
SunYF 572fa975bc feat: 完成WMS系统权限体系与业务功能迭代
本提交完成了WMS系统的多维度优化升级:
1. 新增RBAC权限系统,支持角色/菜单/按钮三级权限管控
2. 重构库存盘点、物料管理、区域维护等模块的查询筛选与展示逻辑
3. 优化入库/出库/质检等业务流程,完善数据冗余与业务闭环
4. 移除旧装箱表,将装箱逻辑合并到出库主表
5. 新增前端权限判断工具、导出工具与端到端测试用例
6. 补充完善各类注释与数据库字段说明
2026-09-03 14:20:37 +08:00

1692 lines
51 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_wms/ent/outboundorder"
"context"
"errors"
"fmt"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// OutboundOrderCreate is the builder for creating a OutboundOrder entity.
type OutboundOrderCreate struct {
config
mutation *OutboundOrderMutation
hooks []Hook
conflict []sql.ConflictOption
}
// SetOutboundNo sets the "outbound_no" field.
func (_c *OutboundOrderCreate) SetOutboundNo(v string) *OutboundOrderCreate {
_c.mutation.SetOutboundNo(v)
return _c
}
// SetOutboundType sets the "outbound_type" field.
func (_c *OutboundOrderCreate) SetOutboundType(v string) *OutboundOrderCreate {
_c.mutation.SetOutboundType(v)
return _c
}
// SetNillableOutboundType sets the "outbound_type" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableOutboundType(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetOutboundType(*v)
}
return _c
}
// SetOrderNo sets the "order_no" field.
func (_c *OutboundOrderCreate) SetOrderNo(v string) *OutboundOrderCreate {
_c.mutation.SetOrderNo(v)
return _c
}
// SetNillableOrderNo sets the "order_no" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableOrderNo(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetOrderNo(*v)
}
return _c
}
// SetMaterialCode sets the "material_code" field.
func (_c *OutboundOrderCreate) SetMaterialCode(v string) *OutboundOrderCreate {
_c.mutation.SetMaterialCode(v)
return _c
}
// SetMaterialName sets the "material_name" field.
func (_c *OutboundOrderCreate) SetMaterialName(v string) *OutboundOrderCreate {
_c.mutation.SetMaterialName(v)
return _c
}
// SetNillableMaterialName sets the "material_name" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableMaterialName(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetMaterialName(*v)
}
return _c
}
// SetManageMode sets the "manage_mode" field.
func (_c *OutboundOrderCreate) SetManageMode(v int) *OutboundOrderCreate {
_c.mutation.SetManageMode(v)
return _c
}
// SetNillableManageMode sets the "manage_mode" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableManageMode(v *int) *OutboundOrderCreate {
if v != nil {
_c.SetManageMode(*v)
}
return _c
}
// SetBatchNo sets the "batch_no" field.
func (_c *OutboundOrderCreate) SetBatchNo(v string) *OutboundOrderCreate {
_c.mutation.SetBatchNo(v)
return _c
}
// SetNillableBatchNo sets the "batch_no" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableBatchNo(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetBatchNo(*v)
}
return _c
}
// SetZoneCode sets the "zone_code" field.
func (_c *OutboundOrderCreate) SetZoneCode(v string) *OutboundOrderCreate {
_c.mutation.SetZoneCode(v)
return _c
}
// SetNillableZoneCode sets the "zone_code" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableZoneCode(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetZoneCode(*v)
}
return _c
}
// SetQuantity sets the "quantity" field.
func (_c *OutboundOrderCreate) SetQuantity(v int) *OutboundOrderCreate {
_c.mutation.SetQuantity(v)
return _c
}
// SetNillableQuantity sets the "quantity" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableQuantity(v *int) *OutboundOrderCreate {
if v != nil {
_c.SetQuantity(*v)
}
return _c
}
// SetOperator sets the "operator" field.
func (_c *OutboundOrderCreate) SetOperator(v string) *OutboundOrderCreate {
_c.mutation.SetOperator(v)
return _c
}
// SetNillableOperator sets the "operator" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableOperator(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetOperator(*v)
}
return _c
}
// SetReviewer sets the "reviewer" field.
func (_c *OutboundOrderCreate) SetReviewer(v string) *OutboundOrderCreate {
_c.mutation.SetReviewer(v)
return _c
}
// SetNillableReviewer sets the "reviewer" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableReviewer(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetReviewer(*v)
}
return _c
}
// SetTargetDock sets the "target_dock" field.
func (_c *OutboundOrderCreate) SetTargetDock(v string) *OutboundOrderCreate {
_c.mutation.SetTargetDock(v)
return _c
}
// SetNillableTargetDock sets the "target_dock" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableTargetDock(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetTargetDock(*v)
}
return _c
}
// SetRemark sets the "remark" field.
func (_c *OutboundOrderCreate) SetRemark(v string) *OutboundOrderCreate {
_c.mutation.SetRemark(v)
return _c
}
// SetNillableRemark sets the "remark" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableRemark(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetRemark(*v)
}
return _c
}
// SetBoxNo sets the "box_no" field.
func (_c *OutboundOrderCreate) SetBoxNo(v string) *OutboundOrderCreate {
_c.mutation.SetBoxNo(v)
return _c
}
// SetNillableBoxNo sets the "box_no" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableBoxNo(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetBoxNo(*v)
}
return _c
}
// SetBoxSnList sets the "box_sn_list" field.
func (_c *OutboundOrderCreate) SetBoxSnList(v string) *OutboundOrderCreate {
_c.mutation.SetBoxSnList(v)
return _c
}
// SetNillableBoxSnList sets the "box_sn_list" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableBoxSnList(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetBoxSnList(*v)
}
return _c
}
// SetContractNo sets the "contract_no" field.
func (_c *OutboundOrderCreate) SetContractNo(v string) *OutboundOrderCreate {
_c.mutation.SetContractNo(v)
return _c
}
// SetNillableContractNo sets the "contract_no" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableContractNo(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetContractNo(*v)
}
return _c
}
// SetCreatedAt sets the "created_at" field.
func (_c *OutboundOrderCreate) SetCreatedAt(v int64) *OutboundOrderCreate {
_c.mutation.SetCreatedAt(v)
return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableCreatedAt(v *int64) *OutboundOrderCreate {
if v != nil {
_c.SetCreatedAt(*v)
}
return _c
}
// Mutation returns the OutboundOrderMutation object of the builder.
func (_c *OutboundOrderCreate) Mutation() *OutboundOrderMutation {
return _c.mutation
}
// Save creates the OutboundOrder in the database.
func (_c *OutboundOrderCreate) Save(ctx context.Context) (*OutboundOrder, error) {
_c.defaults()
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
func (_c *OutboundOrderCreate) SaveX(ctx context.Context) *OutboundOrder {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *OutboundOrderCreate) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *OutboundOrderCreate) ExecX(ctx context.Context) {
if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_c *OutboundOrderCreate) defaults() {
if _, ok := _c.mutation.OutboundType(); !ok {
v := outboundorder.DefaultOutboundType
_c.mutation.SetOutboundType(v)
}
if _, ok := _c.mutation.ManageMode(); !ok {
v := outboundorder.DefaultManageMode
_c.mutation.SetManageMode(v)
}
if _, ok := _c.mutation.Quantity(); !ok {
v := outboundorder.DefaultQuantity
_c.mutation.SetQuantity(v)
}
if _, ok := _c.mutation.CreatedAt(); !ok {
v := outboundorder.DefaultCreatedAt()
_c.mutation.SetCreatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_c *OutboundOrderCreate) check() error {
if _, ok := _c.mutation.OutboundNo(); !ok {
return &ValidationError{Name: "outbound_no", err: errors.New(`ent: missing required field "OutboundOrder.outbound_no"`)}
}
if _, ok := _c.mutation.OutboundType(); !ok {
return &ValidationError{Name: "outbound_type", err: errors.New(`ent: missing required field "OutboundOrder.outbound_type"`)}
}
if _, ok := _c.mutation.MaterialCode(); !ok {
return &ValidationError{Name: "material_code", err: errors.New(`ent: missing required field "OutboundOrder.material_code"`)}
}
if _, ok := _c.mutation.ManageMode(); !ok {
return &ValidationError{Name: "manage_mode", err: errors.New(`ent: missing required field "OutboundOrder.manage_mode"`)}
}
if _, ok := _c.mutation.Quantity(); !ok {
return &ValidationError{Name: "quantity", err: errors.New(`ent: missing required field "OutboundOrder.quantity"`)}
}
if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "OutboundOrder.created_at"`)}
}
return nil
}
func (_c *OutboundOrderCreate) sqlSave(ctx context.Context) (*OutboundOrder, error) {
if err := _c.check(); err != nil {
return nil, err
}
_node, _spec := _c.createSpec()
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
id := _spec.ID.Value.(int64)
_node.ID = int(id)
_c.mutation.id = &_node.ID
_c.mutation.done = true
return _node, nil
}
func (_c *OutboundOrderCreate) createSpec() (*OutboundOrder, *sqlgraph.CreateSpec) {
var (
_node = &OutboundOrder{config: _c.config}
_spec = sqlgraph.NewCreateSpec(outboundorder.Table, sqlgraph.NewFieldSpec(outboundorder.FieldID, field.TypeInt))
)
_spec.OnConflict = _c.conflict
if value, ok := _c.mutation.OutboundNo(); ok {
_spec.SetField(outboundorder.FieldOutboundNo, field.TypeString, value)
_node.OutboundNo = value
}
if value, ok := _c.mutation.OutboundType(); ok {
_spec.SetField(outboundorder.FieldOutboundType, field.TypeString, value)
_node.OutboundType = value
}
if value, ok := _c.mutation.OrderNo(); ok {
_spec.SetField(outboundorder.FieldOrderNo, field.TypeString, value)
_node.OrderNo = value
}
if value, ok := _c.mutation.MaterialCode(); ok {
_spec.SetField(outboundorder.FieldMaterialCode, field.TypeString, value)
_node.MaterialCode = value
}
if value, ok := _c.mutation.MaterialName(); ok {
_spec.SetField(outboundorder.FieldMaterialName, field.TypeString, value)
_node.MaterialName = value
}
if value, ok := _c.mutation.ManageMode(); ok {
_spec.SetField(outboundorder.FieldManageMode, field.TypeInt, value)
_node.ManageMode = value
}
if value, ok := _c.mutation.BatchNo(); ok {
_spec.SetField(outboundorder.FieldBatchNo, field.TypeString, value)
_node.BatchNo = value
}
if value, ok := _c.mutation.ZoneCode(); ok {
_spec.SetField(outboundorder.FieldZoneCode, field.TypeString, value)
_node.ZoneCode = value
}
if value, ok := _c.mutation.Quantity(); ok {
_spec.SetField(outboundorder.FieldQuantity, field.TypeInt, value)
_node.Quantity = value
}
if value, ok := _c.mutation.Operator(); ok {
_spec.SetField(outboundorder.FieldOperator, field.TypeString, value)
_node.Operator = value
}
if value, ok := _c.mutation.Reviewer(); ok {
_spec.SetField(outboundorder.FieldReviewer, field.TypeString, value)
_node.Reviewer = value
}
if value, ok := _c.mutation.TargetDock(); ok {
_spec.SetField(outboundorder.FieldTargetDock, field.TypeString, value)
_node.TargetDock = value
}
if value, ok := _c.mutation.Remark(); ok {
_spec.SetField(outboundorder.FieldRemark, field.TypeString, value)
_node.Remark = value
}
if value, ok := _c.mutation.BoxNo(); ok {
_spec.SetField(outboundorder.FieldBoxNo, field.TypeString, value)
_node.BoxNo = value
}
if value, ok := _c.mutation.BoxSnList(); ok {
_spec.SetField(outboundorder.FieldBoxSnList, field.TypeString, value)
_node.BoxSnList = value
}
if value, ok := _c.mutation.ContractNo(); ok {
_spec.SetField(outboundorder.FieldContractNo, field.TypeString, value)
_node.ContractNo = value
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(outboundorder.FieldCreatedAt, field.TypeInt64, value)
_node.CreatedAt = value
}
return _node, _spec
}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
// client.OutboundOrder.Create().
// SetOutboundNo(v).
// OnConflict(
// // Update the row with the new values
// // the was proposed for insertion.
// sql.ResolveWithNewValues(),
// ).
// // Override some of the fields with custom
// // update values.
// Update(func(u *ent.OutboundOrderUpsert) {
// SetOutboundNo(v+v).
// }).
// Exec(ctx)
func (_c *OutboundOrderCreate) OnConflict(opts ...sql.ConflictOption) *OutboundOrderUpsertOne {
_c.conflict = opts
return &OutboundOrderUpsertOne{
create: _c,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.OutboundOrder.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func (_c *OutboundOrderCreate) OnConflictColumns(columns ...string) *OutboundOrderUpsertOne {
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
return &OutboundOrderUpsertOne{
create: _c,
}
}
type (
// OutboundOrderUpsertOne is the builder for "upsert"-ing
// one OutboundOrder node.
OutboundOrderUpsertOne struct {
create *OutboundOrderCreate
}
// OutboundOrderUpsert is the "OnConflict" setter.
OutboundOrderUpsert struct {
*sql.UpdateSet
}
)
// SetOutboundNo sets the "outbound_no" field.
func (u *OutboundOrderUpsert) SetOutboundNo(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldOutboundNo, v)
return u
}
// UpdateOutboundNo sets the "outbound_no" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateOutboundNo() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldOutboundNo)
return u
}
// SetOutboundType sets the "outbound_type" field.
func (u *OutboundOrderUpsert) SetOutboundType(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldOutboundType, v)
return u
}
// UpdateOutboundType sets the "outbound_type" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateOutboundType() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldOutboundType)
return u
}
// SetOrderNo sets the "order_no" field.
func (u *OutboundOrderUpsert) SetOrderNo(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldOrderNo, v)
return u
}
// UpdateOrderNo sets the "order_no" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateOrderNo() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldOrderNo)
return u
}
// ClearOrderNo clears the value of the "order_no" field.
func (u *OutboundOrderUpsert) ClearOrderNo() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldOrderNo)
return u
}
// SetMaterialCode sets the "material_code" field.
func (u *OutboundOrderUpsert) SetMaterialCode(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldMaterialCode, v)
return u
}
// UpdateMaterialCode sets the "material_code" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateMaterialCode() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldMaterialCode)
return u
}
// SetMaterialName sets the "material_name" field.
func (u *OutboundOrderUpsert) SetMaterialName(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldMaterialName, v)
return u
}
// UpdateMaterialName sets the "material_name" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateMaterialName() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldMaterialName)
return u
}
// ClearMaterialName clears the value of the "material_name" field.
func (u *OutboundOrderUpsert) ClearMaterialName() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldMaterialName)
return u
}
// SetManageMode sets the "manage_mode" field.
func (u *OutboundOrderUpsert) SetManageMode(v int) *OutboundOrderUpsert {
u.Set(outboundorder.FieldManageMode, v)
return u
}
// UpdateManageMode sets the "manage_mode" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateManageMode() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldManageMode)
return u
}
// AddManageMode adds v to the "manage_mode" field.
func (u *OutboundOrderUpsert) AddManageMode(v int) *OutboundOrderUpsert {
u.Add(outboundorder.FieldManageMode, v)
return u
}
// SetBatchNo sets the "batch_no" field.
func (u *OutboundOrderUpsert) SetBatchNo(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldBatchNo, v)
return u
}
// UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateBatchNo() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldBatchNo)
return u
}
// ClearBatchNo clears the value of the "batch_no" field.
func (u *OutboundOrderUpsert) ClearBatchNo() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldBatchNo)
return u
}
// SetZoneCode sets the "zone_code" field.
func (u *OutboundOrderUpsert) SetZoneCode(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldZoneCode, v)
return u
}
// UpdateZoneCode sets the "zone_code" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateZoneCode() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldZoneCode)
return u
}
// ClearZoneCode clears the value of the "zone_code" field.
func (u *OutboundOrderUpsert) ClearZoneCode() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldZoneCode)
return u
}
// SetQuantity sets the "quantity" field.
func (u *OutboundOrderUpsert) SetQuantity(v int) *OutboundOrderUpsert {
u.Set(outboundorder.FieldQuantity, v)
return u
}
// UpdateQuantity sets the "quantity" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateQuantity() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldQuantity)
return u
}
// AddQuantity adds v to the "quantity" field.
func (u *OutboundOrderUpsert) AddQuantity(v int) *OutboundOrderUpsert {
u.Add(outboundorder.FieldQuantity, v)
return u
}
// SetOperator sets the "operator" field.
func (u *OutboundOrderUpsert) SetOperator(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldOperator, v)
return u
}
// UpdateOperator sets the "operator" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateOperator() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldOperator)
return u
}
// ClearOperator clears the value of the "operator" field.
func (u *OutboundOrderUpsert) ClearOperator() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldOperator)
return u
}
// SetReviewer sets the "reviewer" field.
func (u *OutboundOrderUpsert) SetReviewer(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldReviewer, v)
return u
}
// UpdateReviewer sets the "reviewer" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateReviewer() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldReviewer)
return u
}
// ClearReviewer clears the value of the "reviewer" field.
func (u *OutboundOrderUpsert) ClearReviewer() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldReviewer)
return u
}
// SetTargetDock sets the "target_dock" field.
func (u *OutboundOrderUpsert) SetTargetDock(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldTargetDock, v)
return u
}
// UpdateTargetDock sets the "target_dock" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateTargetDock() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldTargetDock)
return u
}
// ClearTargetDock clears the value of the "target_dock" field.
func (u *OutboundOrderUpsert) ClearTargetDock() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldTargetDock)
return u
}
// SetRemark sets the "remark" field.
func (u *OutboundOrderUpsert) SetRemark(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldRemark, v)
return u
}
// UpdateRemark sets the "remark" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateRemark() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldRemark)
return u
}
// ClearRemark clears the value of the "remark" field.
func (u *OutboundOrderUpsert) ClearRemark() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldRemark)
return u
}
// SetBoxNo sets the "box_no" field.
func (u *OutboundOrderUpsert) SetBoxNo(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldBoxNo, v)
return u
}
// UpdateBoxNo sets the "box_no" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateBoxNo() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldBoxNo)
return u
}
// ClearBoxNo clears the value of the "box_no" field.
func (u *OutboundOrderUpsert) ClearBoxNo() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldBoxNo)
return u
}
// SetBoxSnList sets the "box_sn_list" field.
func (u *OutboundOrderUpsert) SetBoxSnList(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldBoxSnList, v)
return u
}
// UpdateBoxSnList sets the "box_sn_list" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateBoxSnList() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldBoxSnList)
return u
}
// ClearBoxSnList clears the value of the "box_sn_list" field.
func (u *OutboundOrderUpsert) ClearBoxSnList() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldBoxSnList)
return u
}
// SetContractNo sets the "contract_no" field.
func (u *OutboundOrderUpsert) SetContractNo(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldContractNo, v)
return u
}
// UpdateContractNo sets the "contract_no" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateContractNo() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldContractNo)
return u
}
// ClearContractNo clears the value of the "contract_no" field.
func (u *OutboundOrderUpsert) ClearContractNo() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldContractNo)
return u
}
// SetCreatedAt sets the "created_at" field.
func (u *OutboundOrderUpsert) SetCreatedAt(v int64) *OutboundOrderUpsert {
u.Set(outboundorder.FieldCreatedAt, v)
return u
}
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateCreatedAt() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldCreatedAt)
return u
}
// AddCreatedAt adds v to the "created_at" field.
func (u *OutboundOrderUpsert) AddCreatedAt(v int64) *OutboundOrderUpsert {
u.Add(outboundorder.FieldCreatedAt, v)
return u
}
// UpdateNewValues updates the mutable fields using the new values that were set on create.
// Using this option is equivalent to using:
//
// client.OutboundOrder.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// ).
// Exec(ctx)
func (u *OutboundOrderUpsertOne) UpdateNewValues() *OutboundOrderUpsertOne {
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
return u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.OutboundOrder.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func (u *OutboundOrderUpsertOne) Ignore() *OutboundOrderUpsertOne {
u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
return u
}
// DoNothing configures the conflict_action to `DO NOTHING`.
// Supported only by SQLite and PostgreSQL.
func (u *OutboundOrderUpsertOne) DoNothing() *OutboundOrderUpsertOne {
u.create.conflict = append(u.create.conflict, sql.DoNothing())
return u
}
// Update allows overriding fields `UPDATE` values. See the OutboundOrderCreate.OnConflict
// documentation for more info.
func (u *OutboundOrderUpsertOne) Update(set func(*OutboundOrderUpsert)) *OutboundOrderUpsertOne {
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
set(&OutboundOrderUpsert{UpdateSet: update})
}))
return u
}
// SetOutboundNo sets the "outbound_no" field.
func (u *OutboundOrderUpsertOne) SetOutboundNo(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOutboundNo(v)
})
}
// UpdateOutboundNo sets the "outbound_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateOutboundNo() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOutboundNo()
})
}
// SetOutboundType sets the "outbound_type" field.
func (u *OutboundOrderUpsertOne) SetOutboundType(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOutboundType(v)
})
}
// UpdateOutboundType sets the "outbound_type" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateOutboundType() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOutboundType()
})
}
// SetOrderNo sets the "order_no" field.
func (u *OutboundOrderUpsertOne) SetOrderNo(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOrderNo(v)
})
}
// UpdateOrderNo sets the "order_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateOrderNo() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOrderNo()
})
}
// ClearOrderNo clears the value of the "order_no" field.
func (u *OutboundOrderUpsertOne) ClearOrderNo() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearOrderNo()
})
}
// SetMaterialCode sets the "material_code" field.
func (u *OutboundOrderUpsertOne) SetMaterialCode(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetMaterialCode(v)
})
}
// UpdateMaterialCode sets the "material_code" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateMaterialCode() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateMaterialCode()
})
}
// SetMaterialName sets the "material_name" field.
func (u *OutboundOrderUpsertOne) SetMaterialName(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetMaterialName(v)
})
}
// UpdateMaterialName sets the "material_name" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateMaterialName() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateMaterialName()
})
}
// ClearMaterialName clears the value of the "material_name" field.
func (u *OutboundOrderUpsertOne) ClearMaterialName() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearMaterialName()
})
}
// SetManageMode sets the "manage_mode" field.
func (u *OutboundOrderUpsertOne) SetManageMode(v int) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetManageMode(v)
})
}
// AddManageMode adds v to the "manage_mode" field.
func (u *OutboundOrderUpsertOne) AddManageMode(v int) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.AddManageMode(v)
})
}
// UpdateManageMode sets the "manage_mode" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateManageMode() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateManageMode()
})
}
// SetBatchNo sets the "batch_no" field.
func (u *OutboundOrderUpsertOne) SetBatchNo(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetBatchNo(v)
})
}
// UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateBatchNo() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateBatchNo()
})
}
// ClearBatchNo clears the value of the "batch_no" field.
func (u *OutboundOrderUpsertOne) ClearBatchNo() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearBatchNo()
})
}
// SetZoneCode sets the "zone_code" field.
func (u *OutboundOrderUpsertOne) SetZoneCode(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetZoneCode(v)
})
}
// UpdateZoneCode sets the "zone_code" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateZoneCode() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateZoneCode()
})
}
// ClearZoneCode clears the value of the "zone_code" field.
func (u *OutboundOrderUpsertOne) ClearZoneCode() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearZoneCode()
})
}
// SetQuantity sets the "quantity" field.
func (u *OutboundOrderUpsertOne) SetQuantity(v int) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetQuantity(v)
})
}
// AddQuantity adds v to the "quantity" field.
func (u *OutboundOrderUpsertOne) AddQuantity(v int) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.AddQuantity(v)
})
}
// UpdateQuantity sets the "quantity" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateQuantity() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateQuantity()
})
}
// SetOperator sets the "operator" field.
func (u *OutboundOrderUpsertOne) SetOperator(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOperator(v)
})
}
// UpdateOperator sets the "operator" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateOperator() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOperator()
})
}
// ClearOperator clears the value of the "operator" field.
func (u *OutboundOrderUpsertOne) ClearOperator() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearOperator()
})
}
// SetReviewer sets the "reviewer" field.
func (u *OutboundOrderUpsertOne) SetReviewer(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetReviewer(v)
})
}
// UpdateReviewer sets the "reviewer" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateReviewer() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateReviewer()
})
}
// ClearReviewer clears the value of the "reviewer" field.
func (u *OutboundOrderUpsertOne) ClearReviewer() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearReviewer()
})
}
// SetTargetDock sets the "target_dock" field.
func (u *OutboundOrderUpsertOne) SetTargetDock(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetTargetDock(v)
})
}
// UpdateTargetDock sets the "target_dock" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateTargetDock() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateTargetDock()
})
}
// ClearTargetDock clears the value of the "target_dock" field.
func (u *OutboundOrderUpsertOne) ClearTargetDock() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearTargetDock()
})
}
// SetRemark sets the "remark" field.
func (u *OutboundOrderUpsertOne) SetRemark(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetRemark(v)
})
}
// UpdateRemark sets the "remark" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateRemark() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateRemark()
})
}
// ClearRemark clears the value of the "remark" field.
func (u *OutboundOrderUpsertOne) ClearRemark() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearRemark()
})
}
// SetBoxNo sets the "box_no" field.
func (u *OutboundOrderUpsertOne) SetBoxNo(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetBoxNo(v)
})
}
// UpdateBoxNo sets the "box_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateBoxNo() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateBoxNo()
})
}
// ClearBoxNo clears the value of the "box_no" field.
func (u *OutboundOrderUpsertOne) ClearBoxNo() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearBoxNo()
})
}
// SetBoxSnList sets the "box_sn_list" field.
func (u *OutboundOrderUpsertOne) SetBoxSnList(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetBoxSnList(v)
})
}
// UpdateBoxSnList sets the "box_sn_list" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateBoxSnList() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateBoxSnList()
})
}
// ClearBoxSnList clears the value of the "box_sn_list" field.
func (u *OutboundOrderUpsertOne) ClearBoxSnList() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearBoxSnList()
})
}
// SetContractNo sets the "contract_no" field.
func (u *OutboundOrderUpsertOne) SetContractNo(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetContractNo(v)
})
}
// UpdateContractNo sets the "contract_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateContractNo() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateContractNo()
})
}
// ClearContractNo clears the value of the "contract_no" field.
func (u *OutboundOrderUpsertOne) ClearContractNo() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearContractNo()
})
}
// SetCreatedAt sets the "created_at" field.
func (u *OutboundOrderUpsertOne) SetCreatedAt(v int64) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetCreatedAt(v)
})
}
// AddCreatedAt adds v to the "created_at" field.
func (u *OutboundOrderUpsertOne) AddCreatedAt(v int64) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.AddCreatedAt(v)
})
}
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateCreatedAt() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateCreatedAt()
})
}
// Exec executes the query.
func (u *OutboundOrderUpsertOne) Exec(ctx context.Context) error {
if len(u.create.conflict) == 0 {
return errors.New("ent: missing options for OutboundOrderCreate.OnConflict")
}
return u.create.Exec(ctx)
}
// ExecX is like Exec, but panics if an error occurs.
func (u *OutboundOrderUpsertOne) ExecX(ctx context.Context) {
if err := u.create.Exec(ctx); err != nil {
panic(err)
}
}
// Exec executes the UPSERT query and returns the inserted/updated ID.
func (u *OutboundOrderUpsertOne) ID(ctx context.Context) (id int, err error) {
node, err := u.create.Save(ctx)
if err != nil {
return id, err
}
return node.ID, nil
}
// IDX is like ID, but panics if an error occurs.
func (u *OutboundOrderUpsertOne) IDX(ctx context.Context) int {
id, err := u.ID(ctx)
if err != nil {
panic(err)
}
return id
}
// OutboundOrderCreateBulk is the builder for creating many OutboundOrder entities in bulk.
type OutboundOrderCreateBulk struct {
config
err error
builders []*OutboundOrderCreate
conflict []sql.ConflictOption
}
// Save creates the OutboundOrder entities in the database.
func (_c *OutboundOrderCreateBulk) Save(ctx context.Context) ([]*OutboundOrder, error) {
if _c.err != nil {
return nil, _c.err
}
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
nodes := make([]*OutboundOrder, len(_c.builders))
mutators := make([]Mutator, len(_c.builders))
for i := range _c.builders {
func(i int, root context.Context) {
builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*OutboundOrderMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T", m)
}
if err := builder.check(); err != nil {
return nil, err
}
builder.mutation = mutation
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
} else {
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
spec.OnConflict = _c.conflict
// Invoke the actual operation on the latest mutation in the chain.
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
}
}
if err != nil {
return nil, err
}
mutation.id = &nodes[i].ID
if specs[i].ID.Value != nil {
id := specs[i].ID.Value.(int64)
nodes[i].ID = int(id)
}
mutation.done = true
return nodes[i], nil
})
for i := len(builder.hooks) - 1; i >= 0; i-- {
mut = builder.hooks[i](mut)
}
mutators[i] = mut
}(i, ctx)
}
if len(mutators) > 0 {
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
return nodes, nil
}
// SaveX is like Save, but panics if an error occurs.
func (_c *OutboundOrderCreateBulk) SaveX(ctx context.Context) []*OutboundOrder {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *OutboundOrderCreateBulk) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *OutboundOrderCreateBulk) ExecX(ctx context.Context) {
if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
// client.OutboundOrder.CreateBulk(builders...).
// OnConflict(
// // Update the row with the new values
// // the was proposed for insertion.
// sql.ResolveWithNewValues(),
// ).
// // Override some of the fields with custom
// // update values.
// Update(func(u *ent.OutboundOrderUpsert) {
// SetOutboundNo(v+v).
// }).
// Exec(ctx)
func (_c *OutboundOrderCreateBulk) OnConflict(opts ...sql.ConflictOption) *OutboundOrderUpsertBulk {
_c.conflict = opts
return &OutboundOrderUpsertBulk{
create: _c,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.OutboundOrder.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func (_c *OutboundOrderCreateBulk) OnConflictColumns(columns ...string) *OutboundOrderUpsertBulk {
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
return &OutboundOrderUpsertBulk{
create: _c,
}
}
// OutboundOrderUpsertBulk is the builder for "upsert"-ing
// a bulk of OutboundOrder nodes.
type OutboundOrderUpsertBulk struct {
create *OutboundOrderCreateBulk
}
// UpdateNewValues updates the mutable fields using the new values that
// were set on create. Using this option is equivalent to using:
//
// client.OutboundOrder.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// ).
// Exec(ctx)
func (u *OutboundOrderUpsertBulk) UpdateNewValues() *OutboundOrderUpsertBulk {
u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
return u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.OutboundOrder.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func (u *OutboundOrderUpsertBulk) Ignore() *OutboundOrderUpsertBulk {
u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
return u
}
// DoNothing configures the conflict_action to `DO NOTHING`.
// Supported only by SQLite and PostgreSQL.
func (u *OutboundOrderUpsertBulk) DoNothing() *OutboundOrderUpsertBulk {
u.create.conflict = append(u.create.conflict, sql.DoNothing())
return u
}
// Update allows overriding fields `UPDATE` values. See the OutboundOrderCreateBulk.OnConflict
// documentation for more info.
func (u *OutboundOrderUpsertBulk) Update(set func(*OutboundOrderUpsert)) *OutboundOrderUpsertBulk {
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
set(&OutboundOrderUpsert{UpdateSet: update})
}))
return u
}
// SetOutboundNo sets the "outbound_no" field.
func (u *OutboundOrderUpsertBulk) SetOutboundNo(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOutboundNo(v)
})
}
// UpdateOutboundNo sets the "outbound_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateOutboundNo() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOutboundNo()
})
}
// SetOutboundType sets the "outbound_type" field.
func (u *OutboundOrderUpsertBulk) SetOutboundType(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOutboundType(v)
})
}
// UpdateOutboundType sets the "outbound_type" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateOutboundType() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOutboundType()
})
}
// SetOrderNo sets the "order_no" field.
func (u *OutboundOrderUpsertBulk) SetOrderNo(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOrderNo(v)
})
}
// UpdateOrderNo sets the "order_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateOrderNo() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOrderNo()
})
}
// ClearOrderNo clears the value of the "order_no" field.
func (u *OutboundOrderUpsertBulk) ClearOrderNo() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearOrderNo()
})
}
// SetMaterialCode sets the "material_code" field.
func (u *OutboundOrderUpsertBulk) SetMaterialCode(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetMaterialCode(v)
})
}
// UpdateMaterialCode sets the "material_code" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateMaterialCode() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateMaterialCode()
})
}
// SetMaterialName sets the "material_name" field.
func (u *OutboundOrderUpsertBulk) SetMaterialName(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetMaterialName(v)
})
}
// UpdateMaterialName sets the "material_name" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateMaterialName() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateMaterialName()
})
}
// ClearMaterialName clears the value of the "material_name" field.
func (u *OutboundOrderUpsertBulk) ClearMaterialName() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearMaterialName()
})
}
// SetManageMode sets the "manage_mode" field.
func (u *OutboundOrderUpsertBulk) SetManageMode(v int) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetManageMode(v)
})
}
// AddManageMode adds v to the "manage_mode" field.
func (u *OutboundOrderUpsertBulk) AddManageMode(v int) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.AddManageMode(v)
})
}
// UpdateManageMode sets the "manage_mode" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateManageMode() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateManageMode()
})
}
// SetBatchNo sets the "batch_no" field.
func (u *OutboundOrderUpsertBulk) SetBatchNo(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetBatchNo(v)
})
}
// UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateBatchNo() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateBatchNo()
})
}
// ClearBatchNo clears the value of the "batch_no" field.
func (u *OutboundOrderUpsertBulk) ClearBatchNo() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearBatchNo()
})
}
// SetZoneCode sets the "zone_code" field.
func (u *OutboundOrderUpsertBulk) SetZoneCode(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetZoneCode(v)
})
}
// UpdateZoneCode sets the "zone_code" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateZoneCode() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateZoneCode()
})
}
// ClearZoneCode clears the value of the "zone_code" field.
func (u *OutboundOrderUpsertBulk) ClearZoneCode() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearZoneCode()
})
}
// SetQuantity sets the "quantity" field.
func (u *OutboundOrderUpsertBulk) SetQuantity(v int) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetQuantity(v)
})
}
// AddQuantity adds v to the "quantity" field.
func (u *OutboundOrderUpsertBulk) AddQuantity(v int) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.AddQuantity(v)
})
}
// UpdateQuantity sets the "quantity" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateQuantity() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateQuantity()
})
}
// SetOperator sets the "operator" field.
func (u *OutboundOrderUpsertBulk) SetOperator(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOperator(v)
})
}
// UpdateOperator sets the "operator" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateOperator() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOperator()
})
}
// ClearOperator clears the value of the "operator" field.
func (u *OutboundOrderUpsertBulk) ClearOperator() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearOperator()
})
}
// SetReviewer sets the "reviewer" field.
func (u *OutboundOrderUpsertBulk) SetReviewer(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetReviewer(v)
})
}
// UpdateReviewer sets the "reviewer" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateReviewer() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateReviewer()
})
}
// ClearReviewer clears the value of the "reviewer" field.
func (u *OutboundOrderUpsertBulk) ClearReviewer() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearReviewer()
})
}
// SetTargetDock sets the "target_dock" field.
func (u *OutboundOrderUpsertBulk) SetTargetDock(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetTargetDock(v)
})
}
// UpdateTargetDock sets the "target_dock" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateTargetDock() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateTargetDock()
})
}
// ClearTargetDock clears the value of the "target_dock" field.
func (u *OutboundOrderUpsertBulk) ClearTargetDock() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearTargetDock()
})
}
// SetRemark sets the "remark" field.
func (u *OutboundOrderUpsertBulk) SetRemark(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetRemark(v)
})
}
// UpdateRemark sets the "remark" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateRemark() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateRemark()
})
}
// ClearRemark clears the value of the "remark" field.
func (u *OutboundOrderUpsertBulk) ClearRemark() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearRemark()
})
}
// SetBoxNo sets the "box_no" field.
func (u *OutboundOrderUpsertBulk) SetBoxNo(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetBoxNo(v)
})
}
// UpdateBoxNo sets the "box_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateBoxNo() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateBoxNo()
})
}
// ClearBoxNo clears the value of the "box_no" field.
func (u *OutboundOrderUpsertBulk) ClearBoxNo() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearBoxNo()
})
}
// SetBoxSnList sets the "box_sn_list" field.
func (u *OutboundOrderUpsertBulk) SetBoxSnList(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetBoxSnList(v)
})
}
// UpdateBoxSnList sets the "box_sn_list" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateBoxSnList() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateBoxSnList()
})
}
// ClearBoxSnList clears the value of the "box_sn_list" field.
func (u *OutboundOrderUpsertBulk) ClearBoxSnList() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearBoxSnList()
})
}
// SetContractNo sets the "contract_no" field.
func (u *OutboundOrderUpsertBulk) SetContractNo(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetContractNo(v)
})
}
// UpdateContractNo sets the "contract_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateContractNo() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateContractNo()
})
}
// ClearContractNo clears the value of the "contract_no" field.
func (u *OutboundOrderUpsertBulk) ClearContractNo() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearContractNo()
})
}
// SetCreatedAt sets the "created_at" field.
func (u *OutboundOrderUpsertBulk) SetCreatedAt(v int64) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetCreatedAt(v)
})
}
// AddCreatedAt adds v to the "created_at" field.
func (u *OutboundOrderUpsertBulk) AddCreatedAt(v int64) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.AddCreatedAt(v)
})
}
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateCreatedAt() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateCreatedAt()
})
}
// Exec executes the query.
func (u *OutboundOrderUpsertBulk) Exec(ctx context.Context) error {
if u.create.err != nil {
return u.create.err
}
for i, b := range u.create.builders {
if len(b.conflict) != 0 {
return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the OutboundOrderCreateBulk instead", i)
}
}
if len(u.create.conflict) == 0 {
return errors.New("ent: missing options for OutboundOrderCreateBulk.OnConflict")
}
return u.create.Exec(ctx)
}
// ExecX is like Exec, but panics if an error occurs.
func (u *OutboundOrderUpsertBulk) ExecX(ctx context.Context) {
if err := u.create.Exec(ctx); err != nil {
panic(err)
}
}