refactor(wms): 合并库存表为统一inventory,重构业务逻辑
1. 合并inventory_batch与serial_number为统一inventory表,用manage_mode区分结构件批次/精密件SN 2. 移除冗余的material_type字段与相关逻辑 3. 重构库存查询、检验、入库出库等业务逻辑适配新表结构 4. 调整前端路由与菜单,拆分基础数据为区域维护和物料档案 5. 优化入库校验逻辑,避免空单问题 6. 调整Vite构建配置,关闭自动清空输出目录 7. 为各模块添加详细中文注释,统一业务术语 8. 生成并更新Ent自动代码文件
This commit is contained in:
@@ -0,0 +1,182 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package inventory
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the inventory type in the database.
|
||||
Label = "inventory"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldManageMode holds the string denoting the manage_mode field in the database.
|
||||
FieldManageMode = "manage_mode"
|
||||
// FieldMaterialCode holds the string denoting the material_code field in the database.
|
||||
FieldMaterialCode = "material_code"
|
||||
// FieldMaterialName holds the string denoting the material_name field in the database.
|
||||
FieldMaterialName = "material_name"
|
||||
// FieldBatchNo holds the string denoting the batch_no field in the database.
|
||||
FieldBatchNo = "batch_no"
|
||||
// FieldSnCode holds the string denoting the sn_code field in the database.
|
||||
FieldSnCode = "sn_code"
|
||||
// FieldQuantity holds the string denoting the quantity field in the database.
|
||||
FieldQuantity = "quantity"
|
||||
// FieldLockedQty holds the string denoting the locked_qty field in the database.
|
||||
FieldLockedQty = "locked_qty"
|
||||
// FieldQualityStatus holds the string denoting the quality_status field in the database.
|
||||
FieldQualityStatus = "quality_status"
|
||||
// FieldZoneCode holds the string denoting the zone_code field in the database.
|
||||
FieldZoneCode = "zone_code"
|
||||
// FieldStatus holds the string denoting the status field in the database.
|
||||
FieldStatus = "status"
|
||||
// FieldProductionDate holds the string denoting the production_date field in the database.
|
||||
FieldProductionDate = "production_date"
|
||||
// FieldSupplier holds the string denoting the supplier field in the database.
|
||||
FieldSupplier = "supplier"
|
||||
// FieldInboundNo holds the string denoting the inbound_no field in the database.
|
||||
FieldInboundNo = "inbound_no"
|
||||
// FieldRemark holds the string denoting the remark field in the database.
|
||||
FieldRemark = "remark"
|
||||
// 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 inventory in the database.
|
||||
Table = "inventories"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for inventory fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldManageMode,
|
||||
FieldMaterialCode,
|
||||
FieldMaterialName,
|
||||
FieldBatchNo,
|
||||
FieldSnCode,
|
||||
FieldQuantity,
|
||||
FieldLockedQty,
|
||||
FieldQualityStatus,
|
||||
FieldZoneCode,
|
||||
FieldStatus,
|
||||
FieldProductionDate,
|
||||
FieldSupplier,
|
||||
FieldInboundNo,
|
||||
FieldRemark,
|
||||
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 (
|
||||
// DefaultQuantity holds the default value on creation for the "quantity" field.
|
||||
DefaultQuantity int
|
||||
// DefaultLockedQty holds the default value on creation for the "locked_qty" field.
|
||||
DefaultLockedQty int
|
||||
// DefaultQualityStatus holds the default value on creation for the "quality_status" field.
|
||||
DefaultQualityStatus string
|
||||
// DefaultStatus holds the default value on creation for the "status" field.
|
||||
DefaultStatus string
|
||||
// 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 Inventory 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()
|
||||
}
|
||||
|
||||
// ByManageMode orders the results by the manage_mode field.
|
||||
func ByManageMode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldManageMode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMaterialCode orders the results by the material_code field.
|
||||
func ByMaterialCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMaterialCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMaterialName orders the results by the material_name field.
|
||||
func ByMaterialName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMaterialName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBatchNo orders the results by the batch_no field.
|
||||
func ByBatchNo(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBatchNo, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySnCode orders the results by the sn_code field.
|
||||
func BySnCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSnCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByQuantity orders the results by the quantity field.
|
||||
func ByQuantity(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldQuantity, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLockedQty orders the results by the locked_qty field.
|
||||
func ByLockedQty(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLockedQty, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByQualityStatus orders the results by the quality_status field.
|
||||
func ByQualityStatus(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldQualityStatus, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByZoneCode orders the results by the zone_code field.
|
||||
func ByZoneCode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldZoneCode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatus orders the results by the status field.
|
||||
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByProductionDate orders the results by the production_date field.
|
||||
func ByProductionDate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldProductionDate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySupplier orders the results by the supplier field.
|
||||
func BySupplier(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSupplier, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByInboundNo orders the results by the inbound_no field.
|
||||
func ByInboundNo(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldInboundNo, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRemark orders the results by the remark field.
|
||||
func ByRemark(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRemark, 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()
|
||||
}
|
||||
Reference in New Issue
Block a user