From 03c7852378953618d9b4ab4beb42d447de2f045f Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetsov Date: Wed, 25 Jun 2025 14:17:34 +1000 Subject: [PATCH] =?UTF-8?q?feat(all):=20!=20=D0=9A=D1=80=D0=B8=D1=82=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D1=81=D0=BA=D0=B8=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA?= =?UTF-8?q?=D0=B8=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D0=B2=D1=81?= =?UTF-8?q?=D0=B5=D1=85=20=D1=81=D0=B5=D1=80=D0=B2=D0=B8=D1=81=D0=BE=D1=80?= =?UTF-8?q?=D0=B2,=20=D0=91=D0=B0=D0=B7=D0=B0=20=D0=94=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20=D0=B8=D0=BC=D0=B5=D0=B5=D0=B5=D1=82=20=D0=BD?= =?UTF-8?q?=D0=B5=D0=BE=D0=BA=D0=BE=D0=BD=D1=87=D0=B0=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=83=D1=8E=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8E?= =?UTF-8?q?.=20Template,=20Scheduler=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B2?= =?UTF-8?q?=D0=B5=D0=B4=D0=B5=D0=BD=D1=8B=20=D0=BD=D0=B0=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D1=83=20=D1=81=20Unit+Job+JobGroup=20=D0=B2?= =?UTF-8?q?=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20Host+ApplicationsInWork?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Contracts/V1/Responses/JobBaseResponse.cs | 17 + .../V1/Responses/RobotTaskTemplateResponse.cs | 2 +- .../Statistics/StatHostTemplateResponse.cs | 2 +- .../V1/Responses/TemplateResponse.cs | 7 +- .../V1/Responses/UnitBaseResponse.cs | 11 - .../Controllers/V1/AgentHistoryController.cs | 16 +- .../Controllers/V1/AgentTaskController.cs | 30 +- .../V1/ApplicationInWorkController.cs | 534 +-- .../Controllers/V1/RobotTaskController.cs | 18 +- .../V1/Statistics/StatHostController.cs | 13 +- .../StatResponseAreaWorkLoadController.cs | 122 +- .../V1/Statistics/StatTemplateController.cs | 100 +- .../StatTemplateDistributionController.cs | 16 +- .../StatWorkGroupWorkLoadController.cs | 6 +- .../Statistics/StatWorkWorkLoadController.cs | 192 +- PARR.API/Controllers/V1/TemplateController.cs | 2 +- PARR.API/Controllers/V1/TestController.cs | 6 +- .../DomainToResponseProfile.cs | 74 +- .../Resolvers/RobotTaskScheduleSchResolver.cs | 4 +- .../Resolvers/TemplateScheduleResolver.cs | 4 +- PARR.DAL/Context/DataContext.cs | 6 +- ...MigrationFormApplicationInWork.Designer.cs | 3773 +++++++++++++++++ ...TemplatesMigrationFormApplicationInWork.cs | 192 + .../Migrations/DataContextModelSnapshot.cs | 77 +- PARR.DAL/Models/ApplicationsInWork.cs | 4 +- PARR.DAL/Models/EsppSchValue.cs | 15 +- PARR.DAL/Models/Host.cs | 2 +- PARR.DAL/Models/Job/JobGroup.cs | 51 +- PARR.DAL/Models/Template.cs | 12 +- PARR.DAL/Models/Unit/Unit.cs | 36 + PARR.DAL/ParrDalInstaller.cs | 4 +- .../EsppSchTypeConfigService.cs | 20 +- .../Implementations/Job/JobDetailsService.cs | 6 +- .../Implementations/Job/JobGroupService.cs | 22 + .../Implementations/TemplateService.cs | 24 +- .../Implementations/Unit/UnitService.cs | 10 + .../Interfaces/IEsppSchTypeConfigService.cs | 8 +- .../Interfaces/Job/IJobDetailsService.cs | 2 +- .../Interfaces/Job/IJobGroupService.cs | 8 + .../Services/Interfaces/Unit/IUnitService.cs | 1 + .../EsppScheduleTransformService.cs | 45 +- .../IEsppScheduleTransformService.cs | 20 +- .../Services/OrderItemService.cs | 2 +- PARR.EsppOrderManager/EsppOrderManager.cs | 4 +- .../Services/EsppOrderService.cs | 2 +- PARR.EsppScheduleSync/ScheduleSyncher.cs | 24 +- PARR.EsppTemplateSync/TemplateMQSyncer.cs | 22 +- .../Services/TemplateManager.cs | 163 +- PARR.Master/Services/OrderMasterService.cs | 12 +- PARR.NextRun/NextRunManager.cs | 2 +- PARR.TemplateActivator/TemplateActivator.cs | 14 +- .../Services/ValidatorService.cs | 35 +- .../TemplateDistributor.cs | 349 +- PARR.Test/Worker.cs | 22 + 54 files changed, 5176 insertions(+), 989 deletions(-) create mode 100644 PARR.API/Contracts/V1/Responses/JobBaseResponse.cs create mode 100644 PARR.DAL/Migrations/20250625035851_tblTemplatesMigrationFormApplicationInWork.Designer.cs create mode 100644 PARR.DAL/Migrations/20250625035851_tblTemplatesMigrationFormApplicationInWork.cs create mode 100644 PARR.DAL/Services/Implementations/Job/JobGroupService.cs create mode 100644 PARR.DAL/Services/Interfaces/Job/IJobGroupService.cs diff --git a/PARR.API/Contracts/V1/Responses/JobBaseResponse.cs b/PARR.API/Contracts/V1/Responses/JobBaseResponse.cs new file mode 100644 index 00000000..ad107d11 --- /dev/null +++ b/PARR.API/Contracts/V1/Responses/JobBaseResponse.cs @@ -0,0 +1,17 @@ +namespace PARR.API.Contracts.V1.Responses +{ + public class JobBaseResponse + { + public Guid Id { get; set; } + + public required string Name { get; set; } + + public required string TemplateNameMask { get; set; } + public TnkResponse? Tnk { get; set; } + } + + public class JobResponse : JobBaseResponse + { + + } +} diff --git a/PARR.API/Contracts/V1/Responses/RobotTaskTemplateResponse.cs b/PARR.API/Contracts/V1/Responses/RobotTaskTemplateResponse.cs index 2668a997..18f453f7 100644 --- a/PARR.API/Contracts/V1/Responses/RobotTaskTemplateResponse.cs +++ b/PARR.API/Contracts/V1/Responses/RobotTaskTemplateResponse.cs @@ -31,7 +31,7 @@ public required string TnkEsppId { get; set; } public required string WorkName { get; set; } - public required string WorkEsppId { get; set; } + //public required string WorkEsppId { get; set; } } diff --git a/PARR.API/Contracts/V1/Responses/Statistics/StatHostTemplateResponse.cs b/PARR.API/Contracts/V1/Responses/Statistics/StatHostTemplateResponse.cs index 57f4683d..2b5951a8 100644 --- a/PARR.API/Contracts/V1/Responses/Statistics/StatHostTemplateResponse.cs +++ b/PARR.API/Contracts/V1/Responses/Statistics/StatHostTemplateResponse.cs @@ -2,7 +2,7 @@ { public class StatHostTemplateResponse { - public int AllHosts { get; set; } + public int AllUnits { get; set; } public int HostsInTemplates { get; set; } } } diff --git a/PARR.API/Contracts/V1/Responses/TemplateResponse.cs b/PARR.API/Contracts/V1/Responses/TemplateResponse.cs index d3bc86ae..cf9f8bc6 100644 --- a/PARR.API/Contracts/V1/Responses/TemplateResponse.cs +++ b/PARR.API/Contracts/V1/Responses/TemplateResponse.cs @@ -25,9 +25,12 @@ public bool IsAutoDistributionEnabled { get; set; } - public HostTemplateResponse? Host { get; set; } + //public HostTemplateResponse? Host { get; set; } + public UnitBaseResponse? Unit { get; set; } - public WorkResponse? Work { get; set; } + public JobBaseResponse? Job { get; set; } + + //public WorkResponse? Work { get; set; } public ProcessResponse? Process { get; set; } public SubprocessResponse? Subprocess { get; set; } public TnkResponse? Tnk { get; set; } diff --git a/PARR.API/Contracts/V1/Responses/UnitBaseResponse.cs b/PARR.API/Contracts/V1/Responses/UnitBaseResponse.cs index 293ad2d3..0fafc7c4 100644 --- a/PARR.API/Contracts/V1/Responses/UnitBaseResponse.cs +++ b/PARR.API/Contracts/V1/Responses/UnitBaseResponse.cs @@ -22,15 +22,4 @@ public List? Attributes { get; set; } } - - - - - - - - - - - } diff --git a/PARR.API/Controllers/V1/AgentHistoryController.cs b/PARR.API/Controllers/V1/AgentHistoryController.cs index 72cc6b2f..c36e4a92 100644 --- a/PARR.API/Controllers/V1/AgentHistoryController.cs +++ b/PARR.API/Controllers/V1/AgentHistoryController.cs @@ -15,6 +15,7 @@ using PARR.Constants; using PARR.DAL.DomainModels; using PARR.DAL.Models; using PARR.DAL.Services.Interfaces; +using PARR.DAL.Services.Interfaces.Unit; namespace PARR.API.Controllers.V1 { @@ -29,6 +30,7 @@ namespace PARR.API.Controllers.V1 private readonly IMapper mapper; private readonly ITemplateService templateService; private readonly IClientService clientService; + private readonly IUnitService unitService; private readonly ILogger logger; public AgentHistoryController( @@ -38,6 +40,7 @@ namespace PARR.API.Controllers.V1 IMapper mapper, ITemplateService templateService, IClientService clientService, + IUnitService unitService, ILogger logger ) { @@ -47,6 +50,7 @@ namespace PARR.API.Controllers.V1 this.mapper = mapper; this.templateService = templateService; this.clientService = clientService; + this.unitService = unitService; this.logger = logger; } @@ -121,16 +125,22 @@ namespace PARR.API.Controllers.V1 var clientIp = clientService.GetClientIp()?.ToString(); - var template = await templateService.Get().Include(t => t.Host).FirstOrDefaultAsync(t => t.Id == request.TemplateId); + var template = await templateService.Get() + .Include(t => t.Unit) + .ThenInclude(t => t!.UnitValues) + + .FirstOrDefaultAsync(t => t.Id == request.TemplateId); if (template == null) return BadRequest(new Response(false, new List { new ErrorModel { FieldName = nameof(request.TemplateId), Message = $"Не найден шаблон с Id: {request.TemplateId}" } })); //проверять что этот этот шаблон привязан к этому серверу по ip - if (template.Host?.IP != clientIp) + var unit = await unitService.GetWithIncludes().AsNoTracking().FirstOrDefaultAsync(t => t.Id == template.UnitId); + var unitIp = unit?.UnitValues.FirstOrDefault(t => t.Field!.AihitName == "IP_АДРЕС")!.Value!.Value; + if (unitIp != clientIp) { logger.LogWarning($"Клиент с ip: {clientIp} пытается записать историю агента для templateId: {request.TemplateId}, " + - $"но у шаблона ip: {template.Host?.IP}, доступ запрещен так как их ip не равны."); + $"но у шаблона ip: {unitIp}, доступ запрещен так как их ip не равны."); return Forbid(); } diff --git a/PARR.API/Controllers/V1/AgentTaskController.cs b/PARR.API/Controllers/V1/AgentTaskController.cs index 6d08caef..1b555be5 100644 --- a/PARR.API/Controllers/V1/AgentTaskController.cs +++ b/PARR.API/Controllers/V1/AgentTaskController.cs @@ -10,6 +10,7 @@ using PARR.API.Services.Interfaces; using PARR.Constants; using PARR.DAL.Contracts; using PARR.DAL.Services.Interfaces; +using PARR.DAL.Services.Interfaces.Unit; using PARR.DAL.TransformServices; namespace PARR.API.Controllers.V1 @@ -22,18 +23,21 @@ namespace PARR.API.Controllers.V1 { private readonly IClientService clientService; private readonly ITemplateService templateService; + private readonly IUnitService unitService; private readonly IEsppScheduleTransformService esppScheduleTransformService; private readonly ILogger logger; public AgentTaskController( IClientService clientService, ITemplateService templateService, + IUnitService unitService, IEsppScheduleTransformService esppScheduleTransformService, ILogger logger ) { this.clientService = clientService; this.templateService = templateService; + this.unitService = unitService; this.esppScheduleTransformService = esppScheduleTransformService; this.logger = logger; } @@ -62,19 +66,21 @@ namespace PARR.API.Controllers.V1 //Агент получает задания, если `IsAgent = true`, шаблон и расписания активны, и статус синхронизации шаблона и расписания `= Ok`, и `NextRun = сегодня`, так же если у ApplicationInWork есть расписание. // С одним IP может быть несколько информационных систем, так что может быть несколько хостов + var units = await unitService.GetWithIncludes().AsNoTracking().Where(t => t.UnitValues.Any(v => v.Field!.AihitName == "IP_АДРЕС" && v.Value!.Value == ip)).ToListAsync(); var templates = await templateService.Get() .Include(t => t.RobotConfigurations) - .Include(t => t.ApplicationsInWork) - .ThenInclude(t => t!.EsppSchValues) - .Include(t => t.Host) - .Where(t => t.Host!.IP == ip - && t.ApplicationsInWork!.IsAgent == true + .Include(t => t.Job) + .ThenInclude(t=>t!.Group) + .ThenInclude(t => t!.EsppSchValues) + .Include(t => t.Unit) + .Where(t => units.Any(u=>u.Id == t.UnitId) + //&& t.ApplicationsInWork!.IsAgent == true//TODO Migration to job && t.IsActiveTemplate == true && t.IsActiveSchedule == true //&& t.ApplicationsInWork!.NextRun.DateTime.Date == date.Date.Date && t.NextRun.DateTime.Date == date.Date.Date && t.RobotConfigurations.All(c => c.TaskStatusCode == (int)TaskStatusEnum.Ok) - && t.ApplicationsInWork.EsppSchValues.Any() + && t.Job!.Group!.EsppSchValues.Any()//.ApplicationsInWork.EsppSchValues.Any() ).ToListAsync(); if (!templates.Any()) @@ -88,26 +94,26 @@ namespace PARR.API.Controllers.V1 foreach (var template in templates) { //var templateSchedule = await esppScheduleTransformService.GetNextScheduleAsync(template.ApplicationInWorkId, template.ApplicationsInWork!.LastRun ?? template.ApplicationsInWork!.NextRun); - var templateSchedule = await esppScheduleTransformService.GetNextScheduleAsync(template.ApplicationInWorkId, template.NextRun); + var templateSchedule = await esppScheduleTransformService.GetNextScheduleAsync(template.Job!.GroupId, template.NextRun); if (!templateSchedule.Any()) { logger.LogWarning($"Запросили раписание для агента по NextRun и вернулся пустой список! Такого не должно быть! " + - $"ApplicationInWorkId: {template.ApplicationInWorkId}, latRun: {template.LastRun}, NextRun: {template.NextRun}, ip: {ip}, date: {date}"); + $"JobGroupId: {template.Job.GroupId}, latRun: {template.LastRun}, NextRun: {template.NextRun}, ip: {ip}, date: {date}"); continue; } - if (string.IsNullOrEmpty(template.ApplicationsInWork.AgentName) && string.IsNullOrEmpty(template.ApplicationsInWork.AgentScript)) + if (string.IsNullOrEmpty(template.Job.Group!.AgentName) && string.IsNullOrEmpty(template.Job.Group!.AgentScript)) { logger.LogWarning($"Запросили задание для агента с пустыми значениями AgentName && AgentScript. Такого не должно быть! " + - $"ApplicationInWorkId: {template.ApplicationInWorkId}, AgentName: {template.ApplicationsInWork.AgentName}, AgentScript: {template.ApplicationsInWork.AgentScript} , ip: {ip}, date: {date}"); + $"JobGroupId: {template.Job.GroupId}, AgentName: {template.Job.Group.AgentName}, AgentScript: {template.Job.Group.AgentScript} , ip: {ip}, date: {date}"); continue; } templateSchedule.ForEach(item => response.Scheduled.Add(new AgentTaskMinScheduleResponse { - Name = template.ApplicationsInWork!.AgentName ?? "", - Script = template.ApplicationsInWork!.AgentScript ?? "", + Name = template.Job.Group.AgentName ?? "", + Script = template.Job.Group.AgentScript ?? "", StartAt = item, TemplateId = template.Id })); diff --git a/PARR.API/Controllers/V1/ApplicationInWorkController.cs b/PARR.API/Controllers/V1/ApplicationInWorkController.cs index b8e6d26d..99afbee6 100644 --- a/PARR.API/Controllers/V1/ApplicationInWorkController.cs +++ b/PARR.API/Controllers/V1/ApplicationInWorkController.cs @@ -62,53 +62,53 @@ namespace PARR.API.Controllers.V1 /// Получить список заданий на выполнение работ(ApplicationInWork) постранично /// /// - [HttpGet(ApiRoutes.Job.GetAll)] - public async Task GetAll([FromQuery] PaginationQuery paginationQuery, [FromQuery] ApplicationInWorkQuery filter) - { - var paginationFilter = mapper.Map(paginationQuery); + //[HttpGet(ApiRoutes.Job.GetAll)] + //public async Task GetAll([FromQuery] PaginationQuery paginationQuery, [FromQuery] ApplicationInWorkQuery filter) + //{ + // var paginationFilter = mapper.Map(paginationQuery); - IQueryable query = applicationsInWorkService.Get().Include(t => t.Application).ThenInclude(t => t!.ApplicationType); + // IQueryable query = applicationsInWorkService.Get().Include(t => t.Application).ThenInclude(t => t!.ApplicationType); - if (filter.IsLight != true) - { - query = query - .Include(t => t.Work) - //.Include(t => t.Templates) - большой запрос, делаем его отдельно - .Include(t => t.WorkGroups).ThenInclude(t => t.WorkGroup) - .Include(t => t.JobAutoControl); - } + // if (filter.IsLight != true) + // { + // query = query + // .Include(t => t.Work) + // //.Include(t => t.Templates) - большой запрос, делаем его отдельно + // .Include(t => t.WorkGroups).ThenInclude(t => t.WorkGroup) + // .Include(t => t.JobAutoControl); + // } - query = query.OrderBy(t => t.ShortDescription).ThenBy(t => t.Application!.Name); + // query = query.OrderBy(t => t.ShortDescription).ThenBy(t => t.Application!.Name); - if (!string.IsNullOrEmpty(filter.ShortDescription)) - query = query.Where(t => t.ShortDescription.ToLower().Contains(filter.ShortDescription.ToLower())); + // if (!string.IsNullOrEmpty(filter.ShortDescription)) + // query = query.Where(t => t.ShortDescription.ToLower().Contains(filter.ShortDescription.ToLower())); - if (filter.WorkId.HasValue) - query = query.Where(t => t.WorkId == filter.WorkId.Value); + // if (filter.WorkId.HasValue) + // query = query.Where(t => t.WorkId == filter.WorkId.Value); - var appInWorks = await applicationsInWorkService.GetPage(query, paginationFilter).ToListAsync(); + // var appInWorks = await applicationsInWorkService.GetPage(query, paginationFilter).ToListAsync(); - if (!appInWorks.Any()) - return NoContent(); + // if (!appInWorks.Any()) + // return NoContent(); - var response = mapper.Map>(appInWorks); + // var response = mapper.Map>(appInWorks);//TODO Migration to job - if (filter.IsLight != true) - { - //Если запрос не легкий, загружаем кол-во шаблонов отдельно, это значительно ускоряет запрос - foreach (var item in response) - { - item.TemplatesCount = await templateService.Get().CountAsync(t => t.ApplicationInWorkId == item.Id); + // if (filter.IsLight != true) + // { + // //Если запрос не легкий, загружаем кол-во шаблонов отдельно, это значительно ускоряет запрос + // foreach (var item in response) + // { + // item.TemplatesCount = await templateService.Get().CountAsync(t => t.JobId == item.Id); - var statistics = await GetStatisticsAsync(item.Id); - BindStatistics(item, statistics); - } - } + // var statistics = await GetStatisticsAsync(item.Id); + // BindStatistics(item, statistics); + // } + // } - var paginationResponse = new PagedResponse(response, true).GetPaginatedProps(paginationFilter, query); + // var paginationResponse = new PagedResponse(response, true).GetPaginatedProps(paginationFilter, query); - return Ok(paginationResponse); - } + // return Ok(paginationResponse); + //} /// @@ -116,28 +116,28 @@ namespace PARR.API.Controllers.V1 /// /// /// - [HttpGet(ApiRoutes.Job.Get)] - public async Task GetById([FromRoute] Guid id) - { - var applicationInWork = await applicationsInWorkService.Get() - .Include(t => t.Application).ThenInclude(t => t!.ApplicationType) - .Include(t => t.Work) - //.Include(t => t.Templates) - .Include(t => t.WorkGroups).ThenInclude(t => t.WorkGroup) - .Include(t => t.JobAutoControl) - .FirstOrDefaultAsync(t => t.Id == id); + //[HttpGet(ApiRoutes.Job.Get)] + //public async Task GetById([FromRoute] Guid id) + //{ + // var applicationInWork = await applicationsInWorkService.Get() + // .Include(t => t.Application).ThenInclude(t => t!.ApplicationType) + // .Include(t => t.Work) + // //.Include(t => t.Templates) + // .Include(t => t.WorkGroups).ThenInclude(t => t.WorkGroup) + // .Include(t => t.JobAutoControl) + // .FirstOrDefaultAsync(t => t.Id == id); - if (applicationInWork == null) - return NotFound(); + // if (applicationInWork == null) + // return NotFound(); - var response = mapper.Map(applicationInWork); - response.TemplatesCount = await templateService.Get().CountAsync(t => t.ApplicationInWorkId == id); + // var response = mapper.Map(applicationInWork); + // response.TemplatesCount = await templateService.Get().CountAsync(t => t.ApplicationInWorkId == id); - var statistics = await GetStatisticsAsync(response.Id); - BindStatistics(response, statistics); + // var statistics = await GetStatisticsAsync(response.Id); + // BindStatistics(response, statistics); - return Ok(new Response(response, true)); - } + // return Ok(new Response(response, true)); + //} /// @@ -145,80 +145,80 @@ namespace PARR.API.Controllers.V1 /// /// /// - [HttpPost(ApiRoutes.Job.Create)] - public async Task Create([FromBody] ApplicationInWorkRequest request) - { - var resultValidate = await validator.ValidateAsync(request); + //[HttpPost(ApiRoutes.Job.Create)] + //public async Task Create([FromBody] ApplicationInWorkRequest request) + //{ + // var resultValidate = await validator.ValidateAsync(request); - if (!resultValidate.IsValid) - return BadRequest(new Response(resultValidate.Errors)); + // if (!resultValidate.IsValid) + // return BadRequest(new Response(resultValidate.Errors)); - //уникальная запись по полям ApplicationId, WorkId - var existSameAiW = await applicationsInWorkService.GetAsync(request.ApplicationId, request.WorkId); - if (existSameAiW != null) - return BadRequest(new Response(false, new List { new ErrorModel { Message = "Задание на выполнение работ с такими ПО и работой уже существует" } })); + // //уникальная запись по полям ApplicationId, WorkId + // var existSameAiW = await applicationsInWorkService.GetAsync(request.ApplicationId, request.WorkId); + // if (existSameAiW != null) + // return BadRequest(new Response(false, new List { new ErrorModel { Message = "Задание на выполнение работ с такими ПО и работой уже существует" } })); - var applicationInWork = new ApplicationsInWork - { - Id = Guid.NewGuid(), - WorkId = request.WorkId, - ApplicationId = request.ApplicationId, - TemplateDuration = request.TemplateDuration, - ShortDescription = request.ShortDescription.Trim(), - FullDescription = request.FullDescription.Trim(), - Solution = request.Solution.Trim(), - //NextRun = request.NextRun, - IsAutoDistributionEnabled = request.IsAutoDistributionEnabled, - ReferenceDate = request.ReferenceDate, - IsAgent = request.IsAgent, - AgentName = request.AgentName?.Trim(), - AgentTimeOutSec = request.AgentTimeOutSec, - AgentScript = request.AgentScript?.Trim() - }; + // var applicationInWork = new ApplicationsInWork + // { + // Id = Guid.NewGuid(), + // WorkId = request.WorkId, + // ApplicationId = request.ApplicationId, + // TemplateDuration = request.TemplateDuration, + // ShortDescription = request.ShortDescription.Trim(), + // FullDescription = request.FullDescription.Trim(), + // Solution = request.Solution.Trim(), + // //NextRun = request.NextRun, + // IsAutoDistributionEnabled = request.IsAutoDistributionEnabled, + // ReferenceDate = request.ReferenceDate, + // IsAgent = request.IsAgent, + // AgentName = request.AgentName?.Trim(), + // AgentTimeOutSec = request.AgentTimeOutSec, + // AgentScript = request.AgentScript?.Trim() + // }; - //Добавляем настройки планировщика - request.Schedule.ForEach(item => - { - applicationInWork.EsppSchValues.Add(new EsppSchValue - { - ApplicationsInWorkId = applicationInWork.Id, - TypeConfigId = item.TypeConfigId, - TypeValueId = item.TypeValueId - }); - }); + // //Добавляем настройки планировщика + // request.Schedule.ForEach(item => + // { + // applicationInWork.EsppSchValues.Add(new EsppSchValue + // { + // ApplicationsInWorkId = applicationInWork.Id, + // TypeConfigId = item.TypeConfigId, + // TypeValueId = item.TypeValueId + // }); + // }); - //Добавляем рабочие группы - request.WorkGroups.ForEach(workGroupId => - { - applicationInWork.WorkGroups.Add(new AppInWorkInWorkGroup - { - ApplicationsInWorkId = applicationInWork.Id, - WorkGroupId = workGroupId - }); - }); + // //Добавляем рабочие группы + // request.WorkGroups.ForEach(workGroupId => + // { + // applicationInWork.WorkGroups.Add(new AppInWorkInWorkGroup + // { + // ApplicationsInWorkId = applicationInWork.Id, + // WorkGroupId = workGroupId + // }); + // }); - if (!await applicationsInWorkService.CreateAsync(applicationInWork) || !await applicationsInWorkService.CommitAsync()) - return BadRequest(new Response(false, new List { new ErrorModel { Message = "Ошибка при созании задания на выполнение работ" } })); + // if (!await applicationsInWorkService.CreateAsync(applicationInWork) || !await applicationsInWorkService.CommitAsync()) + // return BadRequest(new Response(false, new List { new ErrorModel { Message = "Ошибка при созании задания на выполнение работ" } })); - logger.LogInformation($"Пользователь {User.Identity?.Name} добавил задание на выполнение работ: {applicationInWork.Id}, {applicationInWork.ShortDescription}, {applicationInWork.Solution}"); + // logger.LogInformation($"Пользователь {User.Identity?.Name} добавил задание на выполнение работ: {applicationInWork.Id}, {applicationInWork.ShortDescription}, {applicationInWork.Solution}"); - var createdApplicationInWork = await applicationsInWorkService.Get() - .Include(t => t.Application).ThenInclude(t => t!.ApplicationType) - .Include(t => t.Work) - //.Include(t => t.Templates) - .Include(t => t.WorkGroups).ThenInclude(t => t.WorkGroup) - .Include(t => t.JobAutoControl) - .FirstAsync(t => t.Id == applicationInWork.Id); + // var createdApplicationInWork = await applicationsInWorkService.Get() + // .Include(t => t.Application).ThenInclude(t => t!.ApplicationType) + // .Include(t => t.Work) + // //.Include(t => t.Templates) + // .Include(t => t.WorkGroups).ThenInclude(t => t.WorkGroup) + // .Include(t => t.JobAutoControl) + // .FirstAsync(t => t.Id == applicationInWork.Id); - var locationUri = uriService.GetUri(ApiRoutes.Job.Get, ApiRoutes.Job.getParam, createdApplicationInWork.Id); + // var locationUri = uriService.GetUri(ApiRoutes.Job.Get, ApiRoutes.Job.getParam, createdApplicationInWork.Id); - var response = mapper.Map(createdApplicationInWork); - // так как мы только что создали AppInW, то у него нет шаблонов, смело ставим = 0 (ускоряем запрос) - response.TemplatesCount = 0; + // var response = mapper.Map(createdApplicationInWork); + // // так как мы только что создали AppInW, то у него нет шаблонов, смело ставим = 0 (ускоряем запрос) + // response.TemplatesCount = 0; - return Created(locationUri, new Response(response, true)); - } + // return Created(locationUri, new Response(response, true)); + //} /// @@ -227,114 +227,114 @@ namespace PARR.API.Controllers.V1 /// /// /// - [HttpPut(ApiRoutes.Job.Update)] - public async Task Update([FromRoute] Guid id, [FromBody] ApplicationInWorkRequest request) - { - var resultValidate = await validator.ValidateAsync(request); - if (!resultValidate.IsValid) - return BadRequest(new Response(resultValidate.Errors)); + //[HttpPut(ApiRoutes.Job.Update)] + //public async Task Update([FromRoute] Guid id, [FromBody] ApplicationInWorkRequest request) + //{ + // var resultValidate = await validator.ValidateAsync(request); + // if (!resultValidate.IsValid) + // return BadRequest(new Response(resultValidate.Errors)); - //уникальная запись по полям ApplicationId, WorkId у которой id!=[FromRoute]id - var existSameAiW = await applicationsInWorkService.Get() - .FirstOrDefaultAsync(t => t.Id != id && t.ApplicationId == request.ApplicationId && t.WorkId == request.WorkId); - if (existSameAiW != null) - return BadRequest(new Response(false, new List { new ErrorModel { Message = "Задание на выполнение работ с такими ПО и работой уже существует" } })); + // //уникальная запись по полям ApplicationId, WorkId у которой id!=[FromRoute]id + // var existSameAiW = await applicationsInWorkService.Get() + // .FirstOrDefaultAsync(t => t.Id != id && t.ApplicationId == request.ApplicationId && t.WorkId == request.WorkId); + // if (existSameAiW != null) + // return BadRequest(new Response(false, new List { new ErrorModel { Message = "Задание на выполнение работ с такими ПО и работой уже существует" } })); - var orig = await applicationsInWorkService.Get() - .Include(t => t.WorkGroups) - .Include(t => t.EsppSchValues) - .FirstOrDefaultAsync(t => t.Id == id); + // var orig = await applicationsInWorkService.Get() + // .Include(t => t.WorkGroups) + // .Include(t => t.EsppSchValues) + // .FirstOrDefaultAsync(t => t.Id == id); - if (orig == null) - return BadRequest(new Response(false, new List { new ErrorModel { Message = $"Ошибка при изменении задания на выполнение работ. Не найдено задание с Id: {id}" } })); + // if (orig == null) + // return BadRequest(new Response(false, new List { new ErrorModel { Message = $"Ошибка при изменении задания на выполнение работ. Не найдено задание с Id: {id}" } })); - //Расписание было изменено, ниже добавим задание в очередь на обновление расписаний у связанных шаблонов - var isScheduleChanged = IsScheduleChanged(orig, request); + // //Расписание было изменено, ниже добавим задание в очередь на обновление расписаний у связанных шаблонов + // var isScheduleChanged = IsScheduleChanged(orig, request); - orig.WorkId = request.WorkId; - orig.ApplicationId = request.ApplicationId; - orig.TemplateDuration = request.TemplateDuration; - orig.ShortDescription = request.ShortDescription.Trim(); - orig.FullDescription = request.FullDescription.Trim(); - orig.Solution = request.Solution.Trim(); - //orig.NextRun = request.NextRun; - orig.ReferenceDate = request.ReferenceDate; - orig.IsAutoDistributionEnabled = request.IsAutoDistributionEnabled; - orig.IsAgent = request.IsAgent; - orig.AgentName = request.AgentName?.Trim(); - orig.AgentTimeOutSec = request.AgentTimeOutSec; - orig.AgentScript = request.AgentScript?.Trim(); - orig.DateModified = DateTimeOffset.UtcNow; + // orig.WorkId = request.WorkId; + // orig.ApplicationId = request.ApplicationId; + // orig.TemplateDuration = request.TemplateDuration; + // orig.ShortDescription = request.ShortDescription.Trim(); + // orig.FullDescription = request.FullDescription.Trim(); + // orig.Solution = request.Solution.Trim(); + // //orig.NextRun = request.NextRun; + // orig.ReferenceDate = request.ReferenceDate; + // orig.IsAutoDistributionEnabled = request.IsAutoDistributionEnabled; + // orig.IsAgent = request.IsAgent; + // orig.AgentName = request.AgentName?.Trim(); + // orig.AgentTimeOutSec = request.AgentTimeOutSec; + // orig.AgentScript = request.AgentScript?.Trim(); + // orig.DateModified = DateTimeOffset.UtcNow; - //обновляем планировщик - orig.EsppSchValues.Clear(); - request.Schedule.ForEach(item => - { - orig.EsppSchValues.Add(new EsppSchValue - { - ApplicationsInWorkId = orig.Id, - TypeConfigId = item.TypeConfigId, - TypeValueId = item.TypeValueId - }); - }); + // //обновляем планировщик + // orig.EsppSchValues.Clear(); + // request.Schedule.ForEach(item => + // { + // orig.EsppSchValues.Add(new EsppSchValue + // { + // ApplicationsInWorkId = orig.Id, + // TypeConfigId = item.TypeConfigId, + // TypeValueId = item.TypeValueId + // }); + // }); - //Обновляем рабочие группы - orig.WorkGroups.Clear(); - request.WorkGroups.ForEach(workGroupId => - { - orig.WorkGroups.Add(new AppInWorkInWorkGroup - { - ApplicationsInWorkId = orig.Id, - WorkGroupId = workGroupId - }); - }); + // //Обновляем рабочие группы + // orig.WorkGroups.Clear(); + // request.WorkGroups.ForEach(workGroupId => + // { + // orig.WorkGroups.Add(new AppInWorkInWorkGroup + // { + // ApplicationsInWorkId = orig.Id, + // WorkGroupId = workGroupId + // }); + // }); - if (!await applicationsInWorkService.CommitAsync()) - return BadRequest(new Response(false, new List { new ErrorModel { Message = "Ошибка при изменении задания на выполнение работ." } })); + // if (!await applicationsInWorkService.CommitAsync()) + // return BadRequest(new Response(false, new List { new ErrorModel { Message = "Ошибка при изменении задания на выполнение работ." } })); - logger.LogInformation($"Пользователь {User.Identity?.Name} обновил задание на выполнение работ: {orig.Id}," + - $" {orig.WorkId}, {orig.ApplicationId}, {orig.TemplateDuration}, {orig.ShortDescription}," + - $" {orig.FullDescription}, {orig.Solution}, {nameof(orig.IsAutoDistributionEnabled)}: {orig.IsAutoDistributionEnabled}, {orig.IsAgent}, {orig.AgentName}, {orig.AgentTimeOutSec}, {orig.AgentScript}"); + // logger.LogInformation($"Пользователь {User.Identity?.Name} обновил задание на выполнение работ: {orig.Id}," + + // $" {orig.WorkId}, {orig.ApplicationId}, {orig.TemplateDuration}, {orig.ShortDescription}," + + // $" {orig.FullDescription}, {orig.Solution}, {nameof(orig.IsAutoDistributionEnabled)}: {orig.IsAutoDistributionEnabled}, {orig.IsAgent}, {orig.AgentName}, {orig.AgentTimeOutSec}, {orig.AgentScript}"); - if (isScheduleChanged) - { - //расписание было обновлено, отправим задание в очередь на перерасчет NextRun - var requestToMq = new TemplateDistributorMq - { - ApplicationInWorkId = id - }; + // if (isScheduleChanged) + // { + // //расписание было обновлено, отправим задание в очередь на перерасчет NextRun + // var requestToMq = new TemplateDistributorMq + // { + // ApplicationInWorkId = id + // }; - var msg = JsonSerializer.Serialize(requestToMq); + // var msg = JsonSerializer.Serialize(requestToMq); - logger.LogDebug($"Расписание в РР applicationInWorkId: {id} было изменено. Отправляем задание в очередь на перерасчет NextRun"); + // logger.LogDebug($"Расписание в РР applicationInWorkId: {id} было изменено. Отправляем задание в очередь на перерасчет NextRun"); - var sendResult = mqService.Send(mqSettings.TemplateDistributor, new[] { msg }); + // var sendResult = mqService.Send(mqSettings.TemplateDistributor, new[] { msg }); - if (sendResult.IsSuccess) - logger.LogInformation($"Задание на перерасчет NextRun успешно отправлено в очередь MQ {mqSettings.TemplateDistributor.QueueName}"); - else - logger.LogError($"Ошибка при отправке задания на перерасчет NextRun в очередь MQ {mqSettings.TemplateDistributor.QueueName}"); - } + // if (sendResult.IsSuccess) + // logger.LogInformation($"Задание на перерасчет NextRun успешно отправлено в очередь MQ {mqSettings.TemplateDistributor.QueueName}"); + // else + // logger.LogError($"Ошибка при отправке задания на перерасчет NextRun в очередь MQ {mqSettings.TemplateDistributor.QueueName}"); + // } - var updatedApplicationInWork = await applicationsInWorkService.Get() - .Include(t => t.Application).ThenInclude(t => t!.ApplicationType) - .Include(t => t.Work) - //.Include(t => t.Templates) - .Include(t => t.WorkGroups).ThenInclude(t => t.WorkGroup) - .Include(t => t.JobAutoControl) - .FirstAsync(t => t.Id == orig.Id); + // var updatedApplicationInWork = await applicationsInWorkService.Get() + // .Include(t => t.Application).ThenInclude(t => t!.ApplicationType) + // .Include(t => t.Work) + // //.Include(t => t.Templates) + // .Include(t => t.WorkGroups).ThenInclude(t => t.WorkGroup) + // .Include(t => t.JobAutoControl) + // .FirstAsync(t => t.Id == orig.Id); - var response = mapper.Map(updatedApplicationInWork); - response.TemplatesCount = await templateService.Get().CountAsync(t => t.ApplicationInWorkId == id); + // var response = mapper.Map(updatedApplicationInWork); + // response.TemplatesCount = await templateService.Get().CountAsync(t => t.ApplicationInWorkId == id); - var statistics = await GetStatisticsAsync(response.Id); - BindStatistics(response, statistics); + // var statistics = await GetStatisticsAsync(response.Id); + // BindStatistics(response, statistics); - return Ok(new Response(response, true)); + // return Ok(new Response(response, true)); - } + //} /// @@ -342,38 +342,38 @@ namespace PARR.API.Controllers.V1 /// /// /// - [HttpDelete(ApiRoutes.Job.Delete)] - public async Task Delete([FromRoute] Guid id) - { - var applicationsInWork = await applicationsInWorkService.Get() - //.Include(t => t.Templates) - .FirstOrDefaultAsync(t => t.Id == id); + //[HttpDelete(ApiRoutes.Job.Delete)] + //public async Task Delete([FromRoute] Guid id) + //{ + // var applicationsInWork = await applicationsInWorkService.Get() + // //.Include(t => t.Templates) + // .FirstOrDefaultAsync(t => t.Id == id); - if (applicationsInWork == null) - return BadRequest(new Response(false, new List { new ErrorModel { - Message = $"Ошибка при удалении задания на выполнение работ. Не найдено задание на выполнение работ Id: {id}" - } })); + // if (applicationsInWork == null) + // return BadRequest(new Response(false, new List { new ErrorModel { + // Message = $"Ошибка при удалении задания на выполнение работ. Не найдено задание на выполнение работ Id: {id}" + // } })); - var templateCount = await templateService.Get().CountAsync(t => t.ApplicationInWorkId == id); + // var templateCount = await templateService.Get().CountAsync(t => t.ApplicationInWorkId == id); - //if (applicationsInWork.Templates.Any()) - if (templateCount > 0) - return BadRequest(new Response(false, new List { new ErrorModel { - Message = $"Ошибка при удалении задания на выполнение работ. С данным заданием связаны шаблоны: {templateCount} шт." - } })); + // //if (applicationsInWork.Templates.Any()) + // if (templateCount > 0) + // return BadRequest(new Response(false, new List { new ErrorModel { + // Message = $"Ошибка при удалении задания на выполнение работ. С данным заданием связаны шаблоны: {templateCount} шт." + // } })); - if (!applicationsInWorkService.Delete(applicationsInWork) || !await applicationsInWorkService.CommitAsync()) - return BadRequest(new Response(false, new List { new ErrorModel { - Message = $"Ошибка при удалении задания на выполнение работ" - } })); + // if (!applicationsInWorkService.Delete(applicationsInWork) || !await applicationsInWorkService.CommitAsync()) + // return BadRequest(new Response(false, new List { new ErrorModel { + // Message = $"Ошибка при удалении задания на выполнение работ" + // } })); - logger.LogInformation($"Пользователь {User.Identity?.Name} удалил задание на выполнение работ: {applicationsInWork.Id},{applicationsInWork.WorkId}," + - $" {applicationsInWork.ApplicationId}, {applicationsInWork.TemplateDuration}, {applicationsInWork.ShortDescription}," + - $" {applicationsInWork.FullDescription}, {applicationsInWork.Solution}, {nameof(applicationsInWork.IsAutoDistributionEnabled)}: {applicationsInWork.IsAutoDistributionEnabled}, {applicationsInWork.IsAgent}," + - $" {applicationsInWork.AgentName}, {applicationsInWork.AgentTimeOutSec}, {applicationsInWork.AgentScript}"); + // logger.LogInformation($"Пользователь {User.Identity?.Name} удалил задание на выполнение работ: {applicationsInWork.Id},{applicationsInWork.WorkId}," + + // $" {applicationsInWork.ApplicationId}, {applicationsInWork.TemplateDuration}, {applicationsInWork.ShortDescription}," + + // $" {applicationsInWork.FullDescription}, {applicationsInWork.Solution}, {nameof(applicationsInWork.IsAutoDistributionEnabled)}: {applicationsInWork.IsAutoDistributionEnabled}, {applicationsInWork.IsAgent}," + + // $" {applicationsInWork.AgentName}, {applicationsInWork.AgentTimeOutSec}, {applicationsInWork.AgentScript}"); - return NoContent(); - } + // return NoContent(); + //} /// @@ -382,31 +382,31 @@ namespace PARR.API.Controllers.V1 /// /// /// - private bool IsScheduleChanged(ApplicationsInWork orig, ApplicationInWorkRequest request) - { - var isScheduleChanged = false; + //private bool IsScheduleChanged(ApplicationsInWork orig, ApplicationInWorkRequest request) + //{ + // var isScheduleChanged = false; - if (orig.ReferenceDate != request.ReferenceDate) - isScheduleChanged = true; + // if (orig.ReferenceDate != request.ReferenceDate) + // isScheduleChanged = true; - if (request.Schedule.Count() != orig.EsppSchValues.Count()) - isScheduleChanged = true; + // if (request.Schedule.Count() != orig.EsppSchValues.Count()) + // isScheduleChanged = true; - if (request.IsAutoDistributionEnabled != orig.IsAutoDistributionEnabled) - isScheduleChanged = true; + // if (request.IsAutoDistributionEnabled != orig.IsAutoDistributionEnabled) + // isScheduleChanged = true; - request.Schedule.ForEach(requestSchedule => - { - var schExist = orig.EsppSchValues.FirstOrDefault(t => t.ApplicationsInWorkId == orig.Id - && t.TypeValueId == requestSchedule.TypeValueId - && t.TypeConfigId == requestSchedule.TypeConfigId); + // request.Schedule.ForEach(requestSchedule => + // { + // var schExist = orig.EsppSchValues.FirstOrDefault(t => t.ApplicationsInWorkId == orig.Id + // && t.TypeValueId == requestSchedule.TypeValueId + // && t.TypeConfigId == requestSchedule.TypeConfigId); - if (schExist == null) - isScheduleChanged = true; - }); + // if (schExist == null) + // isScheduleChanged = true; + // }); - return isScheduleChanged; - } + // return isScheduleChanged; + //} /// @@ -414,28 +414,28 @@ namespace PARR.API.Controllers.V1 /// /// /// - private async Task GetStatisticsAsync(Guid applicationInWorkId) - { - var statResult = await applicationsInWorkService.Get() - .Include(t => t.Templates).ThenInclude(t => t.RobotConfigurations) - .Where(x => x.Id == applicationInWorkId) - .Select(t => new - { - TemplateActivated = t.Templates.Count(x => x.IsActiveTemplate), - TemplateSynchronized = t.Templates.Count(x => x.RobotConfigurations.Any(c => c.TaskStatusCode == (int)TaskStatusEnum.Ok && c.RobotCode == (int)RobotsEnum.TemplateOrder)), - TemplateErrors = t.Templates.Count(x => x.RobotConfigurations.Any(c => c.RobotStatusCode == (int)RobotStatusEnum.Error && c.RobotCode == (int)RobotsEnum.TemplateOrder)), - ScheduleActivated = t.Templates.Count(x => x.IsActiveSchedule), - ScheduleSynchronized = t.Templates.Count(x => x.RobotConfigurations.Any(c => c.TaskStatusCode == (int)TaskStatusEnum.Ok && c.RobotCode == (int)RobotsEnum.ScheduleOrder)), - ScheduleErrors = t.Templates.Count(x => x.RobotConfigurations.Any(c => c.RobotStatusCode == (int)RobotStatusEnum.Error && c.RobotCode == (int)RobotsEnum.ScheduleOrder)) + //private async Task GetStatisticsAsync(Guid applicationInWorkId) + //{ + // var statResult = await applicationsInWorkService.Get() + // .Include(t => t.Templates).ThenInclude(t => t.RobotConfigurations) + // .Where(x => x.Id == applicationInWorkId) + // .Select(t => new + // { + // TemplateActivated = t.Templates.Count(x => x.IsActiveTemplate), + // TemplateSynchronized = t.Templates.Count(x => x.RobotConfigurations.Any(c => c.TaskStatusCode == (int)TaskStatusEnum.Ok && c.RobotCode == (int)RobotsEnum.TemplateOrder)), + // TemplateErrors = t.Templates.Count(x => x.RobotConfigurations.Any(c => c.RobotStatusCode == (int)RobotStatusEnum.Error && c.RobotCode == (int)RobotsEnum.TemplateOrder)), + // ScheduleActivated = t.Templates.Count(x => x.IsActiveSchedule), + // ScheduleSynchronized = t.Templates.Count(x => x.RobotConfigurations.Any(c => c.TaskStatusCode == (int)TaskStatusEnum.Ok && c.RobotCode == (int)RobotsEnum.ScheduleOrder)), + // ScheduleErrors = t.Templates.Count(x => x.RobotConfigurations.Any(c => c.RobotStatusCode == (int)RobotStatusEnum.Error && c.RobotCode == (int)RobotsEnum.ScheduleOrder)) - }).FirstOrDefaultAsync(); + // }).FirstOrDefaultAsync(); - return new AppInWorkStatModel - { - ScheduleStatistics = new ScheduleStats { Activated = statResult?.ScheduleActivated ?? 0, Errors = statResult?.ScheduleErrors ?? 0, Synchronized = statResult?.ScheduleSynchronized ?? 0 }, - TemplateStatistics = new TemplateStats { Activated = statResult?.TemplateActivated ?? 0, Errors = statResult?.TemplateErrors ?? 0, Synchronized = statResult?.TemplateSynchronized ?? 0 } - }; - } + // return new AppInWorkStatModel + // { + // ScheduleStatistics = new ScheduleStats { Activated = statResult?.ScheduleActivated ?? 0, Errors = statResult?.ScheduleErrors ?? 0, Synchronized = statResult?.ScheduleSynchronized ?? 0 }, + // TemplateStatistics = new TemplateStats { Activated = statResult?.TemplateActivated ?? 0, Errors = statResult?.TemplateErrors ?? 0, Synchronized = statResult?.TemplateSynchronized ?? 0 } + // }; + //} private void BindStatistics(ApplicationInWorkResponse applicationsInWork, AppInWorkStatModel statistics) diff --git a/PARR.API/Controllers/V1/RobotTaskController.cs b/PARR.API/Controllers/V1/RobotTaskController.cs index 351e8db4..7cfee3dc 100644 --- a/PARR.API/Controllers/V1/RobotTaskController.cs +++ b/PARR.API/Controllers/V1/RobotTaskController.cs @@ -71,11 +71,11 @@ namespace PARR.API.Controllers.V1 case RobotsEnum.TemplateOrder: // шаблоны query = query.Include(t => t.Template) - .ThenInclude(t => t!.Host).ThenInclude(t => t!.ResponseArea) - .ThenInclude(t => t!.Hosts).ThenInclude(t => t.WorkGroup).ThenInclude(t => t!.ResponseArea) + .ThenInclude(t => t!.Unit) + //.ThenInclude(t => t!.Hosts).ThenInclude(t => t.WorkGroup).ThenInclude(t => t!.ResponseArea) .Include(t => t.Template) - .ThenInclude(a => a!.ApplicationsInWork) - .ThenInclude(w => w!.Work) + .ThenInclude(a => a!.Job) + //.ThenInclude(w => w!.Work) .ThenInclude(t => t!.Tnk) .ThenInclude(s => s!.Subprocess) .ThenInclude(p => p!.Process); @@ -84,10 +84,12 @@ namespace PARR.API.Controllers.V1 //расписание // тут не делаем AsSplitQuery, не может подтянуть все таблицы query = query.Include(t => t.Template) - .ThenInclude(t => t!.Host).ThenInclude(t => t!.ResponseArea) - .ThenInclude(t => t!.Hosts).ThenInclude(t => t.WorkGroup) + .ThenInclude(t => t!.Unit)//.ThenInclude(t => t!.ResponseArea) + //.ThenInclude(t => t!.Hosts).ThenInclude(t => t.WorkGroup) .Include(t => t.Template) - .ThenInclude(t => t!.ApplicationsInWork) + .ThenInclude(t => t!.Job) + .ThenInclude(t => t!.Group) + //.ThenInclude(t => t!.ApplicationsInWork) .ThenInclude(t => t!.EsppSchValues) .ThenInclude(t => t!.EsppSchTypeConfig) .ThenInclude(t => t!.EsppSchTypeSchedule); @@ -169,7 +171,7 @@ namespace PARR.API.Controllers.V1 // передаем LastRun, если его нет, то NextRun //var nextRun = await esppScheduleTransformService.GetNextDateAsync(task.Template!.ApplicationInWorkId, task.Template.ApplicationsInWork!.LastRun ?? task.Template.ApplicationsInWork.NextRun); // всегда считаем по nextRun - var nextRun = await esppScheduleTransformService.GetNextDateAsync(template.ApplicationInWorkId, template.NextRun); + var nextRun = await esppScheduleTransformService.GetNextDateAsync(template.Job!.GroupId, template.NextRun); if (nextRun != template.NextRun) { diff --git a/PARR.API/Controllers/V1/Statistics/StatHostController.cs b/PARR.API/Controllers/V1/Statistics/StatHostController.cs index 5133fae9..388d9fa4 100644 --- a/PARR.API/Controllers/V1/Statistics/StatHostController.cs +++ b/PARR.API/Controllers/V1/Statistics/StatHostController.cs @@ -9,6 +9,7 @@ using PARR.API.Controllers.V1.Base; using PARR.BLL.Services.Interfaces; using PARR.Constants; using PARR.DAL.Services.Interfaces; +using PARR.DAL.Services.Interfaces.Unit; namespace PARR.API.Controllers.V1.Statistics { @@ -19,11 +20,17 @@ namespace PARR.API.Controllers.V1.Statistics public class StatHostController : BaseApiController { private readonly IHostService hostService; + private readonly IUnitService unitService; private readonly ICalendarService calendarService; - public StatHostController(IHostService hostService, ICalendarService calendarService) + public StatHostController( + IHostService hostService, + IUnitService unitService, + ICalendarService calendarService + ) { this.hostService = hostService; + this.unitService = unitService; this.calendarService = calendarService; } @@ -103,8 +110,8 @@ namespace PARR.API.Controllers.V1.Statistics var response = new StatHostTemplateResponse { - AllHosts = await hostService.Get().CountAsync(), - HostsInTemplates = await hostService.Get().Include(t => t.Templates).CountAsync(t => t.Templates.Any()) + AllUnits = await unitService.Get().CountAsync(), + HostsInTemplates = await unitService.Get().Include(t => t.Templates).CountAsync(t => t.Templates.Any()) }; return Ok(new Response(response, true)); diff --git a/PARR.API/Controllers/V1/Statistics/StatResponseAreaWorkLoadController.cs b/PARR.API/Controllers/V1/Statistics/StatResponseAreaWorkLoadController.cs index b86f2418..91066cfa 100644 --- a/PARR.API/Controllers/V1/Statistics/StatResponseAreaWorkLoadController.cs +++ b/PARR.API/Controllers/V1/Statistics/StatResponseAreaWorkLoadController.cs @@ -40,88 +40,88 @@ namespace PARR.API.Controllers.V1.Statistics } - /// - /// Статистика загрузки РР по всем ЗО - /// - /// - [HttpGet(ApiRoutes.StatResponseAreaWorkLoad.GetAll)] - public async Task GetAll([FromQuery] WorkloadBaseQuery requestQuery) - { - var response = await GetStatisticsAsync(requestQuery); + ///// + ///// Статистика загрузки РР по всем ЗО + ///// + ///// + //[HttpGet(ApiRoutes.StatResponseAreaWorkLoad.GetAll)] + //public async Task GetAll([FromQuery] WorkloadBaseQuery requestQuery) + //{ + // var response = await GetStatisticsAsync(requestQuery); - return Ok(new Response>(response, true)); - } + // return Ok(new Response>(response, true)); + //} - /// - /// Статистика загрузки РР по списку ЗО - /// - /// - [HttpPost(ApiRoutes.StatResponseAreaWorkLoad.GetByResponseAreas)] - public async Task GetByResponseAreas([FromBody] StatResponseAreaWorkloadRequest request) - { - var response = await GetStatisticsAsync(request.Filter, request.ResponseAreas); + ///// + ///// Статистика загрузки РР по списку ЗО + ///// + ///// + //[HttpPost(ApiRoutes.StatResponseAreaWorkLoad.GetByResponseAreas)] + //public async Task GetByResponseAreas([FromBody] StatResponseAreaWorkloadRequest request) + //{ + // var response = await GetStatisticsAsync(request.Filter, request.ResponseAreas); - return Ok(new Response>(response, true)); - } + // return Ok(new Response>(response, true)); + //} - private async Task> GetStatisticsAsync(WorkloadBaseQuery requestQuery, List? responseAreas = null) - { - var daysList = workLoadService.GetDatesForPeriod(requestQuery); + //private async Task> GetStatisticsAsync(WorkloadBaseQuery requestQuery, List? responseAreas = null) + //{ + // var daysList = workLoadService.GetDatesForPeriod(requestQuery); - IQueryable query = templateService.Get() - .Include(t => t.Host).ThenInclude(t => t.WorkGroup); + // IQueryable query = templateService.Get() + // .Include(t => t.Host).ThenInclude(t => t.WorkGroup); - query = workLoadService.FilterTemplatesQuery(query, requestQuery); + // query = workLoadService.FilterTemplatesQuery(query, requestQuery); - if (responseAreas != null && responseAreas.Count() > 0) - query = query.Where(t => responseAreas.Any(x => x == t.Host.WorkGroup.ResponseAreaCode)); + // if (responseAreas != null && responseAreas.Count() > 0) + // query = query.Where(t => responseAreas.Any(x => x == t.Host.WorkGroup.ResponseAreaCode)); - //var groupedQuery = query.GroupBy(t => new { t.NextRun.DateTime.Date, t.Host!.WorkGroup!.ResponseAreaCode }) - var groupedQuery = query.GroupBy(t => new { t.NextRun.AddHours(requestQuery.TimeZoneOffsetHours).DateTime.Date, t.Host!.WorkGroup!.ResponseAreaCode }) - .Select(t => new - { - ResponseAreaCode = t.Key.ResponseAreaCode, - Date = t.Key.Date, - TemplateCount = t.Count() + // //var groupedQuery = query.GroupBy(t => new { t.NextRun.DateTime.Date, t.Host!.WorkGroup!.ResponseAreaCode }) + // var groupedQuery = query.GroupBy(t => new { t.NextRun.AddHours(requestQuery.TimeZoneOffsetHours).DateTime.Date, t.Host!.WorkGroup!.ResponseAreaCode }) + // .Select(t => new + // { + // ResponseAreaCode = t.Key.ResponseAreaCode, + // Date = t.Key.Date, + // TemplateCount = t.Count() - }); + // }); - var queryResult = await groupedQuery.ToListAsync(); + // var queryResult = await groupedQuery.ToListAsync(); - var responseAreaQuery = responseAreaService.Get(); + // var responseAreaQuery = responseAreaService.Get(); - if (responseAreas != null && responseAreas.Count() > 0) - responseAreaQuery = responseAreaQuery.Where(t => responseAreas.Any(x => x == t.Code)); + // if (responseAreas != null && responseAreas.Count() > 0) + // responseAreaQuery = responseAreaQuery.Where(t => responseAreas.Any(x => x == t.Code)); - var allResponseArea = await responseAreaQuery.ToListAsync(); + // var allResponseArea = await responseAreaQuery.ToListAsync(); - //if (!allResponseArea.Any()) - // return NoContent(); + // //if (!allResponseArea.Any()) + // // return NoContent(); - var response = new List(); + // var response = new List(); - allResponseArea.ForEach(respArea => - { - var workLoads = daysList.Select(t => new StatWorkLoadDataResponse - { - Date = t, - TemplateCount = queryResult.FirstOrDefault(x => x.ResponseAreaCode == respArea.Code && DateOnly.FromDateTime(x.Date) == t)?.TemplateCount ?? 0 - }).OrderBy(t => t.Date).ToList(); + // allResponseArea.ForEach(respArea => + // { + // var workLoads = daysList.Select(t => new StatWorkLoadDataResponse + // { + // Date = t, + // TemplateCount = queryResult.FirstOrDefault(x => x.ResponseAreaCode == respArea.Code && DateOnly.FromDateTime(x.Date) == t)?.TemplateCount ?? 0 + // }).OrderBy(t => t.Date).ToList(); - response.Add( - new StatResponseAreaWorkLoadResponse - { - ResponseArea = mapper.Map(respArea), - WorkLoad = workLoads - }); - }); + // response.Add( + // new StatResponseAreaWorkLoadResponse + // { + // ResponseArea = mapper.Map(respArea), + // WorkLoad = workLoads + // }); + // }); - response = response.OrderBy(t => t.ResponseArea.Code).ToList(); + // response = response.OrderBy(t => t.ResponseArea.Code).ToList(); - return response; - } + // return response; + //} } } diff --git a/PARR.API/Controllers/V1/Statistics/StatTemplateController.cs b/PARR.API/Controllers/V1/Statistics/StatTemplateController.cs index 75ad2b18..3074bc59 100644 --- a/PARR.API/Controllers/V1/Statistics/StatTemplateController.cs +++ b/PARR.API/Controllers/V1/Statistics/StatTemplateController.cs @@ -32,66 +32,66 @@ namespace PARR.API.Controllers.V1.Statistics this.calendarService = calendarService; } - /// - /// Статистика по шаблонам - /// - /// - [HttpGet(ApiRoutes.StatTemplate.Get)] - public async Task Get() - { - var response = new StatTemplateResponse - { - ActivateScheduleCount = await templateService.Get().CountAsync(t => t.IsActiveSchedule), - ActivateTemplateCount = await templateService.Get().CountAsync(t => t.IsActiveTemplate), - TemplateAgentCount = await templateService.Get().Include(t => t.ApplicationsInWork).CountAsync(t => t.ApplicationsInWork!.IsAgent), - TemplateCount = await templateService.Get().CountAsync(), - SyncEsppScheduleCount = await templateService.Get().Include(t => t.RobotConfigurations).CountAsync(t => t.RobotConfigurations.Any(c => c.RobotCode == (int)RobotsEnum.ScheduleOrder && c.TaskStatusCode == (int)TaskStatusEnum.Ok)), - SyncEsppTemplatesCount = await templateService.Get().Include(t => t.RobotConfigurations).CountAsync(t => t.RobotConfigurations.Any(c => c.RobotCode == (int)RobotsEnum.TemplateOrder && c.TaskStatusCode == (int)TaskStatusEnum.Ok)) - }; + ///// + ///// Статистика по шаблонам + ///// + ///// + //[HttpGet(ApiRoutes.StatTemplate.Get)] + //public async Task Get() + //{ + // var response = new StatTemplateResponse + // { + // ActivateScheduleCount = await templateService.Get().CountAsync(t => t.IsActiveSchedule), + // ActivateTemplateCount = await templateService.Get().CountAsync(t => t.IsActiveTemplate), + // TemplateAgentCount = await templateService.Get().Include(t => t.ApplicationsInWork).CountAsync(t => t.ApplicationsInWork!.IsAgent), + // TemplateCount = await templateService.Get().CountAsync(), + // SyncEsppScheduleCount = await templateService.Get().Include(t => t.RobotConfigurations).CountAsync(t => t.RobotConfigurations.Any(c => c.RobotCode == (int)RobotsEnum.ScheduleOrder && c.TaskStatusCode == (int)TaskStatusEnum.Ok)), + // SyncEsppTemplatesCount = await templateService.Get().Include(t => t.RobotConfigurations).CountAsync(t => t.RobotConfigurations.Any(c => c.RobotCode == (int)RobotsEnum.TemplateOrder && c.TaskStatusCode == (int)TaskStatusEnum.Ok)) + // }; - return Ok(new Response(response, true)); - } + // return Ok(new Response(response, true)); + //} - /// - /// Получить статистику созданных шаблонов (расписаний) в БД ПАРР - /// - /// - /// - /// - [HttpGet(ApiRoutes.StatTemplate.GetForPeriod)] - public async Task GetForPeriod([FromQuery] TimeZoneOffsetClient timeZoneQuery, [FromQuery] int startPeriodDays = 3) - { - var endPeriod = calendarService.GetDateWithTimeZoneOffset(DateTimeOffset.UtcNow, timeZoneQuery.TimeZoneOffsetHours); - var startPeriod = endPeriod.AddDays(-startPeriodDays); + ///// + ///// Получить статистику созданных шаблонов (расписаний) в БД ПАРР + ///// + ///// + ///// + ///// + //[HttpGet(ApiRoutes.StatTemplate.GetForPeriod)] + //public async Task GetForPeriod([FromQuery] TimeZoneOffsetClient timeZoneQuery, [FromQuery] int startPeriodDays = 3) + //{ + // var endPeriod = calendarService.GetDateWithTimeZoneOffset(DateTimeOffset.UtcNow, timeZoneQuery.TimeZoneOffsetHours); + // var startPeriod = endPeriod.AddDays(-startPeriodDays); - var query = templateService.Get() - .Where(t => - t.DateCreated.DateTime.AddHours(timeZoneQuery.TimeZoneOffsetHours).Date >= startPeriod.Date - && t.DateCreated.DateTime.AddHours(timeZoneQuery.TimeZoneOffsetHours).Date <= endPeriod.Date - ).GroupBy(t => t.DateCreated.AddHours(timeZoneQuery.TimeZoneOffsetHours).Date) - .Select(t => new - { - Date = t.Key, - CreatedObjs = t.Count() - }); + // var query = templateService.Get() + // .Where(t => + // t.DateCreated.DateTime.AddHours(timeZoneQuery.TimeZoneOffsetHours).Date >= startPeriod.Date + // && t.DateCreated.DateTime.AddHours(timeZoneQuery.TimeZoneOffsetHours).Date <= endPeriod.Date + // ).GroupBy(t => t.DateCreated.AddHours(timeZoneQuery.TimeZoneOffsetHours).Date) + // .Select(t => new + // { + // Date = t.Key, + // CreatedObjs = t.Count() + // }); - var result = await query.ToListAsync(); + // var result = await query.ToListAsync(); - var daysList = calendarService.GetDatesForPeriod(startPeriod, endPeriod); + // var daysList = calendarService.GetDatesForPeriod(startPeriod, endPeriod); - var response = new List(); + // var response = new List(); - daysList.ForEach(date => response.Add(new StatTemplatePeriodResponse - { - Date = date, - CreatedTemplatesCount = result.FirstOrDefault(t => DateOnly.FromDateTime(t.Date) == date)?.CreatedObjs ?? 0 - })); + // daysList.ForEach(date => response.Add(new StatTemplatePeriodResponse + // { + // Date = date, + // CreatedTemplatesCount = result.FirstOrDefault(t => DateOnly.FromDateTime(t.Date) == date)?.CreatedObjs ?? 0 + // })); - response = response.OrderBy(t => t.Date).ToList(); + // response = response.OrderBy(t => t.Date).ToList(); - return Ok(new Response>(response, true)); - } + // return Ok(new Response>(response, true)); + //} } diff --git a/PARR.API/Controllers/V1/Statistics/StatTemplateDistributionController.cs b/PARR.API/Controllers/V1/Statistics/StatTemplateDistributionController.cs index fb5899d5..f439f6e2 100644 --- a/PARR.API/Controllers/V1/Statistics/StatTemplateDistributionController.cs +++ b/PARR.API/Controllers/V1/Statistics/StatTemplateDistributionController.cs @@ -37,20 +37,20 @@ namespace PARR.API.Controllers.V1.Statistics /// /// Статистика распределения шаблонов по JobId (ApplicationInWorkId) /// - /// + /// /// [HttpGet(ApiRoutes.StatTemplateDistribution.Get)] - public async Task Get([FromRoute] Guid applicationInWorkId) + public async Task Get([FromRoute] Guid jobId) { // f87dbe9f-cabf-4108-9c93-12068d4b48a5 var query = templateService.Get() - .Include(t => t.Host) - .Where(t => t.ApplicationInWorkId == applicationInWorkId) - .GroupBy(t => t.Host!.WorkGroupId) + .Include(t => t.Unit) + .Where(t => t.JobId == jobId) + .GroupBy(t => t.Unit!.BaseFields!.WorkGroup) .Select(x => new { - WorkGroupId = x.Key, + WorkGroup = x.Key, CountTemplates = x.Count(), IsActivatedAllCount = x.Count(t => t.IsActiveTemplate && t.IsActiveSchedule), IsDeactivatedAllCount = x.Count(t => !t.IsActiveTemplate || !t.IsActiveSchedule || (!t.IsActiveTemplate && !t.IsActiveSchedule)), @@ -73,13 +73,13 @@ namespace PARR.API.Controllers.V1.Statistics var workGroups = await workGroupService.Get() .Include(t => t.ResponseArea) - .Where(t => statResult.Select(x => x.WorkGroupId).Any(w => w == t.Id)) + .Where(t => statResult.Select(x => x.WorkGroup).Any(w => w == t.Name)) .ToListAsync(); var response = statResult.Select(stat => new StatTemplateDistributorResponse { - WorkGroup = mapper.Map(workGroups.FirstOrDefault(x => x.Id == stat.WorkGroupId)), + WorkGroup = mapper.Map(workGroups.FirstOrDefault(x => x.Name == stat.WorkGroup)),//TODO Migration to job AllCount = stat.CountTemplates, IsActivatedAllCount = stat.IsActivatedAllCount, IsDeactivatedAllCount = stat.IsDeactivatedAllCount, diff --git a/PARR.API/Controllers/V1/Statistics/StatWorkGroupWorkLoadController.cs b/PARR.API/Controllers/V1/Statistics/StatWorkGroupWorkLoadController.cs index f266e847..3a894297 100644 --- a/PARR.API/Controllers/V1/Statistics/StatWorkGroupWorkLoadController.cs +++ b/PARR.API/Controllers/V1/Statistics/StatWorkGroupWorkLoadController.cs @@ -39,7 +39,7 @@ namespace PARR.API.Controllers.V1.Statistics this.logger = logger; } - + /* /// /// Статистика загрузки регламентными работами рабочих групп по ЗО /// @@ -54,7 +54,7 @@ namespace PARR.API.Controllers.V1.Statistics return Ok(new Response>(response, true)); } - + /// /// Статистика загрузки РГ по списку РГ /// @@ -137,6 +137,6 @@ namespace PARR.API.Controllers.V1.Statistics return response; } - + */ } } diff --git a/PARR.API/Controllers/V1/Statistics/StatWorkWorkLoadController.cs b/PARR.API/Controllers/V1/Statistics/StatWorkWorkLoadController.cs index b55e70e2..7342ddac 100644 --- a/PARR.API/Controllers/V1/Statistics/StatWorkWorkLoadController.cs +++ b/PARR.API/Controllers/V1/Statistics/StatWorkWorkLoadController.cs @@ -40,132 +40,132 @@ namespace PARR.API.Controllers.V1.Statistics this.workGroupService = workGroupService; } + + ///// + ///// Статистика загрузки регламентными работами по Видам работ(ApplicationInWorks) + ///// + ///// + ///// + ///// + //[HttpGet(ApiRoutes.StatWorkWorkLoad.Get)] + //public async Task Get([FromRoute] Guid workGroupId, [FromQuery] WorkloadBaseQuery requestQuery) + //{ + // var response = await GetStatisticsAsync(workGroupId, requestQuery); - /// - /// Статистика загрузки регламентными работами по Видам работ(ApplicationInWorks) - /// - /// - /// - /// - [HttpGet(ApiRoutes.StatWorkWorkLoad.Get)] - public async Task Get([FromRoute] Guid workGroupId, [FromQuery] WorkloadBaseQuery requestQuery) - { - var response = await GetStatisticsAsync(workGroupId, requestQuery); - - return Ok(new Response>(response, true)); - } + // return Ok(new Response>(response, true)); + //} - /// - /// Статистика загрузки РР по списку РР - /// - /// - /// - [HttpPost(ApiRoutes.StatWorkWorkLoad.GetByApplicationInWork)] - public async Task GetByApplicationInWork([FromBody] StatWorkWorkLoadRequest requestBody) - { - var response = await GetStatisticsAsync(null, requestBody.Filter, requestBody.JobsRequests); + ///// + ///// Статистика загрузки РР по списку РР + ///// + ///// + ///// + //[HttpPost(ApiRoutes.StatWorkWorkLoad.GetByApplicationInWork)] + //public async Task GetByApplicationInWork([FromBody] StatWorkWorkLoadRequest requestBody) + //{ + // var response = await GetStatisticsAsync(null, requestBody.Filter, requestBody.JobsRequests); - return Ok(new Response>(response, true)); - } + // return Ok(new Response>(response, true)); + //} - private async Task> GetStatisticsAsync(Guid? workGroupId, WorkloadBaseQuery requestQuery, List? jobsRequests = null) - { - //защита от дурака, чтоб не выгрузить всю БД - if (workGroupId == null && (jobsRequests == null || jobsRequests.Count() == 0)) - { - logger.LogWarning($"Пытались выполнить запрос получения статситики с нулевыми параметрами {nameof(workGroupId)}, {nameof(jobsRequests)}. Controller {nameof(StatWorkWorkLoadController)}"); - return new List(); - } + //private async Task> GetStatisticsAsync(Guid? workGroupId, WorkloadBaseQuery requestQuery, List? jobsRequests = null) + //{ + // //защита от дурака, чтоб не выгрузить всю БД + // if (workGroupId == null && (jobsRequests == null || jobsRequests.Count() == 0)) + // { + // logger.LogWarning($"Пытались выполнить запрос получения статситики с нулевыми параметрами {nameof(workGroupId)}, {nameof(jobsRequests)}. Controller {nameof(StatWorkWorkLoadController)}"); + // return new List(); + // } - var daysList = workLoadService.GetDatesForPeriod(requestQuery); + // var daysList = workLoadService.GetDatesForPeriod(requestQuery); - IQueryable query = templateService.Get() - .Include(t => t.Host); + // IQueryable query = templateService.Get() + // .Include(t => t.Host); - query = workLoadService.FilterTemplatesQuery(query, requestQuery); + // query = workLoadService.FilterTemplatesQuery(query, requestQuery); - if (workGroupId.HasValue) - query = query.Where(t => t.Host!.WorkGroupId == workGroupId.Value); + // if (workGroupId.HasValue) + // query = query.Where(t => t.Host!.WorkGroupId == workGroupId.Value); - if (jobsRequests != null && jobsRequests.Count() > 0) - //query = query.Where(t => jobsRequests.Any(x => x.JobId == t.ApplicationInWorkId && x.WorkGroupId == t.Host!.WorkGroupId.Value)); /*&& x.WorkGroupId == t.Host!.WorkGroupId.Value*/ - query = query.Where(t => jobsRequests.Select(t => t.JobId).Any(x => x == t.ApplicationInWorkId) && jobsRequests.Select(t => t.WorkGroupId).Any(x => x == t.Host!.WorkGroupId.Value)); + // if (jobsRequests != null && jobsRequests.Count() > 0) + // //query = query.Where(t => jobsRequests.Any(x => x.JobId == t.ApplicationInWorkId && x.WorkGroupId == t.Host!.WorkGroupId.Value)); /*&& x.WorkGroupId == t.Host!.WorkGroupId.Value*/ + // query = query.Where(t => jobsRequests.Select(t => t.JobId).Any(x => x == t.ApplicationInWorkId) && jobsRequests.Select(t => t.WorkGroupId).Any(x => x == t.Host!.WorkGroupId.Value)); - //var groupedQuery = query.GroupBy(t => new { t.NextRun.DateTime.Date, t.ApplicationInWorkId, t.Host.WorkGroupId }) - var groupedQuery = query.GroupBy(t => new { t.NextRun.AddHours(requestQuery.TimeZoneOffsetHours).DateTime.Date, t.ApplicationInWorkId, t.Host.WorkGroupId }) - .Select(t => new - { - ApplicationInWorkId = t.Key.ApplicationInWorkId, - WorkGroupId = t.Key.WorkGroupId, - Date = t.Key.Date, - TemplateCount = t.Count() - }); + // //var groupedQuery = query.GroupBy(t => new { t.NextRun.DateTime.Date, t.ApplicationInWorkId, t.Host.WorkGroupId }) + // var groupedQuery = query.GroupBy(t => new { t.NextRun.AddHours(requestQuery.TimeZoneOffsetHours).DateTime.Date, t.ApplicationInWorkId, t.Host.WorkGroupId }) + // .Select(t => new + // { + // ApplicationInWorkId = t.Key.ApplicationInWorkId, + // WorkGroupId = t.Key.WorkGroupId, + // Date = t.Key.Date, + // TemplateCount = t.Count() + // }); - var queryResult = await groupedQuery.ToListAsync(); + // var queryResult = await groupedQuery.ToListAsync(); - // получаем только работы по которым есть шаблоны (активированные/деакт) и за любой период - IQueryable appInWorksQuery = templateService.Get() - .Include(t => t.Host) - .Include(t => t.ApplicationsInWork).ThenInclude(t => t.Application).ThenInclude(t => t.ApplicationType); + // // получаем только работы по которым есть шаблоны (активированные/деакт) и за любой период + // IQueryable appInWorksQuery = templateService.Get() + // .Include(t => t.Host) + // .Include(t => t.ApplicationsInWork).ThenInclude(t => t.Application).ThenInclude(t => t.ApplicationType); - IQueryable workGroupsQuery = workGroupService.Get() - .Include(t => t.ResponseArea); + // IQueryable workGroupsQuery = workGroupService.Get() + // .Include(t => t.ResponseArea); - if (workGroupId.HasValue) - { - appInWorksQuery = appInWorksQuery.Where(t => t.Host.WorkGroupId == workGroupId); - workGroupsQuery = workGroupsQuery.Where(t => t.Id == workGroupId.Value); - } + // if (workGroupId.HasValue) + // { + // appInWorksQuery = appInWorksQuery.Where(t => t.Host.WorkGroupId == workGroupId); + // workGroupsQuery = workGroupsQuery.Where(t => t.Id == workGroupId.Value); + // } - if (jobsRequests != null && jobsRequests.Count() > 0) - { - //appInWorksQuery = appInWorksQuery.Where(t => jobsRequests.Any(x => x.JobId == t.ApplicationInWorkId)); - appInWorksQuery = appInWorksQuery.Where(t => jobsRequests.Select(j => j.JobId).Any(x => x == t.ApplicationInWorkId)); - workGroupsQuery = workGroupsQuery.Where(t => jobsRequests.Select(w => w.WorkGroupId).Any(x => x == t.Id)); - } + // if (jobsRequests != null && jobsRequests.Count() > 0) + // { + // //appInWorksQuery = appInWorksQuery.Where(t => jobsRequests.Any(x => x.JobId == t.ApplicationInWorkId)); + // appInWorksQuery = appInWorksQuery.Where(t => jobsRequests.Select(j => j.JobId).Any(x => x == t.ApplicationInWorkId)); + // workGroupsQuery = workGroupsQuery.Where(t => jobsRequests.Select(w => w.WorkGroupId).Any(x => x == t.Id)); + // } - var appInWorks = await appInWorksQuery.Select(t => t.ApplicationsInWork) - .Distinct() - .ToListAsync(); + // var appInWorks = await appInWorksQuery.Select(t => t.ApplicationsInWork) + // .Distinct() + // .ToListAsync(); - var workGroups = await workGroupsQuery.Distinct().ToListAsync(); + // var workGroups = await workGroupsQuery.Distinct().ToListAsync(); - var response = new List(); + // var response = new List(); - appInWorks.ForEach(appInWork => - { - workGroups.ForEach(workGroup => - { - var workLoads = daysList.Select(t => new StatWorkLoadDataResponse - { - Date = t, - TemplateCount = queryResult.FirstOrDefault(x => x.ApplicationInWorkId == appInWork.Id && DateOnly.FromDateTime(x.Date) == t && x.WorkGroupId == workGroup.Id)?.TemplateCount ?? 0 - }).OrderBy(t => t.Date).ToList(); + // appInWorks.ForEach(appInWork => + // { + // workGroups.ForEach(workGroup => + // { + // var workLoads = daysList.Select(t => new StatWorkLoadDataResponse + // { + // Date = t, + // TemplateCount = queryResult.FirstOrDefault(x => x.ApplicationInWorkId == appInWork.Id && DateOnly.FromDateTime(x.Date) == t && x.WorkGroupId == workGroup.Id)?.TemplateCount ?? 0 + // }).OrderBy(t => t.Date).ToList(); - response.Add(new StatWorkWorkLoadResponse - { - Job = mapper.Map(appInWork), - WorkGroup = mapper.Map(workGroup), - WorkLoad = workLoads - }); - }); - }); + // response.Add(new StatWorkWorkLoadResponse + // { + // Job = mapper.Map(appInWork), + // WorkGroup = mapper.Map(workGroup), + // WorkLoad = workLoads + // }); + // }); + // }); - // убираем не нужные значения так как запрос в SQL (query) был с несколькими Any - if (jobsRequests != null && jobsRequests.Count() > 0) - response = response.Where(t => jobsRequests.Any(x => x.WorkGroupId == t.WorkGroup.Id && x.JobId == t.Job.Id)).ToList(); + // // убираем не нужные значения так как запрос в SQL (query) был с несколькими Any + // if (jobsRequests != null && jobsRequests.Count() > 0) + // response = response.Where(t => jobsRequests.Any(x => x.WorkGroupId == t.WorkGroup.Id && x.JobId == t.Job.Id)).ToList(); - response = response.OrderBy(t => t.Job.ShortDescription).ThenBy(t => t.Job.Application?.Name).ThenBy(t => t.WorkGroup.Name).ToList(); + // response = response.OrderBy(t => t.Job.ShortDescription).ThenBy(t => t.Job.Application?.Name).ThenBy(t => t.WorkGroup.Name).ToList(); - return response; - } + // return response; + //} } } diff --git a/PARR.API/Controllers/V1/TemplateController.cs b/PARR.API/Controllers/V1/TemplateController.cs index 5c428a8d..018a9245 100644 --- a/PARR.API/Controllers/V1/TemplateController.cs +++ b/PARR.API/Controllers/V1/TemplateController.cs @@ -71,7 +71,7 @@ namespace PARR.API.Controllers.V1 query = query.Where(t => EF.Functions.Like(t.Name.ToLower(), SqlHelpers.RegexToLike(filter.Mask))); if (filter.AppInWorkId.HasValue) - query = query.Where(t => t.ApplicationInWorkId == filter.AppInWorkId.Value); + query = query.Where(t => t.JobId == filter.AppInWorkId.Value);//TODO Migration to job var templates = await templateService.GetPage(query, paginationFilter).ToListAsync(); diff --git a/PARR.API/Controllers/V1/TestController.cs b/PARR.API/Controllers/V1/TestController.cs index f24a1b83..769039a6 100644 --- a/PARR.API/Controllers/V1/TestController.cs +++ b/PARR.API/Controllers/V1/TestController.cs @@ -23,7 +23,7 @@ namespace PARR.API.Controllers.V1 private readonly IUnitService unitService; private readonly IFieldFilterService fieldFilterService; private readonly IJobService jobService; - private readonly IJobDetailsService jobDetailsService; + private readonly IJobUnitFilterService jobUnitFilterService; public TestController( IClientService clientService, @@ -33,7 +33,7 @@ namespace PARR.API.Controllers.V1 IUnitService unitService, IFieldFilterService fieldFilterService, IJobService jobService, - IJobDetailsService jobDetailsService + IJobUnitFilterService jobUnitFilterService ) { this.clientService = clientService; @@ -43,7 +43,7 @@ namespace PARR.API.Controllers.V1 this.unitService = unitService; this.fieldFilterService = fieldFilterService; this.jobService = jobService; - this.jobDetailsService = jobDetailsService; + this.jobUnitFilterService = jobUnitFilterService; } diff --git a/PARR.API/MappingProfiles/DomainToResponseProfile.cs b/PARR.API/MappingProfiles/DomainToResponseProfile.cs index 1cd050d5..60c5a990 100644 --- a/PARR.API/MappingProfiles/DomainToResponseProfile.cs +++ b/PARR.API/MappingProfiles/DomainToResponseProfile.cs @@ -7,6 +7,7 @@ using PARR.Constants.Shortcodes; using PARR.DAL.DomainModels; using PARR.DAL.Extensions; using PARR.DAL.Models; +using PARR.DAL.Models.Job; using PARR.DAL.Models.Unit; namespace PARR.API.MappingProfiles @@ -19,27 +20,27 @@ namespace PARR.API.MappingProfiles // --- Template --- CreateMap() - .ForMember(d => d.Work, o => o.MapFrom(s => s.ApplicationsInWork!.Work)) - .ForMember(d => d.Host, o => o.MapFrom(s => s.Host)) - .ForMember(d => d.Process, o => o.MapFrom(s => s.ApplicationsInWork!.Work!.Tnk!.Subprocess!.Process)) - .ForMember(d => d.Subprocess, o => o.MapFrom(s => s.ApplicationsInWork!.Work!.Tnk!.Subprocess)) - .ForMember(d => d.Tnk, o => o.MapFrom(s => s.ApplicationsInWork!.Work!.Tnk)) - .ForMember(d => d.ShortDescription, o => o.MapFrom(s => s.ApplicationsInWork!.ShortDescription)) - .ForMember(d => d.FullDescription, o => o.MapFrom(s => s.ApplicationsInWork!.FullDescription)) - .ForMember(d => d.Solution, o => o.MapFrom(s => s.ApplicationsInWork!.Solution)) - .ForMember(d => d.TemplateDuration, o => o.MapFrom(s => s.ApplicationsInWork!.TemplateDuration)) + .ForMember(d => d.Job, o => o.MapFrom(s => s.Job)) + .ForMember(d => d.Unit, o => o.MapFrom(s => s.Unit)) + .ForMember(d => d.Process, o => o.MapFrom(s => s.Job!.Tnk!.Subprocess!.Process)) + .ForMember(d => d.Subprocess, o => o.MapFrom(s => s.Job!.Tnk!.Subprocess)) + .ForMember(d => d.Tnk, o => o.MapFrom(s => s.Job!.Tnk)) + .ForMember(d => d.ShortDescription, o => o.MapFrom(s => s.Job!.Group!.ShortDescription)) + .ForMember(d => d.FullDescription, o => o.MapFrom(s => s.Job!.Group!.FullDescription)) + .ForMember(d => d.Solution, o => o.MapFrom(s => s.Job!.Group!.Solution)) + .ForMember(d => d.TemplateDuration, o => o.MapFrom(s => s.Job!.Group!.TemplateDuration)) .ForMember(d => d.Initiator, o => o.MapFrom()) .ForMember(d => d.ClosingCode, o => o.MapFrom()) .ForMember(d => d.Category, o => o.MapFrom()) .ForMember(d => d.SyncStatus, o => o.MapFrom(s => s.RobotConfigurations.OrderBy(t => t.RobotCode))) .ForMember(d => d.Schedule, o => o.MapFrom()) - .ForMember(d => d.Agent, o => o.MapFrom(s => s.ApplicationsInWork)) + .ForMember(d => d.Agent, o => o.MapFrom(s => s.Job!.Group!)) //.ForMember(d => d.NextRun, o => o.MapFrom(s => s.ApplicationsInWork!.NextRun)) //.ForMember(d => d.LastRun, o => o.MapFrom(s => s.ApplicationsInWork!.LastRun)) .ForMember(d => d.NextRun, o => o.MapFrom(s => s.NextRun)) .ForMember(d => d.LastRun, o => o.MapFrom(s => s.LastRun)) .ForMember(d => d.OrderCount, o => o.MapFrom(s => s.Orders.Count())) - .ForMember(d => d.IsAutoDistributionEnabled, o => o.MapFrom(s => s.ApplicationsInWork!.IsAutoDistributionEnabled)); + .ForMember(d => d.IsAutoDistributionEnabled, o => o.MapFrom(s => s.Job!.Group!.IsAutoDistributionEnabled)); // === Template === @@ -156,36 +157,36 @@ namespace PARR.API.MappingProfiles CreateMap() .ForMember(d => d.IsActive, o => o.MapFrom(s => s.Template!.IsActiveTemplate)) .ForMember(d => d.ClosingCode, o => o.MapFrom()) - .ForMember(d => d.FullDescription, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.FullDescription)) - .ForMember(d => d.ShortDescription, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.ShortDescription.ApplyShortcode(ShortcodeEnum.EK, s.Template!.Host!.Ek))) - .ForMember(d => d.Solution, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.Solution)) + .ForMember(d => d.FullDescription, o => o.MapFrom(s => s.Template!.Job!.Group!.FullDescription)) + .ForMember(d => d.ShortDescription, o => o.MapFrom(s => s.Template!.Job!.Group!.ShortDescription.ApplyShortcode(ShortcodeEnum.EK, s.Template!.Unit!.Name))) + .ForMember(d => d.Solution, o => o.MapFrom(s => s.Template!.Job!.Group!.Solution)) //.ForMember(d => d.ResponseArea, o => o.MapFrom(s => s.Template!.Host!.ResponseArea!.Name)) //ЗО берем у группы а не у хоста - .ForMember(d => d.ResponseArea, o => o.MapFrom(s => s.Template!.Host!.WorkGroup!.ResponseArea!.Name)) - .ForMember(d => d.TemplateDuration, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.TemplateDuration)) + .ForMember(d => d.ResponseArea, o => o.MapFrom(s => s.Template!.Unit.BaseFields.ResponseArea)) + .ForMember(d => d.TemplateDuration, o => o.MapFrom(s => s.Template!.Job!.Group!.TemplateDuration)) .ForMember(d => d.Initiator, o => o.MapFrom()) .ForMember(d => d.Category, o => o.MapFrom()) - .ForMember(d => d.WorkGroup, o => o.MapFrom(s => s.Template!.Host!.WorkGroup!.Name)) - .ForMember(d => d.Ek, o => o.MapFrom(s => s.Template!.Host!.Ek)) + .ForMember(d => d.WorkGroup, o => o.MapFrom(s => s.Template!.Unit.BaseFields.WorkGroup)) + .ForMember(d => d.Ek, o => o.MapFrom(s => s.Template!.Unit.Name)) .ForMember(d => d.Name, o => o.MapFrom(s => s.Template!.Name)) - .ForMember(d => d.ProcessName, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.Work!.Tnk!.Subprocess!.Process!.Name)) - .ForMember(d => d.ProcessEsppId, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.Work!.Tnk!.Subprocess!.Process!.EsppId)) - .ForMember(d => d.SubprocessName, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.Work!.Tnk!.Subprocess!.Name)) - .ForMember(d => d.SubprocessEsppId, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.Work!.Tnk!.Subprocess!.EsppId)) - .ForMember(d => d.TnkName, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.Work!.Tnk!.Name.ApplyShortcode(ShortcodeEnum.EK, s.Template!.Host!.Ek))) - .ForMember(d => d.TnkEsppId, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.Work!.Tnk!.EsppId)) - .ForMember(d => d.WorkName, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.Work!.Name.ApplyShortcode(ShortcodeEnum.EK, s.Template!.Host!.Ek))) - .ForMember(d => d.WorkEsppId, o => o.MapFrom(s => s.Template!.ApplicationsInWork!.Work!.EsppId)) + .ForMember(d => d.ProcessName, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Subprocess!.Process!.Name)) + .ForMember(d => d.ProcessEsppId, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Subprocess!.Process!.EsppId)) + .ForMember(d => d.SubprocessName, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Subprocess!.Name)) + .ForMember(d => d.SubprocessEsppId, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Subprocess!.EsppId)) + .ForMember(d => d.TnkName, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Name.ApplyShortcode(ShortcodeEnum.EK, s.Template!.Unit!.Name))) + .ForMember(d => d.TnkEsppId, o => o.MapFrom(s => s.Template!.Job!.Tnk!.EsppId)) + .ForMember(d => d.WorkName, o => o.MapFrom(s => s.Template!.Job!.Name.ApplyShortcode(ShortcodeEnum.EK, s.Template!.Unit!.Name))) + //.ForMember(d => d.WorkEsppId, o => o.MapFrom(s => s.Template!.Job!.EsppId)) .ForMember(d => d.ScheduleEsppId, o => o.MapFrom(s => s.Template!.ScheduleEsppId)); CreateMap() .ForMember(d => d.EsppId, o => o.MapFrom(s => s.Template!.ScheduleEsppId)) .ForMember(d => d.ScheduleName, o => o.MapFrom(s => s.Template!.Name)) .ForMember(d => d.IsActive, o => o.MapFrom(s => s.Template!.IsActiveSchedule)) - .ForMember(d => d.ResponseArea, o => o.MapFrom(s => s.Template!.Host!.ResponseArea!.Name)) + .ForMember(d => d.ResponseArea, o => o.MapFrom(s => s.Template!.Unit!.BaseFields!.ResponseArea)) .ForMember(d => d.TemplateName, o => o.MapFrom(s => s.Template!.Name)) .ForMember(d => d.TemplateId, o => o.MapFrom(s => s.Template!.Id)) - .ForMember(d => d.WorkGroup, o => o.MapFrom(s => s.Template!.Host!.WorkGroup!.Name)) + .ForMember(d => d.WorkGroup, o => o.MapFrom(s => s.Template!.Unit!.BaseFields!.WorkGroup)) .ForMember(d => d.Exclude, o => o.MapFrom()) .ForMember(d => d.Timezone, o => o.MapFrom()) .ForMember(d => d.RepeatRange, o => o.MapFrom()) @@ -195,9 +196,9 @@ namespace PARR.API.MappingProfiles //.ForMember(d => d.NextStart, o => o.MapFrom(s => EsppScheduleHelpers.GetNextRun(s.Template!.NextRun))) .ForMember(d => d.NextStart, o => o.MapFrom()) .ForMember(d => d.ScheduleType, o => o.MapFrom(s => - s.Template!.ApplicationsInWork!.EsppSchValues!.First()!.EsppSchTypeConfig!.EsppSchTypeSchedule!.Description)) + s.Template!.Job!.Group!.EsppSchValues!.First()!.EsppSchTypeConfig!.EsppSchTypeSchedule!.Description)) .ForMember(d => d.ScheduleTypeCode, o => o.MapFrom(s => - s.Template!.ApplicationsInWork!.EsppSchValues!.First()!.EsppSchTypeConfig!.EsppSchTypeSchedule!.Id)) + s.Template!.Job!.Group!.EsppSchValues!.First()!.EsppSchTypeConfig!.EsppSchTypeSchedule!.Id)) .ForMember(d => d.Schedule, o => o.MapFrom()); // === RobotConfiguration === #endregion @@ -291,13 +292,20 @@ namespace PARR.API.MappingProfiles CreateMap() .ForMember(d => d.Work, o => o.MapFrom(s => s.Work)) - .ForMember(d => d.TemplatesCount, o => o.MapFrom(s => s.Templates.Count())) + //.ForMember(d => d.TemplatesCount, o => o.MapFrom(s => s.Templates.Count())) .ForMember(d => d.Schedule, o => o.MapFrom()) - .ForMember(d => d.WorkGroups, o => o.MapFrom(s => s.WorkGroups.OrderBy(t => t.WorkGroup.Name).Select(t => t.WorkGroup))) + .ForMember(d => d.WorkGroups, o => o.MapFrom(s => s.WorkGroups.OrderBy(t => t.WorkGroup!.Name).Select(t => t.WorkGroup))) .ForMember(d => d.AutoControl, o => o.MapFrom(s => s.JobAutoControl)); #endregion + #region Job + CreateMap() + .Include(); + + CreateMap(); + #endregion + #region JobAutoControl CreateMap() @@ -306,7 +314,7 @@ namespace PARR.API.MappingProfiles CreateMap() .ForMember(d => d.EkMasks, o => o.MapFrom(s => s.JobEkMasks.OrderBy(t => t.Name))) .ForMember(d => d.EnabledEkStatuses, o => o.MapFrom(s => s.JobAutoControlInEkStatuses.Select(t => t.EkStatus).OrderBy(t => t.Name))) - .ForMember(d => d.WorkGroups, o => o.MapFrom(s => s.ApplicationsInWork.WorkGroups.Select(t => t.WorkGroup).OrderBy(t => t.Name))); + .ForMember(d => d.WorkGroups, o => o.MapFrom(s => s.ApplicationsInWork!.WorkGroups.Select(t => t.WorkGroup).OrderBy(t => t.Name))); #endregion diff --git a/PARR.API/MappingProfiles/Resolvers/RobotTaskScheduleSchResolver.cs b/PARR.API/MappingProfiles/Resolvers/RobotTaskScheduleSchResolver.cs index f54d7694..938c558e 100644 --- a/PARR.API/MappingProfiles/Resolvers/RobotTaskScheduleSchResolver.cs +++ b/PARR.API/MappingProfiles/Resolvers/RobotTaskScheduleSchResolver.cs @@ -26,7 +26,7 @@ namespace PARR.API.MappingProfiles.Resolvers public List? Resolve(RobotConfiguration source, RobotTaskScheduleResponse destination, List? destMember, ResolutionContext context) { - var appInWorksId = source.Template!.ApplicationInWorkId; + var appInWorksId = source.Template!.JobId; var schedule = esppConfigService.GetEsppScheduleDto(appInWorksId); @@ -45,7 +45,7 @@ namespace PARR.API.MappingProfiles.Resolvers }).OrderBy(t => t.Order).ToList(); //Если задача относится к распределенной модели исполнения за период месяц устанавливаем день равный NextRun - if (source.Template!.ApplicationsInWork!.IsAutoDistributionEnabled && schedule.TypeSchedule.Id == (int)EsppSchTypeScheduleEnum.Monthly) + if (source.Template!.Job!.Group!.IsAutoDistributionEnabled && schedule.TypeSchedule.Id == (int)EsppSchTypeScheduleEnum.Monthly) { var nextRunForRobot = nextRunModifierService.GetNextRunByAccountRobotTimeZone(source.Template.NextRun); diff --git a/PARR.API/MappingProfiles/Resolvers/TemplateScheduleResolver.cs b/PARR.API/MappingProfiles/Resolvers/TemplateScheduleResolver.cs index 4480014e..a05b6be2 100644 --- a/PARR.API/MappingProfiles/Resolvers/TemplateScheduleResolver.cs +++ b/PARR.API/MappingProfiles/Resolvers/TemplateScheduleResolver.cs @@ -28,11 +28,11 @@ namespace PARR.API.MappingProfiles.Resolvers public EsppScheduleResponse? Resolve(Template source, TemplateResponse destination, EsppScheduleResponse? destMember, ResolutionContext context) { - var schedule = esppConfigService.GetEsppScheduleDto(source.ApplicationInWorkId); + var schedule = esppConfigService.GetEsppScheduleDto(source.Job!.GroupId); if (schedule == null) { - logger.LogError($"TemplateScheduleResolver: Не смог замапить расписание для робота, так как оно null. appInWorksId: {source.ApplicationInWorkId}"); + logger.LogError($"TemplateScheduleResolver: Не смог замапить расписание для робота, так как оно null. appInWorksId: {source.Job!.GroupId}"); return null; } diff --git a/PARR.DAL/Context/DataContext.cs b/PARR.DAL/Context/DataContext.cs index 7e8638bb..1d815306 100644 --- a/PARR.DAL/Context/DataContext.cs +++ b/PARR.DAL/Context/DataContext.cs @@ -91,7 +91,11 @@ namespace PARR.DAL.Context public DbSet Jobs { get; set; } - public DbSet JobDetails { get; set; } + public DbSet JobUnitFilters { get; set; } + + public DbSet JobGroups { get; set; } + + #endregion diff --git a/PARR.DAL/Migrations/20250625035851_tblTemplatesMigrationFormApplicationInWork.Designer.cs b/PARR.DAL/Migrations/20250625035851_tblTemplatesMigrationFormApplicationInWork.Designer.cs new file mode 100644 index 00000000..d0a53b2b --- /dev/null +++ b/PARR.DAL/Migrations/20250625035851_tblTemplatesMigrationFormApplicationInWork.Designer.cs @@ -0,0 +1,3773 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using PARR.DAL.Context; + +#nullable disable + +namespace PARR.DAL.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20250625035851_tblTemplatesMigrationFormApplicationInWork")] + partial class tblTemplatesMigrationFormApplicationInWork + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("HistoryLevelId") + .HasColumnType("integer"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("TemplateId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("HistoryLevelId"); + + b.HasIndex("OrderId"); + + b.HasIndex("TemplateId"); + + b.ToTable("AgentHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistoryLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AgentHistoryLevels"); + + b.HasData( + new + { + Id = 1, + Description = "Агент начал выполнять задание", + Name = "Start" + }, + new + { + Id = 5, + Description = "Агент завершил выполнение задания", + Name = "End" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.AppInWorkInWorkGroup", b => + { + b.Property("ApplicationsInWorkId") + .HasColumnType("uuid"); + + b.Property("WorkGroupId") + .HasColumnType("uuid"); + + b.HasKey("ApplicationsInWorkId", "WorkGroupId"); + + b.HasIndex("WorkGroupId"); + + b.ToTable("AppInWorkInWorkGroups"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Application", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationTypeId"); + + b.HasIndex("Name", "ApplicationTypeId") + .IsUnique(); + + b.ToTable("Applications"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId"); + + b.HasIndex("HostId"); + + b.ToTable("ApplicationsInHost"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("ApplicationTypes"); + + b.HasData( + new + { + Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Сервер приложений", + Name = "APP" + }, + new + { + Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "ОС", + Name = "OS" + }, + new + { + Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "СУБД", + Name = "DB" + }, + new + { + Id = new Guid("749f4c34-b883-4f28-90dd-c161dd3c4270"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "ЦК БС", + Name = "CKBS" + }, + new + { + Id = new Guid("0bd96f9b-d36b-4dfb-bd8a-9c356bc6912b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "ИБ", + Name = "IB" + }, + new + { + Id = new Guid("4466148b-510d-4423-a58f-ce878152ff01"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Инфраструктура", + Name = "SI" + }, + new + { + Id = new Guid("725a96db-358e-489b-a7c9-a84b06ec15df"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Мониторинг", + Name = "SM" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AgentName") + .HasColumnType("text"); + + b.Property("AgentScript") + .HasColumnType("text"); + + b.Property("AgentTimeOutSec") + .HasColumnType("integer"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("FullDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsAgent") + .HasColumnType("boolean"); + + b.Property("IsAutoDistributionEnabled") + .HasColumnType("boolean"); + + b.Property("ReferenceDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("Solution") + .IsRequired() + .HasColumnType("text"); + + b.Property("TemplateDuration") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId"); + + b.HasIndex("WorkId", "ApplicationId") + .IsUnique(); + + b.ToTable("ApplicationsInWorks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.DistributionPeriod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Duration") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Type"); + + b.ToTable("DistributionPeriods"); + + b.HasData( + new + { + Id = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + Duration = "1", + Name = "Ежемесячно", + Type = "Month" + }, + new + { + Id = new Guid("0ad2dfdb-3833-46d9-979a-c408b7eadc6c"), + Duration = "90", + Name = "Каждые 90 дней", + Type = "Day" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.DistributionPeriodType", b => + { + b.Property("Type") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Type"); + + b.ToTable("DistributionPeriodTypes"); + + b.HasData( + new + { + Type = "Day", + Description = "День" + }, + new + { + Type = "Month", + Description = "Месяц" + }, + new + { + Type = "Year", + Description = "Год" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EkStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("EkStatuses"); + + b.HasData( + new + { + Code = 1, + Name = "1-Новый" + }, + new + { + Code = 2, + Name = "2-Подготовка к эксплуатации" + }, + new + { + Code = 3, + Name = "3-В эксплуатации" + }, + new + { + Code = 4, + Name = "4-В ремонте" + }, + new + { + Code = 5, + Name = "5-В резерве" + }, + new + { + Code = 6, + Name = "6-Выведен из эксплуатации" + }, + new + { + Code = 7, + Name = "7-Тестовый" + }, + new + { + Code = 9, + Name = "9-В разработке" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EsppSchTypes"); + + b.HasData( + new + { + Id = 1, + Description = "Через интервал", + Name = "Interval" + }, + new + { + Id = 2, + Description = "День недели: пнд, вт...", + Name = "DayOfWeek" + }, + new + { + Id = 3, + Description = "Число месяца: 1,2,3,4", + Name = "DayOfMonth" + }, + new + { + Id = 4, + Description = "Каждый: первый, второй, третий, четвертый, последний", + Name = "Order" + }, + new + { + Id = 5, + Description = "Месяц: январь, февраль...", + Name = "Month" + }, + new + { + Id = 6, + Description = "Месяц (родительный падеж): января, февраля...", + Name = "MonthGenitive" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeConfig", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("TypeScheduleId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.HasIndex("TypeScheduleId", "TypeId") + .IsUnique(); + + b.ToTable("EsppSchTypeConfigs"); + + b.HasData( + new + { + Id = new Guid("d2693562-b3eb-41e9-97db-c6b5d2ef1bea"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 1, + TypeScheduleId = 1 + }, + new + { + Id = new Guid("06b2e7aa-6927-4fbf-99fb-67c92a4fce8a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 2, + TypeScheduleId = 2 + }, + new + { + Id = new Guid("78079071-ff80-417e-9bb0-d928cec853e7"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 3, + TypeScheduleId = 3 + }, + new + { + Id = new Guid("accb1d46-e1c1-4396-9182-4c0766155921"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 4, + TypeScheduleId = 4 + }, + new + { + Id = new Guid("162ffe73-2428-4abe-8f83-235c2593664c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 1, + TypeId = 2, + TypeScheduleId = 4 + }, + new + { + Id = new Guid("8470d1ef-165d-42fc-ab05-8203e4d263cf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 5, + TypeScheduleId = 5 + }, + new + { + Id = new Guid("006900b5-f65c-413e-bc67-09e6dae60b7c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 1, + TypeId = 3, + TypeScheduleId = 5 + }, + new + { + Id = new Guid("85635bc8-f17a-46b8-9c15-8615761be3d9"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 4, + TypeScheduleId = 6 + }, + new + { + Id = new Guid("439460c2-deca-4b54-80e7-2f20806696ec"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 1, + TypeId = 2, + TypeScheduleId = 6 + }, + new + { + Id = new Guid("5c63ad8c-e9b4-43fd-9d24-5c2eed80dadd"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 2, + TypeId = 6, + TypeScheduleId = 6 + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeSchedule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EsppSchTypeSchedules"); + + b.HasData( + new + { + Id = 1, + Description = "Регулярно", + Name = "Regularly" + }, + new + { + Id = 2, + Description = "Еженедельно", + Name = "Weekly" + }, + new + { + Id = 3, + Description = "Ежемесячно", + Name = "Monthly" + }, + new + { + Id = 4, + Description = "Ежемесячно-2", + Name = "Monthly2" + }, + new + { + Id = 5, + Description = "Ежегодно", + Name = "Annually" + }, + new + { + Id = 6, + Description = "Ежегодно-2", + Name = "Annually2" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DistributionPeriodId") + .HasColumnType("uuid"); + + b.Property("EsppExportValue") + .IsRequired() + .HasColumnType("text"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("DistributionPeriodId"); + + b.HasIndex("TypeId"); + + b.ToTable("EsppSchTypeValues"); + + b.HasData( + new + { + Id = new Guid("6e3b5dd2-b2f7-40bc-bace-15bfa6bbd4ff"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "01:00:00", + Order = 0, + TypeId = 1, + Value = "Каждый час" + }, + new + { + Id = new Guid("4df04834-f14f-43d9-8984-334f080f4107"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "02:00:00", + Order = 1, + TypeId = 1, + Value = "Каждые 2 часа" + }, + new + { + Id = new Guid("dab6e3f9-2385-4966-b77c-133ad233c592"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "03:00:00", + Order = 2, + TypeId = 1, + Value = "Каждые 3 часа" + }, + new + { + Id = new Guid("035f485d-8451-47df-bfaa-ba4dd36cf146"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "04:00:00", + Order = 3, + TypeId = 1, + Value = "Каждые 4 часа" + }, + new + { + Id = new Guid("d627daa7-3eed-4571-acae-ffbb3c5bedb9"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "06:00:00", + Order = 4, + TypeId = 1, + Value = "Каждые 6 часов" + }, + new + { + Id = new Guid("ae0a0015-0f1e-4496-b71e-6244f7e321e7"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "12:00:00", + Order = 5, + TypeId = 1, + Value = "Каждые 12 часов" + }, + new + { + Id = new Guid("8df097aa-9860-4a62-9675-a8eecd3f2ce7"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1 00:00:00", + Order = 6, + TypeId = 1, + Value = "Ежедневно" + }, + new + { + Id = new Guid("dee32e60-c1a1-4206-98bc-aa03deabfdf6"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3 00:00:00", + Order = 7, + TypeId = 1, + Value = "Каждые 72 часа" + }, + new + { + Id = new Guid("e0465fbf-e3a5-4486-9f53-5bb85c6feeca"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4 00:00:00", + Order = 8, + TypeId = 1, + Value = "Каждые 96 часов" + }, + new + { + Id = new Guid("4e3f73d1-a0f3-4dd1-bca9-68ada0dd5ce2"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "14 00:00:00", + Order = 9, + TypeId = 1, + Value = "Каждые 2 недели" + }, + new + { + Id = new Guid("55833417-6a24-42f6-bcc2-5d032f883202"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "60 00:00:00", + Order = 10, + TypeId = 1, + Value = "Каждые 60 дней" + }, + new + { + Id = new Guid("7fefa052-29db-4ce5-9c57-2fd9ff855f21"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "80 00:00:00", + Order = 11, + TypeId = 1, + Value = "Каждые 80 дней" + }, + new + { + Id = new Guid("b0ca99f9-5ee0-45b3-bb80-948f82b1fcb1"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("0ad2dfdb-3833-46d9-979a-c408b7eadc6c"), + EsppExportValue = "90 00:00:00", + Order = 12, + TypeId = 1, + Value = "Каждые 90 дней" + }, + new + { + Id = new Guid("086f7a37-9848-423a-a3cc-36dbb5ad43e3"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "182 00:00:00", + Order = 13, + TypeId = 1, + Value = "Каждые полгода" + }, + new + { + Id = new Guid("f2da9e02-d619-4517-a598-374880a8c8e8"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "540 00:00:00", + Order = 14, + TypeId = 1, + Value = "Каждые 1,5 года" + }, + new + { + Id = new Guid("f38d7d30-8923-4ea0-aa7c-5b251e19ab61"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1095 00:00:00", + Order = 15, + TypeId = 1, + Value = "Каждые 3 года" + }, + new + { + Id = new Guid("b7303461-9a30-43fa-8e55-305aa13f186f"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 2, + Value = "Понедельник" + }, + new + { + Id = new Guid("e951135e-71f2-4262-9342-df4d5315ab6c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 2, + Value = "Вторник" + }, + new + { + Id = new Guid("c34d5375-70e7-4632-b3af-30e279a0621a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 2, + Value = "Среда" + }, + new + { + Id = new Guid("ec9540df-c2de-4bda-a063-34d02d4b6e03"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 2, + Value = "Четверг" + }, + new + { + Id = new Guid("2ed85534-4684-4eb2-9ccb-e264d212c945"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 2, + Value = "Пятница" + }, + new + { + Id = new Guid("a6804315-96ef-484e-82ee-c5795694468b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "6", + Order = 5, + TypeId = 2, + Value = "Суббота" + }, + new + { + Id = new Guid("eb71e699-937f-4894-9688-f7a7f95e5e58"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "7", + Order = 6, + TypeId = 2, + Value = "Воскресенье" + }, + new + { + Id = new Guid("e86adbfb-3345-4e0c-aa3b-b4418f9cfe88"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "1", + Order = 0, + TypeId = 3, + Value = "1" + }, + new + { + Id = new Guid("5b4d7ca6-31e7-475b-b7c8-13c6680c3dc3"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "2", + Order = 1, + TypeId = 3, + Value = "2" + }, + new + { + Id = new Guid("0da03db0-9404-425d-bea1-5da0c9b60b59"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "3", + Order = 2, + TypeId = 3, + Value = "3" + }, + new + { + Id = new Guid("199474c8-0a77-47e5-aab8-ba33c216cc9e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "4", + Order = 3, + TypeId = 3, + Value = "4" + }, + new + { + Id = new Guid("e6619da1-f7e8-45b9-bbd3-9c17bec2ccd3"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "5", + Order = 4, + TypeId = 3, + Value = "5" + }, + new + { + Id = new Guid("a8708763-c838-49a5-95fe-bf4f73518d71"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "6", + Order = 5, + TypeId = 3, + Value = "6" + }, + new + { + Id = new Guid("7ec056aa-820c-4900-96cb-4564d2ea6398"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "7", + Order = 6, + TypeId = 3, + Value = "7" + }, + new + { + Id = new Guid("554d7d0c-91b1-4b81-b94d-1ee864192962"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "8", + Order = 7, + TypeId = 3, + Value = "8" + }, + new + { + Id = new Guid("8b7847a4-23de-4199-8aad-3b5c0323b5a2"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "9", + Order = 8, + TypeId = 3, + Value = "9" + }, + new + { + Id = new Guid("fb7f41ca-950b-4dc1-a0a6-bd9a221ab2ad"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "10", + Order = 9, + TypeId = 3, + Value = "10" + }, + new + { + Id = new Guid("a28b530f-ea38-4a2c-a16b-0b7fa3770d3c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "11", + Order = 10, + TypeId = 3, + Value = "11" + }, + new + { + Id = new Guid("7a004a11-32e1-40ae-ab35-0d3dc3a69785"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "12", + Order = 11, + TypeId = 3, + Value = "12" + }, + new + { + Id = new Guid("e0f2f4d1-4a5e-4997-8336-83c3c35f38df"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "13", + Order = 12, + TypeId = 3, + Value = "13" + }, + new + { + Id = new Guid("9c5aaf48-88ec-4c67-b936-2be45550f8bf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "14", + Order = 13, + TypeId = 3, + Value = "14" + }, + new + { + Id = new Guid("8dbd680c-ce49-4d2e-8a1a-05619685e240"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "15", + Order = 14, + TypeId = 3, + Value = "15" + }, + new + { + Id = new Guid("2f476f70-b1ef-419d-aad5-3911f1e3231f"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "16", + Order = 15, + TypeId = 3, + Value = "16" + }, + new + { + Id = new Guid("2c635ce2-fc18-47be-b3e9-98c211abf312"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "17", + Order = 16, + TypeId = 3, + Value = "17" + }, + new + { + Id = new Guid("f9d5b03b-624a-4f9f-8da3-1490ea5d2914"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "18", + Order = 17, + TypeId = 3, + Value = "18" + }, + new + { + Id = new Guid("4f4b249c-db60-4582-86ed-75cfee4edd0c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "19", + Order = 18, + TypeId = 3, + Value = "19" + }, + new + { + Id = new Guid("220a1464-4d39-416c-b4b2-3093eb007298"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "20", + Order = 19, + TypeId = 3, + Value = "20" + }, + new + { + Id = new Guid("c887ca60-b05d-4d3c-ad1f-223c879b1a6d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "21", + Order = 20, + TypeId = 3, + Value = "21" + }, + new + { + Id = new Guid("2905765d-63fb-41fe-a111-ee2f1d03d62e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "22", + Order = 21, + TypeId = 3, + Value = "22" + }, + new + { + Id = new Guid("dbbe704a-8d6d-40e7-bd30-6974035b1fab"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "23", + Order = 22, + TypeId = 3, + Value = "23" + }, + new + { + Id = new Guid("cf7b9645-52ed-43a2-8267-267e0aed19b1"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "24", + Order = 23, + TypeId = 3, + Value = "24" + }, + new + { + Id = new Guid("454788d6-d0ad-4c07-878c-da3fd3cd05e1"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "25", + Order = 24, + TypeId = 3, + Value = "25" + }, + new + { + Id = new Guid("40d70d73-8582-4be6-a9e6-503b96ae3d49"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "26", + Order = 25, + TypeId = 3, + Value = "26" + }, + new + { + Id = new Guid("8f6610dc-ef46-4842-a57e-18d7aaa75931"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "27", + Order = 26, + TypeId = 3, + Value = "27" + }, + new + { + Id = new Guid("03858472-d4ce-47fd-9497-8051728766e4"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "28", + Order = 27, + TypeId = 3, + Value = "28" + }, + new + { + Id = new Guid("b1018e07-e90e-42ee-b399-19f3d0c14dd6"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "29", + Order = 28, + TypeId = 3, + Value = "29" + }, + new + { + Id = new Guid("a1669207-aa31-40fe-98d0-d941008d1655"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "30", + Order = 29, + TypeId = 3, + Value = "30" + }, + new + { + Id = new Guid("0936aa99-73e0-43de-b6df-334c1228a226"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "31", + Order = 30, + TypeId = 3, + Value = "31" + }, + new + { + Id = new Guid("626ca076-f09e-4a7a-8610-b7de6337b24a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 4, + Value = "Первый" + }, + new + { + Id = new Guid("032fbd02-67d0-4b8c-bed0-42629ab7113b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 4, + Value = "Второй" + }, + new + { + Id = new Guid("fa8a8f60-e41e-495e-ac86-35174d9976bf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 4, + Value = "Третий" + }, + new + { + Id = new Guid("d2f90168-2b49-42f2-820b-79db2c522adf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 4, + Value = "Четвертый" + }, + new + { + Id = new Guid("12bb8db2-cf7f-4113-baff-6883770f1ba5"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 4, + Value = "Последний" + }, + new + { + Id = new Guid("18260e91-3fbe-4401-9edc-78dbc419370e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 5, + Value = "Январь" + }, + new + { + Id = new Guid("361526aa-3e1c-452e-bb44-0ade8521830d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 5, + Value = "Февраль" + }, + new + { + Id = new Guid("fad4bdb0-6c51-4810-a30b-6d031a0d4c46"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 5, + Value = "Март" + }, + new + { + Id = new Guid("06ab835d-3d3e-4057-8422-a553b6b40995"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 5, + Value = "Апрель" + }, + new + { + Id = new Guid("83f56b5d-b16b-4aa5-89d7-a253fee4e4ad"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 5, + Value = "Май" + }, + new + { + Id = new Guid("e679ec84-a9ee-4bed-a051-2b14edddcb18"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "6", + Order = 5, + TypeId = 5, + Value = "Июнь" + }, + new + { + Id = new Guid("d439808a-6a10-409b-8809-a755b7cca60b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "7", + Order = 6, + TypeId = 5, + Value = "Июль" + }, + new + { + Id = new Guid("6e9972c4-6bf7-4fe4-b4ea-bbb333fb69c8"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "8", + Order = 7, + TypeId = 5, + Value = "Август" + }, + new + { + Id = new Guid("0883aac2-9d5b-4098-b672-c684d2a3a0c9"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "9", + Order = 8, + TypeId = 5, + Value = "Сентябрь" + }, + new + { + Id = new Guid("5e6592bc-acb2-45a4-979b-fdecf8457453"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "10", + Order = 9, + TypeId = 5, + Value = "Октябрь" + }, + new + { + Id = new Guid("edd7cb49-d6a0-4969-b2d6-1967da69b336"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "11", + Order = 10, + TypeId = 5, + Value = "Ноябрь" + }, + new + { + Id = new Guid("dd695fb2-4ad0-4cda-a4df-e15059c56b24"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "12", + Order = 11, + TypeId = 5, + Value = "Декабрь" + }, + new + { + Id = new Guid("2f473624-4eb3-49b4-a4b9-cc7fc08a50f5"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 6, + Value = "Января" + }, + new + { + Id = new Guid("f0003490-a249-44bd-814f-4566999915d8"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 6, + Value = "Февраля" + }, + new + { + Id = new Guid("f4c3fe38-aeaa-42f7-a9ba-190ea2dfe339"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 6, + Value = "Марта" + }, + new + { + Id = new Guid("06a8bd2f-68e1-42f5-961c-ac3b98a2181e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 6, + Value = "Апреля" + }, + new + { + Id = new Guid("963b9c41-d607-444a-9fe0-fe429590e326"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 6, + Value = "Мая" + }, + new + { + Id = new Guid("ec8554c8-dee4-49a1-b1b7-474ad8ec1473"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "6", + Order = 5, + TypeId = 6, + Value = "Июня" + }, + new + { + Id = new Guid("e15c7c63-e29f-41a3-9c82-f70eb6c24fde"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "7", + Order = 6, + TypeId = 6, + Value = "Июля" + }, + new + { + Id = new Guid("0b1f3cea-301a-4d74-9ce1-2cd93b41897d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "8", + Order = 7, + TypeId = 6, + Value = "Августа" + }, + new + { + Id = new Guid("e2fa3769-f66f-4753-a161-35adad7717a5"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "9", + Order = 8, + TypeId = 6, + Value = "Сентября" + }, + new + { + Id = new Guid("c1de4aca-9f49-48ae-9279-cf9ec4092112"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "10", + Order = 9, + TypeId = 6, + Value = "Октября" + }, + new + { + Id = new Guid("a74b9ebd-bcd8-4537-b371-194de2fe0a4d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "11", + Order = 10, + TypeId = 6, + Value = "Ноября" + }, + new + { + Id = new Guid("852a5ebd-4545-494b-bc69-c27409a41adc"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "12", + Order = 11, + TypeId = 6, + Value = "Декабря" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchValue", b => + { + b.Property("JobGroupId") + .HasColumnType("uuid"); + + b.Property("TypeValueId") + .HasColumnType("uuid"); + + b.Property("TypeConfigId") + .HasColumnType("uuid"); + + b.HasKey("JobGroupId", "TypeValueId", "TypeConfigId"); + + b.HasIndex("TypeConfigId"); + + b.HasIndex("TypeValueId"); + + b.ToTable("EsppSchValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Host", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Ek") + .IsRequired() + .HasColumnType("text"); + + b.Property("EkStatusCode") + .HasColumnType("integer"); + + b.Property("IP") + .HasColumnType("text"); + + b.Property("LastLogon") + .HasColumnType("timestamp with time zone"); + + b.Property("ResponseAreaCode") + .HasColumnType("integer"); + + b.Property("WorkGroupId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("Ek") + .IsUnique(); + + b.HasIndex("EkStatusCode"); + + b.HasIndex("IP"); + + b.HasIndex("ResponseAreaCode"); + + b.HasIndex("WorkGroupId"); + + b.ToTable("Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Job.FieldFilter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("FieldId") + .HasColumnType("uuid"); + + b.Property("UnitFilterId") + .HasColumnType("uuid"); + + b.Property("ValueMask") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("FieldId"); + + b.HasIndex("UnitFilterId"); + + b.ToTable("FieldFilters", "job", t => + { + t.HasComment("Таблица описания критериев выборки аттрибутов ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Job.Job", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("GroupId") + .HasColumnType("uuid"); + + b.Property("MaxValueRelationships") + .HasColumnType("integer"); + + b.Property("MinValueRelationships") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("TemplateNameMask") + .HasColumnType("text"); + + b.Property("TnkId") + .HasColumnType("uuid"); + + b.Property("WorkName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.HasIndex("TnkId"); + + b.ToTable("Jobs", "job", t => + { + t.HasComment("Таблица видов работ"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Job.JobGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AgentName") + .HasColumnType("text"); + + b.Property("AgentScript") + .HasColumnType("text"); + + b.Property("AgentTimeOutSec") + .HasColumnType("integer"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("FullDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("GroupName") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsAgent") + .HasColumnType("boolean"); + + b.Property("IsAutoDistributionEnabled") + .HasColumnType("boolean"); + + b.Property("IsUmbrella") + .HasColumnType("boolean"); + + b.Property("ReferenceDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("Solution") + .IsRequired() + .HasColumnType("text"); + + b.Property("TemplateDuration") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Groups", "job", t => + { + t.HasComment("Таблица описания групп работ, для реализации зонтиков"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Job.JobUnitFilter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("UnitFilter") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("JobId"); + + b.ToTable("UnitFilters", "job", t => + { + t.HasComment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Activate") + .HasColumnType("boolean"); + + b.Property("ApplicationInWorkId") + .HasColumnType("uuid"); + + b.Property("CreateNew") + .HasColumnType("boolean"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Deactivate") + .HasColumnType("boolean"); + + b.Property("OffScheduleIsActive") + .HasColumnType("boolean"); + + b.Property("OffTemplateIsActive") + .HasColumnType("boolean"); + + b.Property("OnScheduleIsActive") + .HasColumnType("boolean"); + + b.Property("OnTemplateIsActive") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationInWorkId") + .IsUnique(); + + b.ToTable("JobAutoControls"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobAutoControlInEkStatus", b => + { + b.Property("JobAutoControlId") + .HasColumnType("uuid"); + + b.Property("EkStatusCode") + .HasColumnType("integer"); + + b.HasKey("JobAutoControlId", "EkStatusCode"); + + b.HasIndex("EkStatusCode"); + + b.ToTable("JobAutoControlInEkStatus"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobEkMask", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("JobAutoControlId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("JobAutoControlId", "Name") + .IsUnique(); + + b.ToTable("JobEkMasks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpirationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("GenerateDate") + .HasColumnType("timestamp with time zone"); + + b.Property("NextStatusCode") + .HasColumnType("integer"); + + b.Property("Number") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("text"); + + b.Property("StatusCode") + .HasColumnType("integer"); + + b.Property("TemplateId") + .HasColumnType("uuid"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("NextStatusCode"); + + b.HasIndex("Number") + .IsUnique(); + + b.HasIndex("StatusCode"); + + b.HasIndex("TemplateId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("PARR.DAL.Models.OrderStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("OrderStatuses"); + + b.HasData( + new + { + Code = 1, + Description = "1-Направлен в группу", + Name = "New" + }, + new + { + Code = 2, + Description = "2-В работе", + Name = "InWork" + }, + new + { + Code = 3, + Description = "3-Приостановлен", + Name = "Stop" + }, + new + { + Code = 4, + Description = "4-Выполнен", + Name = "Complete" + }, + new + { + Code = 5, + Description = "5-Закрыт", + Name = "Closed" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.ParrComponent", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("ParrComponents"); + + b.HasData( + new + { + Id = 0, + Description = "API", + Name = "Api" + }, + new + { + Id = 1, + Description = "Загрузчик из АИХИТ", + Name = "AihitLoader" + }, + new + { + Id = 2, + Description = "Синхронизатор АИХИТ", + Name = "AihitSyncer" + }, + new + { + Id = 3, + Description = "Загрузчик нарядов из ЕСПП", + Name = "EsppOrderLoader" + }, + new + { + Id = 4, + Description = "Управление нарядами ЕСПП", + Name = "EsppOrderManager" + }, + new + { + Id = 5, + Description = "Синхронизатор расписаний", + Name = "EsppScheduleSync" + }, + new + { + Id = 6, + Description = "Синхронизатор шаблонов", + Name = "EsppTemplateSync" + }, + new + { + Id = 7, + Description = "Генератор шаблонов", + Name = "GeneratorTemplates" + }, + new + { + Id = 8, + Description = "Авто-контроль РР", + Name = "JobAutoControl" + }, + new + { + Id = 9, + Description = "Связывание нарядов ЕСПП с ПАРР (шаблонами, агентами)", + Name = "Master" + }, + new + { + Id = 10, + Description = "Рассчет даты следующего срабатывания", + Name = "NextRun" + }, + new + { + Id = 11, + Description = "Активатор шаблонов / расписаний", + Name = "TemplateActivator" + }, + new + { + Id = 12, + Description = "Автораспределение РР", + Name = "TemplateDistributor" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Process", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("EsppId") + .IsUnique(); + + b.ToTable("Processes"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("ResponseAreas"); + + b.HasData( + new + { + Code = 96, + Name = "96-ДВС" + }, + new + { + Code = 94, + Name = "94-ЗАБ" + }, + new + { + Code = 92, + Name = "92-ВСИБ" + }, + new + { + Code = 88, + Name = "88-КРАСН" + }, + new + { + Code = 83, + Name = "83-ЗСИБ" + }, + new + { + Code = 80, + Name = "80-ЮУР" + }, + new + { + Code = 76, + Name = "76-СВРД" + }, + new + { + Code = 63, + Name = "63-КБШ" + }, + new + { + Code = 61, + Name = "61-ПРИВ" + }, + new + { + Code = 58, + Name = "58-ЮВСТ" + }, + new + { + Code = 51, + Name = "51-СКВ" + }, + new + { + Code = 28, + Name = "28-СЕВ" + }, + new + { + Code = 24, + Name = "24-ГОР" + }, + new + { + Code = 17, + Name = "17-МСК" + }, + new + { + Code = 10, + Name = "10-КЛГ" + }, + new + { + Code = 1, + Name = "01-ОКТ" + }, + new + { + Code = 99, + Name = "00-ГВЦ" + }, + new + { + Code = 100, + Name = "ОБЩЕЕ" + }, + new + { + Code = 110, + Name = "ВП" + }, + new + { + Code = 111, + Name = "ОСК" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Robot", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Robots"); + + b.HasData( + new + { + Code = 1, + Description = "Робот по созданию/изменению шаблона наряда ЕСПП", + Name = "TemplateOrder" + }, + new + { + Code = 2, + Description = "Робот по созданию/изменению расписания шаблона наряда в ЕСПП", + Name = "ScheduleOrder" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotConfiguration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AttemptsNumber") + .HasColumnType("integer"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("LastRobotStatusUpdated") + .HasColumnType("timestamp with time zone"); + + b.Property("RobotCode") + .HasColumnType("integer"); + + b.Property("RobotStatusCode") + .HasColumnType("integer"); + + b.Property("TaskStatusCode") + .HasColumnType("integer"); + + b.Property("TemplateId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RobotCode"); + + b.HasIndex("RobotStatusCode"); + + b.HasIndex("TaskStatusCode"); + + b.HasIndex("TemplateId", "RobotCode") + .IsUnique(); + + b.ToTable("RobotConfigurations"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppMessage") + .HasColumnType("text"); + + b.Property("HistoryLevel") + .HasColumnType("integer"); + + b.Property("RobotConfigurationId") + .HasColumnType("uuid"); + + b.Property("RobotIp") + .HasColumnType("text"); + + b.Property("RobotMessage") + .HasColumnType("text"); + + b.Property("TaskStatusCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("HistoryLevel"); + + b.HasIndex("RobotConfigurationId"); + + b.HasIndex("TaskStatusCode"); + + b.ToTable("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistoryLevel", b => + { + b.Property("Level") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Level")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Level"); + + b.ToTable("RobotHistoryLevels"); + + b.HasData( + new + { + Level = 1, + Description = "Робот начал работу ", + Name = "Start" + }, + new + { + Level = 5, + Description = "Информация", + Name = "Information" + }, + new + { + Level = 10, + Description = "Ошибка", + Name = "Error" + }, + new + { + Level = 15, + Description = "Успешно завершил работу", + Name = "Complete" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("RobotStatuses"); + + b.HasData( + new + { + Code = 11, + Description = "Ожидание, ждет пока робот возьмет в работу.", + Name = "Wait" + }, + new + { + Code = 22, + Description = "Робот взял в работу.", + Name = "InProgress" + }, + new + { + Code = 33, + Description = "Ошибка отработки роботом. Требует ручного вмешательства.", + Name = "Error" + }, + new + { + Code = 44, + Description = "Робот успешно отработал.", + Name = "Complete" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Roles"); + + b.HasData( + new + { + Id = new Guid("c8f2f144-e6c2-45d7-ba66-5e9bbd376376"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Администратор", + Name = "administrator" + }, + new + { + Id = new Guid("13bca225-7fa4-42fa-9d80-d2d46de261fe"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Робот ЕСПП", + Name = "espp-robot" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Setting", b => + { + b.Property("Name") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Name"); + + b.ToTable("Settings"); + + b.HasData( + new + { + Name = "Initiator", + Description = "Инициатор регламентной работы, указывается при создании шаблона в ЕСПП.", + Value = "СТАРОСТИНА СВЕТЛАНА БОРИСОВНА (STAROSTINASB@GVC.OAO.RZD)" + }, + new + { + Name = "ClosingCode", + Description = "Код закрытия регламентной работы, указывается при создании шаблона в ЕСПП.", + Value = "выполнен" + }, + new + { + Name = "Category", + Description = "Категория создаваемого объекта в ЕСПП", + Value = "регламентная работа" + }, + new + { + Name = "TemplatePrefixName", + Description = "Префикс имени шаблона в ЕСПП", + Value = "%PREFIX%-ЭИТИ-ПТК-ПАРР" + }, + new + { + Name = "RobotAttemptsNumber", + Description = "Количество попыток выполнения задания роботом", + Value = "3" + }, + new + { + Name = "RobotWaitTime", + Description = "Время ожидания выполнения роботом задания", + Value = "00:15:00" + }, + new + { + Name = "ScheduleTimezone", + Description = "Расписание регламентной работы - В каком часовом поясе", + Value = "MSK" + }, + new + { + Name = "ScheduleExclude", + Description = "Расписание регламентной работы - Тип исключения", + Value = "Нет исключений" + }, + new + { + Name = "ScheduleRepeatRange", + Description = "Расписание регламентной работы - Диапазн повторов", + Value = "Отсутствует дата завершения" + }, + new + { + Name = "OrderSearchDeltaDate", + Description = "Промежуток времени для поиска нарядов в ЕСПП", + Value = "01:30:00" + }, + new + { + Name = "EsppRobotAccountTimeZoneHour", + Description = "Таймзона УЗ роботов в ЕСПП, в часах (может быть положительная и отрицательная)", + Value = "3" + }, + new + { + Name = "WeekendCacheTtl", + Description = "Время хранения в кэше данных о выходных и рабочих днях", + Value = "01:00:00" + }, + new + { + Name = "TemplateNameConstantParts", + Description = "Список неизменных частей имени шаблона", + Value = "[{\"Name\":\"П-1\",\"Value\":\"ЭИТИ\"},{\"Name\":\"П-2\",\"Value\":\"ПАРР\"}]" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Subprocess", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProcessId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("EsppId") + .IsUnique(); + + b.HasIndex("ProcessId"); + + b.ToTable("Subprocesses"); + }); + + modelBuilder.Entity("PARR.DAL.Models.TaskStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("TaskStatuses"); + + b.HasData( + new + { + Code = 10, + Description = "Требуется создание объекта в ЕСПП", + Name = "Creating" + }, + new + { + Code = 20, + Description = "Требуется обновление объекта в ЕСПП", + Name = "Updating" + }, + new + { + Code = 30, + Description = "Нормальное состояние объекта в ЕСПП и ПАРР. Объект в ПАРР соответствует объекту в ЕСПП", + Name = "Ok" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Template", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("InitiatorComment") + .HasColumnType("text"); + + b.Property("InitiatorIp") + .HasColumnType("text"); + + b.Property("InitiatorParrComponentId") + .HasColumnType("integer"); + + b.Property("IsActiveSchedule") + .HasColumnType("boolean"); + + b.Property("IsActiveTemplate") + .HasColumnType("boolean"); + + b.Property("JobId") + .HasColumnType("uuid"); + + b.Property("LastRun") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("NextRun") + .HasColumnType("timestamp with time zone"); + + b.Property("ScheduleEsppId") + .HasColumnType("text"); + + b.Property("UnitId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("JobId"); + + b.HasIndex("Name") + .IsUnique(); + + b.HasIndex("UnitId"); + + b.ToTable("Templates"); + }); + + modelBuilder.Entity("PARR.DAL.Models.TemplateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateAddedToHistory") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("InitiatorComment") + .HasColumnType("text"); + + b.Property("InitiatorIp") + .HasColumnType("text"); + + b.Property("InitiatorParrComponentId") + .HasColumnType("integer"); + + b.Property("IsActiveSchedule") + .HasColumnType("boolean"); + + b.Property("IsActiveTemplate") + .HasColumnType("boolean"); + + b.Property("LastRun") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("NextRun") + .HasColumnType("timestamp with time zone"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("TemplateHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Tnk", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("SubprocessId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("EsppId") + .IsUnique(); + + b.HasIndex("SubprocessId"); + + b.ToTable("Tnks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Units", "unit", t => + { + t.HasComment("Таблица с ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitField", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AihitName") + .IsRequired() + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("EsppName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AihitName"); + + b.HasIndex("EsppName"); + + b.ToTable("Fields", "unit", t => + { + t.HasComment("Справочник полей ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldInUnitFieldValue", b => + { + b.Property("FieldId") + .HasColumnType("uuid"); + + b.Property("FieldValueId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.HasKey("FieldId", "FieldValueId"); + + b.HasIndex("FieldValueId"); + + b.ToTable("FieldInFieldValues", "unit", t => + { + t.HasComment("Значения полей ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Value") + .IsUnique(); + + b.ToTable("FieldValues", "unit", t => + { + t.HasComment("Значения полей ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInField", b => + { + b.Property("UnitId") + .HasColumnType("uuid"); + + b.Property("FieldId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.HasKey("UnitId", "FieldId"); + + b.HasIndex("FieldId"); + + b.ToTable("UnitInFields", "unit", t => + { + t.HasComment("Справочник полей ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInUnit", b => + { + b.Property("ParentUnitId") + .HasColumnType("uuid"); + + b.Property("ChildUnitId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateSynced") + .HasColumnType("timestamp with time zone"); + + b.HasKey("ParentUnitId", "ChildUnitId"); + + b.HasIndex("ChildUnitId"); + + b.ToTable("UnitInUnits", "unit", t => + { + t.HasComment("Таблица связей иерархии между ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInValue", b => + { + b.Property("UnitId") + .HasColumnType("uuid"); + + b.Property("FieldId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ValueId") + .HasColumnType("uuid"); + + b.HasKey("UnitId", "FieldId"); + + b.HasIndex("FieldId"); + + b.HasIndex("ValueId"); + + b.ToTable("UnitInValues", "unit", t => + { + t.HasComment("Таблица связи ЭК с полями и со значениями"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Ip") + .IsRequired() + .HasColumnType("text"); + + b.Property("LastLogon") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Ip") + .IsUnique(); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("PARR.DAL.Models.UsersInRole", b => + { + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("RoleId", "UserId"); + + b.HasIndex("UserId"); + + b.ToTable("UsersInRoles"); + }); + + modelBuilder.Entity("PARR.DAL.Models.WeekendDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Date") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.HasIndex("Date") + .IsUnique(); + + b.ToTable("WeekendDays"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Work", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("TemplateNameMask") + .IsRequired() + .HasColumnType("text"); + + b.Property("TemplateSuffix") + .HasColumnType("text"); + + b.Property("TnkId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("EsppId") + .IsUnique(); + + b.HasIndex("TnkId"); + + b.ToTable("Works"); + }); + + modelBuilder.Entity("PARR.DAL.Models.WorkGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ResponseAreaCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ResponseAreaCode"); + + b.ToTable("WorkGroups"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistory", b => + { + b.HasOne("PARR.DAL.Models.AgentHistoryLevel", "AgentHistoryLevel") + .WithMany("AgentHistories") + .HasForeignKey("HistoryLevelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Order", "Order") + .WithMany("AgentHistories") + .HasForeignKey("OrderId"); + + b.HasOne("PARR.DAL.Models.Template", "Template") + .WithMany("AgentHistories") + .HasForeignKey("TemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AgentHistoryLevel"); + + b.Navigation("Order"); + + b.Navigation("Template"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AppInWorkInWorkGroup", b => + { + b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork") + .WithMany("WorkGroups") + .HasForeignKey("ApplicationsInWorkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.WorkGroup", "WorkGroup") + .WithMany("AppInWorks") + .HasForeignKey("WorkGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationsInWork"); + + b.Navigation("WorkGroup"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Application", b => + { + b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType") + .WithMany("Applications") + .HasForeignKey("ApplicationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationType"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => + { + b.HasOne("PARR.DAL.Models.Application", "Application") + .WithMany("ApplicationsInHosts") + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Host", "Host") + .WithMany("ApplicationsInHosts") + .HasForeignKey("HostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Application"); + + b.Navigation("Host"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b => + { + b.HasOne("PARR.DAL.Models.Application", "Application") + .WithMany("ApplicationsInWorks") + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Work", "Work") + .WithMany("ApplicationsInWorks") + .HasForeignKey("WorkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Application"); + + b.Navigation("Work"); + }); + + modelBuilder.Entity("PARR.DAL.Models.DistributionPeriod", b => + { + b.HasOne("PARR.DAL.Models.DistributionPeriodType", "DistributionPeriodType") + .WithMany("Periods") + .HasForeignKey("Type") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DistributionPeriodType"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeConfig", b => + { + b.HasOne("PARR.DAL.Models.EsppSchType", "EsppSchType") + .WithMany("EsppSchTypeConfigs") + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.EsppSchTypeSchedule", "EsppSchTypeSchedule") + .WithMany("EsppSchTypeConfigs") + .HasForeignKey("TypeScheduleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EsppSchType"); + + b.Navigation("EsppSchTypeSchedule"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeValue", b => + { + b.HasOne("PARR.DAL.Models.DistributionPeriod", "DistributionPeriod") + .WithMany("EsppSchTypeValues") + .HasForeignKey("DistributionPeriodId"); + + b.HasOne("PARR.DAL.Models.EsppSchType", "EsppSchType") + .WithMany("EsppSchTypeValues") + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DistributionPeriod"); + + b.Navigation("EsppSchType"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchValue", b => + { + b.HasOne("PARR.DAL.Models.Job.JobGroup", "JobGroup") + .WithMany("EsppSchValues") + .HasForeignKey("JobGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.EsppSchTypeConfig", "EsppSchTypeConfig") + .WithMany("EsppSchValues") + .HasForeignKey("TypeConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.EsppSchTypeValue", "EsppSchTypeValue") + .WithMany("EsppSchValues") + .HasForeignKey("TypeValueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EsppSchTypeConfig"); + + b.Navigation("EsppSchTypeValue"); + + b.Navigation("JobGroup"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Host", b => + { + b.HasOne("PARR.DAL.Models.EkStatus", "EkStatus") + .WithMany("Hosts") + .HasForeignKey("EkStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.ResponseArea", "ResponseArea") + .WithMany("Hosts") + .HasForeignKey("ResponseAreaCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.WorkGroup", "WorkGroup") + .WithMany("Hosts") + .HasForeignKey("WorkGroupId"); + + b.Navigation("EkStatus"); + + b.Navigation("ResponseArea"); + + b.Navigation("WorkGroup"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Job.FieldFilter", b => + { + b.HasOne("PARR.DAL.Models.Unit.UnitField", "Field") + .WithMany() + .HasForeignKey("FieldId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Job.JobUnitFilter", "UnitFilter") + .WithMany("fieldFilters") + .HasForeignKey("UnitFilterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Field"); + + b.Navigation("UnitFilter"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Job.Job", b => + { + b.HasOne("PARR.DAL.Models.Job.JobGroup", "Group") + .WithMany("Jobs") + .HasForeignKey("GroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Tnk", "Tnk") + .WithMany() + .HasForeignKey("TnkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Group"); + + b.Navigation("Tnk"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Job.JobUnitFilter", b => + { + b.HasOne("PARR.DAL.Models.Job.Job", "Job") + .WithMany("UnitFilters") + .HasForeignKey("JobId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Job"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b => + { + b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork") + .WithOne("JobAutoControl") + .HasForeignKey("PARR.DAL.Models.JobAutoControl", "ApplicationInWorkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationsInWork"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobAutoControlInEkStatus", b => + { + b.HasOne("PARR.DAL.Models.EkStatus", "EkStatus") + .WithMany("JobAutoControlInEkStatuses") + .HasForeignKey("EkStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.JobAutoControl", "JobAutoControl") + .WithMany("JobAutoControlInEkStatuses") + .HasForeignKey("JobAutoControlId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EkStatus"); + + b.Navigation("JobAutoControl"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobEkMask", b => + { + b.HasOne("PARR.DAL.Models.JobAutoControl", "JobAutoControl") + .WithMany("JobEkMasks") + .HasForeignKey("JobAutoControlId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("JobAutoControl"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Order", b => + { + b.HasOne("PARR.DAL.Models.OrderStatus", "NextStatus") + .WithMany("OrdersNext") + .HasForeignKey("NextStatusCode"); + + b.HasOne("PARR.DAL.Models.OrderStatus", "OrderStatus") + .WithMany("Orders") + .HasForeignKey("StatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Template", "Template") + .WithMany("Orders") + .HasForeignKey("TemplateId"); + + b.Navigation("NextStatus"); + + b.Navigation("OrderStatus"); + + b.Navigation("Template"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotConfiguration", b => + { + b.HasOne("PARR.DAL.Models.Robot", "Robot") + .WithMany("RobotConfigurations") + .HasForeignKey("RobotCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.RobotStatus", "RobotStatus") + .WithMany("RobotConfigurations") + .HasForeignKey("RobotStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.TaskStatus", "TaskStatus") + .WithMany("RobotConfigurations") + .HasForeignKey("TaskStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Template", "Template") + .WithMany("RobotConfigurations") + .HasForeignKey("TemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Robot"); + + b.Navigation("RobotStatus"); + + b.Navigation("TaskStatus"); + + b.Navigation("Template"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistory", b => + { + b.HasOne("PARR.DAL.Models.RobotHistoryLevel", "RobotHistoryLevel") + .WithMany("RobotHistories") + .HasForeignKey("HistoryLevel") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.RobotConfiguration", "RobotConfiguration") + .WithMany("RobotHistories") + .HasForeignKey("RobotConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.TaskStatus", "StatusTask") + .WithMany("RobotHistories") + .HasForeignKey("TaskStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RobotConfiguration"); + + b.Navigation("RobotHistoryLevel"); + + b.Navigation("StatusTask"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Subprocess", b => + { + b.HasOne("PARR.DAL.Models.Process", "Process") + .WithMany("Subprocesses") + .HasForeignKey("ProcessId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Process"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Template", b => + { + b.HasOne("PARR.DAL.Models.Job.Job", "Job") + .WithMany() + .HasForeignKey("JobId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.Unit", "Unit") + .WithMany("Templates") + .HasForeignKey("UnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Job"); + + b.Navigation("Unit"); + }); + + modelBuilder.Entity("PARR.DAL.Models.TemplateHistory", b => + { + b.HasOne("PARR.DAL.Models.Template", "Template") + .WithMany("TemplateHistories") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Template"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Tnk", b => + { + b.HasOne("PARR.DAL.Models.Subprocess", "Subprocess") + .WithMany("Tnks") + .HasForeignKey("SubprocessId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subprocess"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldInUnitFieldValue", b => + { + b.HasOne("PARR.DAL.Models.Unit.UnitField", "Field") + .WithMany("FieldValues") + .HasForeignKey("FieldId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.UnitFieldValue", "FieldValue") + .WithMany("FieldValues") + .HasForeignKey("FieldValueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Field"); + + b.Navigation("FieldValue"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInField", b => + { + b.HasOne("PARR.DAL.Models.Unit.UnitField", "UnitField") + .WithMany("Units") + .HasForeignKey("FieldId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.Unit", "Unit") + .WithMany("UnitFields") + .HasForeignKey("UnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Unit"); + + b.Navigation("UnitField"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInUnit", b => + { + b.HasOne("PARR.DAL.Models.Unit.Unit", "ChildUnit") + .WithMany("ParentUnits") + .HasForeignKey("ChildUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.Unit", "ParentUnit") + .WithMany("ChildUnits") + .HasForeignKey("ParentUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChildUnit"); + + b.Navigation("ParentUnit"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInValue", b => + { + b.HasOne("PARR.DAL.Models.Unit.UnitField", "Field") + .WithMany("UnitInValues") + .HasForeignKey("FieldId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.Unit", "Unit") + .WithMany("UnitValues") + .HasForeignKey("UnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.UnitFieldValue", "Value") + .WithMany("UnitInValues") + .HasForeignKey("ValueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Field"); + + b.Navigation("Unit"); + + b.Navigation("Value"); + }); + + modelBuilder.Entity("PARR.DAL.Models.UsersInRole", b => + { + b.HasOne("PARR.DAL.Models.Role", "Role") + .WithMany("Users") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.User", "User") + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Work", b => + { + b.HasOne("PARR.DAL.Models.Tnk", "Tnk") + .WithMany("Works") + .HasForeignKey("TnkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tnk"); + }); + + modelBuilder.Entity("PARR.DAL.Models.WorkGroup", b => + { + b.HasOne("PARR.DAL.Models.ResponseArea", "ResponseArea") + .WithMany("WorkGroups") + .HasForeignKey("ResponseAreaCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ResponseArea"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistoryLevel", b => + { + b.Navigation("AgentHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Application", b => + { + b.Navigation("ApplicationsInHosts"); + + b.Navigation("ApplicationsInWorks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => + { + b.Navigation("Applications"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b => + { + b.Navigation("JobAutoControl"); + + b.Navigation("WorkGroups"); + }); + + modelBuilder.Entity("PARR.DAL.Models.DistributionPeriod", b => + { + b.Navigation("EsppSchTypeValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.DistributionPeriodType", b => + { + b.Navigation("Periods"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EkStatus", b => + { + b.Navigation("Hosts"); + + b.Navigation("JobAutoControlInEkStatuses"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchType", b => + { + b.Navigation("EsppSchTypeConfigs"); + + b.Navigation("EsppSchTypeValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeConfig", b => + { + b.Navigation("EsppSchValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeSchedule", b => + { + b.Navigation("EsppSchTypeConfigs"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeValue", b => + { + b.Navigation("EsppSchValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Host", b => + { + b.Navigation("ApplicationsInHosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Job.Job", b => + { + b.Navigation("UnitFilters"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Job.JobGroup", b => + { + b.Navigation("EsppSchValues"); + + b.Navigation("Jobs"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Job.JobUnitFilter", b => + { + b.Navigation("fieldFilters"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b => + { + b.Navigation("JobAutoControlInEkStatuses"); + + b.Navigation("JobEkMasks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Order", b => + { + b.Navigation("AgentHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.OrderStatus", b => + { + b.Navigation("Orders"); + + b.Navigation("OrdersNext"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Process", b => + { + b.Navigation("Subprocesses"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b => + { + b.Navigation("Hosts"); + + b.Navigation("WorkGroups"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Robot", b => + { + b.Navigation("RobotConfigurations"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotConfiguration", b => + { + b.Navigation("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistoryLevel", b => + { + b.Navigation("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotStatus", b => + { + b.Navigation("RobotConfigurations"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Role", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Subprocess", b => + { + b.Navigation("Tnks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.TaskStatus", b => + { + b.Navigation("RobotConfigurations"); + + b.Navigation("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Template", b => + { + b.Navigation("AgentHistories"); + + b.Navigation("Orders"); + + b.Navigation("RobotConfigurations"); + + b.Navigation("TemplateHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Tnk", b => + { + b.Navigation("Works"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b => + { + b.Navigation("ChildUnits"); + + b.Navigation("ParentUnits"); + + b.Navigation("Templates"); + + b.Navigation("UnitFields"); + + b.Navigation("UnitValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitField", b => + { + b.Navigation("FieldValues"); + + b.Navigation("UnitInValues"); + + b.Navigation("Units"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldValue", b => + { + b.Navigation("FieldValues"); + + b.Navigation("UnitInValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.User", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Work", b => + { + b.Navigation("ApplicationsInWorks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.WorkGroup", b => + { + b.Navigation("AppInWorks"); + + b.Navigation("Hosts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/PARR.DAL/Migrations/20250625035851_tblTemplatesMigrationFormApplicationInWork.cs b/PARR.DAL/Migrations/20250625035851_tblTemplatesMigrationFormApplicationInWork.cs new file mode 100644 index 00000000..495f8354 --- /dev/null +++ b/PARR.DAL/Migrations/20250625035851_tblTemplatesMigrationFormApplicationInWork.cs @@ -0,0 +1,192 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PARR.DAL.Migrations +{ + /// + public partial class tblTemplatesMigrationFormApplicationInWork : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_EsppSchValues_ApplicationsInWorks_ApplicationsInWorkId", + table: "EsppSchValues"); + + migrationBuilder.DropForeignKey( + name: "FK_Templates_ApplicationsInWorks_ApplicationInWorkId", + table: "Templates"); + + migrationBuilder.DropForeignKey( + name: "FK_Templates_Hosts_HostId", + table: "Templates"); + + migrationBuilder.DropIndex( + name: "IX_Templates_ApplicationInWorkId", + table: "Templates"); + + migrationBuilder.DropIndex( + name: "IX_Templates_HostId", + table: "Templates"); + + migrationBuilder.DropColumn( + name: "ApplicationInWorkId", + table: "Templates"); + + migrationBuilder.DropColumn( + name: "HostId", + table: "Templates"); + + migrationBuilder.RenameColumn( + name: "Duration", + schema: "job", + table: "Groups", + newName: "TemplateDuration"); + + migrationBuilder.RenameColumn( + name: "ApplicationsInWorkId", + table: "EsppSchValues", + newName: "JobGroupId"); + + migrationBuilder.AddColumn( + name: "AgentName", + schema: "job", + table: "Groups", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "AgentScript", + schema: "job", + table: "Groups", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "AgentTimeOutSec", + schema: "job", + table: "Groups", + type: "integer", + nullable: true); + + migrationBuilder.AddColumn( + name: "IsAgent", + schema: "job", + table: "Groups", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "IsAutoDistributionEnabled", + schema: "job", + table: "Groups", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.AddForeignKey( + name: "FK_EsppSchValues_Groups_JobGroupId", + table: "EsppSchValues", + column: "JobGroupId", + principalSchema: "job", + principalTable: "Groups", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_EsppSchValues_Groups_JobGroupId", + table: "EsppSchValues"); + + migrationBuilder.DropColumn( + name: "AgentName", + schema: "job", + table: "Groups"); + + migrationBuilder.DropColumn( + name: "AgentScript", + schema: "job", + table: "Groups"); + + migrationBuilder.DropColumn( + name: "AgentTimeOutSec", + schema: "job", + table: "Groups"); + + migrationBuilder.DropColumn( + name: "IsAgent", + schema: "job", + table: "Groups"); + + migrationBuilder.DropColumn( + name: "IsAutoDistributionEnabled", + schema: "job", + table: "Groups"); + + migrationBuilder.RenameColumn( + name: "TemplateDuration", + schema: "job", + table: "Groups", + newName: "Duration"); + + migrationBuilder.RenameColumn( + name: "JobGroupId", + table: "EsppSchValues", + newName: "ApplicationsInWorkId"); + + migrationBuilder.AddColumn( + name: "ApplicationInWorkId", + table: "Templates", + type: "uuid", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + + migrationBuilder.AddColumn( + name: "HostId", + table: "Templates", + type: "uuid", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + + migrationBuilder.CreateIndex( + name: "IX_Templates_ApplicationInWorkId", + table: "Templates", + column: "ApplicationInWorkId"); + + migrationBuilder.CreateIndex( + name: "IX_Templates_HostId", + table: "Templates", + column: "HostId"); + + migrationBuilder.AddForeignKey( + name: "FK_EsppSchValues_ApplicationsInWorks_ApplicationsInWorkId", + table: "EsppSchValues", + column: "ApplicationsInWorkId", + principalTable: "ApplicationsInWorks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Templates_ApplicationsInWorks_ApplicationInWorkId", + table: "Templates", + column: "ApplicationInWorkId", + principalTable: "ApplicationsInWorks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Templates_Hosts_HostId", + table: "Templates", + column: "HostId", + principalTable: "Hosts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/PARR.DAL/Migrations/DataContextModelSnapshot.cs b/PARR.DAL/Migrations/DataContextModelSnapshot.cs index 979ff339..1378144c 100644 --- a/PARR.DAL/Migrations/DataContextModelSnapshot.cs +++ b/PARR.DAL/Migrations/DataContextModelSnapshot.cs @@ -1477,7 +1477,7 @@ namespace PARR.DAL.Migrations modelBuilder.Entity("PARR.DAL.Models.EsppSchValue", b => { - b.Property("ApplicationsInWorkId") + b.Property("JobGroupId") .HasColumnType("uuid"); b.Property("TypeValueId") @@ -1486,7 +1486,7 @@ namespace PARR.DAL.Migrations b.Property("TypeConfigId") .HasColumnType("uuid"); - b.HasKey("ApplicationsInWorkId", "TypeValueId", "TypeConfigId"); + b.HasKey("JobGroupId", "TypeValueId", "TypeConfigId"); b.HasIndex("TypeConfigId"); @@ -1629,16 +1629,21 @@ namespace PARR.DAL.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); + b.Property("AgentName") + .HasColumnType("text"); + + b.Property("AgentScript") + .HasColumnType("text"); + + b.Property("AgentTimeOutSec") + .HasColumnType("integer"); + b.Property("DateCreated") .HasColumnType("timestamp with time zone"); b.Property("DateModified") .HasColumnType("timestamp with time zone"); - b.Property("Duration") - .IsRequired() - .HasColumnType("text"); - b.Property("FullDescription") .IsRequired() .HasColumnType("text"); @@ -1647,6 +1652,12 @@ namespace PARR.DAL.Migrations .IsRequired() .HasColumnType("text"); + b.Property("IsAgent") + .HasColumnType("boolean"); + + b.Property("IsAutoDistributionEnabled") + .HasColumnType("boolean"); + b.Property("IsUmbrella") .HasColumnType("boolean"); @@ -1661,6 +1672,10 @@ namespace PARR.DAL.Migrations .IsRequired() .HasColumnType("text"); + b.Property("TemplateDuration") + .IsRequired() + .HasColumnType("text"); + b.HasKey("Id"); b.ToTable("Groups", "job", t => @@ -2559,18 +2574,12 @@ namespace PARR.DAL.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); - b.Property("ApplicationInWorkId") - .HasColumnType("uuid"); - b.Property("DateCreated") .HasColumnType("timestamp with time zone"); b.Property("DateModified") .HasColumnType("timestamp with time zone"); - b.Property("HostId") - .HasColumnType("uuid"); - b.Property("InitiatorComment") .HasColumnType("text"); @@ -2607,10 +2616,6 @@ namespace PARR.DAL.Migrations b.HasKey("Id"); - b.HasIndex("ApplicationInWorkId"); - - b.HasIndex("HostId"); - b.HasIndex("JobId"); b.HasIndex("Name") @@ -3143,9 +3148,9 @@ namespace PARR.DAL.Migrations modelBuilder.Entity("PARR.DAL.Models.EsppSchValue", b => { - b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork") + b.HasOne("PARR.DAL.Models.Job.JobGroup", "JobGroup") .WithMany("EsppSchValues") - .HasForeignKey("ApplicationsInWorkId") + .HasForeignKey("JobGroupId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -3161,11 +3166,11 @@ namespace PARR.DAL.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("ApplicationsInWork"); - b.Navigation("EsppSchTypeConfig"); b.Navigation("EsppSchTypeValue"); + + b.Navigation("JobGroup"); }); modelBuilder.Entity("PARR.DAL.Models.Host", b => @@ -3215,7 +3220,7 @@ namespace PARR.DAL.Migrations modelBuilder.Entity("PARR.DAL.Models.Job.Job", b => { b.HasOne("PARR.DAL.Models.Job.JobGroup", "Group") - .WithMany("Job") + .WithMany("Jobs") .HasForeignKey("GroupId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -3381,18 +3386,6 @@ namespace PARR.DAL.Migrations modelBuilder.Entity("PARR.DAL.Models.Template", b => { - b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork") - .WithMany("Templates") - .HasForeignKey("ApplicationInWorkId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PARR.DAL.Models.Host", "Host") - .WithMany("Templates") - .HasForeignKey("HostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - b.HasOne("PARR.DAL.Models.Job.Job", "Job") .WithMany() .HasForeignKey("JobId") @@ -3400,15 +3393,11 @@ namespace PARR.DAL.Migrations .IsRequired(); b.HasOne("PARR.DAL.Models.Unit.Unit", "Unit") - .WithMany() + .WithMany("Templates") .HasForeignKey("UnitId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("ApplicationsInWork"); - - b.Navigation("Host"); - b.Navigation("Job"); b.Navigation("Unit"); @@ -3580,12 +3569,8 @@ namespace PARR.DAL.Migrations modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b => { - b.Navigation("EsppSchValues"); - b.Navigation("JobAutoControl"); - b.Navigation("Templates"); - b.Navigation("WorkGroups"); }); @@ -3631,8 +3616,6 @@ namespace PARR.DAL.Migrations modelBuilder.Entity("PARR.DAL.Models.Host", b => { b.Navigation("ApplicationsInHosts"); - - b.Navigation("Templates"); }); modelBuilder.Entity("PARR.DAL.Models.Job.Job", b => @@ -3642,7 +3625,9 @@ namespace PARR.DAL.Migrations modelBuilder.Entity("PARR.DAL.Models.Job.JobGroup", b => { - b.Navigation("Job"); + b.Navigation("EsppSchValues"); + + b.Navigation("Jobs"); }); modelBuilder.Entity("PARR.DAL.Models.Job.JobUnitFilter", b => @@ -3740,6 +3725,8 @@ namespace PARR.DAL.Migrations b.Navigation("ParentUnits"); + b.Navigation("Templates"); + b.Navigation("UnitFields"); b.Navigation("UnitValues"); diff --git a/PARR.DAL/Models/ApplicationsInWork.cs b/PARR.DAL/Models/ApplicationsInWork.cs index eef6b2d8..0eba946f 100644 --- a/PARR.DAL/Models/ApplicationsInWork.cs +++ b/PARR.DAL/Models/ApplicationsInWork.cs @@ -111,9 +111,9 @@ namespace PARR.DAL.Models [ForeignKey(nameof(ApplicationId))] public Application? Application { get; set; } - public ICollection