- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统 - 为BomItem实体添加relatedStandard字段及相关CRUD方法 - 为InspectionRecord实体添加reportNo、materialCode、materialName等字段 - 更新ent schema确保新字段的验证和默认值设置 - 添加必要的数据库迁移和字段映射逻辑
179 lines
6.4 KiB
Go
179 lines
6.4 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package material
|
|
|
|
import (
|
|
"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"
|
|
// FieldShortName holds the string denoting the short_name field in the database.
|
|
FieldShortName = "short_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 item_type field in the database.
|
|
FieldItemType = "item_type"
|
|
// FieldManageMode holds the string denoting the manage_mode field in the database.
|
|
FieldManageMode = "manage_mode"
|
|
// FieldIsBatchManaged holds the string denoting the is_batch_managed field in the database.
|
|
FieldIsBatchManaged = "is_batch_managed"
|
|
// FieldIsSerialManaged holds the string denoting the is_serial_managed field in the database.
|
|
FieldIsSerialManaged = "is_serial_managed"
|
|
// FieldTemplateCode holds the string denoting the template_code field in the database.
|
|
FieldTemplateCode = "template_code"
|
|
// FieldSafetyStock holds the string denoting the safety_stock field in the database.
|
|
FieldSafetyStock = "safety_stock"
|
|
// FieldIsActive holds the string denoting the is_active field in the database.
|
|
FieldIsActive = "is_active"
|
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
|
FieldCreatedAt = "created_at"
|
|
// FieldUpdatedAt holds the string denoting the updated_at 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,
|
|
FieldShortName,
|
|
FieldSpec,
|
|
FieldUnit,
|
|
FieldDescription,
|
|
FieldItemType,
|
|
FieldManageMode,
|
|
FieldIsBatchManaged,
|
|
FieldIsSerialManaged,
|
|
FieldTemplateCode,
|
|
FieldSafetyStock,
|
|
FieldIsActive,
|
|
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 (
|
|
// DefaultItemType holds the default value on creation for the "item_type" field.
|
|
DefaultItemType int
|
|
// DefaultManageMode holds the default value on creation for the "manage_mode" field.
|
|
DefaultManageMode int
|
|
// DefaultIsBatchManaged holds the default value on creation for the "is_batch_managed" field.
|
|
DefaultIsBatchManaged bool
|
|
// DefaultIsSerialManaged holds the default value on creation for the "is_serial_managed" field.
|
|
DefaultIsSerialManaged bool
|
|
// DefaultSafetyStock holds the default value on creation for the "safety_stock" field.
|
|
DefaultSafetyStock int
|
|
// DefaultIsActive holds the default value on creation for the "is_active" field.
|
|
DefaultIsActive bool
|
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
|
DefaultCreatedAt func() int64
|
|
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
|
DefaultUpdatedAt func() int64
|
|
)
|
|
|
|
// 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()
|
|
}
|
|
|
|
// ByShortName orders the results by the short_name field.
|
|
func ByShortName(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldShortName, 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 item_type field.
|
|
func ByItemType(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldItemType, opts...).ToFunc()
|
|
}
|
|
|
|
// ByManageMode orders the results by the manage_mode field.
|
|
func ByManageMode(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldManageMode, opts...).ToFunc()
|
|
}
|
|
|
|
// ByIsBatchManaged orders the results by the is_batch_managed field.
|
|
func ByIsBatchManaged(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldIsBatchManaged, opts...).ToFunc()
|
|
}
|
|
|
|
// ByIsSerialManaged orders the results by the is_serial_managed field.
|
|
func ByIsSerialManaged(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldIsSerialManaged, opts...).ToFunc()
|
|
}
|
|
|
|
// ByTemplateCode orders the results by the template_code field.
|
|
func ByTemplateCode(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldTemplateCode, opts...).ToFunc()
|
|
}
|
|
|
|
// BySafetyStock orders the results by the safety_stock field.
|
|
func BySafetyStock(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldSafetyStock, opts...).ToFunc()
|
|
}
|
|
|
|
// ByIsActive orders the results by the is_active field.
|
|
func ByIsActive(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldIsActive, opts...).ToFunc()
|
|
}
|
|
|
|
// ByCreatedAt orders the results by the created_at field.
|
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
|
}
|
|
|
|
// ByUpdatedAt orders the results by the updated_at field.
|
|
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
|
|
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
|
|
}
|