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
+68
View File
@@ -19,12 +19,28 @@ const (
FieldFileName = "file_name"
// FieldFilePath holds the string denoting the file_path field in the database.
FieldFilePath = "file_path"
// FieldFileType holds the string denoting the file_type field in the database.
FieldFileType = "file_type"
// FieldFileExt holds the string denoting the file_ext field in the database.
FieldFileExt = "file_ext"
// FieldFileMd5 holds the string denoting the file_md5 field in the database.
FieldFileMd5 = "file_md5"
// FieldFileSize holds the string denoting the file_size field in the database.
FieldFileSize = "file_size"
// FieldMimeType holds the string denoting the mime_type field in the database.
FieldMimeType = "mime_type"
// FieldUploadedBy holds the string denoting the uploaded_by field in the database.
FieldUploadedBy = "uploaded_by"
// FieldArchived holds the string denoting the archived field in the database.
FieldArchived = "archived"
// FieldArchivedAt holds the string denoting the archived_at 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 deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldDeletedBy holds the string denoting the deleted_by field in the database.
FieldDeletedBy = "deleted_by"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// Table holds the table name of the attachment in the database.
@@ -38,9 +54,17 @@ var Columns = []string{
FieldBizID,
FieldFileName,
FieldFilePath,
FieldFileType,
FieldFileExt,
FieldFileMd5,
FieldFileSize,
FieldMimeType,
FieldUploadedBy,
FieldArchived,
FieldArchivedAt,
FieldDeleted,
FieldDeletedAt,
FieldDeletedBy,
FieldCreatedAt,
}
@@ -57,6 +81,10 @@ func ValidColumn(column string) bool {
var (
// DefaultFileSize holds the default value on creation for the "file_size" field.
DefaultFileSize int64
// DefaultArchived holds the default value on creation for the "archived" field.
DefaultArchived bool
// DefaultDeleted holds the default value on creation for the "deleted" field.
DefaultDeleted bool
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() int64
)
@@ -89,6 +117,21 @@ func ByFilePath(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFilePath, opts...).ToFunc()
}
// ByFileType orders the results by the file_type field.
func ByFileType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFileType, opts...).ToFunc()
}
// ByFileExt orders the results by the file_ext field.
func ByFileExt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFileExt, opts...).ToFunc()
}
// ByFileMd5 orders the results by the file_md5 field.
func ByFileMd5(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFileMd5, opts...).ToFunc()
}
// ByFileSize orders the results by the file_size field.
func ByFileSize(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFileSize, opts...).ToFunc()
@@ -104,6 +147,31 @@ func ByUploadedBy(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUploadedBy, 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 archived_at 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 deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByDeletedBy orders the results by the deleted_by field.
func ByDeletedBy(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedBy, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()