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
+313 -6
View File
@@ -21,6 +21,46 @@ type ZoneCreate struct {
conflict []sql.ConflictOption
}
// SetLevel sets the "level" field.
func (_c *ZoneCreate) SetLevel(v int) *ZoneCreate {
_c.mutation.SetLevel(v)
return _c
}
// SetCode sets the "code" field.
func (_c *ZoneCreate) SetCode(v string) *ZoneCreate {
_c.mutation.SetCode(v)
return _c
}
// SetName sets the "name" field.
func (_c *ZoneCreate) SetName(v string) *ZoneCreate {
_c.mutation.SetName(v)
return _c
}
// SetNillableName sets the "name" field if the given value is not nil.
func (_c *ZoneCreate) SetNillableName(v *string) *ZoneCreate {
if v != nil {
_c.SetName(*v)
}
return _c
}
// SetParentCode sets the "parent_code" field.
func (_c *ZoneCreate) SetParentCode(v string) *ZoneCreate {
_c.mutation.SetParentCode(v)
return _c
}
// SetNillableParentCode sets the "parent_code" field if the given value is not nil.
func (_c *ZoneCreate) SetNillableParentCode(v *string) *ZoneCreate {
if v != nil {
_c.SetParentCode(*v)
}
return _c
}
// SetZoneCode sets the "zone_code" field.
func (_c *ZoneCreate) SetZoneCode(v string) *ZoneCreate {
_c.mutation.SetZoneCode(v)
@@ -33,6 +73,14 @@ func (_c *ZoneCreate) SetZoneName(v string) *ZoneCreate {
return _c
}
// SetNillableZoneName sets the "zone_name" field if the given value is not nil.
func (_c *ZoneCreate) SetNillableZoneName(v *string) *ZoneCreate {
if v != nil {
_c.SetZoneName(*v)
}
return _c
}
// SetDescription sets the "description" field.
func (_c *ZoneCreate) SetDescription(v string) *ZoneCreate {
_c.mutation.SetDescription(v)
@@ -182,12 +230,15 @@ func (_c *ZoneCreate) defaults() {
// check runs all checks and user-defined validators on the builder.
func (_c *ZoneCreate) check() error {
if _, ok := _c.mutation.Level(); !ok {
return &ValidationError{Name: "level", err: errors.New(`ent: missing required field "Zone.level"`)}
}
if _, ok := _c.mutation.Code(); !ok {
return &ValidationError{Name: "code", err: errors.New(`ent: missing required field "Zone.code"`)}
}
if _, ok := _c.mutation.ZoneCode(); !ok {
return &ValidationError{Name: "zone_code", err: errors.New(`ent: missing required field "Zone.zone_code"`)}
}
if _, ok := _c.mutation.ZoneName(); !ok {
return &ValidationError{Name: "zone_name", err: errors.New(`ent: missing required field "Zone.zone_name"`)}
}
if _, ok := _c.mutation.Status(); !ok {
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "Zone.status"`)}
}
@@ -221,6 +272,22 @@ func (_c *ZoneCreate) createSpec() (*Zone, *sqlgraph.CreateSpec) {
_spec = sqlgraph.NewCreateSpec(zone.Table, sqlgraph.NewFieldSpec(zone.FieldID, field.TypeInt))
)
_spec.OnConflict = _c.conflict
if value, ok := _c.mutation.Level(); ok {
_spec.SetField(zone.FieldLevel, field.TypeInt, value)
_node.Level = value
}
if value, ok := _c.mutation.Code(); ok {
_spec.SetField(zone.FieldCode, field.TypeString, value)
_node.Code = value
}
if value, ok := _c.mutation.Name(); ok {
_spec.SetField(zone.FieldName, field.TypeString, value)
_node.Name = value
}
if value, ok := _c.mutation.ParentCode(); ok {
_spec.SetField(zone.FieldParentCode, field.TypeString, value)
_node.ParentCode = value
}
if value, ok := _c.mutation.ZoneCode(); ok {
_spec.SetField(zone.FieldZoneCode, field.TypeString, value)
_node.ZoneCode = value
@@ -264,7 +331,7 @@ func (_c *ZoneCreate) createSpec() (*Zone, *sqlgraph.CreateSpec) {
// of the `INSERT` statement. For example:
//
// client.Zone.Create().
// SetZoneCode(v).
// SetLevel(v).
// OnConflict(
// // Update the row with the new values
// // the was proposed for insertion.
@@ -273,7 +340,7 @@ func (_c *ZoneCreate) createSpec() (*Zone, *sqlgraph.CreateSpec) {
// // Override some of the fields with custom
// // update values.
// Update(func(u *ent.ZoneUpsert) {
// SetZoneCode(v+v).
// SetLevel(v+v).
// }).
// Exec(ctx)
func (_c *ZoneCreate) OnConflict(opts ...sql.ConflictOption) *ZoneUpsertOne {
@@ -309,6 +376,72 @@ type (
}
)
// SetLevel sets the "level" field.
func (u *ZoneUpsert) SetLevel(v int) *ZoneUpsert {
u.Set(zone.FieldLevel, v)
return u
}
// UpdateLevel sets the "level" field to the value that was provided on create.
func (u *ZoneUpsert) UpdateLevel() *ZoneUpsert {
u.SetExcluded(zone.FieldLevel)
return u
}
// AddLevel adds v to the "level" field.
func (u *ZoneUpsert) AddLevel(v int) *ZoneUpsert {
u.Add(zone.FieldLevel, v)
return u
}
// SetCode sets the "code" field.
func (u *ZoneUpsert) SetCode(v string) *ZoneUpsert {
u.Set(zone.FieldCode, v)
return u
}
// UpdateCode sets the "code" field to the value that was provided on create.
func (u *ZoneUpsert) UpdateCode() *ZoneUpsert {
u.SetExcluded(zone.FieldCode)
return u
}
// SetName sets the "name" field.
func (u *ZoneUpsert) SetName(v string) *ZoneUpsert {
u.Set(zone.FieldName, v)
return u
}
// UpdateName sets the "name" field to the value that was provided on create.
func (u *ZoneUpsert) UpdateName() *ZoneUpsert {
u.SetExcluded(zone.FieldName)
return u
}
// ClearName clears the value of the "name" field.
func (u *ZoneUpsert) ClearName() *ZoneUpsert {
u.SetNull(zone.FieldName)
return u
}
// SetParentCode sets the "parent_code" field.
func (u *ZoneUpsert) SetParentCode(v string) *ZoneUpsert {
u.Set(zone.FieldParentCode, v)
return u
}
// UpdateParentCode sets the "parent_code" field to the value that was provided on create.
func (u *ZoneUpsert) UpdateParentCode() *ZoneUpsert {
u.SetExcluded(zone.FieldParentCode)
return u
}
// ClearParentCode clears the value of the "parent_code" field.
func (u *ZoneUpsert) ClearParentCode() *ZoneUpsert {
u.SetNull(zone.FieldParentCode)
return u
}
// SetZoneCode sets the "zone_code" field.
func (u *ZoneUpsert) SetZoneCode(v string) *ZoneUpsert {
u.Set(zone.FieldZoneCode, v)
@@ -333,6 +466,12 @@ func (u *ZoneUpsert) UpdateZoneName() *ZoneUpsert {
return u
}
// ClearZoneName clears the value of the "zone_name" field.
func (u *ZoneUpsert) ClearZoneName() *ZoneUpsert {
u.SetNull(zone.FieldZoneName)
return u
}
// SetDescription sets the "description" field.
func (u *ZoneUpsert) SetDescription(v string) *ZoneUpsert {
u.Set(zone.FieldDescription, v)
@@ -499,6 +638,83 @@ func (u *ZoneUpsertOne) Update(set func(*ZoneUpsert)) *ZoneUpsertOne {
return u
}
// SetLevel sets the "level" field.
func (u *ZoneUpsertOne) SetLevel(v int) *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.SetLevel(v)
})
}
// AddLevel adds v to the "level" field.
func (u *ZoneUpsertOne) AddLevel(v int) *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.AddLevel(v)
})
}
// UpdateLevel sets the "level" field to the value that was provided on create.
func (u *ZoneUpsertOne) UpdateLevel() *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.UpdateLevel()
})
}
// SetCode sets the "code" field.
func (u *ZoneUpsertOne) SetCode(v string) *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.SetCode(v)
})
}
// UpdateCode sets the "code" field to the value that was provided on create.
func (u *ZoneUpsertOne) UpdateCode() *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.UpdateCode()
})
}
// SetName sets the "name" field.
func (u *ZoneUpsertOne) SetName(v string) *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.SetName(v)
})
}
// UpdateName sets the "name" field to the value that was provided on create.
func (u *ZoneUpsertOne) UpdateName() *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.UpdateName()
})
}
// ClearName clears the value of the "name" field.
func (u *ZoneUpsertOne) ClearName() *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.ClearName()
})
}
// SetParentCode sets the "parent_code" field.
func (u *ZoneUpsertOne) SetParentCode(v string) *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.SetParentCode(v)
})
}
// UpdateParentCode sets the "parent_code" field to the value that was provided on create.
func (u *ZoneUpsertOne) UpdateParentCode() *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.UpdateParentCode()
})
}
// ClearParentCode clears the value of the "parent_code" field.
func (u *ZoneUpsertOne) ClearParentCode() *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.ClearParentCode()
})
}
// SetZoneCode sets the "zone_code" field.
func (u *ZoneUpsertOne) SetZoneCode(v string) *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
@@ -527,6 +743,13 @@ func (u *ZoneUpsertOne) UpdateZoneName() *ZoneUpsertOne {
})
}
// ClearZoneName clears the value of the "zone_name" field.
func (u *ZoneUpsertOne) ClearZoneName() *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
s.ClearZoneName()
})
}
// SetDescription sets the "description" field.
func (u *ZoneUpsertOne) SetDescription(v string) *ZoneUpsertOne {
return u.Update(func(s *ZoneUpsert) {
@@ -809,7 +1032,7 @@ func (_c *ZoneCreateBulk) ExecX(ctx context.Context) {
// // Override some of the fields with custom
// // update values.
// Update(func(u *ent.ZoneUpsert) {
// SetZoneCode(v+v).
// SetLevel(v+v).
// }).
// Exec(ctx)
func (_c *ZoneCreateBulk) OnConflict(opts ...sql.ConflictOption) *ZoneUpsertBulk {
@@ -878,6 +1101,83 @@ func (u *ZoneUpsertBulk) Update(set func(*ZoneUpsert)) *ZoneUpsertBulk {
return u
}
// SetLevel sets the "level" field.
func (u *ZoneUpsertBulk) SetLevel(v int) *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.SetLevel(v)
})
}
// AddLevel adds v to the "level" field.
func (u *ZoneUpsertBulk) AddLevel(v int) *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.AddLevel(v)
})
}
// UpdateLevel sets the "level" field to the value that was provided on create.
func (u *ZoneUpsertBulk) UpdateLevel() *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.UpdateLevel()
})
}
// SetCode sets the "code" field.
func (u *ZoneUpsertBulk) SetCode(v string) *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.SetCode(v)
})
}
// UpdateCode sets the "code" field to the value that was provided on create.
func (u *ZoneUpsertBulk) UpdateCode() *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.UpdateCode()
})
}
// SetName sets the "name" field.
func (u *ZoneUpsertBulk) SetName(v string) *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.SetName(v)
})
}
// UpdateName sets the "name" field to the value that was provided on create.
func (u *ZoneUpsertBulk) UpdateName() *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.UpdateName()
})
}
// ClearName clears the value of the "name" field.
func (u *ZoneUpsertBulk) ClearName() *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.ClearName()
})
}
// SetParentCode sets the "parent_code" field.
func (u *ZoneUpsertBulk) SetParentCode(v string) *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.SetParentCode(v)
})
}
// UpdateParentCode sets the "parent_code" field to the value that was provided on create.
func (u *ZoneUpsertBulk) UpdateParentCode() *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.UpdateParentCode()
})
}
// ClearParentCode clears the value of the "parent_code" field.
func (u *ZoneUpsertBulk) ClearParentCode() *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.ClearParentCode()
})
}
// SetZoneCode sets the "zone_code" field.
func (u *ZoneUpsertBulk) SetZoneCode(v string) *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
@@ -906,6 +1206,13 @@ func (u *ZoneUpsertBulk) UpdateZoneName() *ZoneUpsertBulk {
})
}
// ClearZoneName clears the value of the "zone_name" field.
func (u *ZoneUpsertBulk) ClearZoneName() *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {
s.ClearZoneName()
})
}
// SetDescription sets the "description" field.
func (u *ZoneUpsertBulk) SetDescription(v string) *ZoneUpsertBulk {
return u.Update(func(s *ZoneUpsert) {