- 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"
|
|
)
|
|
|
|
// InventoryBatch 结构件批次台账
|
|
type InventoryBatch struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (InventoryBatch) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.String("batch_no").Unique().Comment("批次号(系统自动生成:日期+自增)"),
|
|
field.String("material_code").Comment("物料编码"),
|
|
field.String("material_name").Optional().Comment("物料名称(冗余)"),
|
|
field.Int("quantity").Default(0).Comment("当前可用数量"),
|
|
field.Int("locked_qty").Default(0).Comment("已锁定数量"),
|
|
field.String("production_date").Optional().Comment("生产日期"),
|
|
field.String("supplier").Optional().Comment("供应商"),
|
|
field.String("quality_status").Default("未检").Comment("检验状态 未检/合格/不合格"),
|
|
field.String("zone_code").Optional().Comment("所在区域"),
|
|
field.String("remark").Optional().Comment("备注"),
|
|
field.Int64("created_at").DefaultFunc(nowUnix),
|
|
field.Int64("updated_at").DefaultFunc(nowUnix),
|
|
}
|
|
}
|
|
|
|
func (InventoryBatch) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("material_code"),
|
|
index.Fields("quality_status"),
|
|
index.Fields("zone_code"),
|
|
}
|
|
}
|