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
@@ -17,6 +17,16 @@ const (
FieldTargetID = "target_id"
// FieldMaterialCode holds the string denoting the material_code field in the database.
FieldMaterialCode = "material_code"
// FieldMaterialName holds the string denoting the material_name field in the database.
FieldMaterialName = "material_name"
// FieldOwnershipType holds the string denoting the ownership_type field in the database.
FieldOwnershipType = "ownership_type"
// FieldOwnershipNo holds the string denoting the ownership_no field in the database.
FieldOwnershipNo = "ownership_no"
// FieldRelatedStandard holds the string denoting the related_standard field in the database.
FieldRelatedStandard = "related_standard"
// FieldManufacturer holds the string denoting the manufacturer field in the database.
FieldManufacturer = "manufacturer"
// FieldInspectionType holds the string denoting the inspection_type field in the database.
FieldInspectionType = "inspection_type"
// FieldStatus holds the string denoting the status field in the database.
@@ -57,6 +67,11 @@ var Columns = []string{
FieldTargetType,
FieldTargetID,
FieldMaterialCode,
FieldMaterialName,
FieldOwnershipType,
FieldOwnershipNo,
FieldRelatedStandard,
FieldManufacturer,
FieldInspectionType,
FieldStatus,
FieldResultValue,
@@ -124,6 +139,31 @@ func ByMaterialCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMaterialCode, opts...).ToFunc()
}
// ByMaterialName orders the results by the material_name field.
func ByMaterialName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMaterialName, opts...).ToFunc()
}
// ByOwnershipType orders the results by the ownership_type field.
func ByOwnershipType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOwnershipType, opts...).ToFunc()
}
// ByOwnershipNo orders the results by the ownership_no field.
func ByOwnershipNo(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOwnershipNo, opts...).ToFunc()
}
// ByRelatedStandard orders the results by the related_standard field.
func ByRelatedStandard(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRelatedStandard, opts...).ToFunc()
}
// ByManufacturer orders the results by the manufacturer field.
func ByManufacturer(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldManufacturer, opts...).ToFunc()
}
// ByInspectionType orders the results by the inspection_type field.
func ByInspectionType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldInspectionType, opts...).ToFunc()
+400
View File
@@ -68,6 +68,31 @@ func MaterialCode(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldMaterialCode, v))
}
// MaterialName applies equality check predicate on the "material_name" field. It's identical to MaterialNameEQ.
func MaterialName(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldMaterialName, v))
}
// OwnershipType applies equality check predicate on the "ownership_type" field. It's identical to OwnershipTypeEQ.
func OwnershipType(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldOwnershipType, v))
}
// OwnershipNo applies equality check predicate on the "ownership_no" field. It's identical to OwnershipNoEQ.
func OwnershipNo(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldOwnershipNo, v))
}
// RelatedStandard applies equality check predicate on the "related_standard" field. It's identical to RelatedStandardEQ.
func RelatedStandard(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldRelatedStandard, v))
}
// Manufacturer applies equality check predicate on the "manufacturer" field. It's identical to ManufacturerEQ.
func Manufacturer(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldManufacturer, v))
}
// InspectionType applies equality check predicate on the "inspection_type" field. It's identical to InspectionTypeEQ.
func InspectionType(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldInspectionType, v))
@@ -338,6 +363,381 @@ func MaterialCodeContainsFold(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldContainsFold(FieldMaterialCode, v))
}
// MaterialNameEQ applies the EQ predicate on the "material_name" field.
func MaterialNameEQ(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldMaterialName, v))
}
// MaterialNameNEQ applies the NEQ predicate on the "material_name" field.
func MaterialNameNEQ(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNEQ(FieldMaterialName, v))
}
// MaterialNameIn applies the In predicate on the "material_name" field.
func MaterialNameIn(vs ...string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIn(FieldMaterialName, vs...))
}
// MaterialNameNotIn applies the NotIn predicate on the "material_name" field.
func MaterialNameNotIn(vs ...string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotIn(FieldMaterialName, vs...))
}
// MaterialNameGT applies the GT predicate on the "material_name" field.
func MaterialNameGT(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGT(FieldMaterialName, v))
}
// MaterialNameGTE applies the GTE predicate on the "material_name" field.
func MaterialNameGTE(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGTE(FieldMaterialName, v))
}
// MaterialNameLT applies the LT predicate on the "material_name" field.
func MaterialNameLT(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLT(FieldMaterialName, v))
}
// MaterialNameLTE applies the LTE predicate on the "material_name" field.
func MaterialNameLTE(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLTE(FieldMaterialName, v))
}
// MaterialNameContains applies the Contains predicate on the "material_name" field.
func MaterialNameContains(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldContains(FieldMaterialName, v))
}
// MaterialNameHasPrefix applies the HasPrefix predicate on the "material_name" field.
func MaterialNameHasPrefix(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldHasPrefix(FieldMaterialName, v))
}
// MaterialNameHasSuffix applies the HasSuffix predicate on the "material_name" field.
func MaterialNameHasSuffix(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldHasSuffix(FieldMaterialName, v))
}
// MaterialNameIsNil applies the IsNil predicate on the "material_name" field.
func MaterialNameIsNil() predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIsNull(FieldMaterialName))
}
// MaterialNameNotNil applies the NotNil predicate on the "material_name" field.
func MaterialNameNotNil() predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotNull(FieldMaterialName))
}
// MaterialNameEqualFold applies the EqualFold predicate on the "material_name" field.
func MaterialNameEqualFold(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEqualFold(FieldMaterialName, v))
}
// MaterialNameContainsFold applies the ContainsFold predicate on the "material_name" field.
func MaterialNameContainsFold(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldContainsFold(FieldMaterialName, v))
}
// OwnershipTypeEQ applies the EQ predicate on the "ownership_type" field.
func OwnershipTypeEQ(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldOwnershipType, v))
}
// OwnershipTypeNEQ applies the NEQ predicate on the "ownership_type" field.
func OwnershipTypeNEQ(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNEQ(FieldOwnershipType, v))
}
// OwnershipTypeIn applies the In predicate on the "ownership_type" field.
func OwnershipTypeIn(vs ...string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIn(FieldOwnershipType, vs...))
}
// OwnershipTypeNotIn applies the NotIn predicate on the "ownership_type" field.
func OwnershipTypeNotIn(vs ...string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotIn(FieldOwnershipType, vs...))
}
// OwnershipTypeGT applies the GT predicate on the "ownership_type" field.
func OwnershipTypeGT(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGT(FieldOwnershipType, v))
}
// OwnershipTypeGTE applies the GTE predicate on the "ownership_type" field.
func OwnershipTypeGTE(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGTE(FieldOwnershipType, v))
}
// OwnershipTypeLT applies the LT predicate on the "ownership_type" field.
func OwnershipTypeLT(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLT(FieldOwnershipType, v))
}
// OwnershipTypeLTE applies the LTE predicate on the "ownership_type" field.
func OwnershipTypeLTE(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLTE(FieldOwnershipType, v))
}
// OwnershipTypeContains applies the Contains predicate on the "ownership_type" field.
func OwnershipTypeContains(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldContains(FieldOwnershipType, v))
}
// OwnershipTypeHasPrefix applies the HasPrefix predicate on the "ownership_type" field.
func OwnershipTypeHasPrefix(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldHasPrefix(FieldOwnershipType, v))
}
// OwnershipTypeHasSuffix applies the HasSuffix predicate on the "ownership_type" field.
func OwnershipTypeHasSuffix(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldHasSuffix(FieldOwnershipType, v))
}
// OwnershipTypeIsNil applies the IsNil predicate on the "ownership_type" field.
func OwnershipTypeIsNil() predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIsNull(FieldOwnershipType))
}
// OwnershipTypeNotNil applies the NotNil predicate on the "ownership_type" field.
func OwnershipTypeNotNil() predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotNull(FieldOwnershipType))
}
// OwnershipTypeEqualFold applies the EqualFold predicate on the "ownership_type" field.
func OwnershipTypeEqualFold(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEqualFold(FieldOwnershipType, v))
}
// OwnershipTypeContainsFold applies the ContainsFold predicate on the "ownership_type" field.
func OwnershipTypeContainsFold(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldContainsFold(FieldOwnershipType, v))
}
// OwnershipNoEQ applies the EQ predicate on the "ownership_no" field.
func OwnershipNoEQ(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldOwnershipNo, v))
}
// OwnershipNoNEQ applies the NEQ predicate on the "ownership_no" field.
func OwnershipNoNEQ(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNEQ(FieldOwnershipNo, v))
}
// OwnershipNoIn applies the In predicate on the "ownership_no" field.
func OwnershipNoIn(vs ...string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIn(FieldOwnershipNo, vs...))
}
// OwnershipNoNotIn applies the NotIn predicate on the "ownership_no" field.
func OwnershipNoNotIn(vs ...string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotIn(FieldOwnershipNo, vs...))
}
// OwnershipNoGT applies the GT predicate on the "ownership_no" field.
func OwnershipNoGT(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGT(FieldOwnershipNo, v))
}
// OwnershipNoGTE applies the GTE predicate on the "ownership_no" field.
func OwnershipNoGTE(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGTE(FieldOwnershipNo, v))
}
// OwnershipNoLT applies the LT predicate on the "ownership_no" field.
func OwnershipNoLT(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLT(FieldOwnershipNo, v))
}
// OwnershipNoLTE applies the LTE predicate on the "ownership_no" field.
func OwnershipNoLTE(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLTE(FieldOwnershipNo, v))
}
// OwnershipNoContains applies the Contains predicate on the "ownership_no" field.
func OwnershipNoContains(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldContains(FieldOwnershipNo, v))
}
// OwnershipNoHasPrefix applies the HasPrefix predicate on the "ownership_no" field.
func OwnershipNoHasPrefix(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldHasPrefix(FieldOwnershipNo, v))
}
// OwnershipNoHasSuffix applies the HasSuffix predicate on the "ownership_no" field.
func OwnershipNoHasSuffix(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldHasSuffix(FieldOwnershipNo, v))
}
// OwnershipNoIsNil applies the IsNil predicate on the "ownership_no" field.
func OwnershipNoIsNil() predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIsNull(FieldOwnershipNo))
}
// OwnershipNoNotNil applies the NotNil predicate on the "ownership_no" field.
func OwnershipNoNotNil() predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotNull(FieldOwnershipNo))
}
// OwnershipNoEqualFold applies the EqualFold predicate on the "ownership_no" field.
func OwnershipNoEqualFold(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEqualFold(FieldOwnershipNo, v))
}
// OwnershipNoContainsFold applies the ContainsFold predicate on the "ownership_no" field.
func OwnershipNoContainsFold(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldContainsFold(FieldOwnershipNo, v))
}
// RelatedStandardEQ applies the EQ predicate on the "related_standard" field.
func RelatedStandardEQ(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldRelatedStandard, v))
}
// RelatedStandardNEQ applies the NEQ predicate on the "related_standard" field.
func RelatedStandardNEQ(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNEQ(FieldRelatedStandard, v))
}
// RelatedStandardIn applies the In predicate on the "related_standard" field.
func RelatedStandardIn(vs ...string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIn(FieldRelatedStandard, vs...))
}
// RelatedStandardNotIn applies the NotIn predicate on the "related_standard" field.
func RelatedStandardNotIn(vs ...string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotIn(FieldRelatedStandard, vs...))
}
// RelatedStandardGT applies the GT predicate on the "related_standard" field.
func RelatedStandardGT(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGT(FieldRelatedStandard, v))
}
// RelatedStandardGTE applies the GTE predicate on the "related_standard" field.
func RelatedStandardGTE(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGTE(FieldRelatedStandard, v))
}
// RelatedStandardLT applies the LT predicate on the "related_standard" field.
func RelatedStandardLT(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLT(FieldRelatedStandard, v))
}
// RelatedStandardLTE applies the LTE predicate on the "related_standard" field.
func RelatedStandardLTE(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLTE(FieldRelatedStandard, v))
}
// RelatedStandardContains applies the Contains predicate on the "related_standard" field.
func RelatedStandardContains(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldContains(FieldRelatedStandard, v))
}
// RelatedStandardHasPrefix applies the HasPrefix predicate on the "related_standard" field.
func RelatedStandardHasPrefix(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldHasPrefix(FieldRelatedStandard, v))
}
// RelatedStandardHasSuffix applies the HasSuffix predicate on the "related_standard" field.
func RelatedStandardHasSuffix(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldHasSuffix(FieldRelatedStandard, v))
}
// RelatedStandardIsNil applies the IsNil predicate on the "related_standard" field.
func RelatedStandardIsNil() predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIsNull(FieldRelatedStandard))
}
// RelatedStandardNotNil applies the NotNil predicate on the "related_standard" field.
func RelatedStandardNotNil() predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotNull(FieldRelatedStandard))
}
// RelatedStandardEqualFold applies the EqualFold predicate on the "related_standard" field.
func RelatedStandardEqualFold(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEqualFold(FieldRelatedStandard, v))
}
// RelatedStandardContainsFold applies the ContainsFold predicate on the "related_standard" field.
func RelatedStandardContainsFold(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldContainsFold(FieldRelatedStandard, v))
}
// ManufacturerEQ applies the EQ predicate on the "manufacturer" field.
func ManufacturerEQ(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldManufacturer, v))
}
// ManufacturerNEQ applies the NEQ predicate on the "manufacturer" field.
func ManufacturerNEQ(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNEQ(FieldManufacturer, v))
}
// ManufacturerIn applies the In predicate on the "manufacturer" field.
func ManufacturerIn(vs ...string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIn(FieldManufacturer, vs...))
}
// ManufacturerNotIn applies the NotIn predicate on the "manufacturer" field.
func ManufacturerNotIn(vs ...string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotIn(FieldManufacturer, vs...))
}
// ManufacturerGT applies the GT predicate on the "manufacturer" field.
func ManufacturerGT(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGT(FieldManufacturer, v))
}
// ManufacturerGTE applies the GTE predicate on the "manufacturer" field.
func ManufacturerGTE(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldGTE(FieldManufacturer, v))
}
// ManufacturerLT applies the LT predicate on the "manufacturer" field.
func ManufacturerLT(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLT(FieldManufacturer, v))
}
// ManufacturerLTE applies the LTE predicate on the "manufacturer" field.
func ManufacturerLTE(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldLTE(FieldManufacturer, v))
}
// ManufacturerContains applies the Contains predicate on the "manufacturer" field.
func ManufacturerContains(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldContains(FieldManufacturer, v))
}
// ManufacturerHasPrefix applies the HasPrefix predicate on the "manufacturer" field.
func ManufacturerHasPrefix(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldHasPrefix(FieldManufacturer, v))
}
// ManufacturerHasSuffix applies the HasSuffix predicate on the "manufacturer" field.
func ManufacturerHasSuffix(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldHasSuffix(FieldManufacturer, v))
}
// ManufacturerIsNil applies the IsNil predicate on the "manufacturer" field.
func ManufacturerIsNil() predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldIsNull(FieldManufacturer))
}
// ManufacturerNotNil applies the NotNil predicate on the "manufacturer" field.
func ManufacturerNotNil() predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldNotNull(FieldManufacturer))
}
// ManufacturerEqualFold applies the EqualFold predicate on the "manufacturer" field.
func ManufacturerEqualFold(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEqualFold(FieldManufacturer, v))
}
// ManufacturerContainsFold applies the ContainsFold predicate on the "manufacturer" field.
func ManufacturerContainsFold(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldContainsFold(FieldManufacturer, v))
}
// InspectionTypeEQ applies the EQ predicate on the "inspection_type" field.
func InspectionTypeEQ(v string) predicate.InspectionRecord {
return predicate.InspectionRecord(sql.FieldEQ(FieldInspectionType, v))