feat: 完成附件存储重构与磁盘监控功能,同步物料档案与入库单规则更新

1.  新增跨平台磁盘空间监控能力,每日7点自动检测附件目录剩余空间,触发阈值告警
2.  重构附件存储方案为年/月/日/文件类型分层结构,统一MES与WMS的附件管理逻辑
3.  对齐物料档案与入库单的质量状态校验规则,仅合格品计入库存与出库
4.  实现入库单作废功能与区域库位的多级父子结构管理
5.  删除物料简称字段,补充规格型号与单位必填项,统一系统数据口径
6.  新增附件中心与磁盘状态查询接口,完善权限控制与操作日志
This commit is contained in:
SunYF
2026-09-19 10:54:15 +08:00
parent 9002d9a642
commit 62e45b7379
95 changed files with 10467 additions and 2677 deletions
+100
View File
@@ -27,6 +27,24 @@ const (
FieldUploader = "uploader"
// FieldCreatedAt holds the string denoting the createdat field in the database.
FieldCreatedAt = "created_at"
// FieldFileType holds the string denoting the filetype field in the database.
FieldFileType = "file_type"
// FieldFileExt holds the string denoting the fileext field in the database.
FieldFileExt = "file_ext"
// FieldFileMd5 holds the string denoting the filemd5 field in the database.
FieldFileMd5 = "file_md5"
// FieldMimeType holds the string denoting the mimetype field in the database.
FieldMimeType = "mime_type"
// FieldArchived holds the string denoting the archived field in the database.
FieldArchived = "archived"
// FieldArchivedAt holds the string denoting the archivedat field in the database.
FieldArchivedAt = "archived_at"
// FieldDeleted holds the string denoting the deleted field in the database.
FieldDeleted = "deleted"
// FieldDeletedAt holds the string denoting the deletedat field in the database.
FieldDeletedAt = "deleted_at"
// FieldDeletedBy holds the string denoting the deletedby field in the database.
FieldDeletedBy = "deleted_by"
// Table holds the table name of the attachment in the database.
Table = "attachment"
)
@@ -41,6 +59,15 @@ var Columns = []string{
FieldFileSize,
FieldUploader,
FieldCreatedAt,
FieldFileType,
FieldFileExt,
FieldFileMd5,
FieldMimeType,
FieldArchived,
FieldArchivedAt,
FieldDeleted,
FieldDeletedAt,
FieldDeletedBy,
}
// ValidColumn reports if the column name is valid (part of the table columns).
@@ -70,6 +97,34 @@ var (
UploaderValidator func(string) error
// DefaultCreatedAt holds the default value on creation for the "createdAt" field.
DefaultCreatedAt func() time.Time
// DefaultFileType holds the default value on creation for the "fileType" field.
DefaultFileType string
// FileTypeValidator is a validator for the "fileType" field. It is called by the builders before save.
FileTypeValidator func(string) error
// DefaultFileExt holds the default value on creation for the "fileExt" field.
DefaultFileExt string
// FileExtValidator is a validator for the "fileExt" field. It is called by the builders before save.
FileExtValidator func(string) error
// DefaultFileMd5 holds the default value on creation for the "fileMd5" field.
DefaultFileMd5 string
// FileMd5Validator is a validator for the "fileMd5" field. It is called by the builders before save.
FileMd5Validator func(string) error
// DefaultMimeType holds the default value on creation for the "mimeType" field.
DefaultMimeType string
// MimeTypeValidator is a validator for the "mimeType" field. It is called by the builders before save.
MimeTypeValidator func(string) error
// DefaultArchived holds the default value on creation for the "archived" field.
DefaultArchived bool
// DefaultArchivedAt holds the default value on creation for the "archivedAt" field.
DefaultArchivedAt int64
// DefaultDeleted holds the default value on creation for the "deleted" field.
DefaultDeleted bool
// DefaultDeletedAt holds the default value on creation for the "deletedAt" field.
DefaultDeletedAt int64
// DefaultDeletedBy holds the default value on creation for the "deletedBy" field.
DefaultDeletedBy string
// DeletedByValidator is a validator for the "deletedBy" field. It is called by the builders before save.
DeletedByValidator func(string) error
// IDValidator is a validator for the "id" field. It is called by the builders before save.
IDValidator func(int) error
)
@@ -116,3 +171,48 @@ func ByUploader(opts ...sql.OrderTermOption) OrderOption {
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByFileType orders the results by the fileType field.
func ByFileType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFileType, opts...).ToFunc()
}
// ByFileExt orders the results by the fileExt field.
func ByFileExt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFileExt, opts...).ToFunc()
}
// ByFileMd5 orders the results by the fileMd5 field.
func ByFileMd5(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFileMd5, opts...).ToFunc()
}
// ByMimeType orders the results by the mimeType field.
func ByMimeType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMimeType, opts...).ToFunc()
}
// ByArchived orders the results by the archived field.
func ByArchived(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldArchived, opts...).ToFunc()
}
// ByArchivedAt orders the results by the archivedAt field.
func ByArchivedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldArchivedAt, opts...).ToFunc()
}
// ByDeleted orders the results by the deleted field.
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
}
// ByDeletedAt orders the results by the deletedAt field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByDeletedBy orders the results by the deletedBy field.
func ByDeletedBy(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedBy, opts...).ToFunc()
}