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
@@ -55,6 +55,86 @@ func (_u *OutboundOrderUpdate) SetNillableOutboundType(v *string) *OutboundOrder
return _u
}
// SetOutboundCategory sets the "outbound_category" field.
func (_u *OutboundOrderUpdate) SetOutboundCategory(v string) *OutboundOrderUpdate {
_u.mutation.SetOutboundCategory(v)
return _u
}
// SetNillableOutboundCategory sets the "outbound_category" field if the given value is not nil.
func (_u *OutboundOrderUpdate) SetNillableOutboundCategory(v *string) *OutboundOrderUpdate {
if v != nil {
_u.SetOutboundCategory(*v)
}
return _u
}
// ClearOutboundCategory clears the value of the "outbound_category" field.
func (_u *OutboundOrderUpdate) ClearOutboundCategory() *OutboundOrderUpdate {
_u.mutation.ClearOutboundCategory()
return _u
}
// SetOwnershipType sets the "ownership_type" field.
func (_u *OutboundOrderUpdate) SetOwnershipType(v string) *OutboundOrderUpdate {
_u.mutation.SetOwnershipType(v)
return _u
}
// SetNillableOwnershipType sets the "ownership_type" field if the given value is not nil.
func (_u *OutboundOrderUpdate) SetNillableOwnershipType(v *string) *OutboundOrderUpdate {
if v != nil {
_u.SetOwnershipType(*v)
}
return _u
}
// ClearOwnershipType clears the value of the "ownership_type" field.
func (_u *OutboundOrderUpdate) ClearOwnershipType() *OutboundOrderUpdate {
_u.mutation.ClearOwnershipType()
return _u
}
// SetOwnershipNo sets the "ownership_no" field.
func (_u *OutboundOrderUpdate) SetOwnershipNo(v string) *OutboundOrderUpdate {
_u.mutation.SetOwnershipNo(v)
return _u
}
// SetNillableOwnershipNo sets the "ownership_no" field if the given value is not nil.
func (_u *OutboundOrderUpdate) SetNillableOwnershipNo(v *string) *OutboundOrderUpdate {
if v != nil {
_u.SetOwnershipNo(*v)
}
return _u
}
// ClearOwnershipNo clears the value of the "ownership_no" field.
func (_u *OutboundOrderUpdate) ClearOwnershipNo() *OutboundOrderUpdate {
_u.mutation.ClearOwnershipNo()
return _u
}
// SetTargetStation sets the "target_station" field.
func (_u *OutboundOrderUpdate) SetTargetStation(v string) *OutboundOrderUpdate {
_u.mutation.SetTargetStation(v)
return _u
}
// SetNillableTargetStation sets the "target_station" field if the given value is not nil.
func (_u *OutboundOrderUpdate) SetNillableTargetStation(v *string) *OutboundOrderUpdate {
if v != nil {
_u.SetTargetStation(*v)
}
return _u
}
// ClearTargetStation clears the value of the "target_station" field.
func (_u *OutboundOrderUpdate) ClearTargetStation() *OutboundOrderUpdate {
_u.mutation.ClearTargetStation()
return _u
}
// SetOrderNo sets the "order_no" field.
func (_u *OutboundOrderUpdate) SetOrderNo(v string) *OutboundOrderUpdate {
_u.mutation.SetOrderNo(v)
@@ -399,6 +479,30 @@ func (_u *OutboundOrderUpdate) sqlSave(ctx context.Context) (_node int, err erro
if value, ok := _u.mutation.OutboundType(); ok {
_spec.SetField(outboundorder.FieldOutboundType, field.TypeString, value)
}
if value, ok := _u.mutation.OutboundCategory(); ok {
_spec.SetField(outboundorder.FieldOutboundCategory, field.TypeString, value)
}
if _u.mutation.OutboundCategoryCleared() {
_spec.ClearField(outboundorder.FieldOutboundCategory, field.TypeString)
}
if value, ok := _u.mutation.OwnershipType(); ok {
_spec.SetField(outboundorder.FieldOwnershipType, field.TypeString, value)
}
if _u.mutation.OwnershipTypeCleared() {
_spec.ClearField(outboundorder.FieldOwnershipType, field.TypeString)
}
if value, ok := _u.mutation.OwnershipNo(); ok {
_spec.SetField(outboundorder.FieldOwnershipNo, field.TypeString, value)
}
if _u.mutation.OwnershipNoCleared() {
_spec.ClearField(outboundorder.FieldOwnershipNo, field.TypeString)
}
if value, ok := _u.mutation.TargetStation(); ok {
_spec.SetField(outboundorder.FieldTargetStation, field.TypeString, value)
}
if _u.mutation.TargetStationCleared() {
_spec.ClearField(outboundorder.FieldTargetStation, field.TypeString)
}
if value, ok := _u.mutation.OrderNo(); ok {
_spec.SetField(outboundorder.FieldOrderNo, field.TypeString, value)
}
@@ -534,6 +638,86 @@ func (_u *OutboundOrderUpdateOne) SetNillableOutboundType(v *string) *OutboundOr
return _u
}
// SetOutboundCategory sets the "outbound_category" field.
func (_u *OutboundOrderUpdateOne) SetOutboundCategory(v string) *OutboundOrderUpdateOne {
_u.mutation.SetOutboundCategory(v)
return _u
}
// SetNillableOutboundCategory sets the "outbound_category" field if the given value is not nil.
func (_u *OutboundOrderUpdateOne) SetNillableOutboundCategory(v *string) *OutboundOrderUpdateOne {
if v != nil {
_u.SetOutboundCategory(*v)
}
return _u
}
// ClearOutboundCategory clears the value of the "outbound_category" field.
func (_u *OutboundOrderUpdateOne) ClearOutboundCategory() *OutboundOrderUpdateOne {
_u.mutation.ClearOutboundCategory()
return _u
}
// SetOwnershipType sets the "ownership_type" field.
func (_u *OutboundOrderUpdateOne) SetOwnershipType(v string) *OutboundOrderUpdateOne {
_u.mutation.SetOwnershipType(v)
return _u
}
// SetNillableOwnershipType sets the "ownership_type" field if the given value is not nil.
func (_u *OutboundOrderUpdateOne) SetNillableOwnershipType(v *string) *OutboundOrderUpdateOne {
if v != nil {
_u.SetOwnershipType(*v)
}
return _u
}
// ClearOwnershipType clears the value of the "ownership_type" field.
func (_u *OutboundOrderUpdateOne) ClearOwnershipType() *OutboundOrderUpdateOne {
_u.mutation.ClearOwnershipType()
return _u
}
// SetOwnershipNo sets the "ownership_no" field.
func (_u *OutboundOrderUpdateOne) SetOwnershipNo(v string) *OutboundOrderUpdateOne {
_u.mutation.SetOwnershipNo(v)
return _u
}
// SetNillableOwnershipNo sets the "ownership_no" field if the given value is not nil.
func (_u *OutboundOrderUpdateOne) SetNillableOwnershipNo(v *string) *OutboundOrderUpdateOne {
if v != nil {
_u.SetOwnershipNo(*v)
}
return _u
}
// ClearOwnershipNo clears the value of the "ownership_no" field.
func (_u *OutboundOrderUpdateOne) ClearOwnershipNo() *OutboundOrderUpdateOne {
_u.mutation.ClearOwnershipNo()
return _u
}
// SetTargetStation sets the "target_station" field.
func (_u *OutboundOrderUpdateOne) SetTargetStation(v string) *OutboundOrderUpdateOne {
_u.mutation.SetTargetStation(v)
return _u
}
// SetNillableTargetStation sets the "target_station" field if the given value is not nil.
func (_u *OutboundOrderUpdateOne) SetNillableTargetStation(v *string) *OutboundOrderUpdateOne {
if v != nil {
_u.SetTargetStation(*v)
}
return _u
}
// ClearTargetStation clears the value of the "target_station" field.
func (_u *OutboundOrderUpdateOne) ClearTargetStation() *OutboundOrderUpdateOne {
_u.mutation.ClearTargetStation()
return _u
}
// SetOrderNo sets the "order_no" field.
func (_u *OutboundOrderUpdateOne) SetOrderNo(v string) *OutboundOrderUpdateOne {
_u.mutation.SetOrderNo(v)
@@ -908,6 +1092,30 @@ func (_u *OutboundOrderUpdateOne) sqlSave(ctx context.Context) (_node *OutboundO
if value, ok := _u.mutation.OutboundType(); ok {
_spec.SetField(outboundorder.FieldOutboundType, field.TypeString, value)
}
if value, ok := _u.mutation.OutboundCategory(); ok {
_spec.SetField(outboundorder.FieldOutboundCategory, field.TypeString, value)
}
if _u.mutation.OutboundCategoryCleared() {
_spec.ClearField(outboundorder.FieldOutboundCategory, field.TypeString)
}
if value, ok := _u.mutation.OwnershipType(); ok {
_spec.SetField(outboundorder.FieldOwnershipType, field.TypeString, value)
}
if _u.mutation.OwnershipTypeCleared() {
_spec.ClearField(outboundorder.FieldOwnershipType, field.TypeString)
}
if value, ok := _u.mutation.OwnershipNo(); ok {
_spec.SetField(outboundorder.FieldOwnershipNo, field.TypeString, value)
}
if _u.mutation.OwnershipNoCleared() {
_spec.ClearField(outboundorder.FieldOwnershipNo, field.TypeString)
}
if value, ok := _u.mutation.TargetStation(); ok {
_spec.SetField(outboundorder.FieldTargetStation, field.TypeString, value)
}
if _u.mutation.TargetStationCleared() {
_spec.ClearField(outboundorder.FieldTargetStation, field.TypeString)
}
if value, ok := _u.mutation.OrderNo(); ok {
_spec.SetField(outboundorder.FieldOrderNo, field.TypeString, value)
}