feat: 完成附件存储重构与磁盘监控功能,同步物料档案与入库单规则更新
1. 新增跨平台磁盘空间监控能力,每日7点自动检测附件目录剩余空间,触发阈值告警 2. 重构附件存储方案为年/月/日/文件类型分层结构,统一MES与WMS的附件管理逻辑 3. 对齐物料档案与入库单的质量状态校验规则,仅合格品计入库存与出库 4. 实现入库单作废功能与区域库位的多级父子结构管理 5. 删除物料简称字段,补充规格型号与单位必填项,统一系统数据口径 6. 新增附件中心与磁盘状态查询接口,完善权限控制与操作日志
This commit is contained in:
@@ -86,6 +86,132 @@ func (_c *AttachmentCreate) SetNillableCreatedAt(v *time.Time) *AttachmentCreate
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetFileType sets the "fileType" field.
|
||||
func (_c *AttachmentCreate) SetFileType(v string) *AttachmentCreate {
|
||||
_c.mutation.SetFileType(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableFileType sets the "fileType" field if the given value is not nil.
|
||||
func (_c *AttachmentCreate) SetNillableFileType(v *string) *AttachmentCreate {
|
||||
if v != nil {
|
||||
_c.SetFileType(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetFileExt sets the "fileExt" field.
|
||||
func (_c *AttachmentCreate) SetFileExt(v string) *AttachmentCreate {
|
||||
_c.mutation.SetFileExt(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableFileExt sets the "fileExt" field if the given value is not nil.
|
||||
func (_c *AttachmentCreate) SetNillableFileExt(v *string) *AttachmentCreate {
|
||||
if v != nil {
|
||||
_c.SetFileExt(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetFileMd5 sets the "fileMd5" field.
|
||||
func (_c *AttachmentCreate) SetFileMd5(v string) *AttachmentCreate {
|
||||
_c.mutation.SetFileMd5(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableFileMd5 sets the "fileMd5" field if the given value is not nil.
|
||||
func (_c *AttachmentCreate) SetNillableFileMd5(v *string) *AttachmentCreate {
|
||||
if v != nil {
|
||||
_c.SetFileMd5(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetMimeType sets the "mimeType" field.
|
||||
func (_c *AttachmentCreate) SetMimeType(v string) *AttachmentCreate {
|
||||
_c.mutation.SetMimeType(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableMimeType sets the "mimeType" field if the given value is not nil.
|
||||
func (_c *AttachmentCreate) SetNillableMimeType(v *string) *AttachmentCreate {
|
||||
if v != nil {
|
||||
_c.SetMimeType(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetArchived sets the "archived" field.
|
||||
func (_c *AttachmentCreate) SetArchived(v bool) *AttachmentCreate {
|
||||
_c.mutation.SetArchived(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableArchived sets the "archived" field if the given value is not nil.
|
||||
func (_c *AttachmentCreate) SetNillableArchived(v *bool) *AttachmentCreate {
|
||||
if v != nil {
|
||||
_c.SetArchived(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetArchivedAt sets the "archivedAt" field.
|
||||
func (_c *AttachmentCreate) SetArchivedAt(v int64) *AttachmentCreate {
|
||||
_c.mutation.SetArchivedAt(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableArchivedAt sets the "archivedAt" field if the given value is not nil.
|
||||
func (_c *AttachmentCreate) SetNillableArchivedAt(v *int64) *AttachmentCreate {
|
||||
if v != nil {
|
||||
_c.SetArchivedAt(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeleted sets the "deleted" field.
|
||||
func (_c *AttachmentCreate) SetDeleted(v bool) *AttachmentCreate {
|
||||
_c.mutation.SetDeleted(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||
func (_c *AttachmentCreate) SetNillableDeleted(v *bool) *AttachmentCreate {
|
||||
if v != nil {
|
||||
_c.SetDeleted(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeletedAt sets the "deletedAt" field.
|
||||
func (_c *AttachmentCreate) SetDeletedAt(v int64) *AttachmentCreate {
|
||||
_c.mutation.SetDeletedAt(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableDeletedAt sets the "deletedAt" field if the given value is not nil.
|
||||
func (_c *AttachmentCreate) SetNillableDeletedAt(v *int64) *AttachmentCreate {
|
||||
if v != nil {
|
||||
_c.SetDeletedAt(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetDeletedBy sets the "deletedBy" field.
|
||||
func (_c *AttachmentCreate) SetDeletedBy(v string) *AttachmentCreate {
|
||||
_c.mutation.SetDeletedBy(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableDeletedBy sets the "deletedBy" field if the given value is not nil.
|
||||
func (_c *AttachmentCreate) SetNillableDeletedBy(v *string) *AttachmentCreate {
|
||||
if v != nil {
|
||||
_c.SetDeletedBy(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (_c *AttachmentCreate) SetID(v int) *AttachmentCreate {
|
||||
_c.mutation.SetID(v)
|
||||
@@ -139,6 +265,42 @@ func (_c *AttachmentCreate) defaults() {
|
||||
v := attachment.DefaultCreatedAt()
|
||||
_c.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := _c.mutation.FileType(); !ok {
|
||||
v := attachment.DefaultFileType
|
||||
_c.mutation.SetFileType(v)
|
||||
}
|
||||
if _, ok := _c.mutation.FileExt(); !ok {
|
||||
v := attachment.DefaultFileExt
|
||||
_c.mutation.SetFileExt(v)
|
||||
}
|
||||
if _, ok := _c.mutation.FileMd5(); !ok {
|
||||
v := attachment.DefaultFileMd5
|
||||
_c.mutation.SetFileMd5(v)
|
||||
}
|
||||
if _, ok := _c.mutation.MimeType(); !ok {
|
||||
v := attachment.DefaultMimeType
|
||||
_c.mutation.SetMimeType(v)
|
||||
}
|
||||
if _, ok := _c.mutation.Archived(); !ok {
|
||||
v := attachment.DefaultArchived
|
||||
_c.mutation.SetArchived(v)
|
||||
}
|
||||
if _, ok := _c.mutation.ArchivedAt(); !ok {
|
||||
v := attachment.DefaultArchivedAt
|
||||
_c.mutation.SetArchivedAt(v)
|
||||
}
|
||||
if _, ok := _c.mutation.Deleted(); !ok {
|
||||
v := attachment.DefaultDeleted
|
||||
_c.mutation.SetDeleted(v)
|
||||
}
|
||||
if _, ok := _c.mutation.DeletedAt(); !ok {
|
||||
v := attachment.DefaultDeletedAt
|
||||
_c.mutation.SetDeletedAt(v)
|
||||
}
|
||||
if _, ok := _c.mutation.DeletedBy(); !ok {
|
||||
v := attachment.DefaultDeletedBy
|
||||
_c.mutation.SetDeletedBy(v)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
@@ -189,6 +351,58 @@ func (_c *AttachmentCreate) check() error {
|
||||
if _, ok := _c.mutation.CreatedAt(); !ok {
|
||||
return &ValidationError{Name: "createdAt", err: errors.New(`ent: missing required field "Attachment.createdAt"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.FileType(); !ok {
|
||||
return &ValidationError{Name: "fileType", err: errors.New(`ent: missing required field "Attachment.fileType"`)}
|
||||
}
|
||||
if v, ok := _c.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 _, ok := _c.mutation.FileExt(); !ok {
|
||||
return &ValidationError{Name: "fileExt", err: errors.New(`ent: missing required field "Attachment.fileExt"`)}
|
||||
}
|
||||
if v, ok := _c.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 _, ok := _c.mutation.FileMd5(); !ok {
|
||||
return &ValidationError{Name: "fileMd5", err: errors.New(`ent: missing required field "Attachment.fileMd5"`)}
|
||||
}
|
||||
if v, ok := _c.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 _, ok := _c.mutation.MimeType(); !ok {
|
||||
return &ValidationError{Name: "mimeType", err: errors.New(`ent: missing required field "Attachment.mimeType"`)}
|
||||
}
|
||||
if v, ok := _c.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 _, ok := _c.mutation.Archived(); !ok {
|
||||
return &ValidationError{Name: "archived", err: errors.New(`ent: missing required field "Attachment.archived"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.ArchivedAt(); !ok {
|
||||
return &ValidationError{Name: "archivedAt", err: errors.New(`ent: missing required field "Attachment.archivedAt"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.Deleted(); !ok {
|
||||
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "Attachment.deleted"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.DeletedAt(); !ok {
|
||||
return &ValidationError{Name: "deletedAt", err: errors.New(`ent: missing required field "Attachment.deletedAt"`)}
|
||||
}
|
||||
if _, ok := _c.mutation.DeletedBy(); !ok {
|
||||
return &ValidationError{Name: "deletedBy", err: errors.New(`ent: missing required field "Attachment.deletedBy"`)}
|
||||
}
|
||||
if v, ok := _c.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)}
|
||||
}
|
||||
}
|
||||
if v, ok := _c.mutation.ID(); ok {
|
||||
if err := attachment.IDValidator(v); err != nil {
|
||||
return &ValidationError{Name: "id", err: fmt.Errorf(`ent: validator failed for field "Attachment.id": %w`, err)}
|
||||
@@ -254,6 +468,42 @@ func (_c *AttachmentCreate) createSpec() (*Attachment, *sqlgraph.CreateSpec) {
|
||||
_spec.SetField(attachment.FieldCreatedAt, field.TypeTime, value)
|
||||
_node.CreatedAt = value
|
||||
}
|
||||
if value, ok := _c.mutation.FileType(); ok {
|
||||
_spec.SetField(attachment.FieldFileType, field.TypeString, value)
|
||||
_node.FileType = value
|
||||
}
|
||||
if value, ok := _c.mutation.FileExt(); ok {
|
||||
_spec.SetField(attachment.FieldFileExt, field.TypeString, value)
|
||||
_node.FileExt = value
|
||||
}
|
||||
if value, ok := _c.mutation.FileMd5(); ok {
|
||||
_spec.SetField(attachment.FieldFileMd5, field.TypeString, value)
|
||||
_node.FileMd5 = value
|
||||
}
|
||||
if value, ok := _c.mutation.MimeType(); ok {
|
||||
_spec.SetField(attachment.FieldMimeType, field.TypeString, value)
|
||||
_node.MimeType = value
|
||||
}
|
||||
if value, ok := _c.mutation.Archived(); ok {
|
||||
_spec.SetField(attachment.FieldArchived, field.TypeBool, value)
|
||||
_node.Archived = value
|
||||
}
|
||||
if value, ok := _c.mutation.ArchivedAt(); ok {
|
||||
_spec.SetField(attachment.FieldArchivedAt, field.TypeInt64, value)
|
||||
_node.ArchivedAt = value
|
||||
}
|
||||
if value, ok := _c.mutation.Deleted(); ok {
|
||||
_spec.SetField(attachment.FieldDeleted, field.TypeBool, value)
|
||||
_node.Deleted = value
|
||||
}
|
||||
if value, ok := _c.mutation.DeletedAt(); ok {
|
||||
_spec.SetField(attachment.FieldDeletedAt, field.TypeInt64, value)
|
||||
_node.DeletedAt = value
|
||||
}
|
||||
if value, ok := _c.mutation.DeletedBy(); ok {
|
||||
_spec.SetField(attachment.FieldDeletedBy, field.TypeString, value)
|
||||
_node.DeletedBy = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user