feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段
- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统 - 为BomItem实体添加relatedStandard字段及相关CRUD方法 - 为InspectionRecord实体添加reportNo、materialCode、materialName等字段 - 更新ent schema确保新字段的验证和默认值设置 - 添加必要的数据库迁移和字段映射逻辑
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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 秒)"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user