feat: 完成产线与仓储系统多模块迭代升级
本次迭代覆盖MES与WMS核心业务: 1. 新增接驳台托盘传感器读取与AGV对接能力 2. 完善工单排产、备料流程与权限体系拆分 3. 优化看板接口与前端路由、样式 4. 新增操作日志、库存盘点与角色保护逻辑 5. 修复代理地址、BOM保存等已知问题
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"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"
|
||||
)
|
||||
|
||||
// EventLog 操作日志(事件审计)
|
||||
// 参照 MES 的 event_log 模型落地到 WMS,按 WMS 约定调整:
|
||||
// - 字段名 snake_case(tools/generate.go 统一转 camelCase 输出 JSON)
|
||||
// - 时间字段用 Int64 unix 秒
|
||||
// - 无 work_order_no(WMS 无工单概念),用 entity_type/entity_id 描述业务对象
|
||||
// 只增不改,不设 updated_at。
|
||||
type EventLog struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (EventLog) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Annotation{Table: "event_log"}}
|
||||
}
|
||||
|
||||
func (EventLog) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("event_type").MaxLen(64).Comment("事件类型,如 user.create / inbound.create / auth.login"),
|
||||
field.String("operator").Default("").MaxLen(64).Comment("操作人"),
|
||||
field.String("entity_type").Default("").MaxLen(32).Comment("对象类型,如 user/role/material/inbound/outbound"),
|
||||
field.String("entity_id").Default("").MaxLen(64).Comment("对象标识:主键ID或业务单号"),
|
||||
field.Text("description").Default("").Comment("事件描述"),
|
||||
field.JSON("payload", map[string]any{}).Optional().SchemaType(map[string]string{
|
||||
dialect.Postgres: "jsonb",
|
||||
}).Comment("扩展负载"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix).Comment("发生时间"),
|
||||
}
|
||||
}
|
||||
|
||||
func (EventLog) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("event_type"),
|
||||
index.Fields("operator"),
|
||||
index.Fields("created_at"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user