feat: 完成附件存储重构与磁盘监控功能,同步物料档案与入库单规则更新
1. 新增跨平台磁盘空间监控能力,每日7点自动检测附件目录剩余空间,触发阈值告警 2. 重构附件存储方案为年/月/日/文件类型分层结构,统一MES与WMS的附件管理逻辑 3. 对齐物料档案与入库单的质量状态校验规则,仅合格品计入库存与出库 4. 实现入库单作废功能与区域库位的多级父子结构管理 5. 删除物料简称字段,补充规格型号与单位必填项,统一系统数据口径 6. 新增附件中心与磁盘状态查询接口,完善权限控制与操作日志
This commit is contained in:
@@ -119,6 +119,146 @@ func (_u *AttachmentUpdate) SetNillableUploader(v *string) *AttachmentUpdate {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFileType sets the "fileType" field.
|
||||
func (_u *AttachmentUpdate) SetFileType(v string) *AttachmentUpdate {
|
||||
_u.mutation.SetFileType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableFileType sets the "fileType" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdate) SetNillableFileType(v *string) *AttachmentUpdate {
|
||||
if v != nil {
|
||||
_u.SetFileType(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFileExt sets the "fileExt" field.
|
||||
func (_u *AttachmentUpdate) SetFileExt(v string) *AttachmentUpdate {
|
||||
_u.mutation.SetFileExt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableFileExt sets the "fileExt" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdate) SetNillableFileExt(v *string) *AttachmentUpdate {
|
||||
if v != nil {
|
||||
_u.SetFileExt(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFileMd5 sets the "fileMd5" field.
|
||||
func (_u *AttachmentUpdate) SetFileMd5(v string) *AttachmentUpdate {
|
||||
_u.mutation.SetFileMd5(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableFileMd5 sets the "fileMd5" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdate) SetNillableFileMd5(v *string) *AttachmentUpdate {
|
||||
if v != nil {
|
||||
_u.SetFileMd5(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMimeType sets the "mimeType" field.
|
||||
func (_u *AttachmentUpdate) SetMimeType(v string) *AttachmentUpdate {
|
||||
_u.mutation.SetMimeType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMimeType sets the "mimeType" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdate) SetNillableMimeType(v *string) *AttachmentUpdate {
|
||||
if v != nil {
|
||||
_u.SetMimeType(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArchived sets the "archived" field.
|
||||
func (_u *AttachmentUpdate) SetArchived(v bool) *AttachmentUpdate {
|
||||
_u.mutation.SetArchived(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArchived sets the "archived" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdate) SetNillableArchived(v *bool) *AttachmentUpdate {
|
||||
if v != nil {
|
||||
_u.SetArchived(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArchivedAt sets the "archivedAt" field.
|
||||
func (_u *AttachmentUpdate) SetArchivedAt(v int64) *AttachmentUpdate {
|
||||
_u.mutation.ResetArchivedAt()
|
||||
_u.mutation.SetArchivedAt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArchivedAt sets the "archivedAt" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdate) SetNillableArchivedAt(v *int64) *AttachmentUpdate {
|
||||
if v != nil {
|
||||
_u.SetArchivedAt(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddArchivedAt adds value to the "archivedAt" field.
|
||||
func (_u *AttachmentUpdate) AddArchivedAt(v int64) *AttachmentUpdate {
|
||||
_u.mutation.AddArchivedAt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *AttachmentUpdate) SetDeleted(v bool) *AttachmentUpdate {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdate) SetNillableDeleted(v *bool) *AttachmentUpdate {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeletedAt sets the "deletedAt" field.
|
||||
func (_u *AttachmentUpdate) SetDeletedAt(v int64) *AttachmentUpdate {
|
||||
_u.mutation.ResetDeletedAt()
|
||||
_u.mutation.SetDeletedAt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeletedAt sets the "deletedAt" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdate) SetNillableDeletedAt(v *int64) *AttachmentUpdate {
|
||||
if v != nil {
|
||||
_u.SetDeletedAt(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDeletedAt adds value to the "deletedAt" field.
|
||||
func (_u *AttachmentUpdate) AddDeletedAt(v int64) *AttachmentUpdate {
|
||||
_u.mutation.AddDeletedAt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeletedBy sets the "deletedBy" field.
|
||||
func (_u *AttachmentUpdate) SetDeletedBy(v string) *AttachmentUpdate {
|
||||
_u.mutation.SetDeletedBy(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeletedBy sets the "deletedBy" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdate) SetNillableDeletedBy(v *string) *AttachmentUpdate {
|
||||
if v != nil {
|
||||
_u.SetDeletedBy(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the AttachmentMutation object of the builder.
|
||||
func (_u *AttachmentUpdate) Mutation() *AttachmentMutation {
|
||||
return _u.mutation
|
||||
@@ -178,6 +318,31 @@ func (_u *AttachmentUpdate) check() error {
|
||||
return &ValidationError{Name: "uploader", err: fmt.Errorf(`ent: validator failed for field "Attachment.uploader": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.FileType(); ok {
|
||||
if err := attachment.FileTypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "fileType", err: fmt.Errorf(`ent: validator failed for field "Attachment.fileType": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.FileExt(); ok {
|
||||
if err := attachment.FileExtValidator(v); err != nil {
|
||||
return &ValidationError{Name: "fileExt", err: fmt.Errorf(`ent: validator failed for field "Attachment.fileExt": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.FileMd5(); ok {
|
||||
if err := attachment.FileMd5Validator(v); err != nil {
|
||||
return &ValidationError{Name: "fileMd5", err: fmt.Errorf(`ent: validator failed for field "Attachment.fileMd5": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.MimeType(); ok {
|
||||
if err := attachment.MimeTypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "mimeType", err: fmt.Errorf(`ent: validator failed for field "Attachment.mimeType": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.DeletedBy(); ok {
|
||||
if err := attachment.DeletedByValidator(v); err != nil {
|
||||
return &ValidationError{Name: "deletedBy", err: fmt.Errorf(`ent: validator failed for field "Attachment.deletedBy": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -220,6 +385,39 @@ func (_u *AttachmentUpdate) sqlSave(ctx context.Context) (_node int, err error)
|
||||
if value, ok := _u.mutation.Uploader(); ok {
|
||||
_spec.SetField(attachment.FieldUploader, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.FileType(); ok {
|
||||
_spec.SetField(attachment.FieldFileType, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.FileExt(); ok {
|
||||
_spec.SetField(attachment.FieldFileExt, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.FileMd5(); ok {
|
||||
_spec.SetField(attachment.FieldFileMd5, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.MimeType(); ok {
|
||||
_spec.SetField(attachment.FieldMimeType, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Archived(); ok {
|
||||
_spec.SetField(attachment.FieldArchived, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ArchivedAt(); ok {
|
||||
_spec.SetField(attachment.FieldArchivedAt, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedArchivedAt(); ok {
|
||||
_spec.AddField(attachment.FieldArchivedAt, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(attachment.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.DeletedAt(); ok {
|
||||
_spec.SetField(attachment.FieldDeletedAt, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedDeletedAt(); ok {
|
||||
_spec.AddField(attachment.FieldDeletedAt, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.DeletedBy(); ok {
|
||||
_spec.SetField(attachment.FieldDeletedBy, field.TypeString, value)
|
||||
}
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
@@ -333,6 +531,146 @@ func (_u *AttachmentUpdateOne) SetNillableUploader(v *string) *AttachmentUpdateO
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFileType sets the "fileType" field.
|
||||
func (_u *AttachmentUpdateOne) SetFileType(v string) *AttachmentUpdateOne {
|
||||
_u.mutation.SetFileType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableFileType sets the "fileType" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdateOne) SetNillableFileType(v *string) *AttachmentUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetFileType(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFileExt sets the "fileExt" field.
|
||||
func (_u *AttachmentUpdateOne) SetFileExt(v string) *AttachmentUpdateOne {
|
||||
_u.mutation.SetFileExt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableFileExt sets the "fileExt" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdateOne) SetNillableFileExt(v *string) *AttachmentUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetFileExt(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetFileMd5 sets the "fileMd5" field.
|
||||
func (_u *AttachmentUpdateOne) SetFileMd5(v string) *AttachmentUpdateOne {
|
||||
_u.mutation.SetFileMd5(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableFileMd5 sets the "fileMd5" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdateOne) SetNillableFileMd5(v *string) *AttachmentUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetFileMd5(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetMimeType sets the "mimeType" field.
|
||||
func (_u *AttachmentUpdateOne) SetMimeType(v string) *AttachmentUpdateOne {
|
||||
_u.mutation.SetMimeType(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableMimeType sets the "mimeType" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdateOne) SetNillableMimeType(v *string) *AttachmentUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetMimeType(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArchived sets the "archived" field.
|
||||
func (_u *AttachmentUpdateOne) SetArchived(v bool) *AttachmentUpdateOne {
|
||||
_u.mutation.SetArchived(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArchived sets the "archived" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdateOne) SetNillableArchived(v *bool) *AttachmentUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetArchived(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetArchivedAt sets the "archivedAt" field.
|
||||
func (_u *AttachmentUpdateOne) SetArchivedAt(v int64) *AttachmentUpdateOne {
|
||||
_u.mutation.ResetArchivedAt()
|
||||
_u.mutation.SetArchivedAt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableArchivedAt sets the "archivedAt" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdateOne) SetNillableArchivedAt(v *int64) *AttachmentUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetArchivedAt(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddArchivedAt adds value to the "archivedAt" field.
|
||||
func (_u *AttachmentUpdateOne) AddArchivedAt(v int64) *AttachmentUpdateOne {
|
||||
_u.mutation.AddArchivedAt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_u *AttachmentUpdateOne) SetDeleted(v bool) *AttachmentUpdateOne {
|
||||
_u.mutation.SetDeleted(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdateOne) SetNillableDeleted(v *bool) *AttachmentUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDeleted(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeletedAt sets the "deletedAt" field.
|
||||
func (_u *AttachmentUpdateOne) SetDeletedAt(v int64) *AttachmentUpdateOne {
|
||||
_u.mutation.ResetDeletedAt()
|
||||
_u.mutation.SetDeletedAt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeletedAt sets the "deletedAt" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdateOne) SetNillableDeletedAt(v *int64) *AttachmentUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDeletedAt(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddDeletedAt adds value to the "deletedAt" field.
|
||||
func (_u *AttachmentUpdateOne) AddDeletedAt(v int64) *AttachmentUpdateOne {
|
||||
_u.mutation.AddDeletedAt(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetDeletedBy sets the "deletedBy" field.
|
||||
func (_u *AttachmentUpdateOne) SetDeletedBy(v string) *AttachmentUpdateOne {
|
||||
_u.mutation.SetDeletedBy(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableDeletedBy sets the "deletedBy" field if the given value is not nil.
|
||||
func (_u *AttachmentUpdateOne) SetNillableDeletedBy(v *string) *AttachmentUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetDeletedBy(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the AttachmentMutation object of the builder.
|
||||
func (_u *AttachmentUpdateOne) Mutation() *AttachmentMutation {
|
||||
return _u.mutation
|
||||
@@ -405,6 +743,31 @@ func (_u *AttachmentUpdateOne) check() error {
|
||||
return &ValidationError{Name: "uploader", err: fmt.Errorf(`ent: validator failed for field "Attachment.uploader": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.FileType(); ok {
|
||||
if err := attachment.FileTypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "fileType", err: fmt.Errorf(`ent: validator failed for field "Attachment.fileType": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.FileExt(); ok {
|
||||
if err := attachment.FileExtValidator(v); err != nil {
|
||||
return &ValidationError{Name: "fileExt", err: fmt.Errorf(`ent: validator failed for field "Attachment.fileExt": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.FileMd5(); ok {
|
||||
if err := attachment.FileMd5Validator(v); err != nil {
|
||||
return &ValidationError{Name: "fileMd5", err: fmt.Errorf(`ent: validator failed for field "Attachment.fileMd5": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.MimeType(); ok {
|
||||
if err := attachment.MimeTypeValidator(v); err != nil {
|
||||
return &ValidationError{Name: "mimeType", err: fmt.Errorf(`ent: validator failed for field "Attachment.mimeType": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.DeletedBy(); ok {
|
||||
if err := attachment.DeletedByValidator(v); err != nil {
|
||||
return &ValidationError{Name: "deletedBy", err: fmt.Errorf(`ent: validator failed for field "Attachment.deletedBy": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -464,6 +827,39 @@ func (_u *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment,
|
||||
if value, ok := _u.mutation.Uploader(); ok {
|
||||
_spec.SetField(attachment.FieldUploader, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.FileType(); ok {
|
||||
_spec.SetField(attachment.FieldFileType, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.FileExt(); ok {
|
||||
_spec.SetField(attachment.FieldFileExt, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.FileMd5(); ok {
|
||||
_spec.SetField(attachment.FieldFileMd5, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.MimeType(); ok {
|
||||
_spec.SetField(attachment.FieldMimeType, field.TypeString, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Archived(); ok {
|
||||
_spec.SetField(attachment.FieldArchived, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.ArchivedAt(); ok {
|
||||
_spec.SetField(attachment.FieldArchivedAt, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedArchivedAt(); ok {
|
||||
_spec.AddField(attachment.FieldArchivedAt, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Deleted(); ok {
|
||||
_spec.SetField(attachment.FieldDeleted, field.TypeBool, value)
|
||||
}
|
||||
if value, ok := _u.mutation.DeletedAt(); ok {
|
||||
_spec.SetField(attachment.FieldDeletedAt, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedDeletedAt(); ok {
|
||||
_spec.AddField(attachment.FieldDeletedAt, field.TypeInt64, value)
|
||||
}
|
||||
if value, ok := _u.mutation.DeletedBy(); ok {
|
||||
_spec.SetField(attachment.FieldDeletedBy, field.TypeString, value)
|
||||
}
|
||||
_spec.AddModifiers(_u.modifiers...)
|
||||
_node = &Attachment{config: _u.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
|
||||
Reference in New Issue
Block a user