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
+234
View File
@@ -67,6 +67,48 @@ func (_c *StocktakeItemCreate) SetNillableZoneCode(v *string) *StocktakeItemCrea
return _c
}
// SetShelfNo sets the "shelf_no" field.
func (_c *StocktakeItemCreate) SetShelfNo(v string) *StocktakeItemCreate {
_c.mutation.SetShelfNo(v)
return _c
}
// SetNillableShelfNo sets the "shelf_no" field if the given value is not nil.
func (_c *StocktakeItemCreate) SetNillableShelfNo(v *string) *StocktakeItemCreate {
if v != nil {
_c.SetShelfNo(*v)
}
return _c
}
// SetLayerNo sets the "layer_no" field.
func (_c *StocktakeItemCreate) SetLayerNo(v string) *StocktakeItemCreate {
_c.mutation.SetLayerNo(v)
return _c
}
// SetNillableLayerNo sets the "layer_no" field if the given value is not nil.
func (_c *StocktakeItemCreate) SetNillableLayerNo(v *string) *StocktakeItemCreate {
if v != nil {
_c.SetLayerNo(*v)
}
return _c
}
// SetPositionNo sets the "position_no" field.
func (_c *StocktakeItemCreate) SetPositionNo(v string) *StocktakeItemCreate {
_c.mutation.SetPositionNo(v)
return _c
}
// SetNillablePositionNo sets the "position_no" field if the given value is not nil.
func (_c *StocktakeItemCreate) SetNillablePositionNo(v *string) *StocktakeItemCreate {
if v != nil {
_c.SetPositionNo(*v)
}
return _c
}
// SetBookQty sets the "book_qty" field.
func (_c *StocktakeItemCreate) SetBookQty(v int) *StocktakeItemCreate {
_c.mutation.SetBookQty(v)
@@ -267,6 +309,18 @@ func (_c *StocktakeItemCreate) createSpec() (*StocktakeItem, *sqlgraph.CreateSpe
_spec.SetField(stocktakeitem.FieldZoneCode, field.TypeString, value)
_node.ZoneCode = value
}
if value, ok := _c.mutation.ShelfNo(); ok {
_spec.SetField(stocktakeitem.FieldShelfNo, field.TypeString, value)
_node.ShelfNo = value
}
if value, ok := _c.mutation.LayerNo(); ok {
_spec.SetField(stocktakeitem.FieldLayerNo, field.TypeString, value)
_node.LayerNo = value
}
if value, ok := _c.mutation.PositionNo(); ok {
_spec.SetField(stocktakeitem.FieldPositionNo, field.TypeString, value)
_node.PositionNo = value
}
if value, ok := _c.mutation.BookQty(); ok {
_spec.SetField(stocktakeitem.FieldBookQty, field.TypeInt, value)
_node.BookQty = value
@@ -411,6 +465,60 @@ func (u *StocktakeItemUpsert) ClearZoneCode() *StocktakeItemUpsert {
return u
}
// SetShelfNo sets the "shelf_no" field.
func (u *StocktakeItemUpsert) SetShelfNo(v string) *StocktakeItemUpsert {
u.Set(stocktakeitem.FieldShelfNo, v)
return u
}
// UpdateShelfNo sets the "shelf_no" field to the value that was provided on create.
func (u *StocktakeItemUpsert) UpdateShelfNo() *StocktakeItemUpsert {
u.SetExcluded(stocktakeitem.FieldShelfNo)
return u
}
// ClearShelfNo clears the value of the "shelf_no" field.
func (u *StocktakeItemUpsert) ClearShelfNo() *StocktakeItemUpsert {
u.SetNull(stocktakeitem.FieldShelfNo)
return u
}
// SetLayerNo sets the "layer_no" field.
func (u *StocktakeItemUpsert) SetLayerNo(v string) *StocktakeItemUpsert {
u.Set(stocktakeitem.FieldLayerNo, v)
return u
}
// UpdateLayerNo sets the "layer_no" field to the value that was provided on create.
func (u *StocktakeItemUpsert) UpdateLayerNo() *StocktakeItemUpsert {
u.SetExcluded(stocktakeitem.FieldLayerNo)
return u
}
// ClearLayerNo clears the value of the "layer_no" field.
func (u *StocktakeItemUpsert) ClearLayerNo() *StocktakeItemUpsert {
u.SetNull(stocktakeitem.FieldLayerNo)
return u
}
// SetPositionNo sets the "position_no" field.
func (u *StocktakeItemUpsert) SetPositionNo(v string) *StocktakeItemUpsert {
u.Set(stocktakeitem.FieldPositionNo, v)
return u
}
// UpdatePositionNo sets the "position_no" field to the value that was provided on create.
func (u *StocktakeItemUpsert) UpdatePositionNo() *StocktakeItemUpsert {
u.SetExcluded(stocktakeitem.FieldPositionNo)
return u
}
// ClearPositionNo clears the value of the "position_no" field.
func (u *StocktakeItemUpsert) ClearPositionNo() *StocktakeItemUpsert {
u.SetNull(stocktakeitem.FieldPositionNo)
return u
}
// SetBookQty sets the "book_qty" field.
func (u *StocktakeItemUpsert) SetBookQty(v int) *StocktakeItemUpsert {
u.Set(stocktakeitem.FieldBookQty, v)
@@ -619,6 +727,69 @@ func (u *StocktakeItemUpsertOne) ClearZoneCode() *StocktakeItemUpsertOne {
})
}
// SetShelfNo sets the "shelf_no" field.
func (u *StocktakeItemUpsertOne) SetShelfNo(v string) *StocktakeItemUpsertOne {
return u.Update(func(s *StocktakeItemUpsert) {
s.SetShelfNo(v)
})
}
// UpdateShelfNo sets the "shelf_no" field to the value that was provided on create.
func (u *StocktakeItemUpsertOne) UpdateShelfNo() *StocktakeItemUpsertOne {
return u.Update(func(s *StocktakeItemUpsert) {
s.UpdateShelfNo()
})
}
// ClearShelfNo clears the value of the "shelf_no" field.
func (u *StocktakeItemUpsertOne) ClearShelfNo() *StocktakeItemUpsertOne {
return u.Update(func(s *StocktakeItemUpsert) {
s.ClearShelfNo()
})
}
// SetLayerNo sets the "layer_no" field.
func (u *StocktakeItemUpsertOne) SetLayerNo(v string) *StocktakeItemUpsertOne {
return u.Update(func(s *StocktakeItemUpsert) {
s.SetLayerNo(v)
})
}
// UpdateLayerNo sets the "layer_no" field to the value that was provided on create.
func (u *StocktakeItemUpsertOne) UpdateLayerNo() *StocktakeItemUpsertOne {
return u.Update(func(s *StocktakeItemUpsert) {
s.UpdateLayerNo()
})
}
// ClearLayerNo clears the value of the "layer_no" field.
func (u *StocktakeItemUpsertOne) ClearLayerNo() *StocktakeItemUpsertOne {
return u.Update(func(s *StocktakeItemUpsert) {
s.ClearLayerNo()
})
}
// SetPositionNo sets the "position_no" field.
func (u *StocktakeItemUpsertOne) SetPositionNo(v string) *StocktakeItemUpsertOne {
return u.Update(func(s *StocktakeItemUpsert) {
s.SetPositionNo(v)
})
}
// UpdatePositionNo sets the "position_no" field to the value that was provided on create.
func (u *StocktakeItemUpsertOne) UpdatePositionNo() *StocktakeItemUpsertOne {
return u.Update(func(s *StocktakeItemUpsert) {
s.UpdatePositionNo()
})
}
// ClearPositionNo clears the value of the "position_no" field.
func (u *StocktakeItemUpsertOne) ClearPositionNo() *StocktakeItemUpsertOne {
return u.Update(func(s *StocktakeItemUpsert) {
s.ClearPositionNo()
})
}
// SetBookQty sets the "book_qty" field.
func (u *StocktakeItemUpsertOne) SetBookQty(v int) *StocktakeItemUpsertOne {
return u.Update(func(s *StocktakeItemUpsert) {
@@ -1005,6 +1176,69 @@ func (u *StocktakeItemUpsertBulk) ClearZoneCode() *StocktakeItemUpsertBulk {
})
}
// SetShelfNo sets the "shelf_no" field.
func (u *StocktakeItemUpsertBulk) SetShelfNo(v string) *StocktakeItemUpsertBulk {
return u.Update(func(s *StocktakeItemUpsert) {
s.SetShelfNo(v)
})
}
// UpdateShelfNo sets the "shelf_no" field to the value that was provided on create.
func (u *StocktakeItemUpsertBulk) UpdateShelfNo() *StocktakeItemUpsertBulk {
return u.Update(func(s *StocktakeItemUpsert) {
s.UpdateShelfNo()
})
}
// ClearShelfNo clears the value of the "shelf_no" field.
func (u *StocktakeItemUpsertBulk) ClearShelfNo() *StocktakeItemUpsertBulk {
return u.Update(func(s *StocktakeItemUpsert) {
s.ClearShelfNo()
})
}
// SetLayerNo sets the "layer_no" field.
func (u *StocktakeItemUpsertBulk) SetLayerNo(v string) *StocktakeItemUpsertBulk {
return u.Update(func(s *StocktakeItemUpsert) {
s.SetLayerNo(v)
})
}
// UpdateLayerNo sets the "layer_no" field to the value that was provided on create.
func (u *StocktakeItemUpsertBulk) UpdateLayerNo() *StocktakeItemUpsertBulk {
return u.Update(func(s *StocktakeItemUpsert) {
s.UpdateLayerNo()
})
}
// ClearLayerNo clears the value of the "layer_no" field.
func (u *StocktakeItemUpsertBulk) ClearLayerNo() *StocktakeItemUpsertBulk {
return u.Update(func(s *StocktakeItemUpsert) {
s.ClearLayerNo()
})
}
// SetPositionNo sets the "position_no" field.
func (u *StocktakeItemUpsertBulk) SetPositionNo(v string) *StocktakeItemUpsertBulk {
return u.Update(func(s *StocktakeItemUpsert) {
s.SetPositionNo(v)
})
}
// UpdatePositionNo sets the "position_no" field to the value that was provided on create.
func (u *StocktakeItemUpsertBulk) UpdatePositionNo() *StocktakeItemUpsertBulk {
return u.Update(func(s *StocktakeItemUpsert) {
s.UpdatePositionNo()
})
}
// ClearPositionNo clears the value of the "position_no" field.
func (u *StocktakeItemUpsertBulk) ClearPositionNo() *StocktakeItemUpsertBulk {
return u.Update(func(s *StocktakeItemUpsert) {
s.ClearPositionNo()
})
}
// SetBookQty sets the "book_qty" field.
func (u *StocktakeItemUpsertBulk) SetBookQty(v int) *StocktakeItemUpsertBulk {
return u.Update(func(s *StocktakeItemUpsert) {