45 lines
1.8 KiB
Go
45 lines
1.8 KiB
Go
package schema
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"entgo.io/ent"
|
||
|
|
"entgo.io/ent/dialect/entsql"
|
||
|
|
"entgo.io/ent/schema"
|
||
|
|
"entgo.io/ent/schema/field"
|
||
|
|
"entgo.io/ent/schema/index"
|
||
|
|
)
|
||
|
|
|
||
|
|
// DeliveryOrderItem 配送单明细(2026-11-05 拍板:配送单必须有配送详情)。
|
||
|
|
// 一行 = 一个物料 × 数量 × 工位 × 工单 × 工艺 × 排产日;
|
||
|
|
// 由叫料单(material_request,含 plan_breakdown 明细)在创建配送单时快照落库。
|
||
|
|
type DeliveryOrderItem struct {
|
||
|
|
ent.Schema
|
||
|
|
}
|
||
|
|
|
||
|
|
func (DeliveryOrderItem) Annotations() []schema.Annotation {
|
||
|
|
return []schema.Annotation{entsql.Annotation{Table: "delivery_order_item"}, entsql.WithComments(true), schema.Comment("DeliveryOrderItem 配送单明细:物料×量×工位×工单×工艺×排产日")}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (DeliveryOrderItem) Fields() []ent.Field {
|
||
|
|
return []ent.Field{
|
||
|
|
field.Int("id").Positive(),
|
||
|
|
field.String("deliveryNo").MaxLen(64).Comment("配送单号"),
|
||
|
|
field.String("requestNo").Default("").MaxLen(64).Comment("关联叫料单号"),
|
||
|
|
field.String("materialCode").MaxLen(64).Comment("物料编码"),
|
||
|
|
field.String("materialName").Default("").MaxLen(128).Comment("物料名称"),
|
||
|
|
field.String("unit").Default("").MaxLen(16).Comment("单位"),
|
||
|
|
field.Float("qty").Default(0).Comment("本次配送数量"),
|
||
|
|
field.Int("stationNo").Default(0).Comment("目标工位号"),
|
||
|
|
field.String("orderNo").Default("").MaxLen(64).Comment("工单号(物料挂工单)"),
|
||
|
|
field.String("flowName").Default("").MaxLen(128).Comment("工艺名"),
|
||
|
|
field.String("planDate").Default("").MaxLen(10).Comment("排产日 yyyy-MM-dd"),
|
||
|
|
field.Int("snMode").Default(2).Comment("序列号 1=是(逐件SN)/2=否"),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (DeliveryOrderItem) Indexes() []ent.Index {
|
||
|
|
return []ent.Index{
|
||
|
|
index.Fields("deliveryNo"),
|
||
|
|
index.Fields("requestNo"),
|
||
|
|
}
|
||
|
|
}
|