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
+74 -10
View File
@@ -255,12 +255,18 @@ func init() {
bomitemDescLossRate := bomitemFields[10].Descriptor()
// bomitem.DefaultLossRate holds the default value on creation for the lossRate field.
bomitem.DefaultLossRate = bomitemDescLossRate.Default.(float64)
// bomitemDescRelatedStandard is the schema descriptor for relatedStandard field.
bomitemDescRelatedStandard := bomitemFields[11].Descriptor()
// bomitem.DefaultRelatedStandard holds the default value on creation for the relatedStandard field.
bomitem.DefaultRelatedStandard = bomitemDescRelatedStandard.Default.(string)
// bomitem.RelatedStandardValidator is a validator for the "relatedStandard" field. It is called by the builders before save.
bomitem.RelatedStandardValidator = bomitemDescRelatedStandard.Validators[0].(func(string) error)
// bomitemDescRequiredQty is the schema descriptor for requiredQty field.
bomitemDescRequiredQty := bomitemFields[11].Descriptor()
bomitemDescRequiredQty := bomitemFields[12].Descriptor()
// bomitem.DefaultRequiredQty holds the default value on creation for the requiredQty field.
bomitem.DefaultRequiredQty = bomitemDescRequiredQty.Default.(float64)
// bomitemDescCreatedAt is the schema descriptor for createdAt field.
bomitemDescCreatedAt := bomitemFields[13].Descriptor()
bomitemDescCreatedAt := bomitemFields[14].Descriptor()
// bomitem.DefaultCreatedAt holds the default value on creation for the createdAt field.
bomitem.DefaultCreatedAt = bomitemDescCreatedAt.Default.(func() time.Time)
// bomitemDescID is the schema descriptor for id field.
@@ -427,8 +433,56 @@ func init() {
inspectionrecord.DefaultMeasuredValue = inspectionrecordDescMeasuredValue.Default.(string)
// inspectionrecord.MeasuredValueValidator is a validator for the "measuredValue" field. It is called by the builders before save.
inspectionrecord.MeasuredValueValidator = inspectionrecordDescMeasuredValue.Validators[0].(func(string) error)
// inspectionrecordDescReportNo is the schema descriptor for reportNo field.
inspectionrecordDescReportNo := inspectionrecordFields[15].Descriptor()
// inspectionrecord.DefaultReportNo holds the default value on creation for the reportNo field.
inspectionrecord.DefaultReportNo = inspectionrecordDescReportNo.Default.(string)
// inspectionrecord.ReportNoValidator is a validator for the "reportNo" field. It is called by the builders before save.
inspectionrecord.ReportNoValidator = inspectionrecordDescReportNo.Validators[0].(func(string) error)
// inspectionrecordDescMaterialCode is the schema descriptor for materialCode field.
inspectionrecordDescMaterialCode := inspectionrecordFields[16].Descriptor()
// inspectionrecord.DefaultMaterialCode holds the default value on creation for the materialCode field.
inspectionrecord.DefaultMaterialCode = inspectionrecordDescMaterialCode.Default.(string)
// inspectionrecord.MaterialCodeValidator is a validator for the "materialCode" field. It is called by the builders before save.
inspectionrecord.MaterialCodeValidator = inspectionrecordDescMaterialCode.Validators[0].(func(string) error)
// inspectionrecordDescMaterialName is the schema descriptor for materialName field.
inspectionrecordDescMaterialName := inspectionrecordFields[17].Descriptor()
// inspectionrecord.DefaultMaterialName holds the default value on creation for the materialName field.
inspectionrecord.DefaultMaterialName = inspectionrecordDescMaterialName.Default.(string)
// inspectionrecord.MaterialNameValidator is a validator for the "materialName" field. It is called by the builders before save.
inspectionrecord.MaterialNameValidator = inspectionrecordDescMaterialName.Validators[0].(func(string) error)
// inspectionrecordDescManufacturer is the schema descriptor for manufacturer field.
inspectionrecordDescManufacturer := inspectionrecordFields[18].Descriptor()
// inspectionrecord.DefaultManufacturer holds the default value on creation for the manufacturer field.
inspectionrecord.DefaultManufacturer = inspectionrecordDescManufacturer.Default.(string)
// inspectionrecord.ManufacturerValidator is a validator for the "manufacturer" field. It is called by the builders before save.
inspectionrecord.ManufacturerValidator = inspectionrecordDescManufacturer.Validators[0].(func(string) error)
// inspectionrecordDescInspectionNo is the schema descriptor for inspectionNo field.
inspectionrecordDescInspectionNo := inspectionrecordFields[19].Descriptor()
// inspectionrecord.DefaultInspectionNo holds the default value on creation for the inspectionNo field.
inspectionrecord.DefaultInspectionNo = inspectionrecordDescInspectionNo.Default.(string)
// inspectionrecord.InspectionNoValidator is a validator for the "inspectionNo" field. It is called by the builders before save.
inspectionrecord.InspectionNoValidator = inspectionrecordDescInspectionNo.Validators[0].(func(string) error)
// inspectionrecordDescAttachmentIds is the schema descriptor for attachmentIds field.
inspectionrecordDescAttachmentIds := inspectionrecordFields[20].Descriptor()
// inspectionrecord.DefaultAttachmentIds holds the default value on creation for the attachmentIds field.
inspectionrecord.DefaultAttachmentIds = inspectionrecordDescAttachmentIds.Default.(string)
// inspectionrecord.AttachmentIdsValidator is a validator for the "attachmentIds" field. It is called by the builders before save.
inspectionrecord.AttachmentIdsValidator = inspectionrecordDescAttachmentIds.Validators[0].(func(string) error)
// inspectionrecordDescDisposalType is the schema descriptor for disposalType field.
inspectionrecordDescDisposalType := inspectionrecordFields[21].Descriptor()
// inspectionrecord.DefaultDisposalType holds the default value on creation for the disposalType field.
inspectionrecord.DefaultDisposalType = inspectionrecordDescDisposalType.Default.(string)
// inspectionrecord.DisposalTypeValidator is a validator for the "disposalType" field. It is called by the builders before save.
inspectionrecord.DisposalTypeValidator = inspectionrecordDescDisposalType.Validators[0].(func(string) error)
// inspectionrecordDescDisposalRemark is the schema descriptor for disposalRemark field.
inspectionrecordDescDisposalRemark := inspectionrecordFields[22].Descriptor()
// inspectionrecord.DefaultDisposalRemark holds the default value on creation for the disposalRemark field.
inspectionrecord.DefaultDisposalRemark = inspectionrecordDescDisposalRemark.Default.(string)
// inspectionrecord.DisposalRemarkValidator is a validator for the "disposalRemark" field. It is called by the builders before save.
inspectionrecord.DisposalRemarkValidator = inspectionrecordDescDisposalRemark.Validators[0].(func(string) error)
// inspectionrecordDescCreatedAt is the schema descriptor for createdAt field.
inspectionrecordDescCreatedAt := inspectionrecordFields[15].Descriptor()
inspectionrecordDescCreatedAt := inspectionrecordFields[23].Descriptor()
// inspectionrecord.DefaultCreatedAt holds the default value on creation for the createdAt field.
inspectionrecord.DefaultCreatedAt = inspectionrecordDescCreatedAt.Default.(func() time.Time)
// inspectionrecordDescID is the schema descriptor for id field.
@@ -846,13 +900,13 @@ func init() {
// processstep.DefaultNeedCheck holds the default value on creation for the needCheck field.
processstep.DefaultNeedCheck = processstepDescNeedCheck.Default.(bool)
// processstepDescRemark is the schema descriptor for remark field.
processstepDescRemark := processstepFields[7].Descriptor()
processstepDescRemark := processstepFields[8].Descriptor()
// processstep.DefaultRemark holds the default value on creation for the remark field.
processstep.DefaultRemark = processstepDescRemark.Default.(string)
// processstep.RemarkValidator is a validator for the "remark" field. It is called by the builders before save.
processstep.RemarkValidator = processstepDescRemark.Validators[0].(func(string) error)
// processstepDescCreatedAt is the schema descriptor for createdAt field.
processstepDescCreatedAt := processstepFields[8].Descriptor()
processstepDescCreatedAt := processstepFields[9].Descriptor()
// processstep.DefaultCreatedAt holds the default value on creation for the createdAt field.
processstep.DefaultCreatedAt = processstepDescCreatedAt.Default.(func() time.Time)
// processstepDescID is the schema descriptor for id field.
@@ -1357,18 +1411,24 @@ func init() {
workorder.DefaultProductSerial = workorderDescProductSerial.Default.(string)
// workorder.ProductSerialValidator is a validator for the "productSerial" field. It is called by the builders before save.
workorder.ProductSerialValidator = workorderDescProductSerial.Validators[0].(func(string) error)
// workorderDescCreatedBy is the schema descriptor for createdBy field.
workorderDescCreatedBy := workorderFields[12].Descriptor()
// workorder.DefaultCreatedBy holds the default value on creation for the createdBy field.
workorder.DefaultCreatedBy = workorderDescCreatedBy.Default.(string)
// workorder.CreatedByValidator is a validator for the "createdBy" field. It is called by the builders before save.
workorder.CreatedByValidator = workorderDescCreatedBy.Validators[0].(func(string) error)
// workorderDescStatus is the schema descriptor for status field.
workorderDescStatus := workorderFields[12].Descriptor()
workorderDescStatus := workorderFields[14].Descriptor()
// workorder.DefaultStatus holds the default value on creation for the status field.
workorder.DefaultStatus = workorderDescStatus.Default.(string)
// workorder.StatusValidator is a validator for the "status" field. It is called by the builders before save.
workorder.StatusValidator = workorderDescStatus.Validators[0].(func(string) error)
// workorderDescCreatedAt is the schema descriptor for createdAt field.
workorderDescCreatedAt := workorderFields[17].Descriptor()
workorderDescCreatedAt := workorderFields[19].Descriptor()
// workorder.DefaultCreatedAt holds the default value on creation for the createdAt field.
workorder.DefaultCreatedAt = workorderDescCreatedAt.Default.(func() time.Time)
// workorderDescUpdatedAt is the schema descriptor for updatedAt field.
workorderDescUpdatedAt := workorderFields[18].Descriptor()
workorderDescUpdatedAt := workorderFields[20].Descriptor()
// workorder.DefaultUpdatedAt holds the default value on creation for the updatedAt field.
workorder.DefaultUpdatedAt = workorderDescUpdatedAt.Default.(func() time.Time)
// workorder.UpdateDefaultUpdatedAt holds the default value on update for the updatedAt field.
@@ -1527,14 +1587,18 @@ func init() {
workpieceprocess.DefaultResult = workpieceprocessDescResult.Default.(string)
// workpieceprocess.ResultValidator is a validator for the "result" field. It is called by the builders before save.
workpieceprocess.ResultValidator = workpieceprocessDescResult.Validators[0].(func(string) error)
// workpieceprocessDescDurationSec is the schema descriptor for durationSec field.
workpieceprocessDescDurationSec := workpieceprocessFields[11].Descriptor()
// workpieceprocess.DefaultDurationSec holds the default value on creation for the durationSec field.
workpieceprocess.DefaultDurationSec = workpieceprocessDescDurationSec.Default.(int)
// workpieceprocessDescRemark is the schema descriptor for remark field.
workpieceprocessDescRemark := workpieceprocessFields[11].Descriptor()
workpieceprocessDescRemark := workpieceprocessFields[12].Descriptor()
// workpieceprocess.DefaultRemark holds the default value on creation for the remark field.
workpieceprocess.DefaultRemark = workpieceprocessDescRemark.Default.(string)
// workpieceprocess.RemarkValidator is a validator for the "remark" field. It is called by the builders before save.
workpieceprocess.RemarkValidator = workpieceprocessDescRemark.Validators[0].(func(string) error)
// workpieceprocessDescCreatedAt is the schema descriptor for createdAt field.
workpieceprocessDescCreatedAt := workpieceprocessFields[12].Descriptor()
workpieceprocessDescCreatedAt := workpieceprocessFields[13].Descriptor()
// workpieceprocess.DefaultCreatedAt holds the default value on creation for the createdAt field.
workpieceprocess.DefaultCreatedAt = workpieceprocessDescCreatedAt.Default.(func() time.Time)
// workpieceprocessDescID is the schema descriptor for id field.