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
+208
View File
@@ -150,6 +150,66 @@ func (_u *InboundOrderUpdate) ClearZoneCode() *InboundOrderUpdate {
return _u
}
// SetShelfNo sets the "shelf_no" field.
func (_u *InboundOrderUpdate) SetShelfNo(v string) *InboundOrderUpdate {
_u.mutation.SetShelfNo(v)
return _u
}
// SetNillableShelfNo sets the "shelf_no" field if the given value is not nil.
func (_u *InboundOrderUpdate) SetNillableShelfNo(v *string) *InboundOrderUpdate {
if v != nil {
_u.SetShelfNo(*v)
}
return _u
}
// ClearShelfNo clears the value of the "shelf_no" field.
func (_u *InboundOrderUpdate) ClearShelfNo() *InboundOrderUpdate {
_u.mutation.ClearShelfNo()
return _u
}
// SetLayerNo sets the "layer_no" field.
func (_u *InboundOrderUpdate) SetLayerNo(v string) *InboundOrderUpdate {
_u.mutation.SetLayerNo(v)
return _u
}
// SetNillableLayerNo sets the "layer_no" field if the given value is not nil.
func (_u *InboundOrderUpdate) SetNillableLayerNo(v *string) *InboundOrderUpdate {
if v != nil {
_u.SetLayerNo(*v)
}
return _u
}
// ClearLayerNo clears the value of the "layer_no" field.
func (_u *InboundOrderUpdate) ClearLayerNo() *InboundOrderUpdate {
_u.mutation.ClearLayerNo()
return _u
}
// SetPositionNo sets the "position_no" field.
func (_u *InboundOrderUpdate) SetPositionNo(v string) *InboundOrderUpdate {
_u.mutation.SetPositionNo(v)
return _u
}
// SetNillablePositionNo sets the "position_no" field if the given value is not nil.
func (_u *InboundOrderUpdate) SetNillablePositionNo(v *string) *InboundOrderUpdate {
if v != nil {
_u.SetPositionNo(*v)
}
return _u
}
// ClearPositionNo clears the value of the "position_no" field.
func (_u *InboundOrderUpdate) ClearPositionNo() *InboundOrderUpdate {
_u.mutation.ClearPositionNo()
return _u
}
// SetQuantity sets the "quantity" field.
func (_u *InboundOrderUpdate) SetQuantity(v int) *InboundOrderUpdate {
_u.mutation.ResetQuantity()
@@ -259,6 +319,26 @@ func (_u *InboundOrderUpdate) ClearOwnershipNo() *InboundOrderUpdate {
return _u
}
// SetQualityStatus sets the "quality_status" field.
func (_u *InboundOrderUpdate) SetQualityStatus(v string) *InboundOrderUpdate {
_u.mutation.SetQualityStatus(v)
return _u
}
// SetNillableQualityStatus sets the "quality_status" field if the given value is not nil.
func (_u *InboundOrderUpdate) SetNillableQualityStatus(v *string) *InboundOrderUpdate {
if v != nil {
_u.SetQualityStatus(*v)
}
return _u
}
// ClearQualityStatus clears the value of the "quality_status" field.
func (_u *InboundOrderUpdate) ClearQualityStatus() *InboundOrderUpdate {
_u.mutation.ClearQualityStatus()
return _u
}
// SetCreatedAt sets the "created_at" field.
func (_u *InboundOrderUpdate) SetCreatedAt(v int64) *InboundOrderUpdate {
_u.mutation.ResetCreatedAt()
@@ -354,6 +434,24 @@ func (_u *InboundOrderUpdate) sqlSave(ctx context.Context) (_node int, err error
if _u.mutation.ZoneCodeCleared() {
_spec.ClearField(inboundorder.FieldZoneCode, field.TypeString)
}
if value, ok := _u.mutation.ShelfNo(); ok {
_spec.SetField(inboundorder.FieldShelfNo, field.TypeString, value)
}
if _u.mutation.ShelfNoCleared() {
_spec.ClearField(inboundorder.FieldShelfNo, field.TypeString)
}
if value, ok := _u.mutation.LayerNo(); ok {
_spec.SetField(inboundorder.FieldLayerNo, field.TypeString, value)
}
if _u.mutation.LayerNoCleared() {
_spec.ClearField(inboundorder.FieldLayerNo, field.TypeString)
}
if value, ok := _u.mutation.PositionNo(); ok {
_spec.SetField(inboundorder.FieldPositionNo, field.TypeString, value)
}
if _u.mutation.PositionNoCleared() {
_spec.ClearField(inboundorder.FieldPositionNo, field.TypeString)
}
if value, ok := _u.mutation.Quantity(); ok {
_spec.SetField(inboundorder.FieldQuantity, field.TypeInt, value)
}
@@ -384,6 +482,12 @@ func (_u *InboundOrderUpdate) sqlSave(ctx context.Context) (_node int, err error
if _u.mutation.OwnershipNoCleared() {
_spec.ClearField(inboundorder.FieldOwnershipNo, field.TypeString)
}
if value, ok := _u.mutation.QualityStatus(); ok {
_spec.SetField(inboundorder.FieldQualityStatus, field.TypeString, value)
}
if _u.mutation.QualityStatusCleared() {
_spec.ClearField(inboundorder.FieldQualityStatus, field.TypeString)
}
if value, ok := _u.mutation.CreatedAt(); ok {
_spec.SetField(inboundorder.FieldCreatedAt, field.TypeInt64, value)
}
@@ -533,6 +637,66 @@ func (_u *InboundOrderUpdateOne) ClearZoneCode() *InboundOrderUpdateOne {
return _u
}
// SetShelfNo sets the "shelf_no" field.
func (_u *InboundOrderUpdateOne) SetShelfNo(v string) *InboundOrderUpdateOne {
_u.mutation.SetShelfNo(v)
return _u
}
// SetNillableShelfNo sets the "shelf_no" field if the given value is not nil.
func (_u *InboundOrderUpdateOne) SetNillableShelfNo(v *string) *InboundOrderUpdateOne {
if v != nil {
_u.SetShelfNo(*v)
}
return _u
}
// ClearShelfNo clears the value of the "shelf_no" field.
func (_u *InboundOrderUpdateOne) ClearShelfNo() *InboundOrderUpdateOne {
_u.mutation.ClearShelfNo()
return _u
}
// SetLayerNo sets the "layer_no" field.
func (_u *InboundOrderUpdateOne) SetLayerNo(v string) *InboundOrderUpdateOne {
_u.mutation.SetLayerNo(v)
return _u
}
// SetNillableLayerNo sets the "layer_no" field if the given value is not nil.
func (_u *InboundOrderUpdateOne) SetNillableLayerNo(v *string) *InboundOrderUpdateOne {
if v != nil {
_u.SetLayerNo(*v)
}
return _u
}
// ClearLayerNo clears the value of the "layer_no" field.
func (_u *InboundOrderUpdateOne) ClearLayerNo() *InboundOrderUpdateOne {
_u.mutation.ClearLayerNo()
return _u
}
// SetPositionNo sets the "position_no" field.
func (_u *InboundOrderUpdateOne) SetPositionNo(v string) *InboundOrderUpdateOne {
_u.mutation.SetPositionNo(v)
return _u
}
// SetNillablePositionNo sets the "position_no" field if the given value is not nil.
func (_u *InboundOrderUpdateOne) SetNillablePositionNo(v *string) *InboundOrderUpdateOne {
if v != nil {
_u.SetPositionNo(*v)
}
return _u
}
// ClearPositionNo clears the value of the "position_no" field.
func (_u *InboundOrderUpdateOne) ClearPositionNo() *InboundOrderUpdateOne {
_u.mutation.ClearPositionNo()
return _u
}
// SetQuantity sets the "quantity" field.
func (_u *InboundOrderUpdateOne) SetQuantity(v int) *InboundOrderUpdateOne {
_u.mutation.ResetQuantity()
@@ -642,6 +806,26 @@ func (_u *InboundOrderUpdateOne) ClearOwnershipNo() *InboundOrderUpdateOne {
return _u
}
// SetQualityStatus sets the "quality_status" field.
func (_u *InboundOrderUpdateOne) SetQualityStatus(v string) *InboundOrderUpdateOne {
_u.mutation.SetQualityStatus(v)
return _u
}
// SetNillableQualityStatus sets the "quality_status" field if the given value is not nil.
func (_u *InboundOrderUpdateOne) SetNillableQualityStatus(v *string) *InboundOrderUpdateOne {
if v != nil {
_u.SetQualityStatus(*v)
}
return _u
}
// ClearQualityStatus clears the value of the "quality_status" field.
func (_u *InboundOrderUpdateOne) ClearQualityStatus() *InboundOrderUpdateOne {
_u.mutation.ClearQualityStatus()
return _u
}
// SetCreatedAt sets the "created_at" field.
func (_u *InboundOrderUpdateOne) SetCreatedAt(v int64) *InboundOrderUpdateOne {
_u.mutation.ResetCreatedAt()
@@ -767,6 +951,24 @@ func (_u *InboundOrderUpdateOne) sqlSave(ctx context.Context) (_node *InboundOrd
if _u.mutation.ZoneCodeCleared() {
_spec.ClearField(inboundorder.FieldZoneCode, field.TypeString)
}
if value, ok := _u.mutation.ShelfNo(); ok {
_spec.SetField(inboundorder.FieldShelfNo, field.TypeString, value)
}
if _u.mutation.ShelfNoCleared() {
_spec.ClearField(inboundorder.FieldShelfNo, field.TypeString)
}
if value, ok := _u.mutation.LayerNo(); ok {
_spec.SetField(inboundorder.FieldLayerNo, field.TypeString, value)
}
if _u.mutation.LayerNoCleared() {
_spec.ClearField(inboundorder.FieldLayerNo, field.TypeString)
}
if value, ok := _u.mutation.PositionNo(); ok {
_spec.SetField(inboundorder.FieldPositionNo, field.TypeString, value)
}
if _u.mutation.PositionNoCleared() {
_spec.ClearField(inboundorder.FieldPositionNo, field.TypeString)
}
if value, ok := _u.mutation.Quantity(); ok {
_spec.SetField(inboundorder.FieldQuantity, field.TypeInt, value)
}
@@ -797,6 +999,12 @@ func (_u *InboundOrderUpdateOne) sqlSave(ctx context.Context) (_node *InboundOrd
if _u.mutation.OwnershipNoCleared() {
_spec.ClearField(inboundorder.FieldOwnershipNo, field.TypeString)
}
if value, ok := _u.mutation.QualityStatus(); ok {
_spec.SetField(inboundorder.FieldQualityStatus, field.TypeString, value)
}
if _u.mutation.QualityStatusCleared() {
_spec.ClearField(inboundorder.FieldQualityStatus, field.TypeString)
}
if value, ok := _u.mutation.CreatedAt(); ok {
_spec.SetField(inboundorder.FieldCreatedAt, field.TypeInt64, value)
}