Files
bj_power/bj_power_wms/ent/inventorylock.go
T
SunYF bb22148625 feat: 完成区域管理、装箱功能优化与接口标准化
- 新增区域状态字段与增删改查接口,支持区域启用/停用
- 重构实体字段JSON标签为camelCase格式统一接口规范
- 优化入库、盘点、装箱流程的交互与提示文案
- 新增装箱管理功能,支持合同号关联与装箱编辑
- 调整前端菜单与帮助文档适配业务场景变更
2026-09-01 13:49:44 +08:00

203 lines
6.9 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_wms/ent/inventorylock"
"fmt"
"strings"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// InventoryLock is the model entity for the InventoryLock schema.
type InventoryLock struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// BATCH/SN
TargetType string `json:"targetType,omitempty"`
// 批次号或 SN
TargetID string `json:"targetId,omitempty"`
// 物料编码
MaterialCode string `json:"materialCode,omitempty"`
// 锁定数量
LockedQty int `json:"lockedQty,omitempty"`
// 关联工单号
OrderNo string `json:"orderNo,omitempty"`
// ACTIVE/RELEASED/CONSUMED
Status string `json:"status,omitempty"`
// 过期时间戳
ExpiredAt int64 `json:"expiredAt,omitempty"`
// 备注
Remark string `json:"remark,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt int64 `json:"createdAt,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt int64 `json:"updatedAt,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*InventoryLock) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case inventorylock.FieldID, inventorylock.FieldLockedQty, inventorylock.FieldExpiredAt, inventorylock.FieldCreatedAt, inventorylock.FieldUpdatedAt:
values[i] = new(sql.NullInt64)
case inventorylock.FieldTargetType, inventorylock.FieldTargetID, inventorylock.FieldMaterialCode, inventorylock.FieldOrderNo, inventorylock.FieldStatus, inventorylock.FieldRemark:
values[i] = new(sql.NullString)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the InventoryLock fields.
func (_m *InventoryLock) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case inventorylock.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
_m.ID = int(value.Int64)
case inventorylock.FieldTargetType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field target_type", values[i])
} else if value.Valid {
_m.TargetType = value.String
}
case inventorylock.FieldTargetID:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field target_id", values[i])
} else if value.Valid {
_m.TargetID = value.String
}
case inventorylock.FieldMaterialCode:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field material_code", values[i])
} else if value.Valid {
_m.MaterialCode = value.String
}
case inventorylock.FieldLockedQty:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field locked_qty", values[i])
} else if value.Valid {
_m.LockedQty = int(value.Int64)
}
case inventorylock.FieldOrderNo:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field order_no", values[i])
} else if value.Valid {
_m.OrderNo = value.String
}
case inventorylock.FieldStatus:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field status", values[i])
} else if value.Valid {
_m.Status = value.String
}
case inventorylock.FieldExpiredAt:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field expired_at", values[i])
} else if value.Valid {
_m.ExpiredAt = value.Int64
}
case inventorylock.FieldRemark:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field remark", values[i])
} else if value.Valid {
_m.Remark = value.String
}
case inventorylock.FieldCreatedAt:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
_m.CreatedAt = value.Int64
}
case inventorylock.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
_m.UpdatedAt = value.Int64
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the InventoryLock.
// This includes values selected through modifiers, order, etc.
func (_m *InventoryLock) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this InventoryLock.
// Note that you need to call InventoryLock.Unwrap() before calling this method if this InventoryLock
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *InventoryLock) Update() *InventoryLockUpdateOne {
return NewInventoryLockClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the InventoryLock entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (_m *InventoryLock) Unwrap() *InventoryLock {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: InventoryLock is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *InventoryLock) String() string {
var builder strings.Builder
builder.WriteString("InventoryLock(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("target_type=")
builder.WriteString(_m.TargetType)
builder.WriteString(", ")
builder.WriteString("target_id=")
builder.WriteString(_m.TargetID)
builder.WriteString(", ")
builder.WriteString("material_code=")
builder.WriteString(_m.MaterialCode)
builder.WriteString(", ")
builder.WriteString("locked_qty=")
builder.WriteString(fmt.Sprintf("%v", _m.LockedQty))
builder.WriteString(", ")
builder.WriteString("order_no=")
builder.WriteString(_m.OrderNo)
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(_m.Status)
builder.WriteString(", ")
builder.WriteString("expired_at=")
builder.WriteString(fmt.Sprintf("%v", _m.ExpiredAt))
builder.WriteString(", ")
builder.WriteString("remark=")
builder.WriteString(_m.Remark)
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(fmt.Sprintf("%v", _m.CreatedAt))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(fmt.Sprintf("%v", _m.UpdatedAt))
builder.WriteByte(')')
return builder.String()
}
// InventoryLocks is a parsable slice of InventoryLock.
type InventoryLocks []*InventoryLock