feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段
- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统 - 为BomItem实体添加relatedStandard字段及相关CRUD方法 - 为InspectionRecord实体添加reportNo、materialCode、materialName等字段 - 更新ent schema确保新字段的验证和默认值设置 - 添加必要的数据库迁移和字段映射逻辑
This commit is contained in:
@@ -33,6 +33,8 @@ const (
|
||||
FieldUnitQty = "unit_qty"
|
||||
// FieldLossRate holds the string denoting the lossrate field in the database.
|
||||
FieldLossRate = "loss_rate"
|
||||
// FieldRelatedStandard holds the string denoting the relatedstandard field in the database.
|
||||
FieldRelatedStandard = "related_standard"
|
||||
// FieldRequiredQty holds the string denoting the requiredqty field in the database.
|
||||
FieldRequiredQty = "required_qty"
|
||||
// FieldSerialSns holds the string denoting the serialsns field in the database.
|
||||
@@ -56,6 +58,7 @@ var Columns = []string{
|
||||
FieldProcessCode,
|
||||
FieldUnitQty,
|
||||
FieldLossRate,
|
||||
FieldRelatedStandard,
|
||||
FieldRequiredQty,
|
||||
FieldSerialSns,
|
||||
FieldCreatedAt,
|
||||
@@ -104,6 +107,10 @@ var (
|
||||
DefaultUnitQty float64
|
||||
// DefaultLossRate holds the default value on creation for the "lossRate" field.
|
||||
DefaultLossRate float64
|
||||
// DefaultRelatedStandard holds the default value on creation for the "relatedStandard" field.
|
||||
DefaultRelatedStandard string
|
||||
// RelatedStandardValidator is a validator for the "relatedStandard" field. It is called by the builders before save.
|
||||
RelatedStandardValidator func(string) error
|
||||
// DefaultRequiredQty holds the default value on creation for the "requiredQty" field.
|
||||
DefaultRequiredQty float64
|
||||
// DefaultCreatedAt holds the default value on creation for the "createdAt" field.
|
||||
@@ -170,6 +177,11 @@ func ByLossRate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLossRate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRelatedStandard orders the results by the relatedStandard field.
|
||||
func ByRelatedStandard(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRelatedStandard, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByRequiredQty orders the results by the requiredQty field.
|
||||
func ByRequiredQty(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldRequiredQty, opts...).ToFunc()
|
||||
|
||||
@@ -104,6 +104,11 @@ func LossRate(v float64) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldEQ(FieldLossRate, v))
|
||||
}
|
||||
|
||||
// RelatedStandard applies equality check predicate on the "relatedStandard" field. It's identical to RelatedStandardEQ.
|
||||
func RelatedStandard(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldEQ(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RequiredQty applies equality check predicate on the "requiredQty" field. It's identical to RequiredQtyEQ.
|
||||
func RequiredQty(v float64) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldEQ(FieldRequiredQty, v))
|
||||
@@ -689,6 +694,71 @@ func LossRateLTE(v float64) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldLTE(FieldLossRate, v))
|
||||
}
|
||||
|
||||
// RelatedStandardEQ applies the EQ predicate on the "relatedStandard" field.
|
||||
func RelatedStandardEQ(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldEQ(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RelatedStandardNEQ applies the NEQ predicate on the "relatedStandard" field.
|
||||
func RelatedStandardNEQ(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldNEQ(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RelatedStandardIn applies the In predicate on the "relatedStandard" field.
|
||||
func RelatedStandardIn(vs ...string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldIn(FieldRelatedStandard, vs...))
|
||||
}
|
||||
|
||||
// RelatedStandardNotIn applies the NotIn predicate on the "relatedStandard" field.
|
||||
func RelatedStandardNotIn(vs ...string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldNotIn(FieldRelatedStandard, vs...))
|
||||
}
|
||||
|
||||
// RelatedStandardGT applies the GT predicate on the "relatedStandard" field.
|
||||
func RelatedStandardGT(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldGT(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RelatedStandardGTE applies the GTE predicate on the "relatedStandard" field.
|
||||
func RelatedStandardGTE(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldGTE(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RelatedStandardLT applies the LT predicate on the "relatedStandard" field.
|
||||
func RelatedStandardLT(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldLT(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RelatedStandardLTE applies the LTE predicate on the "relatedStandard" field.
|
||||
func RelatedStandardLTE(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldLTE(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RelatedStandardContains applies the Contains predicate on the "relatedStandard" field.
|
||||
func RelatedStandardContains(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldContains(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RelatedStandardHasPrefix applies the HasPrefix predicate on the "relatedStandard" field.
|
||||
func RelatedStandardHasPrefix(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldHasPrefix(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RelatedStandardHasSuffix applies the HasSuffix predicate on the "relatedStandard" field.
|
||||
func RelatedStandardHasSuffix(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldHasSuffix(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RelatedStandardEqualFold applies the EqualFold predicate on the "relatedStandard" field.
|
||||
func RelatedStandardEqualFold(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldEqualFold(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RelatedStandardContainsFold applies the ContainsFold predicate on the "relatedStandard" field.
|
||||
func RelatedStandardContainsFold(v string) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldContainsFold(FieldRelatedStandard, v))
|
||||
}
|
||||
|
||||
// RequiredQtyEQ applies the EQ predicate on the "requiredQty" field.
|
||||
func RequiredQtyEQ(v float64) predicate.BomItem {
|
||||
return predicate.BomItem(sql.FieldEQ(FieldRequiredQty, v))
|
||||
|
||||
Reference in New Issue
Block a user