feat: 五项目业务实现并对接完成
- 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
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// InboundDetail 入库明细(SN 逐条)
|
||||
type InboundDetail struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (InboundDetail) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("inbound_no").Comment("入库单号"),
|
||||
field.String("sn_code").Optional().Comment("SN(精密件)"),
|
||||
field.String("batch_no").Optional().Comment("批次号(结构件)"),
|
||||
field.String("material_code").Comment("物料编码"),
|
||||
field.Int("quantity").Default(1).Comment("数量"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (InboundDetail) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("inbound_no"),
|
||||
index.Fields("sn_code"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// InboundOrder 入库单
|
||||
type InboundOrder struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (InboundOrder) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("inbound_no").Unique().Comment("入库单号"),
|
||||
// 类型:purchase(采购) semi(半成品) finished(成品) return(退货)
|
||||
field.String("inbound_type").Default("purchase").Comment("入库类型"),
|
||||
field.String("material_code").Comment("物料编码"),
|
||||
field.String("material_name").Optional().Comment("物料名称(冗余)"),
|
||||
// 管理粒度 1批次/2序列号
|
||||
field.Int("manage_mode").Default(1),
|
||||
field.String("batch_no").Optional().Comment("批次号(结构件)"),
|
||||
field.String("zone_code").Optional().Comment("入库区域"),
|
||||
field.Int("quantity").Default(0).Comment("数量"),
|
||||
field.String("operator").Optional().Comment("操作人"),
|
||||
field.String("remark").Optional().Comment("备注"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (InboundOrder) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("material_code"),
|
||||
index.Fields("inbound_type"),
|
||||
index.Fields("operator"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// InspectionRecord 检验记录
|
||||
// 来料检/过程检/成品检;支持批量翻转;部分检验项录实测值
|
||||
type InspectionRecord struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (InspectionRecord) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// 检验对象:BATCH/SN
|
||||
field.String("target_type").Comment("BATCH/SN"),
|
||||
field.String("target_id").Comment("批次号或 SN"),
|
||||
field.String("material_code").Comment("物料编码"),
|
||||
// 检验类型:incoming(来料检) process(过程检) finished(成品检)
|
||||
field.String("inspection_type").Default("incoming").Comment("来料检/过程检/成品检"),
|
||||
field.String("status").Default("未检").Comment("未检/合格/不合格"),
|
||||
field.String("result_value").Optional().Comment("实测值(部分检验项)"),
|
||||
field.String("inspector").Optional().Comment("检验人"),
|
||||
field.String("remark").Optional().Comment("备注"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
field.Int64("updated_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (InspectionRecord) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("target_id"),
|
||||
index.Fields("material_code"),
|
||||
index.Fields("inspection_type"),
|
||||
index.Fields("status"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
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"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// InventoryLock 库存锁定(工单锁库存,防超卖)
|
||||
type InventoryLock struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (InventoryLock) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// 锁定对象:批次或 SN
|
||||
field.String("target_type").Comment("BATCH/SN"),
|
||||
field.String("target_id").Comment("批次号或 SN"),
|
||||
field.String("material_code").Comment("物料编码"),
|
||||
field.Int("locked_qty").Default(1).Comment("锁定数量"),
|
||||
field.String("order_no").Comment("关联工单号"),
|
||||
field.String("status").Default("ACTIVE").Comment("ACTIVE/RELEASED/CONSUMED"),
|
||||
field.Int64("expired_at").Optional().Comment("过期时间戳"),
|
||||
field.String("remark").Optional().Comment("备注"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
field.Int64("updated_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (InventoryLock) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("order_no"),
|
||||
index.Fields("status"),
|
||||
index.Fields("target_id"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// Material 物料档案
|
||||
// 精密件(manage_mode=2) 逐件 SN 管理;结构件(manage_mode=1) 批次管理
|
||||
type Material struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (Material) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("code").Unique().Comment("物料唯一编码"),
|
||||
field.String("name").Comment("物料真实名称"),
|
||||
field.String("short_name").Optional().Comment("简称"),
|
||||
field.String("spec").Optional().Comment("规格型号"),
|
||||
field.String("unit").Optional().Comment("单位"),
|
||||
field.String("description").Optional().Comment("描述"),
|
||||
// 管理粒度:1=批次管理(结构件) 2=序列号管理(精密件)
|
||||
field.Int("manage_mode").Default(1).Comment("管理粒度 1批次/2序列号"),
|
||||
field.Bool("is_batch_managed").Default(false).Comment("是否批次管理"),
|
||||
field.Bool("is_serial_managed").Default(false).Comment("是否序列号管理"),
|
||||
// 物料类型:raw(原材料) semi(半成品) finished(成品)
|
||||
field.String("material_type").Default("raw").Comment("物料总状态 raw/semi/finished"),
|
||||
// 所属物料模板(种类)
|
||||
field.String("template_code").Optional().Comment("物料模板编码(物料种类)"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix).Comment("创建时间"),
|
||||
field.Int64("updated_at").DefaultFunc(nowUnix).Comment("更新时间"),
|
||||
}
|
||||
}
|
||||
|
||||
func (Material) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("name"),
|
||||
index.Fields("template_code"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package schema
|
||||
|
||||
import "time"
|
||||
|
||||
func nowUnix() int64 {
|
||||
return time.Now().Unix()
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// OrderMaterialLedger 工单物料台账(WMS 侧)
|
||||
// 维护:物料总需求数量、累计已出库数量、剩余待出库数量
|
||||
// 强约束:累计出库 ≤ 工单总需求量;等于时领料完结,禁止再出库
|
||||
type OrderMaterialLedger struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (OrderMaterialLedger) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("order_no").Comment("工单号"),
|
||||
field.String("material_code").Comment("物料编码"),
|
||||
field.String("material_name").Optional().Comment("物料名称(冗余)"),
|
||||
field.Int("total_qty").Default(0).Comment("物料总需求数量"),
|
||||
field.Int("out_qty").Default(0).Comment("累计已出库数量"),
|
||||
field.String("status").Default("进行中").Comment("进行中/领料完结"),
|
||||
field.String("remark").Optional().Comment("备注"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
field.Int64("updated_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (OrderMaterialLedger) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("order_no"),
|
||||
index.Fields("material_code"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// OutboundDetail 出库明细
|
||||
type OutboundDetail struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (OutboundDetail) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("outbound_no").Comment("出库单号"),
|
||||
field.String("sn_code").Optional().Comment("SN(精密件)"),
|
||||
field.String("batch_no").Optional().Comment("批次号(结构件)"),
|
||||
field.String("material_code").Comment("物料编码"),
|
||||
field.Int("quantity").Default(1).Comment("数量"),
|
||||
field.String("order_no").Optional().Comment("关联工单号"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (OutboundDetail) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("outbound_no"),
|
||||
index.Fields("sn_code"),
|
||||
index.Fields("order_no"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// OutboundOrder 出库单
|
||||
// 出库强约束:累计出库 ≤ 工单 BOM 需求量(由 MES 校验),WMS 侧校验 order_no 对应台账
|
||||
type OutboundOrder struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (OutboundOrder) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("outbound_no").Unique().Comment("出库单号"),
|
||||
// 类型:workorder(工单领料) semi(半成品) finished(成品) scrap(报废)
|
||||
field.String("outbound_type").Default("workorder").Comment("出库类型"),
|
||||
field.String("order_no").Optional().Comment("关联工单号(工单为唯一挂靠载体)"),
|
||||
field.String("material_code").Comment("物料编码"),
|
||||
field.String("material_name").Optional().Comment("物料名称(冗余)"),
|
||||
field.Int("manage_mode").Default(1),
|
||||
field.String("batch_no").Optional().Comment("批次号(结构件)"),
|
||||
field.String("zone_code").Optional().Comment("出库区域"),
|
||||
field.Int("quantity").Default(0).Comment("数量"),
|
||||
field.String("operator").Optional().Comment("操作人"),
|
||||
field.String("reviewer").Optional().Comment("复核人"),
|
||||
field.String("target_dock").Optional().Comment("目标接驳台(AGV配送)"),
|
||||
field.String("remark").Optional().Comment("备注"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (OutboundOrder) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("order_no"),
|
||||
index.Fields("material_code"),
|
||||
index.Fields("outbound_type"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// PackageBox 包装箱 ↔ SN 关联
|
||||
type PackageBox struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (PackageBox) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("box_no").Unique().Comment("箱号"),
|
||||
// 关联 SN 列表(逗号分隔)或 JSON
|
||||
field.String("sn_list").Optional().Comment("箱内 SN 列表"),
|
||||
field.String("material_code").Optional().Comment("物料编码"),
|
||||
field.Int("quantity").Default(0).Comment("箱内数量"),
|
||||
field.String("operator").Optional().Comment("包装人"),
|
||||
field.String("remark").Optional().Comment("备注"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (PackageBox) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("material_code"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// SemiFinished 半成品库存
|
||||
// 记录已完成工序,支持流转
|
||||
type SemiFinished struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (SemiFinished) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("sn").Unique().Comment("半成品 SN"),
|
||||
field.String("material_code").Comment("物料编码"),
|
||||
field.String("completed_process").Optional().Comment("已完成工序(如 135)"),
|
||||
field.Int("quantity").Default(1).Comment("数量"),
|
||||
field.String("zone_code").Optional().Comment("所在区域"),
|
||||
field.String("status").Default("在库").Comment("在库/出库/使用"),
|
||||
field.String("order_no").Optional().Comment("关联工单"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
field.Int64("updated_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (SemiFinished) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("material_code"),
|
||||
index.Fields("status"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
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"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// StocktakeOrder 盘点单:发起时冻结当时库存快照(明细行)
|
||||
type StocktakeOrder struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (StocktakeOrder) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("stocktake_no").Unique().Comment("盘点单号"),
|
||||
field.String("status").Default("进行中").Comment("进行中/已完成"),
|
||||
field.String("operator").Optional().Comment("发起人"),
|
||||
field.Int("total_targets").Default(0).Comment("快照目标数"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
field.Int64("finished_at").Optional().Comment("完成时间"),
|
||||
}
|
||||
}
|
||||
|
||||
func (StocktakeOrder) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("status"),
|
||||
}
|
||||
}
|
||||
|
||||
// StocktakeItem 盘点明细(发起时的账面快照 + 扫码实盘数)
|
||||
type StocktakeItem struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (StocktakeItem) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("stocktake_no").Comment("所属盘点单号"),
|
||||
field.String("target_type").Comment("BATCH/SN"),
|
||||
field.String("target_id").Comment("批次号或SN码"),
|
||||
field.String("material_code").Optional(),
|
||||
field.String("zone_code").Optional().Comment("所在区域"),
|
||||
field.Int("book_qty").Default(0).Comment("账面数量"),
|
||||
field.Int("scanned_qty").Default(-1).Comment("实盘数量,-1=未盘"),
|
||||
field.Int("diff_qty").Default(0).Comment("差异 = 实盘 - 账面"),
|
||||
field.Bool("counted").Default(false).Comment("是否已扫码"),
|
||||
field.Int64("updated_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (StocktakeItem) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("stocktake_no"),
|
||||
index.Fields("target_id"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// User 用户
|
||||
type User struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (User) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("username").Unique().Comment("登录名"),
|
||||
field.String("password").Comment("密码(哈希)"),
|
||||
field.String("real_name").Optional().Comment("姓名"),
|
||||
field.String("role").Default("operator").Comment("角色 admin/operator/inspector"),
|
||||
field.String("dept").Optional().Comment("部门"),
|
||||
field.String("phone").Optional().Comment("电话"),
|
||||
field.Bool("is_active").Default(true).Comment("是否启用"),
|
||||
field.Int64("last_login_at").Optional().Comment("最近登录时间"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
field.Int64("updated_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (User) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("role"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// Zone 库房区域
|
||||
// 待检/合格/不合格/退货区 等
|
||||
type Zone struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (Zone) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("zone_code").Unique().Comment("区域编码"),
|
||||
field.String("zone_name").Comment("区域名称"),
|
||||
field.String("description").Optional().Comment("描述"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user