42 lines
1.5 KiB
Go
42 lines
1.5 KiB
Go
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"),
|
|
}
|
|
}
|