feat(mes): 添加定时同步可生产数量到WMS及BOM项相关标准字段
- 在main.go中添加定时任务每10分钟同步可生产数量到WMS系统 - 为BomItem实体添加relatedStandard字段及相关CRUD方法 - 为InspectionRecord实体添加reportNo、materialCode、materialName等字段 - 更新ent schema确保新字段的验证和默认值设置 - 添加必要的数据库迁移和字段映射逻辑
This commit is contained in:
@@ -109,6 +109,66 @@ func (_u *StocktakeItemUpdate) ClearZoneCode() *StocktakeItemUpdate {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetShelfNo sets the "shelf_no" field.
|
||||
func (_u *StocktakeItemUpdate) SetShelfNo(v string) *StocktakeItemUpdate {
|
||||
_u.mutation.SetShelfNo(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableShelfNo sets the "shelf_no" field if the given value is not nil.
|
||||
func (_u *StocktakeItemUpdate) SetNillableShelfNo(v *string) *StocktakeItemUpdate {
|
||||
if v != nil {
|
||||
_u.SetShelfNo(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearShelfNo clears the value of the "shelf_no" field.
|
||||
func (_u *StocktakeItemUpdate) ClearShelfNo() *StocktakeItemUpdate {
|
||||
_u.mutation.ClearShelfNo()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetLayerNo sets the "layer_no" field.
|
||||
func (_u *StocktakeItemUpdate) SetLayerNo(v string) *StocktakeItemUpdate {
|
||||
_u.mutation.SetLayerNo(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableLayerNo sets the "layer_no" field if the given value is not nil.
|
||||
func (_u *StocktakeItemUpdate) SetNillableLayerNo(v *string) *StocktakeItemUpdate {
|
||||
if v != nil {
|
||||
_u.SetLayerNo(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearLayerNo clears the value of the "layer_no" field.
|
||||
func (_u *StocktakeItemUpdate) ClearLayerNo() *StocktakeItemUpdate {
|
||||
_u.mutation.ClearLayerNo()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPositionNo sets the "position_no" field.
|
||||
func (_u *StocktakeItemUpdate) SetPositionNo(v string) *StocktakeItemUpdate {
|
||||
_u.mutation.SetPositionNo(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePositionNo sets the "position_no" field if the given value is not nil.
|
||||
func (_u *StocktakeItemUpdate) SetNillablePositionNo(v *string) *StocktakeItemUpdate {
|
||||
if v != nil {
|
||||
_u.SetPositionNo(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearPositionNo clears the value of the "position_no" field.
|
||||
func (_u *StocktakeItemUpdate) ClearPositionNo() *StocktakeItemUpdate {
|
||||
_u.mutation.ClearPositionNo()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBookQty sets the "book_qty" field.
|
||||
func (_u *StocktakeItemUpdate) SetBookQty(v int) *StocktakeItemUpdate {
|
||||
_u.mutation.ResetBookQty()
|
||||
@@ -269,6 +329,24 @@ func (_u *StocktakeItemUpdate) sqlSave(ctx context.Context) (_node int, err erro
|
||||
if _u.mutation.ZoneCodeCleared() {
|
||||
_spec.ClearField(stocktakeitem.FieldZoneCode, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.ShelfNo(); ok {
|
||||
_spec.SetField(stocktakeitem.FieldShelfNo, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.ShelfNoCleared() {
|
||||
_spec.ClearField(stocktakeitem.FieldShelfNo, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.LayerNo(); ok {
|
||||
_spec.SetField(stocktakeitem.FieldLayerNo, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.LayerNoCleared() {
|
||||
_spec.ClearField(stocktakeitem.FieldLayerNo, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.PositionNo(); ok {
|
||||
_spec.SetField(stocktakeitem.FieldPositionNo, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.PositionNoCleared() {
|
||||
_spec.ClearField(stocktakeitem.FieldPositionNo, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.BookQty(); ok {
|
||||
_spec.SetField(stocktakeitem.FieldBookQty, field.TypeInt, value)
|
||||
}
|
||||
@@ -398,6 +476,66 @@ func (_u *StocktakeItemUpdateOne) ClearZoneCode() *StocktakeItemUpdateOne {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetShelfNo sets the "shelf_no" field.
|
||||
func (_u *StocktakeItemUpdateOne) SetShelfNo(v string) *StocktakeItemUpdateOne {
|
||||
_u.mutation.SetShelfNo(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableShelfNo sets the "shelf_no" field if the given value is not nil.
|
||||
func (_u *StocktakeItemUpdateOne) SetNillableShelfNo(v *string) *StocktakeItemUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetShelfNo(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearShelfNo clears the value of the "shelf_no" field.
|
||||
func (_u *StocktakeItemUpdateOne) ClearShelfNo() *StocktakeItemUpdateOne {
|
||||
_u.mutation.ClearShelfNo()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetLayerNo sets the "layer_no" field.
|
||||
func (_u *StocktakeItemUpdateOne) SetLayerNo(v string) *StocktakeItemUpdateOne {
|
||||
_u.mutation.SetLayerNo(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableLayerNo sets the "layer_no" field if the given value is not nil.
|
||||
func (_u *StocktakeItemUpdateOne) SetNillableLayerNo(v *string) *StocktakeItemUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetLayerNo(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearLayerNo clears the value of the "layer_no" field.
|
||||
func (_u *StocktakeItemUpdateOne) ClearLayerNo() *StocktakeItemUpdateOne {
|
||||
_u.mutation.ClearLayerNo()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPositionNo sets the "position_no" field.
|
||||
func (_u *StocktakeItemUpdateOne) SetPositionNo(v string) *StocktakeItemUpdateOne {
|
||||
_u.mutation.SetPositionNo(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePositionNo sets the "position_no" field if the given value is not nil.
|
||||
func (_u *StocktakeItemUpdateOne) SetNillablePositionNo(v *string) *StocktakeItemUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetPositionNo(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearPositionNo clears the value of the "position_no" field.
|
||||
func (_u *StocktakeItemUpdateOne) ClearPositionNo() *StocktakeItemUpdateOne {
|
||||
_u.mutation.ClearPositionNo()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetBookQty sets the "book_qty" field.
|
||||
func (_u *StocktakeItemUpdateOne) SetBookQty(v int) *StocktakeItemUpdateOne {
|
||||
_u.mutation.ResetBookQty()
|
||||
@@ -588,6 +726,24 @@ func (_u *StocktakeItemUpdateOne) sqlSave(ctx context.Context) (_node *Stocktake
|
||||
if _u.mutation.ZoneCodeCleared() {
|
||||
_spec.ClearField(stocktakeitem.FieldZoneCode, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.ShelfNo(); ok {
|
||||
_spec.SetField(stocktakeitem.FieldShelfNo, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.ShelfNoCleared() {
|
||||
_spec.ClearField(stocktakeitem.FieldShelfNo, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.LayerNo(); ok {
|
||||
_spec.SetField(stocktakeitem.FieldLayerNo, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.LayerNoCleared() {
|
||||
_spec.ClearField(stocktakeitem.FieldLayerNo, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.PositionNo(); ok {
|
||||
_spec.SetField(stocktakeitem.FieldPositionNo, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.PositionNoCleared() {
|
||||
_spec.ClearField(stocktakeitem.FieldPositionNo, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.BookQty(); ok {
|
||||
_spec.SetField(stocktakeitem.FieldBookQty, field.TypeInt, value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user