feat(dal,domain): Таблицы для JobGroup фильтров.

This commit is contained in:
Mikhail Trubnikov
2026-06-15 16:56:23 +10:00
parent 1fb5cbd2e8
commit 108eb05853
49 changed files with 4997 additions and 190 deletions

View File

@@ -16,6 +16,10 @@
/// </summary>
public const string Job = "job";
/// <summary>
/// Группы работ
/// </summary>
public const string JobGroup = "jobGroup";
/// <summary>
/// Расписание регламентных работ

View File

@@ -1,6 +1,6 @@
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

View File

@@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using PARR.Domain.Entities.JobGroupEntities;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

View File

@@ -1,30 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using PARR.Domain.Enums;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.Domain.Entities.Job
{
[Table("GroupTypes", Schema = DatabaseSchemas.Job)]
[Comment("Таблица типов групп работ")]
public class JobGroupType : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public required JobGroupTypesEnum Code { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
public ICollection<JobGroup> JobGroups { get; set; } = new HashSet<JobGroup>();
}
}

View File

@@ -11,6 +11,7 @@ namespace PARR.Domain.Entities.Job
public class JobRelationshipFilter
{
public Guid UnitFilterId { get; set; }
/// <summary>
/// Родительская связь - true,
/// Дочерняя связь - false

View File

@@ -7,9 +7,9 @@ using PARR.Domain.Settings;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.Domain.Entities.Job
namespace PARR.Domain.Entities.JobGroupEntities
{
[Table("Groups", Schema = DatabaseSchemas.Job)]
[Table("Groups", Schema = DatabaseSchemas.JobGroup)]
[Comment("Таблица описания групп работ, для реализации зонтиков")]
public class JobGroup : IBaseEntity
{
@@ -180,7 +180,7 @@ namespace PARR.Domain.Entities.Job
[ForeignKey(nameof(GroupTypeId))]
public JobGroupType? GroupType { get; set; }
public ICollection<Job> Jobs { get; set; } = new HashSet<Job>();
public ICollection<Job.Job> Jobs { get; set; } = new HashSet<Job.Job>();
public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
@@ -191,5 +191,7 @@ namespace PARR.Domain.Entities.Job
public ScheduleExcludeTypeCalendar? ScheduleExcludeTypeCalendar { get; set; }
public JobGroupDistributionConfig? DistributionConfig { get; set; }
public JobGroupAutoControl? AutoControl { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.Domain.Entities.JobGroupEntities
{
[Table("AutoControls", Schema = DatabaseSchemas.JobGroup)]
[Comment("Таблица управления автоконтролем для группы работ")]
public class JobGroupAutoControl
{
[Key]
public Guid JobGroupId { get; set; }
/// <summary>
/// Включен автоконтроль
/// </summary>
public bool IsEnable { get; set; } = false;
/// <summary>
/// Статус шаблона в момент привязки или создания нового шаблона к Job
/// </summary>
public bool InitUsedTemplateState { get; set; } = false;
/// <summary>
/// Статус расписания в момент привязки или создания нового шаблона к Job
/// </summary>
public bool InitUsedScheduleState { get; set; } = false;
[ForeignKey(nameof(JobGroupId))]
public JobGroup? JobGroup { get; set; }
}
}

View File

@@ -3,12 +3,12 @@ using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.Domain.Entities.Job
namespace PARR.Domain.Entities.JobGroupEntities
{
/// <summary>
/// Настройки автораспределения для JobGroup
/// </summary>
[Table("GroupDistributionConfigs", Schema = DatabaseSchemas.Job)]
[Table("GroupDistributionConfigs", Schema = DatabaseSchemas.JobGroup)]
[Comment("Настройки автораспределения для группы работ")]
public class JobGroupDistributionConfig
{

View File

@@ -0,0 +1,39 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using PARR.Domain.Entities.Unit;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.Domain.Entities.JobGroupEntities
{
[Table("FieldFilters", Schema = DatabaseSchemas.JobGroup)]
[Comment("Таблица описания критериев выборки аттрибутов ЭК")]
public class JobGroupFieldFilter : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public Guid UnitFilterId { get; set; }
public Guid FieldId { get; set; }
public required string ValueMask { get; set; }
/// <summary>
/// Отсутствует
/// </summary>
public bool IsInverse { get; set; } = false;
[ForeignKey(nameof(FieldId))]
public UnitField? UnitField { get; set; }
[ForeignKey(nameof(UnitFilterId))]
public JobGroupUnitFilter? UnitFilter { get; set; }
}
}

View File

@@ -0,0 +1,51 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Cache.Models;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.Unit;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PARR.Domain.Entities.JobGroupEntities
{
[Table("RelationshipFilters", Schema = DatabaseSchemas.JobGroup)]
[Comment("Таблица фильтров связей ЭК")]
[PrimaryKey(nameof(UnitFilterId), nameof(FieldId))]
public class JobGroupRelationshipFilter
{
public Guid UnitFilterId { get; set; }
/// <summary>
/// Родительская связь - true,
/// Дочерняя связь - false
/// </summary>
public bool IsParent { get; set; }
public Guid FieldId { get; set; }
public required string ValueMask { get; set; }
/// <summary>
/// Полное совпадение или хотябы одно
/// true - list.All()
/// false - list.Any()
/// </summary>
public bool IsFullMatch { get; set; }
/// <summary>
/// Обратный фильтр, что у связи нет таких значений
/// </summary>
public bool IsInverse { get; set; }
[ForeignKey(nameof(UnitFilterId))]
public JobGroupUnitFilter? UnitFilter { get; set; }
[ForeignKey(nameof(FieldId))]
public UnitField? UnitField { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using PARR.Domain.Enums;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.Domain.Entities.JobGroupEntities
{
[Table("GroupTypes", Schema = DatabaseSchemas.JobGroup)]
[Comment("Таблица типов групп работ")]
public class JobGroupType : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public required JobGroupTypesEnum Code { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
/// <summary>
/// Разрешить Job фильтры. Влияет только на интерфейс.
/// Мэтчер собирает все фильтры из группы и работ всегда.
/// </summary>
[Comment("Разрешить Job фильтры. Влияет только на интерфейс. Мэтчер собирает все фильтры из группы и работ всегда.")]
public bool IsAllowJobUnitFilter { get; set; }
/// <summary>
/// Автоконтролем управляет JobGroup? true - да JobGroup, false - Job.
/// Влияет на интерфейс и на логику работы автоконтроля.
/// </summary>
[Comment("Автоконтролем управляет JobGroup? true - да JobGroup, false - Job. Влияет на интерфейс и на логику работы автоконтроля.")]
public bool IsJobGroupAutoControl { get; set; } = false;
public ICollection<JobGroup> JobGroups { get; set; } = new HashSet<JobGroup>();
}
}

View File

@@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.Domain.Entities.JobGroupEntities
{
[Table("UnitFilters", Schema = DatabaseSchemas.JobGroup)]
[Comment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП")]
public class JobGroupUnitFilter : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public required string UnitFilter { get; set; }
public Guid JobGroupId { get; set; }
[ForeignKey(nameof(JobGroupId))]
public JobGroup? JobGroup { get; set; }
public ICollection<JobGroupFieldFilter> FieldFilters { get; set; } = new HashSet<JobGroupFieldFilter>();
public ICollection<JobGroupRelationshipFilter> RelationshipFilters { get; set; } = new HashSet<JobGroupRelationshipFilter>();
}
}

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.Domain.Entities.Schedule

View File

@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

View File

@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

View File

@@ -2,6 +2,7 @@
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -58,10 +59,17 @@ namespace PARR.Domain.Entities.Unit
public ICollection<JobRelationshipFilter> RelationshipFilters { get; set; } = new HashSet<JobRelationshipFilter>();
public ICollection<JobGroupRelationshipFilter> JobGroupRelationshipFilters { get; set; } = new HashSet<JobGroupRelationshipFilter>();
/// <summary>
/// JobGroup которые группируются по этому полю (!!!отключено каскадное удаление!!!)
/// </summary>
public ICollection<JobGroup> JobGroupWithGrouping { get; set; } = new HashSet<JobGroup>();
public ICollection<JobFieldFilter> JobFieldFilters { get; set; } = new HashSet<JobFieldFilter>();
public ICollection<JobGroupFieldFilter> JobGroupFieldFilters { get; set; } = new HashSet<JobGroupFieldFilter>();
}
}