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
+312
View File
@@ -41,6 +41,62 @@ func (_c *OutboundOrderCreate) SetNillableOutboundType(v *string) *OutboundOrder
return _c
}
// SetOutboundCategory sets the "outbound_category" field.
func (_c *OutboundOrderCreate) SetOutboundCategory(v string) *OutboundOrderCreate {
_c.mutation.SetOutboundCategory(v)
return _c
}
// SetNillableOutboundCategory sets the "outbound_category" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableOutboundCategory(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetOutboundCategory(*v)
}
return _c
}
// SetOwnershipType sets the "ownership_type" field.
func (_c *OutboundOrderCreate) SetOwnershipType(v string) *OutboundOrderCreate {
_c.mutation.SetOwnershipType(v)
return _c
}
// SetNillableOwnershipType sets the "ownership_type" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableOwnershipType(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetOwnershipType(*v)
}
return _c
}
// SetOwnershipNo sets the "ownership_no" field.
func (_c *OutboundOrderCreate) SetOwnershipNo(v string) *OutboundOrderCreate {
_c.mutation.SetOwnershipNo(v)
return _c
}
// SetNillableOwnershipNo sets the "ownership_no" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableOwnershipNo(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetOwnershipNo(*v)
}
return _c
}
// SetTargetStation sets the "target_station" field.
func (_c *OutboundOrderCreate) SetTargetStation(v string) *OutboundOrderCreate {
_c.mutation.SetTargetStation(v)
return _c
}
// SetNillableTargetStation sets the "target_station" field if the given value is not nil.
func (_c *OutboundOrderCreate) SetNillableTargetStation(v *string) *OutboundOrderCreate {
if v != nil {
_c.SetTargetStation(*v)
}
return _c
}
// SetOrderNo sets the "order_no" field.
func (_c *OutboundOrderCreate) SetOrderNo(v string) *OutboundOrderCreate {
_c.mutation.SetOrderNo(v)
@@ -351,6 +407,22 @@ func (_c *OutboundOrderCreate) createSpec() (*OutboundOrder, *sqlgraph.CreateSpe
_spec.SetField(outboundorder.FieldOutboundType, field.TypeString, value)
_node.OutboundType = value
}
if value, ok := _c.mutation.OutboundCategory(); ok {
_spec.SetField(outboundorder.FieldOutboundCategory, field.TypeString, value)
_node.OutboundCategory = value
}
if value, ok := _c.mutation.OwnershipType(); ok {
_spec.SetField(outboundorder.FieldOwnershipType, field.TypeString, value)
_node.OwnershipType = value
}
if value, ok := _c.mutation.OwnershipNo(); ok {
_spec.SetField(outboundorder.FieldOwnershipNo, field.TypeString, value)
_node.OwnershipNo = value
}
if value, ok := _c.mutation.TargetStation(); ok {
_spec.SetField(outboundorder.FieldTargetStation, field.TypeString, value)
_node.TargetStation = value
}
if value, ok := _c.mutation.OrderNo(); ok {
_spec.SetField(outboundorder.FieldOrderNo, field.TypeString, value)
_node.OrderNo = value
@@ -487,6 +559,78 @@ func (u *OutboundOrderUpsert) UpdateOutboundType() *OutboundOrderUpsert {
return u
}
// SetOutboundCategory sets the "outbound_category" field.
func (u *OutboundOrderUpsert) SetOutboundCategory(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldOutboundCategory, v)
return u
}
// UpdateOutboundCategory sets the "outbound_category" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateOutboundCategory() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldOutboundCategory)
return u
}
// ClearOutboundCategory clears the value of the "outbound_category" field.
func (u *OutboundOrderUpsert) ClearOutboundCategory() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldOutboundCategory)
return u
}
// SetOwnershipType sets the "ownership_type" field.
func (u *OutboundOrderUpsert) SetOwnershipType(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldOwnershipType, v)
return u
}
// UpdateOwnershipType sets the "ownership_type" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateOwnershipType() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldOwnershipType)
return u
}
// ClearOwnershipType clears the value of the "ownership_type" field.
func (u *OutboundOrderUpsert) ClearOwnershipType() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldOwnershipType)
return u
}
// SetOwnershipNo sets the "ownership_no" field.
func (u *OutboundOrderUpsert) SetOwnershipNo(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldOwnershipNo, v)
return u
}
// UpdateOwnershipNo sets the "ownership_no" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateOwnershipNo() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldOwnershipNo)
return u
}
// ClearOwnershipNo clears the value of the "ownership_no" field.
func (u *OutboundOrderUpsert) ClearOwnershipNo() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldOwnershipNo)
return u
}
// SetTargetStation sets the "target_station" field.
func (u *OutboundOrderUpsert) SetTargetStation(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldTargetStation, v)
return u
}
// UpdateTargetStation sets the "target_station" field to the value that was provided on create.
func (u *OutboundOrderUpsert) UpdateTargetStation() *OutboundOrderUpsert {
u.SetExcluded(outboundorder.FieldTargetStation)
return u
}
// ClearTargetStation clears the value of the "target_station" field.
func (u *OutboundOrderUpsert) ClearTargetStation() *OutboundOrderUpsert {
u.SetNull(outboundorder.FieldTargetStation)
return u
}
// SetOrderNo sets the "order_no" field.
func (u *OutboundOrderUpsert) SetOrderNo(v string) *OutboundOrderUpsert {
u.Set(outboundorder.FieldOrderNo, v)
@@ -819,6 +963,90 @@ func (u *OutboundOrderUpsertOne) UpdateOutboundType() *OutboundOrderUpsertOne {
})
}
// SetOutboundCategory sets the "outbound_category" field.
func (u *OutboundOrderUpsertOne) SetOutboundCategory(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOutboundCategory(v)
})
}
// UpdateOutboundCategory sets the "outbound_category" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateOutboundCategory() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOutboundCategory()
})
}
// ClearOutboundCategory clears the value of the "outbound_category" field.
func (u *OutboundOrderUpsertOne) ClearOutboundCategory() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearOutboundCategory()
})
}
// SetOwnershipType sets the "ownership_type" field.
func (u *OutboundOrderUpsertOne) SetOwnershipType(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOwnershipType(v)
})
}
// UpdateOwnershipType sets the "ownership_type" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateOwnershipType() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOwnershipType()
})
}
// ClearOwnershipType clears the value of the "ownership_type" field.
func (u *OutboundOrderUpsertOne) ClearOwnershipType() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearOwnershipType()
})
}
// SetOwnershipNo sets the "ownership_no" field.
func (u *OutboundOrderUpsertOne) SetOwnershipNo(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOwnershipNo(v)
})
}
// UpdateOwnershipNo sets the "ownership_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateOwnershipNo() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOwnershipNo()
})
}
// ClearOwnershipNo clears the value of the "ownership_no" field.
func (u *OutboundOrderUpsertOne) ClearOwnershipNo() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearOwnershipNo()
})
}
// SetTargetStation sets the "target_station" field.
func (u *OutboundOrderUpsertOne) SetTargetStation(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetTargetStation(v)
})
}
// UpdateTargetStation sets the "target_station" field to the value that was provided on create.
func (u *OutboundOrderUpsertOne) UpdateTargetStation() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateTargetStation()
})
}
// ClearTargetStation clears the value of the "target_station" field.
func (u *OutboundOrderUpsertOne) ClearTargetStation() *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearTargetStation()
})
}
// SetOrderNo sets the "order_no" field.
func (u *OutboundOrderUpsertOne) SetOrderNo(v string) *OutboundOrderUpsertOne {
return u.Update(func(s *OutboundOrderUpsert) {
@@ -1359,6 +1587,90 @@ func (u *OutboundOrderUpsertBulk) UpdateOutboundType() *OutboundOrderUpsertBulk
})
}
// SetOutboundCategory sets the "outbound_category" field.
func (u *OutboundOrderUpsertBulk) SetOutboundCategory(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOutboundCategory(v)
})
}
// UpdateOutboundCategory sets the "outbound_category" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateOutboundCategory() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOutboundCategory()
})
}
// ClearOutboundCategory clears the value of the "outbound_category" field.
func (u *OutboundOrderUpsertBulk) ClearOutboundCategory() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearOutboundCategory()
})
}
// SetOwnershipType sets the "ownership_type" field.
func (u *OutboundOrderUpsertBulk) SetOwnershipType(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOwnershipType(v)
})
}
// UpdateOwnershipType sets the "ownership_type" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateOwnershipType() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOwnershipType()
})
}
// ClearOwnershipType clears the value of the "ownership_type" field.
func (u *OutboundOrderUpsertBulk) ClearOwnershipType() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearOwnershipType()
})
}
// SetOwnershipNo sets the "ownership_no" field.
func (u *OutboundOrderUpsertBulk) SetOwnershipNo(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetOwnershipNo(v)
})
}
// UpdateOwnershipNo sets the "ownership_no" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateOwnershipNo() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateOwnershipNo()
})
}
// ClearOwnershipNo clears the value of the "ownership_no" field.
func (u *OutboundOrderUpsertBulk) ClearOwnershipNo() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearOwnershipNo()
})
}
// SetTargetStation sets the "target_station" field.
func (u *OutboundOrderUpsertBulk) SetTargetStation(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.SetTargetStation(v)
})
}
// UpdateTargetStation sets the "target_station" field to the value that was provided on create.
func (u *OutboundOrderUpsertBulk) UpdateTargetStation() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.UpdateTargetStation()
})
}
// ClearTargetStation clears the value of the "target_station" field.
func (u *OutboundOrderUpsertBulk) ClearTargetStation() *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {
s.ClearTargetStation()
})
}
// SetOrderNo sets the "order_no" field.
func (u *OutboundOrderUpsertBulk) SetOrderNo(v string) *OutboundOrderUpsertBulk {
return u.Update(func(s *OutboundOrderUpsert) {