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
@@ -38,6 +38,8 @@ type BomItem struct {
UnitQty float64 `json:"unitQty,omitempty"`
// 损耗率%
LossRate float64 `json:"lossRate,omitempty"`
// 相关标准(检验细则)
RelatedStandard string `json:"relatedStandard,omitempty"`
// 需求总量=总台数*单台*(1+损耗)
RequiredQty float64 `json:"requiredQty,omitempty"`
// 电气件SN下发列表(可选)
@@ -58,7 +60,7 @@ func (*BomItem) scanValues(columns []string) ([]any, error) {
values[i] = new(sql.NullFloat64)
case bomitem.FieldID, bomitem.FieldProcessCode:
values[i] = new(sql.NullInt64)
case bomitem.FieldProductCode, bomitem.FieldBomName, bomitem.FieldMaterialCode, bomitem.FieldMaterialName, bomitem.FieldSpec, bomitem.FieldUnit, bomitem.FieldManageMode:
case bomitem.FieldProductCode, bomitem.FieldBomName, bomitem.FieldMaterialCode, bomitem.FieldMaterialName, bomitem.FieldSpec, bomitem.FieldUnit, bomitem.FieldManageMode, bomitem.FieldRelatedStandard:
values[i] = new(sql.NullString)
case bomitem.FieldCreatedAt:
values[i] = new(sql.NullTime)
@@ -143,6 +145,12 @@ func (_m *BomItem) assignValues(columns []string, values []any) error {
} else if value.Valid {
_m.LossRate = value.Float64
}
case bomitem.FieldRelatedStandard:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field relatedStandard", values[i])
} else if value.Valid {
_m.RelatedStandard = value.String
}
case bomitem.FieldRequiredQty:
if value, ok := values[i].(*sql.NullFloat64); !ok {
return fmt.Errorf("unexpected type %T for field requiredQty", values[i])
@@ -229,6 +237,9 @@ func (_m *BomItem) String() string {
builder.WriteString("lossRate=")
builder.WriteString(fmt.Sprintf("%v", _m.LossRate))
builder.WriteString(", ")
builder.WriteString("relatedStandard=")
builder.WriteString(_m.RelatedStandard)
builder.WriteString(", ")
builder.WriteString("requiredQty=")
builder.WriteString(fmt.Sprintf("%v", _m.RequiredQty))
builder.WriteString(", ")