fix(API,DAL): Восстановлена работа контроллеров RobotTask, TemplateActivator, Template
This commit is contained in:
@@ -394,9 +394,9 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class TemplateActivator
|
public static class TemplateActivator
|
||||||
{
|
{
|
||||||
public const string SendRequest = Base + "/jobs/" + appInWorkId + "/template-activator";
|
public const string SendRequest = Base + "/jobs/" + jobId + "/template-activator";
|
||||||
|
|
||||||
public const string appInWorkId = "{applicationInWorkId}";
|
public const string jobId = "{jobId}";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
//public int? StatusCode { get; set; }
|
//public int? StatusCode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Поиск по маске. Например: "*-ДВС"
|
/// Поиск по маске. Например: "ДВС-*"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Mask { get; set; }
|
public string? Mask { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Поиск по ИД Задания (ApplicationInWorkId)
|
/// Поиск по ИД Задания (JobGroupId)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid? AppInWorkId { get; set; }
|
public Guid? JobGroupId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,36 +3,43 @@
|
|||||||
public class TemplateResponse
|
public class TemplateResponse
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
public required string Name { get; set; }
|
public required string Name { get; set; }
|
||||||
|
|
||||||
public bool IsActiveTemplate { get; set; }
|
public bool IsActiveTemplate { get; set; }
|
||||||
|
|
||||||
public bool IsActiveSchedule { get; set; }
|
public bool IsActiveSchedule { get; set; }
|
||||||
|
|
||||||
public Guid ApplicationInWorkId { get; set; }
|
|
||||||
|
|
||||||
public required string Category { get; set; }
|
public required string Category { get; set; }
|
||||||
|
|
||||||
public required string Initiator { get; set; }
|
public required string Initiator { get; set; }
|
||||||
|
|
||||||
public required string ClosingCode { get; set; }
|
public required string ClosingCode { get; set; }
|
||||||
|
|
||||||
public required string ShortDescription { get; set; }
|
public required string ShortDescription { get; set; }
|
||||||
|
|
||||||
public required string FullDescription { get; set; }
|
public required string FullDescription { get; set; }
|
||||||
|
|
||||||
public required string Solution { get; set; }
|
public required string Solution { get; set; }
|
||||||
|
|
||||||
public required string TemplateDuration { get; set; }
|
public required string TemplateDuration { get; set; }
|
||||||
|
|
||||||
public TemplateAgentResponse? Agent { get; set; }
|
public TemplateAgentResponse? Agent { get; set; }
|
||||||
|
|
||||||
public DateTimeOffset? LastRun { get; set; }
|
public DateTimeOffset? LastRun { get; set; }
|
||||||
|
|
||||||
public DateTimeOffset NextRun { get; set; }
|
public DateTimeOffset NextRun { get; set; }
|
||||||
|
|
||||||
public bool IsAutoDistributionEnabled { get; set; }
|
public bool IsAutoDistributionEnabled { get; set; }
|
||||||
|
|
||||||
//public HostTemplateResponse? Host { get; set; }
|
|
||||||
public UnitBaseResponse? Unit { get; set; }
|
public UnitBaseResponse? Unit { get; set; }
|
||||||
|
|
||||||
public JobBaseResponse? Job { get; set; }
|
public JobBaseResponse? Job { get; set; }
|
||||||
|
|
||||||
//public WorkResponse? Work { get; set; }
|
|
||||||
public ProcessResponse? Process { get; set; }
|
public ProcessResponse? Process { get; set; }
|
||||||
|
|
||||||
public SubprocessResponse? Subprocess { get; set; }
|
public SubprocessResponse? Subprocess { get; set; }
|
||||||
|
|
||||||
public TnkResponse? Tnk { get; set; }
|
public TnkResponse? Tnk { get; set; }
|
||||||
|
|
||||||
public List<RobotConfigurationResponse>? SyncStatus { get; set; }
|
public List<RobotConfigurationResponse>? SyncStatus { get; set; }
|
||||||
|
|||||||
@@ -72,10 +72,17 @@ namespace PARR.API.Controllers.V1
|
|||||||
// шаблоны
|
// шаблоны
|
||||||
query = query.Include(t => t.Template)
|
query = query.Include(t => t.Template)
|
||||||
.ThenInclude(t => t!.Unit)
|
.ThenInclude(t => t!.Unit)
|
||||||
//.ThenInclude(t => t!.Hosts).ThenInclude(t => t.WorkGroup).ThenInclude(t => t!.ResponseArea)
|
.ThenInclude(t => t!.UnitValues)
|
||||||
.Include(t => t.Template)
|
.ThenInclude(t => t.Field)
|
||||||
|
.Include(t => t.Template)
|
||||||
|
.ThenInclude(t => t!.Unit)
|
||||||
|
.ThenInclude(t => t!.UnitValues)
|
||||||
|
.ThenInclude(t => t.Value)
|
||||||
|
.Include(t => t.Template)
|
||||||
.ThenInclude(a => a!.Job)
|
.ThenInclude(a => a!.Job)
|
||||||
//.ThenInclude(w => w!.Work)
|
.ThenInclude(t => t!.Group)
|
||||||
|
.Include(t => t.Template)
|
||||||
|
.ThenInclude(w => w!.Job)
|
||||||
.ThenInclude(t => t!.Tnk)
|
.ThenInclude(t => t!.Tnk)
|
||||||
.ThenInclude(s => s!.Subprocess)
|
.ThenInclude(s => s!.Subprocess)
|
||||||
.ThenInclude(p => p!.Process);
|
.ThenInclude(p => p!.Process);
|
||||||
@@ -84,12 +91,16 @@ namespace PARR.API.Controllers.V1
|
|||||||
//расписание
|
//расписание
|
||||||
// тут не делаем AsSplitQuery, не может подтянуть все таблицы
|
// тут не делаем AsSplitQuery, не может подтянуть все таблицы
|
||||||
query = query.Include(t => t.Template)
|
query = query.Include(t => t.Template)
|
||||||
.ThenInclude(t => t!.Unit)//.ThenInclude(t => t!.ResponseArea)
|
.ThenInclude(t => t!.Unit)
|
||||||
//.ThenInclude(t => t!.Hosts).ThenInclude(t => t.WorkGroup)
|
.ThenInclude(t => t!.UnitValues)
|
||||||
.Include(t => t.Template)
|
.ThenInclude(t => t.Field)
|
||||||
.ThenInclude(t => t!.Job)
|
.Include(t => t.Template)
|
||||||
.ThenInclude(t => t!.Group)
|
.ThenInclude(t => t!.Unit)
|
||||||
//.ThenInclude(t => t!.ApplicationsInWork)
|
.ThenInclude(t => t!.UnitValues)
|
||||||
|
.ThenInclude(t => t.Value)
|
||||||
|
.Include(t => t.Template)
|
||||||
|
.ThenInclude(a => a!.Job)
|
||||||
|
.ThenInclude(t => t!.Group)
|
||||||
.ThenInclude(t => t!.EsppSchValues)
|
.ThenInclude(t => t!.EsppSchValues)
|
||||||
.ThenInclude(t => t!.EsppSchTypeConfig)
|
.ThenInclude(t => t!.EsppSchTypeConfig)
|
||||||
.ThenInclude(t => t!.EsppSchTypeSchedule);
|
.ThenInclude(t => t!.EsppSchTypeSchedule);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using PARR.BLL.Domain.Mq;
|
|||||||
using PARR.BLL.Services.Interfaces;
|
using PARR.BLL.Services.Interfaces;
|
||||||
using PARR.Common.Domain;
|
using PARR.Common.Domain;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces.Job;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
@@ -26,7 +26,7 @@ namespace PARR.API.Controllers.V1
|
|||||||
private readonly IMqService mqService;
|
private readonly IMqService mqService;
|
||||||
private readonly IUriService uriService;
|
private readonly IUriService uriService;
|
||||||
private readonly MqSettings mqSettings;
|
private readonly MqSettings mqSettings;
|
||||||
private readonly IApplicationsInWorkService applicationsInWorkService;
|
private readonly IJobService jobService;
|
||||||
private readonly IClientService clientService;
|
private readonly IClientService clientService;
|
||||||
|
|
||||||
public TemplateActivatorController(
|
public TemplateActivatorController(
|
||||||
@@ -34,7 +34,7 @@ namespace PARR.API.Controllers.V1
|
|||||||
IMqService mqService,
|
IMqService mqService,
|
||||||
IUriService uriService,
|
IUriService uriService,
|
||||||
MqSettings mqSettings,
|
MqSettings mqSettings,
|
||||||
IApplicationsInWorkService applicationsInWorkService,
|
IJobService jobService,
|
||||||
IClientService clientService
|
IClientService clientService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -42,7 +42,7 @@ namespace PARR.API.Controllers.V1
|
|||||||
this.mqService = mqService;
|
this.mqService = mqService;
|
||||||
this.uriService = uriService;
|
this.uriService = uriService;
|
||||||
this.mqSettings = mqSettings;
|
this.mqSettings = mqSettings;
|
||||||
this.applicationsInWorkService = applicationsInWorkService;
|
this.jobService = jobService;
|
||||||
this.clientService = clientService;
|
this.clientService = clientService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,24 +50,24 @@ namespace PARR.API.Controllers.V1
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Отправить запрос на активацию/деактивацию шаблонов/расписаний
|
/// Отправить запрос на активацию/деактивацию шаблонов/расписаний
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="applicationInWorkId"></param>
|
/// <param name="jobId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost(ApiRoutes.TemplateActivator.SendRequest)]
|
[HttpPost(ApiRoutes.TemplateActivator.SendRequest)]
|
||||||
public async Task<IActionResult> SendRequest([FromRoute] Guid applicationInWorkId, [FromBody] TemplateActivatorRequest request)
|
public async Task<IActionResult> SendRequest([FromRoute] Guid jobId, [FromBody] TemplateActivatorRequest request)
|
||||||
{
|
{
|
||||||
var resultValidate = await validator.ValidateAsync(request);
|
var resultValidate = await validator.ValidateAsync(request);
|
||||||
if (!resultValidate.IsValid)
|
if (!resultValidate.IsValid)
|
||||||
return BadRequest(new Response(resultValidate.Errors));
|
return BadRequest(new Response(resultValidate.Errors));
|
||||||
|
|
||||||
var appInWork = await applicationsInWorkService.GetAsync(applicationInWorkId);
|
var job = await jobService.GetAsync(jobId);
|
||||||
|
|
||||||
if (appInWork == null)
|
if (job == null)
|
||||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { FieldName = nameof(applicationInWorkId), Message = "Некорректное значение" } }));
|
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { FieldName = nameof(jobId), Message = "Некорректное значение" } }));
|
||||||
|
|
||||||
|
|
||||||
var mqRequest = new TemplateActivatorMq
|
var mqRequest = new TemplateActivatorMq
|
||||||
{
|
{
|
||||||
ApplicationInWorkId = applicationInWorkId,
|
JobId = jobId,
|
||||||
Action = request.Action,
|
Action = request.Action,
|
||||||
HistoryInitiator = new HistoryInitiator { InitiatorIp = clientService.GetClientIp()?.ToString(), InitiatorParrComponentId = ParrComponentsEnum.Api }
|
HistoryInitiator = new HistoryInitiator { InitiatorIp = clientService.GetClientIp()?.ToString(), InitiatorParrComponentId = ParrComponentsEnum.Api }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,21 +28,18 @@ namespace PARR.API.Controllers.V1
|
|||||||
{
|
{
|
||||||
private readonly IMapper mapper;
|
private readonly IMapper mapper;
|
||||||
private readonly ITemplateService templateService;
|
private readonly ITemplateService templateService;
|
||||||
private readonly SettingsFromDb settingsFromDb;
|
|
||||||
private readonly IRobotConfigurationService robotConfigurationService;
|
private readonly IRobotConfigurationService robotConfigurationService;
|
||||||
private readonly IClientService clientService;
|
private readonly IClientService clientService;
|
||||||
|
|
||||||
public TemplateController(
|
public TemplateController(
|
||||||
IMapper mapper,
|
IMapper mapper,
|
||||||
ITemplateService templateService,
|
ITemplateService templateService,
|
||||||
SettingsFromDb settingsFromDb,
|
|
||||||
IRobotConfigurationService robotConfigurationService,
|
IRobotConfigurationService robotConfigurationService,
|
||||||
IClientService clientService
|
IClientService clientService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
this.templateService = templateService;
|
this.templateService = templateService;
|
||||||
this.settingsFromDb = settingsFromDb;
|
|
||||||
this.robotConfigurationService = robotConfigurationService;
|
this.robotConfigurationService = robotConfigurationService;
|
||||||
this.clientService = clientService;
|
this.clientService = clientService;
|
||||||
}
|
}
|
||||||
@@ -58,7 +55,9 @@ namespace PARR.API.Controllers.V1
|
|||||||
{
|
{
|
||||||
var paginationFilter = mapper.Map<PaginationFilter>(paginationQuery);
|
var paginationFilter = mapper.Map<PaginationFilter>(paginationQuery);
|
||||||
|
|
||||||
IQueryable<Template> query = templateService.GetWithIncludes()
|
IQueryable<Template> query = templateService.GetWithIncludes().AsNoTracking()
|
||||||
|
.Include(t => t.Unit).ThenInclude(t => t!.UnitValues).ThenInclude(t => t.Field)
|
||||||
|
.Include(t => t.Unit).ThenInclude(t => t!.UnitValues).ThenInclude(t => t.Value)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.Robot)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.Robot)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.TaskStatus)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.TaskStatus)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.RobotStatus)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.RobotStatus)
|
||||||
@@ -70,8 +69,8 @@ namespace PARR.API.Controllers.V1
|
|||||||
if (!string.IsNullOrEmpty(filter.Mask))
|
if (!string.IsNullOrEmpty(filter.Mask))
|
||||||
query = query.Where(t => EF.Functions.Like(t.Name.ToLower(), SqlHelpers.RegexToLike(filter.Mask)));
|
query = query.Where(t => EF.Functions.Like(t.Name.ToLower(), SqlHelpers.RegexToLike(filter.Mask)));
|
||||||
|
|
||||||
if (filter.AppInWorkId.HasValue)
|
if (filter.JobGroupId.HasValue)
|
||||||
query = query.Where(t => t.JobId == filter.AppInWorkId.Value);//TODO Migration to job
|
query = query.Where(t => t.Job!.GroupId == filter.JobGroupId.Value);
|
||||||
|
|
||||||
var templates = await templateService.GetPage(query, paginationFilter).ToListAsync();
|
var templates = await templateService.GetPage(query, paginationFilter).ToListAsync();
|
||||||
|
|
||||||
@@ -92,7 +91,9 @@ namespace PARR.API.Controllers.V1
|
|||||||
[HttpGet(ApiRoutes.Template.Get)]
|
[HttpGet(ApiRoutes.Template.Get)]
|
||||||
public async Task<IActionResult> GetById([FromRoute] Guid id)
|
public async Task<IActionResult> GetById([FromRoute] Guid id)
|
||||||
{
|
{
|
||||||
var template = await templateService.GetWithIncludes()
|
var template = await templateService.GetWithIncludes().AsNoTracking()
|
||||||
|
.Include(t => t.Unit).ThenInclude(t => t!.UnitValues).ThenInclude(t => t.Field)
|
||||||
|
.Include(t => t.Unit).ThenInclude(t => t!.UnitValues).ThenInclude(t => t.Value)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.Robot)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.Robot)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.TaskStatus)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.TaskStatus)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.RobotStatus)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.RobotStatus)
|
||||||
@@ -118,6 +119,8 @@ namespace PARR.API.Controllers.V1
|
|||||||
public async Task<IActionResult> ChangeState([FromRoute] Guid id, [FromBody] TemplateChangeStateRequest request)
|
public async Task<IActionResult> ChangeState([FromRoute] Guid id, [FromBody] TemplateChangeStateRequest request)
|
||||||
{
|
{
|
||||||
var template = await templateService.GetWithIncludes()
|
var template = await templateService.GetWithIncludes()
|
||||||
|
.Include(t => t.Unit).ThenInclude(t => t!.UnitValues).ThenInclude(t => t.Field)
|
||||||
|
.Include(t => t.Unit).ThenInclude(t => t!.UnitValues).ThenInclude(t => t.Value)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.Robot)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.Robot)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.TaskStatus)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.TaskStatus)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.RobotStatus)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.RobotStatus)
|
||||||
@@ -147,7 +150,9 @@ namespace PARR.API.Controllers.V1
|
|||||||
if (!await templateService.CommitAsync(new HistoryInitiator { InitiatorComment = "Изменён статус шаблона/расписания", InitiatorIp = clientService.GetClientIp()?.ToString(), InitiatorParrComponentId = ParrComponentsEnum.Api }))
|
if (!await templateService.CommitAsync(new HistoryInitiator { InitiatorComment = "Изменён статус шаблона/расписания", InitiatorIp = clientService.GetClientIp()?.ToString(), InitiatorParrComponentId = ParrComponentsEnum.Api }))
|
||||||
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = "Ошибка при изменении шаблона." } }));
|
return BadRequest(new Response(false, new List<ErrorModel> { new ErrorModel { Message = "Ошибка при изменении шаблона." } }));
|
||||||
|
|
||||||
var templateToResponse = await templateService.GetWithIncludes()
|
var templateToResponse = await templateService.GetWithIncludes().AsNoTracking()
|
||||||
|
.Include(t => t.Unit).ThenInclude(t => t.UnitValues).ThenInclude(t => t.Field)
|
||||||
|
.Include(t => t.Unit).ThenInclude(t => t.UnitValues).ThenInclude(t => t.Value)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.Robot)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.Robot)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.TaskStatus)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.TaskStatus)
|
||||||
.Include(t => t.RobotConfigurations).ThenInclude(t => t.RobotStatus)
|
.Include(t => t.RobotConfigurations).ThenInclude(t => t.RobotStatus)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace PARR.API.MappingProfiles
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
CreateMap<ApplicationsInWork, TemplateAgentResponse>()
|
CreateMap<JobGroup, TemplateAgentResponse>()
|
||||||
.ForMember(d => d.IsAgent, o => o.MapFrom(s => s.IsAgent))
|
.ForMember(d => d.IsAgent, o => o.MapFrom(s => s.IsAgent))
|
||||||
.ForMember(d => d.Name, o => o.MapFrom(s => s.AgentName))
|
.ForMember(d => d.Name, o => o.MapFrom(s => s.AgentName))
|
||||||
.ForMember(d => d.Script, o => o.MapFrom(s => s.AgentScript))
|
.ForMember(d => d.Script, o => o.MapFrom(s => s.AgentScript))
|
||||||
@@ -167,7 +167,7 @@ namespace PARR.API.MappingProfiles
|
|||||||
.ForMember(d => d.Initiator, o => o.MapFrom<RobotTaskTemplateInitiatorResolver>())
|
.ForMember(d => d.Initiator, o => o.MapFrom<RobotTaskTemplateInitiatorResolver>())
|
||||||
.ForMember(d => d.Category, o => o.MapFrom<RobotTaskTemplateCategoryResolver>())
|
.ForMember(d => d.Category, o => o.MapFrom<RobotTaskTemplateCategoryResolver>())
|
||||||
.ForMember(d => d.WorkGroup, o => o.MapFrom(s => s.Template!.Unit.BaseFields.WorkGroup))
|
.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.Ek, o => o.MapFrom(s => s.Template!.Unit!.Name))
|
||||||
.ForMember(d => d.Name, o => o.MapFrom(s => s.Template!.Name))
|
.ForMember(d => d.Name, o => o.MapFrom(s => s.Template!.Name))
|
||||||
.ForMember(d => d.ProcessName, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Subprocess!.Process!.Name))
|
.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.ProcessEsppId, o => o.MapFrom(s => s.Template!.Job!.Tnk!.Subprocess!.Process!.EsppId))
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ namespace PARR.API.MappingProfiles.Resolvers
|
|||||||
|
|
||||||
public List<RobotTaskScheduleSchResponse>? Resolve(RobotConfiguration source, RobotTaskScheduleResponse destination, List<RobotTaskScheduleSchResponse>? destMember, ResolutionContext context)
|
public List<RobotTaskScheduleSchResponse>? Resolve(RobotConfiguration source, RobotTaskScheduleResponse destination, List<RobotTaskScheduleSchResponse>? destMember, ResolutionContext context)
|
||||||
{
|
{
|
||||||
var appInWorksId = source.Template!.JobId;
|
var jobGroupId = source.Template!.Job!.GroupId;
|
||||||
|
|
||||||
var schedule = esppConfigService.GetEsppScheduleDto(appInWorksId);
|
var schedule = esppConfigService.GetEsppScheduleDto(jobGroupId);
|
||||||
|
|
||||||
if (schedule == null)
|
if (schedule == null)
|
||||||
{
|
{
|
||||||
logger.LogError($"RobotTaskScheduleSchResolver: Не смог замапить расписание для робота, так как оно null. appInWorksId: {appInWorksId}");
|
logger.LogError($"RobotTaskScheduleSchResolver: Не смог замапить расписание для робота, так как оно null. jobGroupId: {jobGroupId}");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace PARR.BLL.Domain.Mq
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Id регламентной работы
|
/// Id регламентной работы
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid ApplicationInWorkId { get; set; }
|
public Guid JobId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Действие по активации/деактивации
|
/// Действие по активации/деактивации
|
||||||
|
|||||||
@@ -35,15 +35,6 @@ namespace PARR.DAL.Services.Implementations
|
|||||||
{
|
{
|
||||||
//Формирует расписание в нормальном понятном виде из БД
|
//Формирует расписание в нормальном понятном виде из БД
|
||||||
|
|
||||||
var test = await dataContext.EsppSchValues
|
|
||||||
//.Include(t => t.JobGroup)
|
|
||||||
//.Include(t => t.EsppSchTypeConfig)
|
|
||||||
// .ThenInclude(t => t!.EsppSchTypeSchedule)
|
|
||||||
//.Include(t => t.EsppSchTypeConfig)
|
|
||||||
// .ThenInclude(t => t.EsppSchType)
|
|
||||||
//.Include(t => t.EsppSchTypeValue)
|
|
||||||
.ToListAsync();
|
|
||||||
|
|
||||||
var schValues = await dataContext.EsppSchValues
|
var schValues = await dataContext.EsppSchValues
|
||||||
.Include(t => t.EsppSchTypeConfig)
|
.Include(t => t.EsppSchTypeConfig)
|
||||||
.ThenInclude(t => t!.EsppSchTypeSchedule)
|
.ThenInclude(t => t!.EsppSchTypeSchedule)
|
||||||
|
|||||||
@@ -38,7 +38,10 @@ namespace PARR.DAL.Services.Implementations
|
|||||||
.Include(a => a.Job)
|
.Include(a => a.Job)
|
||||||
.ThenInclude(t => t!.Tnk)
|
.ThenInclude(t => t!.Tnk)
|
||||||
.ThenInclude(s => s!.Subprocess)
|
.ThenInclude(s => s!.Subprocess)
|
||||||
.ThenInclude(p => p!.Process);
|
.ThenInclude(p => p!.Process)
|
||||||
|
.Include(t=>t.Job)
|
||||||
|
.ThenInclude(t=>t!.Group);
|
||||||
|
|
||||||
//return Get()
|
//return Get()
|
||||||
// .Include(h => h.Host)
|
// .Include(h => h.Host)
|
||||||
// .ThenInclude(t => t!.ResponseArea)
|
// .ThenInclude(t => t!.ResponseArea)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PARR.Common;
|
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.Contracts;
|
using PARR.DAL.Contracts;
|
||||||
using PARR.DAL.DomainModels;
|
using PARR.DAL.DomainModels;
|
||||||
@@ -13,8 +12,6 @@ namespace PARR.DAL.TransformServices
|
|||||||
internal class EsppScheduleTransformService : IEsppScheduleTransformService
|
internal class EsppScheduleTransformService : IEsppScheduleTransformService
|
||||||
{
|
{
|
||||||
private readonly IEsppSchTypeConfigService esppSchTypeConfigService;
|
private readonly IEsppSchTypeConfigService esppSchTypeConfigService;
|
||||||
private readonly IApplicationsInWorkService applicationsInWorkService;
|
|
||||||
private readonly IWeekendDayService weekendDayService;
|
|
||||||
private readonly INextRunModifierService nextRunModifierService;
|
private readonly INextRunModifierService nextRunModifierService;
|
||||||
private readonly IJobGroupService jobGroupService;
|
private readonly IJobGroupService jobGroupService;
|
||||||
private readonly ILogger<EsppScheduleTransformService> logger;
|
private readonly ILogger<EsppScheduleTransformService> logger;
|
||||||
@@ -59,15 +56,12 @@ namespace PARR.DAL.TransformServices
|
|||||||
public EsppScheduleTransformService(
|
public EsppScheduleTransformService(
|
||||||
ILogger<EsppScheduleTransformService> logger,
|
ILogger<EsppScheduleTransformService> logger,
|
||||||
IEsppSchTypeConfigService esppSchTypeConfigService,
|
IEsppSchTypeConfigService esppSchTypeConfigService,
|
||||||
IApplicationsInWorkService applicationsInWorkService,
|
|
||||||
IWeekendDayService weekendDayService,
|
IWeekendDayService weekendDayService,
|
||||||
INextRunModifierService nextRunModifierService,
|
INextRunModifierService nextRunModifierService,
|
||||||
IJobGroupService jobGroupService
|
IJobGroupService jobGroupService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.esppSchTypeConfigService = esppSchTypeConfigService;
|
this.esppSchTypeConfigService = esppSchTypeConfigService;
|
||||||
this.applicationsInWorkService = applicationsInWorkService;
|
|
||||||
this.weekendDayService = weekendDayService;
|
|
||||||
this.nextRunModifierService = nextRunModifierService;
|
this.nextRunModifierService = nextRunModifierService;
|
||||||
this.jobGroupService = jobGroupService;
|
this.jobGroupService = jobGroupService;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
@@ -167,13 +161,8 @@ namespace PARR.DAL.TransformServices
|
|||||||
if (lastRun > DateTimeOffset.UtcNow)
|
if (lastRun > DateTimeOffset.UtcNow)
|
||||||
return await nextRunModifierService.GetWorkDayAsync(lastRun);
|
return await nextRunModifierService.GetWorkDayAsync(lastRun);
|
||||||
|
|
||||||
//var appInWork = await applicationsInWorkService.Get()
|
var jobGroup = await jobGroupService.Get().AsTracking()
|
||||||
// .Include(aiw => aiw.EsppSchValues)
|
.Include(t => t.EsppSchValues)
|
||||||
// .ThenInclude(esv => esv.EsppSchTypeValue)
|
|
||||||
// .ThenInclude(etv => etv!.DistributionPeriod)
|
|
||||||
// .FirstOrDefaultAsync(t => t.Id == applicationInWorkId);
|
|
||||||
var jobGroup = await jobGroupService.Get()
|
|
||||||
.Include(t=>t.EsppSchValues)
|
|
||||||
.ThenInclude(esv => esv.EsppSchTypeValue)
|
.ThenInclude(esv => esv.EsppSchTypeValue)
|
||||||
.ThenInclude(etv => etv!.DistributionPeriod)
|
.ThenInclude(etv => etv!.DistributionPeriod)
|
||||||
.FirstOrDefaultAsync(t => t.Id == jobGroupId);
|
.FirstOrDefaultAsync(t => t.Id == jobGroupId);
|
||||||
|
|||||||
Reference in New Issue
Block a user