feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段
- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统 - 为BomItem实体添加relatedStandard字段及相关CRUD方法 - 为InspectionRecord实体添加reportNo、materialCode、materialName等字段 - 更新ent schema确保新字段的验证和默认值设置 - 添加必要的数据库迁移和字段映射逻辑
This commit is contained in:
@@ -144,6 +144,20 @@ func (_c *WorkpieceProcessCreate) SetNillableEndedAt(v *time.Time) *WorkpiecePro
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDurationSec sets the "durationSec" field.
|
||||
func (_c *WorkpieceProcessCreate) SetDurationSec(v int) *WorkpieceProcessCreate {
|
||||
_c.mutation.SetDurationSec(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableDurationSec sets the "durationSec" field if the given value is not nil.
|
||||
func (_c *WorkpieceProcessCreate) SetNillableDurationSec(v *int) *WorkpieceProcessCreate {
|
||||
if v != nil {
|
||||
_c.SetDurationSec(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetRemark sets the "remark" field.
|
||||
func (_c *WorkpieceProcessCreate) SetRemark(v string) *WorkpieceProcessCreate {
|
||||
_c.mutation.SetRemark(v)
|
||||
@@ -237,6 +251,10 @@ func (_c *WorkpieceProcessCreate) defaults() {
|
||||
v := workpieceprocess.DefaultResult
|
||||
_c.mutation.SetResult(v)
|
||||
}
|
||||
if _, ok := _c.mutation.DurationSec(); !ok {
|
||||
v := workpieceprocess.DefaultDurationSec
|
||||
_c.mutation.SetDurationSec(v)
|
||||
}
|
||||
if _, ok := _c.mutation.Remark(); !ok {
|
||||
v := workpieceprocess.DefaultRemark
|
||||
_c.mutation.SetRemark(v)
|
||||
@@ -308,6 +326,9 @@ func (_c *WorkpieceProcessCreate) check() error {
|
||||
return &ValidationError{Name: "result", err: fmt.Errorf(`ent: validator failed for field "WorkpieceProcess.result": %w`, err)}
|
||||
}
|
||||
}
|
||||
if _, ok := _c.mutation.DurationSec(); !ok {
|
||||
return &ValidationError{Name: "durationSec", err: errors.New(`ent: missing required field "WorkpieceProcess.durationSec"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.Remark(); !ok {
|
||||
return &ValidationError{Name: "remark", err: errors.New(`ent: missing required field "WorkpieceProcess.remark"`)}
|
||||
}
|
||||
@@ -396,6 +417,10 @@ func (_c *WorkpieceProcessCreate) createSpec() (*WorkpieceProcess, *sqlgraph.Cre
|
||||
_spec.SetField(workpieceprocess.FieldEndedAt, field.TypeTime, value)
|
||||
_node.EndedAt = &value
|
||||
}
|
||||
if value, ok := _c.mutation.DurationSec(); ok {
|
||||
_spec.SetField(workpieceprocess.FieldDurationSec, field.TypeInt, value)
|
||||
_node.DurationSec = value
|
||||
}
|
||||
if value, ok := _c.mutation.Remark(); ok {
|
||||
_spec.SetField(workpieceprocess.FieldRemark, field.TypeString, value)
|
||||
_node.Remark = value
|
||||
|
||||
Reference in New Issue
Block a user