Files
bj_power/bj_power_mes/ent/material/material.go
T
SunYF c33acab9c8 feat: 解耦管理类型与SN管理方式,新增sn_mode字段实现全链路SN管理标准化
本次重构将原manage_mode字段拆分为独立的分类维度(manage_mode)和SN管理维度(sn_mode),实现全链路(MES/WMS/工位终端)的SN管理行为统一依据:
1. 新增sn_mode字段,定义1=序列号件、2=批次件、0=未选择,替代原manage_mode的SN判断逻辑
2. 移除冗余的manage_mode字段在多个实体中的使用,统一使用sn_mode决定业务行为
3. 新增工位接驳台配置,服务端固定接驳台,前端不可修改,确保AGV送达准确性
4. 优化检验记录导出,新增装配物料绑定明细,满足客户追溯需求
5. 修正前端提示文本,统一使用序列号件/批次件表述,与后端逻辑对齐
2026-09-30 17:33:11 +08:00

195 lines
7.2 KiB
Go

// Code generated by ent, DO NOT EDIT.
package material
import (
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the material type in the database.
Label = "material"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCode holds the string denoting the code field in the database.
FieldCode = "code"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldSpec holds the string denoting the spec field in the database.
FieldSpec = "spec"
// FieldUnit holds the string denoting the unit field in the database.
FieldUnit = "unit"
// FieldDescription holds the string denoting the description field in the database.
FieldDescription = "description"
// FieldItemType holds the string denoting the itemtype field in the database.
FieldItemType = "item_type"
// FieldManageMode holds the string denoting the managemode field in the database.
FieldManageMode = "manage_mode"
// FieldSnMode holds the string denoting the snmode field in the database.
FieldSnMode = "sn_mode"
// FieldTemplateCode holds the string denoting the templatecode field in the database.
FieldTemplateCode = "template_code"
// FieldSafetyStock holds the string denoting the safetystock field in the database.
FieldSafetyStock = "safety_stock"
// FieldIsActive holds the string denoting the isactive field in the database.
FieldIsActive = "is_active"
// FieldSyncPending holds the string denoting the syncpending field in the database.
FieldSyncPending = "sync_pending"
// FieldCreatedAt holds the string denoting the createdat field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updatedat field in the database.
FieldUpdatedAt = "updated_at"
// Table holds the table name of the material in the database.
Table = "materials"
)
// Columns holds all SQL columns for material fields.
var Columns = []string{
FieldID,
FieldCode,
FieldName,
FieldSpec,
FieldUnit,
FieldDescription,
FieldItemType,
FieldManageMode,
FieldSnMode,
FieldTemplateCode,
FieldSafetyStock,
FieldIsActive,
FieldSyncPending,
FieldCreatedAt,
FieldUpdatedAt,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// CodeValidator is a validator for the "code" field. It is called by the builders before save.
CodeValidator func(string) error
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
// DefaultSpec holds the default value on creation for the "spec" field.
DefaultSpec string
// SpecValidator is a validator for the "spec" field. It is called by the builders before save.
SpecValidator func(string) error
// DefaultUnit holds the default value on creation for the "unit" field.
DefaultUnit string
// UnitValidator is a validator for the "unit" field. It is called by the builders before save.
UnitValidator func(string) error
// DefaultDescription holds the default value on creation for the "description" field.
DefaultDescription string
// DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
DescriptionValidator func(string) error
// DefaultItemType holds the default value on creation for the "itemType" field.
DefaultItemType int
// DefaultManageMode holds the default value on creation for the "manageMode" field.
DefaultManageMode int
// DefaultSnMode holds the default value on creation for the "snMode" field.
DefaultSnMode int
// DefaultTemplateCode holds the default value on creation for the "templateCode" field.
DefaultTemplateCode string
// TemplateCodeValidator is a validator for the "templateCode" field. It is called by the builders before save.
TemplateCodeValidator func(string) error
// DefaultSafetyStock holds the default value on creation for the "safetyStock" field.
DefaultSafetyStock int
// DefaultIsActive holds the default value on creation for the "isActive" field.
DefaultIsActive bool
// DefaultSyncPending holds the default value on creation for the "syncPending" field.
DefaultSyncPending bool
// DefaultCreatedAt holds the default value on creation for the "createdAt" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updatedAt" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updatedAt" field.
UpdateDefaultUpdatedAt func() time.Time
)
// OrderOption defines the ordering options for the Material queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByCode orders the results by the code field.
func ByCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCode, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// BySpec orders the results by the spec field.
func BySpec(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSpec, opts...).ToFunc()
}
// ByUnit orders the results by the unit field.
func ByUnit(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUnit, opts...).ToFunc()
}
// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDescription, opts...).ToFunc()
}
// ByItemType orders the results by the itemType field.
func ByItemType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldItemType, opts...).ToFunc()
}
// ByManageMode orders the results by the manageMode field.
func ByManageMode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldManageMode, opts...).ToFunc()
}
// BySnMode orders the results by the snMode field.
func BySnMode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSnMode, opts...).ToFunc()
}
// ByTemplateCode orders the results by the templateCode field.
func ByTemplateCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTemplateCode, opts...).ToFunc()
}
// BySafetyStock orders the results by the safetyStock field.
func BySafetyStock(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSafetyStock, opts...).ToFunc()
}
// ByIsActive orders the results by the isActive field.
func ByIsActive(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIsActive, opts...).ToFunc()
}
// BySyncPending orders the results by the syncPending field.
func BySyncPending(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSyncPending, opts...).ToFunc()
}
// ByCreatedAt orders the results by the createdAt field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updatedAt field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}