Files
bj_power/bj_power_wms/schema/inbound_detail.go
T

38 lines
1.2 KiB
Go
Raw Normal View History

2026-08-28 15:06:01 +08:00
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
2026-08-28 15:06:01 +08:00
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// InboundDetail 入库明细(一张入库单可含多行)
// 结构件记录 batch_no,电气件记录 sn_code(逐件一行),quantity 冗余记录该行数量。
// 用于入库单正向追溯(查某入库单具体入了哪些批次/SN)。
2026-08-28 15:06:01 +08:00
type InboundDetail struct {
ent.Schema
}
func (InboundDetail) Annotations() []schema.Annotation {
return []schema.Annotation{entsql.Table("inbound_details"), entsql.WithComments(true), schema.Comment("InboundDetail 入库明细(一张入库单可含多行)")}
}
2026-08-28 15:06:01 +08:00
func (InboundDetail) Fields() []ent.Field {
return []ent.Field{
field.String("inbound_no").Comment("入库单号"),
field.String("sn_code").Optional().Comment("SN(电气件)"),
2026-08-28 15:06:01 +08:00
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"),
}
}