Files
SunYF bf3a408839 refactor: 统一术语BOM为物料清单并补充工位扩展能力
主要变更:
1.  后端:重构工位管理逻辑,新增工位自定义扩展能力,将工位号上限调整为999并支持14+虚拟工位
2.  前后端:全量替换"BOM"术语为"物料清单",包括提示语、注释和文档
3.  WMS模块:新增AGV任务取消接口与前端页面,对接海康RCS取消任务逻辑
4.  权限与种子数据:新增工位新增权限并更新权限配置
5.  修复错误校验逻辑,优化AGV客户端签名与请求处理
2026-09-17 19:41:00 +08:00

53 lines
2.1 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 (
"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 产品物料清单明细(一个产品型号可并存多份:不同厂家供货/含半成品等不同料单结构,工单建单时选定一份)
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("物料清单名称:同一型号多份并存(如 厂家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.String("relatedStandard").Default("").MaxLen(255).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(),
}
}