24 lines
869 B
Go
24 lines
869 B
Go
package schema
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"entgo.io/ent"
|
||
|
|
"entgo.io/ent/schema/field"
|
||
|
|
)
|
||
|
|
|
||
|
|
// MaterialDemand 物料未来需求(MES 按日排产推送,WMS 备料四态"预警"判定的数据源)
|
||
|
|
//
|
||
|
|
// 客户口径(问题记录 L256):预警 = 可用库存 < 未来5天需求量,
|
||
|
|
// 未来5天需求量 = 近5天日排产 × 物料清单单台用量(日排产总量可大于库存量,附一#7)。
|
||
|
|
// 日排产只在 MES,故由 MES 计算后推送本表(按 material_code 覆盖更新)。
|
||
|
|
type MaterialDemand struct {
|
||
|
|
ent.Schema
|
||
|
|
}
|
||
|
|
|
||
|
|
func (MaterialDemand) Fields() []ent.Field {
|
||
|
|
return []ent.Field{
|
||
|
|
field.String("material_code").Unique().Comment("物料编码(图号)"),
|
||
|
|
field.Int("future5_qty").Default(0).Comment("未来5天需求量(近5天日排产×单台用量)"),
|
||
|
|
field.Int64("updated_at").DefaultFunc(nowUnix).Comment("更新时间(unix 秒)"),
|
||
|
|
}
|
||
|
|
}
|