- MES(B): 工单/BOM/备料/工序字典/PLC下发/拧紧/扫码报工/半成品/AGV/追溯逻辑,WMS与海康RCS客户端,看板Redis缓存API(概览/设备/进度/报警/趋势)+SSE - WMS(C): JWT滑动续签、Excel导入、盘点、内部API、种子数据、独立Postgres配置 - WMS客户端(E): Go网关8891反向代理+内嵌Vue3十页 - 工位终端(D): SQLite本地缓存+模拟拧紧源+内嵌Vue3页面 - Dashboard(A): 看板数据改接MES内部缓存API,SSE实时刷新+vite代理 - 清理各项目球形磨遗留代码,新增部署手册.md
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/field"
|
|
"entgo.io/ent/schema/index"
|
|
)
|
|
|
|
// SerialNumber 精密件/成品 单件管理
|
|
type SerialNumber struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (SerialNumber) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.String("sn_code").Unique().Comment("序列号"),
|
|
field.String("material_code").Comment("物料编码"),
|
|
field.String("batch_no").Optional().Comment("所属批次"),
|
|
// 状态:在库/锁定/出库/使用/报废
|
|
field.String("status").Default("在库").Comment("在库/锁定/出库/使用/报废"),
|
|
field.String("current_zone").Optional().Comment("当前区域"),
|
|
field.String("quality_status").Default("未检").Comment("检验状态 未检/合格/不合格"),
|
|
field.String("last_inbound_at").Optional().Comment("最近入库时间"),
|
|
field.String("last_outbound_at").Optional().Comment("最近出库时间"),
|
|
field.String("remark").Optional().Comment("备注"),
|
|
field.Int64("created_at").DefaultFunc(nowUnix),
|
|
field.Int64("updated_at").DefaultFunc(nowUnix),
|
|
}
|
|
}
|
|
|
|
func (SerialNumber) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("material_code"),
|
|
index.Fields("status"),
|
|
index.Fields("batch_no"),
|
|
}
|
|
}
|