feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段

- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统
- 为BomItem实体添加relatedStandard字段及相关CRUD方法
- 为InspectionRecord实体添加reportNo、materialCode、materialName等字段
- 更新ent schema确保新字段的验证和默认值设置
- 添加必要的数据库迁移和字段映射逻辑
This commit is contained in:
SunYF
2026-09-17 12:49:07 +08:00
parent b4b274301d
commit 1cc93795ce
191 changed files with 24504 additions and 1250 deletions
+12 -1
View File
@@ -37,6 +37,8 @@ type WorkpieceProcess struct {
StartedAt *time.Time `json:"startedAt,omitempty"`
// EndedAt holds the value of the "endedAt" field.
EndedAt *time.Time `json:"endedAt,omitempty"`
// 作业时长(秒)=endedAt-startedAt
DurationSec int `json:"durationSec,omitempty"`
// Remark holds the value of the "remark" field.
Remark string `json:"remark,omitempty"`
// CreatedAt holds the value of the "createdAt" field.
@@ -49,7 +51,7 @@ func (*WorkpieceProcess) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case workpieceprocess.FieldID, workpieceprocess.FieldProcessCode:
case workpieceprocess.FieldID, workpieceprocess.FieldProcessCode, workpieceprocess.FieldDurationSec:
values[i] = new(sql.NullInt64)
case workpieceprocess.FieldSn, workpieceprocess.FieldStationNo, workpieceprocess.FieldOrderNo, workpieceprocess.FieldProcessName, workpieceprocess.FieldStatus, workpieceprocess.FieldOperator, workpieceprocess.FieldResult, workpieceprocess.FieldRemark:
values[i] = new(sql.NullString)
@@ -138,6 +140,12 @@ func (_m *WorkpieceProcess) assignValues(columns []string, values []any) error {
_m.EndedAt = new(time.Time)
*_m.EndedAt = value.Time
}
case workpieceprocess.FieldDurationSec:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field durationSec", values[i])
} else if value.Valid {
_m.DurationSec = int(value.Int64)
}
case workpieceprocess.FieldRemark:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field remark", values[i])
@@ -220,6 +228,9 @@ func (_m *WorkpieceProcess) String() string {
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteString(", ")
builder.WriteString("durationSec=")
builder.WriteString(fmt.Sprintf("%v", _m.DurationSec))
builder.WriteString(", ")
builder.WriteString("remark=")
builder.WriteString(_m.Remark)
builder.WriteString(", ")