feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段
- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统 - 为BomItem实体添加relatedStandard字段及相关CRUD方法 - 为InspectionRecord实体添加reportNo、materialCode、materialName等字段 - 更新ent schema确保新字段的验证和默认值设置 - 添加必要的数据库迁移和字段映射逻辑
This commit is contained in:
@@ -4,6 +4,7 @@ package ent
|
||||
|
||||
import (
|
||||
"bj_power_mes/ent/processstep"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -29,6 +30,8 @@ type ProcessStep struct {
|
||||
IsTorque bool `json:"isTorque,omitempty"`
|
||||
// 是否需要检测确认(报工前须检验通过)
|
||||
NeedCheck bool `json:"needCheck,omitempty"`
|
||||
// 本步骤图纸/附件列表 [{name,url}]
|
||||
Attachment []map[string]string `json:"attachment,omitempty"`
|
||||
// Remark holds the value of the "remark" field.
|
||||
Remark string `json:"remark,omitempty"`
|
||||
// CreatedAt holds the value of the "createdAt" field.
|
||||
@@ -41,6 +44,8 @@ func (*ProcessStep) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case processstep.FieldAttachment:
|
||||
values[i] = new([]byte)
|
||||
case processstep.FieldIsTorque, processstep.FieldNeedCheck:
|
||||
values[i] = new(sql.NullBool)
|
||||
case processstep.FieldID, processstep.FieldFlowId, processstep.FieldSeq:
|
||||
@@ -106,6 +111,14 @@ func (_m *ProcessStep) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
_m.NeedCheck = value.Bool
|
||||
}
|
||||
case processstep.FieldAttachment:
|
||||
if value, ok := values[i].(*[]byte); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field attachment", values[i])
|
||||
} else if value != nil && len(*value) > 0 {
|
||||
if err := json.Unmarshal(*value, &_m.Attachment); err != nil {
|
||||
return fmt.Errorf("unmarshal field attachment: %w", err)
|
||||
}
|
||||
}
|
||||
case processstep.FieldRemark:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field remark", values[i])
|
||||
@@ -172,6 +185,9 @@ func (_m *ProcessStep) String() string {
|
||||
builder.WriteString("needCheck=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.NeedCheck))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("attachment=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Attachment))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("remark=")
|
||||
builder.WriteString(_m.Remark)
|
||||
builder.WriteString(", ")
|
||||
|
||||
Reference in New Issue
Block a user