Files
SunYF 1cc93795ce feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段
- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统
- 为BomItem实体添加relatedStandard字段及相关CRUD方法
- 为InspectionRecord实体添加reportNo、materialCode、materialName等字段
- 更新ent schema确保新字段的验证和默认值设置
- 添加必要的数据库迁移和字段映射逻辑
2026-09-17 12:49:07 +08:00

34 lines
1.5 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/field"
)
// Zone 库房货位主数据(区域 → 货架 → 层 → 位置 四级)
// 客户诉求(问题记录 L32/L169 + U18):货位按「区域(zone_code) + 货架号 + 第几层 + 位置号」四级定位,
// 四级均手填、不做编号规则校验(L584)。每一行 = 一个货位。
// zone_code 只是四级中的“区域”这一级,同一区域下可有多个货位,故 zone_code 不再单列唯一;
// 货位唯一性由组合唯一索引 ux_zones_location(zone_code, shelf_no, layer_no, position_no) 保证
// (见 internal/db/db.go applyColumnPatches,用 COALESCE 归一空值,防止同一货位重复登记)。
type Zone struct {
ent.Schema
}
func (Zone) Fields() []ent.Field {
return []ent.Field{
field.String("zone_code").Comment("区域编码(货位四级第一级;同区域可多货位,故不单列唯一)"),
field.String("zone_name").Comment("区域名称"),
field.String("description").Optional().Comment("描述"),
// 货架号(手填,如 A/03
field.String("shelf_no").Optional().Comment("货架号(手填)"),
// 第几层(手填,如 3
field.String("layer_no").Optional().Comment("第几层(手填)"),
// 位置号(手填,如 12
field.String("position_no").Optional().Comment("位置号(手填)"),
field.String("status").Default("启用").Comment("状态:启用/停用"),
field.Int64("created_at").DefaultFunc(nowUnix),
field.Int64("updated_at").DefaultFunc(nowUnix).Optional().Comment("更新时间"),
}
}