Files
bj_power/bj_power_mes/schema/bom_item.go
T
SunYF e852c7cd37 chore: 批量完成项目多模块迭代优化
1. 废弃半成品库存表并统一库存主表
2. 修复列表排序与搜索大小写不敏感问题
3. 新增用户最近登录时间、工单BOM名称字段
4. 完善角色管理、工位选择器功能
5. 增加拧紧数据补录、成品自动回流WMS能力
6. 统一导出时间范围校验规则
7. 丰富物料/备料单筛选条件
8. 调整菜单与权限命名适配产品型号业务
2026-09-08 11:44:04 +08:00

52 lines
2.0 KiB
Go
Raw 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 (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// BomItem 产品 BOM 明细(一个产品型号可并存多份 BOM:不同厂家供货/含半成品等不同料单结构,工单建单时选定一份)
type BomItem struct {
ent.Schema
}
func (BomItem) Annotations() []schema.Annotation {
return []schema.Annotation{entsql.Annotation{Table: "work_order_bom"}}
}
func (BomItem) Fields() []ent.Field {
return []ent.Field{
field.Int("id").Positive(),
field.String("productCode").Default("").MaxLen(64).Comment("产品编码"),
field.String("bomName").Default("默认").MaxLen(64).Comment("BOM名称:同一型号多份并存(如 厂家A/厂家B/含半成品),工单按名选用"),
field.String("materialCode").MaxLen(64).Comment("物料编码"),
field.String("materialName").Default("").MaxLen(128),
field.String("spec").Default("").MaxLen(128),
field.String("unit").Default("").MaxLen(16),
// 1 批次(结构件) / 2 序列号(精密件)
field.String("manageMode").Default("2").MaxLen(10),
// 装配工序 1..12:该料在第几道工序被装配(装机绑定/齐套校验按此过滤);0=未指定,不参与工位绑定校验
field.Int("processCode").Default(0).Comment("装配工序 1~120=不参与工位绑定"),
field.Float("unitQty").Default(0).Comment("单台用量"),
field.Float("lossRate").Default(0).Comment("损耗率%"),
field.Float("requiredQty").Default(0).Comment("需求总量=总台数*单台*(1+损耗)"),
field.JSON("serialSns", []string{}).Optional().SchemaType(map[string]string{
dialect.Postgres: "jsonb",
}).Comment("精密件SN下发列表(可选)"),
field.Time("createdAt").Default(time.Now).Immutable(),
}
}
func (BomItem) Indexes() []ent.Index {
return []ent.Index{
index.Fields("productCode"),
index.Fields("productCode", "bomName", "materialCode").Unique(),
}
}