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

@@ -21,7 +21,7 @@ using PARR.Domain.Common.Pagination;
using PARR.Domain.Common.Rabbit.Messages; using PARR.Domain.Common.Rabbit.Messages;
using PARR.Domain.Common.Roles; using PARR.Domain.Common.Roles;
using PARR.Domain.Entities.Base.History; using PARR.Domain.Entities.Base.History;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
using PARR.Domain.Entities.Schedule; using PARR.Domain.Entities.Schedule;
using PARR.Domain.Enums; using PARR.Domain.Enums;

View File

@@ -15,7 +15,7 @@ using PARR.Core.Services.NextRunServices;
using PARR.Core.Services.Shortcodes; using PARR.Core.Services.Shortcodes;
using PARR.Domain.Common.Roles; using PARR.Domain.Common.Roles;
using PARR.Domain.Entities; using PARR.Domain.Entities;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
using PARR.Domain.Enums; using PARR.Domain.Enums;
namespace PARR.API.Controllers.V1.Statistics namespace PARR.API.Controllers.V1.Statistics

View File

@@ -14,6 +14,7 @@ using PARR.Domain.DTOs.Workload;
using PARR.Domain.Entities; using PARR.Domain.Entities;
using PARR.Domain.Entities.Base.History; using PARR.Domain.Entities.Base.History;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using PARR.Domain.Entities.Schedule; using PARR.Domain.Entities.Schedule;
using PARR.Domain.Entities.Unit; using PARR.Domain.Entities.Unit;

View File

@@ -1,7 +1,7 @@
using AutoMapper; using AutoMapper;
using PARR.API.Contracts.V1.Responses; using PARR.API.Contracts.V1.Responses;
using PARR.Core.Repositories.Interfaces.Schedule; using PARR.Core.Repositories.Interfaces.Schedule;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
using PARR.Domain.Settings; using PARR.Domain.Settings;
namespace PARR.API.MappingProfiles.Resolvers namespace PARR.API.MappingProfiles.Resolvers

View File

@@ -3,7 +3,7 @@ using PARR.API.Contracts.V1.Requests;
using PARR.Core.Repositories.Interfaces; using PARR.Core.Repositories.Interfaces;
using PARR.Core.Repositories.Interfaces.Job; using PARR.Core.Repositories.Interfaces.Job;
using PARR.Core.Repositories.Interfaces.Unit; using PARR.Core.Repositories.Interfaces.Unit;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.API.Validators namespace PARR.API.Validators
{ {

View File

@@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Job; using PARR.Core.Repositories.Interfaces.Job;
using PARR.Domain.Entities.Base.History; using PARR.Domain.Entities.Base.History;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using PARR.Domain.Entities.Schedule; using PARR.Domain.Entities.Schedule;
namespace PARR.Core.Common.Helpers; namespace PARR.Core.Common.Helpers;

View File

@@ -1,5 +1,5 @@
using PARR.Core.Repositories.Base; using PARR.Core.Repositories.Base;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.Core.Repositories.Interfaces.Job namespace PARR.Core.Repositories.Interfaces.Job
{ {

View File

@@ -1,5 +1,5 @@
using PARR.Core.Repositories.Base; using PARR.Core.Repositories.Base;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.Core.Repositories.Interfaces.Job namespace PARR.Core.Repositories.Interfaces.Job
{ {

View File

@@ -0,0 +1,9 @@
using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.Core.Repositories.Interfaces.JobGroupRepositories
{
public interface IJobGroupAutoControlRepository
{
IQueryable<JobGroupAutoControl> Get();
}
}

View File

@@ -0,0 +1,9 @@
using PARR.Core.Repositories.Base;
using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.Core.Repositories.Interfaces.JobGroupRepositories
{
public interface IJobGroupFieldFilterRepository : IBaseRepository<JobGroupFieldFilter>
{
}
}

View File

@@ -0,0 +1,6 @@
namespace PARR.Core.Repositories.Interfaces.JobGroupRepositories
{
public interface IJobGroupRelationshipFilterRepository
{
}
}

View File

@@ -0,0 +1,9 @@
using PARR.Core.Repositories.Base;
using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.Core.Repositories.Interfaces.JobGroupRepositories
{
public interface IJobGroupUnitFilterRepository : IBaseRepository<JobGroupUnitFilter>
{
}
}

View File

@@ -1,5 +1,5 @@
using PARR.Core.Services.NextRunServices.Models; using PARR.Core.Services.NextRunServices.Models;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
using PARR.Domain.Enums; using PARR.Domain.Enums;
namespace PARR.Core.Services.NextRunServices namespace PARR.Core.Services.NextRunServices

View File

@@ -7,7 +7,7 @@ using PARR.Core.Services.NextRunServices.Models;
using PARR.Core.Services.NextRunServices.Subservices; using PARR.Core.Services.NextRunServices.Subservices;
using PARR.Core.Services.Shortcodes; using PARR.Core.Services.Shortcodes;
using PARR.Domain.Entities; using PARR.Domain.Entities;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
using PARR.Domain.Enums; using PARR.Domain.Enums;
using PARR.Domain.Settings; using PARR.Domain.Settings;

View File

@@ -12,6 +12,7 @@ using PARR.Core.Services.UnitService.Interfaces;
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.Domain.Cache.Models; using PARR.Domain.Cache.Models;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using PARR.Domain.Entities.Unit; using PARR.Domain.Entities.Unit;
using PARR.Domain.Enums; using PARR.Domain.Enums;

View File

@@ -4,6 +4,7 @@ using PARR.Domain.Common.Roles;
using PARR.Domain.Common.Template; using PARR.Domain.Common.Template;
using PARR.Domain.Entities; using PARR.Domain.Entities;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using PARR.Domain.Entities.RobotEntities; using PARR.Domain.Entities.RobotEntities;
using PARR.Domain.Entities.Schedule; using PARR.Domain.Entities.Schedule;
using PARR.Domain.Entities.TaskEntities; using PARR.Domain.Entities.TaskEntities;
@@ -106,16 +107,28 @@ namespace PARR.DAL.Context
public DbSet<JobUnitFilter> JobUnitFilters { get; set; } public DbSet<JobUnitFilter> JobUnitFilters { get; set; }
public DbSet<JobGroup> JobGroups { get; set; }
public DbSet<JobGroupType> JobGroupTypes { get; set; }
public DbSet<JobRelationshipFilter> JobRelationshipFilters { get; set; } public DbSet<JobRelationshipFilter> JobRelationshipFilters { get; set; }
public DbSet<JobAutoControl> JobAutoControls { get; set; } public DbSet<JobAutoControl> JobAutoControls { get; set; }
#endregion
#region JobGroup
public DbSet<JobGroup> JobGroups { get; set; }
public DbSet<JobGroupType> JobGroupTypes { get; set; }
public DbSet<JobGroupDistributionConfig> JobGroupDistributionConfigs { get; set; } public DbSet<JobGroupDistributionConfig> JobGroupDistributionConfigs { get; set; }
public DbSet<JobGroupAutoControl> JobGroupAutoControls { get; set; }
public DbSet<JobGroupUnitFilter> JobGroupUnitFilters { get; set; }
public DbSet<JobGroupFieldFilter> JobGroupFieldFilters { get; set; }
public DbSet<JobGroupRelationshipFilter> JobGroupRelationshipFilters { get; set; }
#endregion #endregion
#region Tasks #region Tasks
@@ -166,9 +179,9 @@ namespace PARR.DAL.Context
modelBuilder.Entity<JobGroupType>(f => modelBuilder.Entity<JobGroupType>(f =>
{ {
f.HasData( f.HasData(
new() { Id = new Guid("4FA62E79-86BB-47C2-BE1A-72A716A170FA"), DateCreated = dateCreated, DateModified = null, Name = JobGroupTypesEnum.Simple.ToString(), Code = JobGroupTypesEnum.Simple, Description = "Обычный" }, new() { Id = new Guid("4FA62E79-86BB-47C2-BE1A-72A716A170FA"), DateCreated = dateCreated, DateModified = null, Name = JobGroupTypesEnum.Simple.ToString(), Code = JobGroupTypesEnum.Simple, Description = "Обычный", IsAllowJobUnitFilter = true, IsJobGroupAutoControl = false },
new() { Id = new Guid("6EC58B1A-5C40-47B9-B036-4FA490E8D503"), DateCreated = dateCreated, DateModified = null, Name = JobGroupTypesEnum.Umbrella.ToString(), Code = JobGroupTypesEnum.Umbrella, Description = "Зонтик" }, new() { Id = new Guid("6EC58B1A-5C40-47B9-B036-4FA490E8D503"), DateCreated = dateCreated, DateModified = null, Name = JobGroupTypesEnum.Umbrella.ToString(), Code = JobGroupTypesEnum.Umbrella, Description = "Зонтик", IsAllowJobUnitFilter = false, IsJobGroupAutoControl = true },
new() { Id = new Guid("318625E5-F833-436A-99DF-2A382A1E71C7"), DateCreated = dateCreated, DateModified = null, Name = JobGroupTypesEnum.Group.ToString(), Code = JobGroupTypesEnum.Group, Description = "Сгруппированный" } new() { Id = new Guid("318625E5-F833-436A-99DF-2A382A1E71C7"), DateCreated = dateCreated, DateModified = null, Name = JobGroupTypesEnum.Group.ToString(), Code = JobGroupTypesEnum.Group, Description = "Сгруппированный", IsAllowJobUnitFilter = false, IsJobGroupAutoControl = true }
); );
}); });
#endregion #endregion
@@ -205,7 +218,7 @@ namespace PARR.DAL.Context
{ {
// При добавлении записей, добавлять тоже в PARR.DAL.Contracts.SettingsFromDb // При добавлении записей, добавлять тоже в PARR.DAL.Contracts.SettingsFromDb
f.HasData( f.HasData(
new { Name = nameof(SettingsFromDb.Initiator), Description = "Инициатор регламентной работы, указывается при создании шаблона в ЕСПП.", Value = "ОВЧАРЕНКО АЛЕКСЕЙ ВИТАЛЬЕВИЧ (OVCHARENKOAV@GVC.OAO.RZD)" }, new { Name = nameof(SettingsFromDb.Initiator), Description = "Инициатор регламентной работы, указывается при создании шаблона в ЕСПП.", Value = "АКСЕНОВ АЛЕКСАНДР ЕВГЕНЬЕВИЧ (AKSENOVAE@GVC.OAO.RZD)" },
new { Name = nameof(SettingsFromDb.ClosingCode), Description = "Код закрытия регламентной работы, указывается при создании шаблона в ЕСПП.", Value = "выполнен" }, new { Name = nameof(SettingsFromDb.ClosingCode), Description = "Код закрытия регламентной работы, указывается при создании шаблона в ЕСПП.", Value = "выполнен" },
new { Name = nameof(SettingsFromDb.Category), Description = "Категория создаваемого объекта в ЕСПП", Value = "регламентная работа" }, new { Name = nameof(SettingsFromDb.Category), Description = "Категория создаваемого объекта в ЕСПП", Value = "регламентная работа" },
new { Name = nameof(SettingsFromDb.TemplatePrefixName), Description = "Префикс имени шаблона в ЕСПП", Value = "%PREFIX%-ЭИТИ-ПТК-ПАРР" }, new { Name = nameof(SettingsFromDb.TemplatePrefixName), Description = "Префикс имени шаблона в ЕСПП", Value = "%PREFIX%-ЭИТИ-ПТК-ПАРР" },

View File

@@ -4,6 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces; using PARR.Core.Repositories.Interfaces;
using PARR.Core.Repositories.Interfaces.Job; using PARR.Core.Repositories.Interfaces.Job;
using PARR.Core.Repositories.Interfaces.JobGroupRepositories;
using PARR.Core.Repositories.Interfaces.RobotRepositories; using PARR.Core.Repositories.Interfaces.RobotRepositories;
using PARR.Core.Repositories.Interfaces.Schedule; using PARR.Core.Repositories.Interfaces.Schedule;
using PARR.Core.Repositories.Interfaces.TaskRepositories; using PARR.Core.Repositories.Interfaces.TaskRepositories;
@@ -12,6 +13,7 @@ using PARR.DAL.Configurations.DbSettings;
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.DAL.Repositories; using PARR.DAL.Repositories;
using PARR.DAL.Repositories.Job; using PARR.DAL.Repositories.Job;
using PARR.DAL.Repositories.JobGroupRepositories;
using PARR.DAL.Repositories.RobotRepositories; using PARR.DAL.Repositories.RobotRepositories;
using PARR.DAL.Repositories.Schedule; using PARR.DAL.Repositories.Schedule;
using PARR.DAL.Repositories.TaskRepositories; using PARR.DAL.Repositories.TaskRepositories;
@@ -115,6 +117,15 @@ namespace PARR.DAL
#endregion #endregion
#region JobGroup
services.AddScoped<IJobGroupFieldFilterRepository, JobGroupFieldFilterRepository>();
services.AddScoped<IJobGroupRelationshipFilterRepository, JobGroupRelationshipFilterRepository>();
services.AddScoped<IJobGroupUnitFilterRepository, JobGroupUnitFilterRepository>();
services.AddScoped<IJobGroupAutoControlRepository, JobGroupAutoControlRepository>();
#endregion
#region Task #region Task
services.AddScoped<ITaskErrorRepository, TaskErrorRepository>(); services.AddScoped<ITaskErrorRepository, TaskErrorRepository>();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,284 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PARR.DAL.Migrations
{
/// <inheritdoc />
public partial class tblsJobGroups : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "jobGroup");
migrationBuilder.RenameTable(
name: "GroupTypes",
schema: "job",
newName: "GroupTypes",
newSchema: "jobGroup");
migrationBuilder.RenameTable(
name: "Groups",
schema: "job",
newName: "Groups",
newSchema: "jobGroup");
migrationBuilder.RenameTable(
name: "GroupDistributionConfigs",
schema: "job",
newName: "GroupDistributionConfigs",
newSchema: "jobGroup");
migrationBuilder.AddColumn<bool>(
name: "IsAllowJobUnitFilter",
schema: "jobGroup",
table: "GroupTypes",
type: "boolean",
nullable: false,
defaultValue: false,
comment: "Разрешить Job фильтры. Влияет только на интерфейс. Мэтчер собирает все фильтры из группы и работ всегда.");
migrationBuilder.AddColumn<bool>(
name: "IsJobGroupAutoControl",
schema: "jobGroup",
table: "GroupTypes",
type: "boolean",
nullable: false,
defaultValue: false,
comment: "Автоконтролем управляет JobGroup? true - да JobGroup, false - Job. Влияет на интерфейс и на логику работы автоконтроля.");
migrationBuilder.CreateTable(
name: "AutoControls",
schema: "jobGroup",
columns: table => new
{
JobGroupId = table.Column<Guid>(type: "uuid", nullable: false),
IsEnable = table.Column<bool>(type: "boolean", nullable: false),
InitUsedTemplateState = table.Column<bool>(type: "boolean", nullable: false),
InitUsedScheduleState = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AutoControls", x => x.JobGroupId);
table.ForeignKey(
name: "FK_AutoControls_Groups_JobGroupId",
column: x => x.JobGroupId,
principalSchema: "jobGroup",
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица управления автоконтролем для группы работ");
migrationBuilder.CreateTable(
name: "UnitFilters",
schema: "jobGroup",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
UnitFilter = table.Column<string>(type: "text", nullable: false),
JobGroupId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UnitFilters", x => x.Id);
table.ForeignKey(
name: "FK_UnitFilters_Groups_JobGroupId",
column: x => x.JobGroupId,
principalSchema: "jobGroup",
principalTable: "Groups",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП");
migrationBuilder.CreateTable(
name: "FieldFilters",
schema: "jobGroup",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
DateCreated = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
UnitFilterId = table.Column<Guid>(type: "uuid", nullable: false),
FieldId = table.Column<Guid>(type: "uuid", nullable: false),
ValueMask = table.Column<string>(type: "text", nullable: false),
IsInverse = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_FieldFilters", x => x.Id);
table.ForeignKey(
name: "FK_FieldFilters_Fields_FieldId",
column: x => x.FieldId,
principalSchema: "unit",
principalTable: "Fields",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_FieldFilters_UnitFilters_UnitFilterId",
column: x => x.UnitFilterId,
principalSchema: "jobGroup",
principalTable: "UnitFilters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица описания критериев выборки аттрибутов ЭК");
migrationBuilder.CreateTable(
name: "RelationshipFilters",
schema: "jobGroup",
columns: table => new
{
UnitFilterId = table.Column<Guid>(type: "uuid", nullable: false),
FieldId = table.Column<Guid>(type: "uuid", nullable: false),
IsParent = table.Column<bool>(type: "boolean", nullable: false),
ValueMask = table.Column<string>(type: "text", nullable: false),
IsFullMatch = table.Column<bool>(type: "boolean", nullable: false),
IsInverse = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RelationshipFilters", x => new { x.UnitFilterId, x.FieldId });
table.ForeignKey(
name: "FK_RelationshipFilters_Fields_FieldId",
column: x => x.FieldId,
principalSchema: "unit",
principalTable: "Fields",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RelationshipFilters_UnitFilters_UnitFilterId",
column: x => x.UnitFilterId,
principalSchema: "jobGroup",
principalTable: "UnitFilters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица фильтров связей ЭК");
migrationBuilder.UpdateData(
schema: "jobGroup",
table: "GroupTypes",
keyColumn: "Id",
keyValue: new Guid("318625e5-f833-436a-99df-2a382a1e71c7"),
columns: new[] { "IsAllowJobUnitFilter", "IsJobGroupAutoControl" },
values: new object[] { false, true });
migrationBuilder.UpdateData(
schema: "jobGroup",
table: "GroupTypes",
keyColumn: "Id",
keyValue: new Guid("4fa62e79-86bb-47c2-be1a-72a716a170fa"),
columns: new[] { "IsAllowJobUnitFilter", "IsJobGroupAutoControl" },
values: new object[] { true, false });
migrationBuilder.UpdateData(
schema: "jobGroup",
table: "GroupTypes",
keyColumn: "Id",
keyValue: new Guid("6ec58b1a-5c40-47b9-b036-4fa490e8d503"),
columns: new[] { "IsAllowJobUnitFilter", "IsJobGroupAutoControl" },
values: new object[] { false, true });
migrationBuilder.UpdateData(
table: "Settings",
keyColumn: "Name",
keyValue: "Initiator",
column: "Value",
value: "АКСЕНОВ АЛЕКСАНДР ЕВГЕНЬЕВИЧ (AKSENOVAE@GVC.OAO.RZD)");
migrationBuilder.CreateIndex(
name: "IX_FieldFilters_FieldId1",
schema: "jobGroup",
table: "FieldFilters",
column: "FieldId");
migrationBuilder.CreateIndex(
name: "IX_FieldFilters_UnitFilterId1",
schema: "jobGroup",
table: "FieldFilters",
column: "UnitFilterId");
migrationBuilder.CreateIndex(
name: "IX_RelationshipFilters_FieldId1",
schema: "jobGroup",
table: "RelationshipFilters",
column: "FieldId");
migrationBuilder.CreateIndex(
name: "IX_UnitFilters_JobGroupId",
schema: "jobGroup",
table: "UnitFilters",
column: "JobGroupId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_FieldFilters_Fields_FieldId",
schema: "job",
table: "FieldFilters");
migrationBuilder.DropForeignKey(
name: "FK_RelationshipFilters_Fields_FieldId",
schema: "job",
table: "RelationshipFilters");
migrationBuilder.DropTable(
name: "AutoControls",
schema: "jobGroup");
migrationBuilder.DropTable(
name: "FieldFilters",
schema: "jobGroup");
migrationBuilder.DropTable(
name: "RelationshipFilters",
schema: "jobGroup");
migrationBuilder.DropTable(
name: "UnitFilters",
schema: "jobGroup");
migrationBuilder.DropColumn(
name: "IsAllowJobUnitFilter",
schema: "jobGroup",
table: "GroupTypes");
migrationBuilder.DropColumn(
name: "IsJobGroupAutoControl",
schema: "jobGroup",
table: "GroupTypes");
migrationBuilder.RenameTable(
name: "GroupTypes",
schema: "jobGroup",
newName: "GroupTypes",
newSchema: "job");
migrationBuilder.RenameTable(
name: "Groups",
schema: "jobGroup",
newName: "Groups",
newSchema: "job");
migrationBuilder.RenameTable(
name: "GroupDistributionConfigs",
schema: "jobGroup",
newName: "GroupDistributionConfigs",
newSchema: "job");
migrationBuilder.UpdateData(
table: "Settings",
keyColumn: "Name",
keyValue: "Initiator",
column: "Value",
value: "ОВЧАРЕНКО АЛЕКСЕЙ ВИТАЛЬЕВИЧ (OVCHARENKOAV@GVC.OAO.RZD)");
}
}
}

View File

@@ -290,7 +290,90 @@ namespace PARR.DAL.Migrations
}); });
}); });
modelBuilder.Entity("PARR.Domain.Entities.Job.JobGroup", b => modelBuilder.Entity("PARR.Domain.Entities.Job.JobRelationshipFilter", b =>
{
b.Property<Guid>("UnitFilterId")
.HasColumnType("uuid");
b.Property<Guid>("FieldId")
.HasColumnType("uuid");
b.Property<bool>("IsFullMatch")
.HasColumnType("boolean");
b.Property<bool>("IsInverse")
.HasColumnType("boolean");
b.Property<bool>("IsParent")
.HasColumnType("boolean");
b.Property<string>("ValueMask")
.IsRequired()
.HasColumnType("text");
b.HasKey("UnitFilterId", "FieldId");
b.HasIndex("FieldId");
b.ToTable("RelationshipFilters", "job", t =>
{
t.HasComment("Таблица фильтров связей ЭК");
});
});
modelBuilder.Entity("PARR.Domain.Entities.Job.JobUnitFilter", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("JobId")
.HasColumnType("uuid");
b.Property<string>("UnitFilter")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("JobId");
b.ToTable("UnitFilters", "job", t =>
{
t.HasComment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП");
});
});
modelBuilder.Entity("PARR.Domain.Entities.Job.UnitsInTemplate", b =>
{
b.Property<Guid>("TemplateId")
.HasColumnType("uuid");
b.Property<Guid>("UnitId")
.HasColumnType("uuid");
b.Property<Guid>("UnitFieldValueId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.HasKey("TemplateId", "UnitId", "UnitFieldValueId");
b.HasIndex("UnitFieldValueId");
b.HasIndex("UnitId");
b.ToTable("UnitsInTemplates", "job", t =>
{
t.HasComment("Таблица связи ЭК в шаблонах");
});
});
modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroup", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -372,13 +455,35 @@ namespace PARR.DAL.Migrations
b.HasIndex("ScheduleExcludeTypeId"); b.HasIndex("ScheduleExcludeTypeId");
b.ToTable("Groups", "job", t => b.ToTable("Groups", "jobGroup", t =>
{ {
t.HasComment("Таблица описания групп работ, для реализации зонтиков"); t.HasComment("Таблица описания групп работ, для реализации зонтиков");
}); });
}); });
modelBuilder.Entity("PARR.Domain.Entities.Job.JobGroupDistributionConfig", b => modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupAutoControl", b =>
{
b.Property<Guid>("JobGroupId")
.HasColumnType("uuid");
b.Property<bool>("InitUsedScheduleState")
.HasColumnType("boolean");
b.Property<bool>("InitUsedTemplateState")
.HasColumnType("boolean");
b.Property<bool>("IsEnable")
.HasColumnType("boolean");
b.HasKey("JobGroupId");
b.ToTable("AutoControls", "jobGroup", t =>
{
t.HasComment("Таблица управления автоконтролем для группы работ");
});
});
modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupDistributionConfig", b =>
{ {
b.Property<Guid>("GroupId") b.Property<Guid>("GroupId")
.HasColumnType("uuid"); .HasColumnType("uuid");
@@ -396,67 +501,49 @@ namespace PARR.DAL.Migrations
b.HasIndex("DistributionPeriodId"); b.HasIndex("DistributionPeriodId");
b.ToTable("GroupDistributionConfigs", "job", t => b.ToTable("GroupDistributionConfigs", "jobGroup", t =>
{ {
t.HasComment("Настройки автораспределения для группы работ"); t.HasComment("Настройки автораспределения для группы работ");
}); });
}); });
modelBuilder.Entity("PARR.Domain.Entities.Job.JobGroupType", b => modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupFieldFilter", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<int>("Code")
.HasColumnType("integer");
b.Property<DateTimeOffset>("DateCreated") b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone"); .HasColumnType("timestamp with time zone");
b.Property<string>("Description") b.Property<Guid>("FieldId")
.IsRequired() .HasColumnType("uuid");
.HasColumnType("text");
b.Property<string>("Name") b.Property<bool>("IsInverse")
.HasColumnType("boolean");
b.Property<Guid>("UnitFilterId")
.HasColumnType("uuid");
b.Property<string>("ValueMask")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("GroupTypes", "job", t => b.HasIndex("FieldId")
{ .HasDatabaseName("IX_FieldFilters_FieldId1");
t.HasComment("Таблица типов групп работ");
});
b.HasData( b.HasIndex("UnitFilterId")
new .HasDatabaseName("IX_FieldFilters_UnitFilterId1");
b.ToTable("FieldFilters", "jobGroup", t =>
{ {
Id = new Guid("4fa62e79-86bb-47c2-be1a-72a716a170fa"), t.HasComment("Таблица описания критериев выборки аттрибутов ЭК");
Code = 0,
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Обычный",
Name = "Simple"
},
new
{
Id = new Guid("6ec58b1a-5c40-47b9-b036-4fa490e8d503"),
Code = 1,
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зонтик",
Name = "Umbrella"
},
new
{
Id = new Guid("318625e5-f833-436a-99df-2a382a1e71c7"),
Code = 2,
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Сгруппированный",
Name = "Group"
}); });
}); });
modelBuilder.Entity("PARR.Domain.Entities.Job.JobRelationshipFilter", b => modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupRelationshipFilter", b =>
{ {
b.Property<Guid>("UnitFilterId") b.Property<Guid>("UnitFilterId")
.HasColumnType("uuid"); .HasColumnType("uuid");
@@ -479,15 +566,84 @@ namespace PARR.DAL.Migrations
b.HasKey("UnitFilterId", "FieldId"); b.HasKey("UnitFilterId", "FieldId");
b.HasIndex("FieldId"); b.HasIndex("FieldId")
.HasDatabaseName("IX_RelationshipFilters_FieldId1");
b.ToTable("RelationshipFilters", "job", t => b.ToTable("RelationshipFilters", "jobGroup", t =>
{ {
t.HasComment("Таблица фильтров связей ЭК"); t.HasComment("Таблица фильтров связей ЭК");
}); });
}); });
modelBuilder.Entity("PARR.Domain.Entities.Job.JobUnitFilter", b => modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<int>("Code")
.HasColumnType("integer");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("IsAllowJobUnitFilter")
.HasColumnType("boolean")
.HasComment("Разрешить Job фильтры. Влияет только на интерфейс. Мэтчер собирает все фильтры из группы и работ всегда.");
b.Property<bool>("IsJobGroupAutoControl")
.HasColumnType("boolean")
.HasComment("Автоконтролем управляет JobGroup? true - да JobGroup, false - Job. Влияет на интерфейс и на логику работы автоконтроля.");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("GroupTypes", "jobGroup", t =>
{
t.HasComment("Таблица типов групп работ");
});
b.HasData(
new
{
Id = new Guid("4fa62e79-86bb-47c2-be1a-72a716a170fa"),
Code = 0,
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Обычный",
IsAllowJobUnitFilter = true,
IsJobGroupAutoControl = false,
Name = "Simple"
},
new
{
Id = new Guid("6ec58b1a-5c40-47b9-b036-4fa490e8d503"),
Code = 1,
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Зонтик",
IsAllowJobUnitFilter = false,
IsJobGroupAutoControl = true,
Name = "Umbrella"
},
new
{
Id = new Guid("318625e5-f833-436a-99df-2a382a1e71c7"),
Code = 2,
DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
Description = "Сгруппированный",
IsAllowJobUnitFilter = false,
IsJobGroupAutoControl = true,
Name = "Group"
});
});
modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupUnitFilter", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -496,7 +652,7 @@ namespace PARR.DAL.Migrations
b.Property<DateTimeOffset>("DateCreated") b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone"); .HasColumnType("timestamp with time zone");
b.Property<Guid>("JobId") b.Property<Guid>("JobGroupId")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<string>("UnitFilter") b.Property<string>("UnitFilter")
@@ -505,40 +661,14 @@ namespace PARR.DAL.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("JobId"); b.HasIndex("JobGroupId");
b.ToTable("UnitFilters", "job", t => b.ToTable("UnitFilters", "jobGroup", t =>
{ {
t.HasComment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП"); t.HasComment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП");
}); });
}); });
modelBuilder.Entity("PARR.Domain.Entities.Job.UnitsInTemplate", b =>
{
b.Property<Guid>("TemplateId")
.HasColumnType("uuid");
b.Property<Guid>("UnitId")
.HasColumnType("uuid");
b.Property<Guid>("UnitFieldValueId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("DateCreated")
.HasColumnType("timestamp with time zone");
b.HasKey("TemplateId", "UnitId", "UnitFieldValueId");
b.HasIndex("UnitFieldValueId");
b.HasIndex("UnitId");
b.ToTable("UnitsInTemplates", "job", t =>
{
t.HasComment("Таблица связи ЭК в шаблонах");
});
});
modelBuilder.Entity("PARR.Domain.Entities.Order", b => modelBuilder.Entity("PARR.Domain.Entities.Order", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@@ -2268,7 +2398,7 @@ namespace PARR.DAL.Migrations
{ {
Name = "Initiator", Name = "Initiator",
Description = "Инициатор регламентной работы, указывается при создании шаблона в ЕСПП.", Description = "Инициатор регламентной работы, указывается при создании шаблона в ЕСПП.",
Value = "ОВЧАРЕНКО АЛЕКСЕЙ ВИТАЛЬЕВИЧ (OVCHARENKOAV@GVC.OAO.RZD)" Value = "АКСЕНОВ АЛЕКСАНДР ЕВГЕНЬЕВИЧ (AKSENOVAE@GVC.OAO.RZD)"
}, },
new new
{ {
@@ -3097,7 +3227,7 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.Domain.Entities.Job.Job", b => modelBuilder.Entity("PARR.Domain.Entities.Job.Job", b =>
{ {
b.HasOne("PARR.Domain.Entities.Job.JobGroup", "Group") b.HasOne("PARR.Domain.Entities.JobGroupEntities.JobGroup", "Group")
.WithMany("Jobs") .WithMany("Jobs")
.HasForeignKey("GroupId") .HasForeignKey("GroupId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@@ -3128,7 +3258,7 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.Domain.Entities.Job.JobFieldFilter", b => modelBuilder.Entity("PARR.Domain.Entities.Job.JobFieldFilter", b =>
{ {
b.HasOne("PARR.Domain.Entities.Unit.UnitField", "UnitField") b.HasOne("PARR.Domain.Entities.Unit.UnitField", "UnitField")
.WithMany() .WithMany("JobFieldFilters")
.HasForeignKey("FieldId") .HasForeignKey("FieldId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
@@ -3144,57 +3274,6 @@ namespace PARR.DAL.Migrations
b.Navigation("UnitFilter"); b.Navigation("UnitFilter");
}); });
modelBuilder.Entity("PARR.Domain.Entities.Job.JobGroup", b =>
{
b.HasOne("PARR.Domain.Entities.Job.JobGroupType", "GroupType")
.WithMany("JobGroups")
.HasForeignKey("GroupTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.Domain.Entities.Unit.UnitField", "GroupingUnitField")
.WithMany("JobGroupWithGrouping")
.HasForeignKey("GroupingUnitFieldId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("PARR.Domain.Entities.Schedule.ScheduleExcludeTypeCalendar", "ScheduleExcludeTypeCalendar")
.WithMany("JobGroups")
.HasForeignKey("ScheduleExcludeTypeCalendarId");
b.HasOne("PARR.Domain.Entities.Schedule.ScheduleExcludeType", "ScheduleExcludeType")
.WithMany("JobGroups")
.HasForeignKey("ScheduleExcludeTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("GroupType");
b.Navigation("GroupingUnitField");
b.Navigation("ScheduleExcludeType");
b.Navigation("ScheduleExcludeTypeCalendar");
});
modelBuilder.Entity("PARR.Domain.Entities.Job.JobGroupDistributionConfig", b =>
{
b.HasOne("PARR.Domain.Entities.DistributionPeriod", "DistributionPeriod")
.WithMany("GroupDistributionConfig")
.HasForeignKey("DistributionPeriodId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.Domain.Entities.Job.JobGroup", "Group")
.WithOne("DistributionConfig")
.HasForeignKey("PARR.Domain.Entities.Job.JobGroupDistributionConfig", "GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DistributionPeriod");
b.Navigation("Group");
});
modelBuilder.Entity("PARR.Domain.Entities.Job.JobRelationshipFilter", b => modelBuilder.Entity("PARR.Domain.Entities.Job.JobRelationshipFilter", b =>
{ {
b.HasOne("PARR.Domain.Entities.Unit.UnitField", "UnitField") b.HasOne("PARR.Domain.Entities.Unit.UnitField", "UnitField")
@@ -3252,6 +3331,117 @@ namespace PARR.DAL.Migrations
b.Navigation("UnitFieldValue"); b.Navigation("UnitFieldValue");
}); });
modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroup", b =>
{
b.HasOne("PARR.Domain.Entities.JobGroupEntities.JobGroupType", "GroupType")
.WithMany("JobGroups")
.HasForeignKey("GroupTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.Domain.Entities.Unit.UnitField", "GroupingUnitField")
.WithMany("JobGroupWithGrouping")
.HasForeignKey("GroupingUnitFieldId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("PARR.Domain.Entities.Schedule.ScheduleExcludeTypeCalendar", "ScheduleExcludeTypeCalendar")
.WithMany("JobGroups")
.HasForeignKey("ScheduleExcludeTypeCalendarId");
b.HasOne("PARR.Domain.Entities.Schedule.ScheduleExcludeType", "ScheduleExcludeType")
.WithMany("JobGroups")
.HasForeignKey("ScheduleExcludeTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("GroupType");
b.Navigation("GroupingUnitField");
b.Navigation("ScheduleExcludeType");
b.Navigation("ScheduleExcludeTypeCalendar");
});
modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupAutoControl", b =>
{
b.HasOne("PARR.Domain.Entities.JobGroupEntities.JobGroup", "JobGroup")
.WithOne("AutoControl")
.HasForeignKey("PARR.Domain.Entities.JobGroupEntities.JobGroupAutoControl", "JobGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("JobGroup");
});
modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupDistributionConfig", b =>
{
b.HasOne("PARR.Domain.Entities.DistributionPeriod", "DistributionPeriod")
.WithMany("GroupDistributionConfig")
.HasForeignKey("DistributionPeriodId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.Domain.Entities.JobGroupEntities.JobGroup", "Group")
.WithOne("DistributionConfig")
.HasForeignKey("PARR.Domain.Entities.JobGroupEntities.JobGroupDistributionConfig", "GroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DistributionPeriod");
b.Navigation("Group");
});
modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupFieldFilter", b =>
{
b.HasOne("PARR.Domain.Entities.Unit.UnitField", "UnitField")
.WithMany("JobGroupFieldFilters")
.HasForeignKey("FieldId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.Domain.Entities.JobGroupEntities.JobGroupUnitFilter", "UnitFilter")
.WithMany("FieldFilters")
.HasForeignKey("UnitFilterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UnitField");
b.Navigation("UnitFilter");
});
modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupRelationshipFilter", b =>
{
b.HasOne("PARR.Domain.Entities.Unit.UnitField", "UnitField")
.WithMany("JobGroupRelationshipFilters")
.HasForeignKey("FieldId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PARR.Domain.Entities.JobGroupEntities.JobGroupUnitFilter", "UnitFilter")
.WithMany("RelationshipFilters")
.HasForeignKey("UnitFilterId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UnitField");
b.Navigation("UnitFilter");
});
modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupUnitFilter", b =>
{
b.HasOne("PARR.Domain.Entities.JobGroupEntities.JobGroup", "JobGroup")
.WithMany()
.HasForeignKey("JobGroupId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("JobGroup");
});
modelBuilder.Entity("PARR.Domain.Entities.Order", b => modelBuilder.Entity("PARR.Domain.Entities.Order", b =>
{ {
b.HasOne("PARR.Domain.Entities.OrderStatus", "NextStatus") b.HasOne("PARR.Domain.Entities.OrderStatus", "NextStatus")
@@ -3369,7 +3559,7 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.Domain.Entities.Schedule.EsppSchValue", b => modelBuilder.Entity("PARR.Domain.Entities.Schedule.EsppSchValue", b =>
{ {
b.HasOne("PARR.Domain.Entities.Job.JobGroup", "JobGroup") b.HasOne("PARR.Domain.Entities.JobGroupEntities.JobGroup", "JobGroup")
.WithMany("EsppSchValues") .WithMany("EsppSchValues")
.HasForeignKey("JobGroupId") .HasForeignKey("JobGroupId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@@ -3614,8 +3804,17 @@ namespace PARR.DAL.Migrations
b.Navigation("UnitFilters"); b.Navigation("UnitFilters");
}); });
modelBuilder.Entity("PARR.Domain.Entities.Job.JobGroup", b => modelBuilder.Entity("PARR.Domain.Entities.Job.JobUnitFilter", b =>
{ {
b.Navigation("FieldFilters");
b.Navigation("RelationshipFilters");
});
modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroup", b =>
{
b.Navigation("AutoControl");
b.Navigation("DistributionConfig"); b.Navigation("DistributionConfig");
b.Navigation("EsppSchValues"); b.Navigation("EsppSchValues");
@@ -3623,12 +3822,12 @@ namespace PARR.DAL.Migrations
b.Navigation("Jobs"); b.Navigation("Jobs");
}); });
modelBuilder.Entity("PARR.Domain.Entities.Job.JobGroupType", b => modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupType", b =>
{ {
b.Navigation("JobGroups"); b.Navigation("JobGroups");
}); });
modelBuilder.Entity("PARR.Domain.Entities.Job.JobUnitFilter", b => modelBuilder.Entity("PARR.Domain.Entities.JobGroupEntities.JobGroupUnitFilter", b =>
{ {
b.Navigation("FieldFilters"); b.Navigation("FieldFilters");
@@ -3776,6 +3975,12 @@ namespace PARR.DAL.Migrations
modelBuilder.Entity("PARR.Domain.Entities.Unit.UnitField", b => modelBuilder.Entity("PARR.Domain.Entities.Unit.UnitField", b =>
{ {
b.Navigation("JobFieldFilters");
b.Navigation("JobGroupFieldFilters");
b.Navigation("JobGroupRelationshipFilters");
b.Navigation("JobGroupWithGrouping"); b.Navigation("JobGroupWithGrouping");
b.Navigation("RelationshipFilters"); b.Navigation("RelationshipFilters");

View File

@@ -2,7 +2,7 @@
using PARR.Core.Repositories.Interfaces.Job; using PARR.Core.Repositories.Interfaces.Job;
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.DAL.Repositories.Base; using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.DAL.Repositories.Job namespace PARR.DAL.Repositories.Job
{ {

View File

@@ -2,7 +2,7 @@
using PARR.Core.Repositories.Interfaces.Job; using PARR.Core.Repositories.Interfaces.Job;
using PARR.DAL.Context; using PARR.DAL.Context;
using PARR.DAL.Repositories.Base; using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.DAL.Repositories.Job namespace PARR.DAL.Repositories.Job
{ {

View File

@@ -0,0 +1,21 @@
using PARR.Core.Repositories.Interfaces.JobGroupRepositories;
using PARR.DAL.Context;
using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.DAL.Repositories.JobGroupRepositories
{
internal class JobGroupAutoControlRepository : IJobGroupAutoControlRepository
{
private readonly DataContext _dataContext;
public JobGroupAutoControlRepository(DataContext dataContext)
{
_dataContext = dataContext;
}
public IQueryable<JobGroupAutoControl> Get()
{
return _dataContext.JobGroupAutoControls;
}
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.JobGroupRepositories;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.DAL.Repositories.JobGroupRepositories
{
internal class JobGroupFieldFilterRepository : BaseRepository<JobGroupFieldFilter>, IJobGroupFieldFilterRepository
{
public JobGroupFieldFilterRepository(ILogger<JobGroupFieldFilterRepository> logger, DataContext dataContext) : base(logger, dataContext) { }
}
}

View File

@@ -0,0 +1,8 @@
using PARR.Core.Repositories.Interfaces.JobGroupRepositories;
namespace PARR.DAL.Repositories.JobGroupRepositories
{
internal class JobGroupRelationshipFilterRepository : IJobGroupRelationshipFilterRepository
{
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.JobGroupRepositories;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.DAL.Repositories.JobGroupRepositories
{
internal class JobGroupUnitFilterRepository : BaseRepository<JobGroupUnitFilter>, IJobGroupUnitFilterRepository
{
public JobGroupUnitFilterRepository(ILogger<JobGroupUnitFilterRepository> logger, DataContext dataContext) : base(logger, dataContext) { }
}
}

View File

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

View File

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

View File

@@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using PARR.Domain.Constants; using PARR.Domain.Constants;
using PARR.Domain.Entities.Base; using PARR.Domain.Entities.Base;
using PARR.Domain.Entities.JobGroupEntities;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; 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 class JobRelationshipFilter
{ {
public Guid UnitFilterId { get; set; } public Guid UnitFilterId { get; set; }
/// <summary> /// <summary>
/// Родительская связь - true, /// Родительская связь - true,
/// Дочерняя связь - false /// Дочерняя связь - false

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,6 +6,7 @@ using PARR.Core.Repositories.Interfaces.Job;
using PARR.Domain.Entities; using PARR.Domain.Entities;
using PARR.Domain.Entities.Base; using PARR.Domain.Entities.Base;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using PARR.Domain.Enums; using PARR.Domain.Enums;
namespace PARR.TemplateActivator; namespace PARR.TemplateActivator;

View File

@@ -2,7 +2,7 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Job; using PARR.Core.Repositories.Interfaces.Job;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.TemplateDistributor.Services namespace PARR.TemplateDistributor.Services
{ {

View File

@@ -1,6 +1,7 @@
using PARR.Core.Services.UnitFilterService.Models; using PARR.Core.Services.UnitFilterService.Models;
using PARR.Domain.Entities.Base.History; using PARR.Domain.Entities.Base.History;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using PARR.TemplateMatcher.Models; using PARR.TemplateMatcher.Models;
namespace PARR.TemplateMatcher.Services.Implementations.GroupedSync; namespace PARR.TemplateMatcher.Services.Implementations.GroupedSync;

View File

@@ -5,6 +5,7 @@ using PARR.Core.Services.Shortcodes;
using PARR.Domain.Constants; using PARR.Domain.Constants;
using PARR.Domain.Entities; using PARR.Domain.Entities;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using PARR.TemplateMatcher.Models; using PARR.TemplateMatcher.Models;
namespace PARR.TemplateMatcher.Services.GroupedSync; namespace PARR.TemplateMatcher.Services.GroupedSync;

View File

@@ -1,7 +1,7 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Unit; using PARR.Core.Repositories.Interfaces.Unit;
using PARR.Core.Services.UnitFilterService.Models; using PARR.Core.Services.UnitFilterService.Models;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.TemplateMatcher.Services.GroupedSync; namespace PARR.TemplateMatcher.Services.GroupedSync;

View File

@@ -1,4 +1,5 @@
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.JobGroupEntities;
using PARR.TemplateMatcher.Models; using PARR.TemplateMatcher.Models;
namespace PARR.TemplateMatcher.Services.GroupedSync; namespace PARR.TemplateMatcher.Services.GroupedSync;

View File

@@ -1,5 +1,5 @@
using PARR.Core.Services.UnitFilterService.Models; using PARR.Core.Services.UnitFilterService.Models;
using PARR.Domain.Entities.Job; using PARR.Domain.Entities.JobGroupEntities;
namespace PARR.TemplateMatcher.Services.GroupedSync namespace PARR.TemplateMatcher.Services.GroupedSync
{ {