feat(api): JobGroupResponse, TemplateResponse - отображение настроек автораспределения
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
namespace PARR.API.Contracts.V1.Responses
|
||||||
|
{
|
||||||
|
public class DistributionPeriodResponse
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public required string Name { get; set; }
|
||||||
|
|
||||||
|
public required string Duration { get; set; }
|
||||||
|
|
||||||
|
public required string Type { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace PARR.API.Contracts.V1.Responses
|
||||||
|
{
|
||||||
|
public class JobGroupDistributionConfigResponse
|
||||||
|
{
|
||||||
|
public bool IsExcludeWeekends { get; set; }
|
||||||
|
|
||||||
|
public bool IsGroupingByWorkGroup { get; set; }
|
||||||
|
|
||||||
|
public DistributionPeriodResponse? Period { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,10 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public FieldResponse? GroupingUnitField { get; set; }
|
public FieldResponse? GroupingUnitField { get; set; }
|
||||||
|
|
||||||
// public bool IsAutoDistributionEnabled { get; set; }
|
/// <summary>
|
||||||
|
/// Включено автораспределение
|
||||||
|
/// </summary>
|
||||||
|
public bool IsAutoDistributionEnabled { get; set; }
|
||||||
|
|
||||||
// public bool IsAgent { get; set; }
|
// public bool IsAgent { get; set; }
|
||||||
|
|
||||||
@@ -55,6 +58,11 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ScheduleExcludeTypeCalendarResponse? ScheduleExcludeTypeCalendar { get; set; }
|
public ScheduleExcludeTypeCalendarResponse? ScheduleExcludeTypeCalendar { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Настройки автораспределения
|
||||||
|
/// </summary>
|
||||||
|
public JobGroupDistributionConfigResponse? DistributionConfig { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class JobGroupScheduleResponse
|
public class JobGroupScheduleResponse
|
||||||
@@ -65,4 +73,6 @@
|
|||||||
|
|
||||||
public List<EsppScheduleValResponse>? Values { get; set; }
|
public List<EsppScheduleValResponse>? Values { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,5 +75,7 @@
|
|||||||
public int OrderCount { get; set; }
|
public int OrderCount { get; set; }
|
||||||
|
|
||||||
public TemplateStatusTypeResponse? StatusType { get; set; }
|
public TemplateStatusTypeResponse? StatusType { get; set; }
|
||||||
|
|
||||||
|
public JobGroupDistributionConfigResponse? DistributionConfig { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,9 @@ namespace PARR.API.Controllers.V1
|
|||||||
query = query.Where(t => t.GroupName.ToLower().Contains(filter.Name.ToLower()));
|
query = query.Where(t => t.GroupName.ToLower().Contains(filter.Name.ToLower()));
|
||||||
|
|
||||||
if (filter.IsFull)
|
if (filter.IsFull)
|
||||||
query = query.Include(t => t.Jobs).ThenInclude(t => t.Tnk);
|
query = query
|
||||||
|
.Include(t => t.Jobs).ThenInclude(t => t.Tnk)
|
||||||
|
.Include(t => t.DistributionConfig).ThenInclude(t => t.DistributionPeriod);
|
||||||
|
|
||||||
var jobGroups = await groupService.GetPage(query, paginationFilter).ToListAsync();
|
var jobGroups = await groupService.GetPage(query, paginationFilter).ToListAsync();
|
||||||
|
|
||||||
@@ -119,6 +121,7 @@ namespace PARR.API.Controllers.V1
|
|||||||
.Include(t => t.GroupingUnitField)
|
.Include(t => t.GroupingUnitField)
|
||||||
.Include(t => t.ScheduleExcludeType)
|
.Include(t => t.ScheduleExcludeType)
|
||||||
.Include(t => t.ScheduleExcludeTypeCalendar)
|
.Include(t => t.ScheduleExcludeTypeCalendar)
|
||||||
|
.Include(t => t.DistributionConfig).ThenInclude(t => t.DistributionPeriod)
|
||||||
.FirstOrDefaultAsync(t => t.Id == id);
|
.FirstOrDefaultAsync(t => t.Id == id);
|
||||||
|
|
||||||
if (jobGroup == null)
|
if (jobGroup == null)
|
||||||
@@ -187,6 +190,7 @@ namespace PARR.API.Controllers.V1
|
|||||||
.Include(t => t.GroupingUnitField)
|
.Include(t => t.GroupingUnitField)
|
||||||
.Include(t => t.ScheduleExcludeType)
|
.Include(t => t.ScheduleExcludeType)
|
||||||
.Include(t => t.ScheduleExcludeTypeCalendar)
|
.Include(t => t.ScheduleExcludeTypeCalendar)
|
||||||
|
.Include(t => t.DistributionConfig).ThenInclude(t => t.DistributionPeriod)
|
||||||
.FirstAsync(t => t.Id == jobGroup.Id);
|
.FirstAsync(t => t.Id == jobGroup.Id);
|
||||||
|
|
||||||
var locationUri = uriService.GetUri(ApiRoutes.JobGroup.Get, ApiRoutes.JobGroup.getParam, createdJobGroup.Id);
|
var locationUri = uriService.GetUri(ApiRoutes.JobGroup.Get, ApiRoutes.JobGroup.getParam, createdJobGroup.Id);
|
||||||
@@ -290,6 +294,7 @@ namespace PARR.API.Controllers.V1
|
|||||||
.Include(t => t.GroupingUnitField)
|
.Include(t => t.GroupingUnitField)
|
||||||
.Include(t => t.ScheduleExcludeType)
|
.Include(t => t.ScheduleExcludeType)
|
||||||
.Include(t => t.ScheduleExcludeTypeCalendar)
|
.Include(t => t.ScheduleExcludeTypeCalendar)
|
||||||
|
.Include(t => t.DistributionConfig).ThenInclude(t => t.DistributionPeriod)
|
||||||
.FirstAsync(t => t.Id == orig.Id);
|
.FirstAsync(t => t.Id == orig.Id);
|
||||||
|
|
||||||
var response = mapper.Map<JobGroupResponse>(updatedJobGroup);
|
var response = mapper.Map<JobGroupResponse>(updatedJobGroup);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ namespace PARR.API.MappingProfiles
|
|||||||
.ForMember(d => d.StatusType, o => o.MapFrom(s => s.StatusType))
|
.ForMember(d => d.StatusType, o => o.MapFrom(s => s.StatusType))
|
||||||
.ForMember(d => d.ScheduleExcludeType, o => o.MapFrom(s => s.Job!.Group!.ScheduleExcludeType))
|
.ForMember(d => d.ScheduleExcludeType, o => o.MapFrom(s => s.Job!.Group!.ScheduleExcludeType))
|
||||||
.ForMember(d => d.ScheduleExcludeTypeCalendar, o => o.MapFrom(s => s.Job!.Group!.ScheduleExcludeTypeCalendar))
|
.ForMember(d => d.ScheduleExcludeTypeCalendar, o => o.MapFrom(s => s.Job!.Group!.ScheduleExcludeTypeCalendar))
|
||||||
|
.ForMember(d => d.DistributionConfig, o => o.MapFrom(s => s.Job.Group.DistributionConfig))
|
||||||
;
|
;
|
||||||
// === Template ===
|
// === Template ===
|
||||||
|
|
||||||
@@ -330,7 +331,6 @@ namespace PARR.API.MappingProfiles
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Job
|
#region Job
|
||||||
|
|
||||||
CreateMap<Job, JobBaseResponse>()
|
CreateMap<Job, JobBaseResponse>()
|
||||||
@@ -368,9 +368,19 @@ namespace PARR.API.MappingProfiles
|
|||||||
|
|
||||||
CreateMap<JobGroup, JobGroupResponse>()
|
CreateMap<JobGroup, JobGroupResponse>()
|
||||||
.ForMember(d => d.ScheduleExcludeType, o => o.MapFrom(s => s.ScheduleExcludeType))
|
.ForMember(d => d.ScheduleExcludeType, o => o.MapFrom(s => s.ScheduleExcludeType))
|
||||||
.ForMember(d => d.ScheduleExcludeTypeCalendar, o => o.MapFrom(s => s.ScheduleExcludeTypeCalendar));
|
.ForMember(d => d.ScheduleExcludeTypeCalendar, o => o.MapFrom(s => s.ScheduleExcludeTypeCalendar))
|
||||||
|
.ForMember(d => d.DistributionConfig, o => o.MapFrom(s => s.DistributionConfig));
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region JobGroupDistributionConfig
|
||||||
|
|
||||||
|
CreateMap<JobGroupDistributionConfig, JobGroupDistributionConfigResponse>()
|
||||||
|
.ForMember(d => d.Period, o => o.MapFrom(s => s.DistributionPeriod));
|
||||||
|
|
||||||
|
CreateMap<DistributionPeriod, DistributionPeriodResponse>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ScheduleExcludeTypeCalendarResponse
|
#region ScheduleExcludeTypeCalendarResponse
|
||||||
|
|||||||
@@ -48,7 +48,11 @@ namespace PARR.DAL.Services.Implementations
|
|||||||
.ThenInclude(p => p!.Process)
|
.ThenInclude(p => p!.Process)
|
||||||
.Include(t => t.Job)
|
.Include(t => t.Job)
|
||||||
.ThenInclude(t => t!.Group)
|
.ThenInclude(t => t!.Group)
|
||||||
.ThenInclude(t => t!.GroupType);
|
.ThenInclude(t => t!.GroupType)
|
||||||
|
.Include(t => t.Job)
|
||||||
|
.ThenInclude(t => t!.Group)
|
||||||
|
.ThenInclude(t => t.DistributionConfig)
|
||||||
|
.ThenInclude(t => t.DistributionPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<bool> CreateAsync(Template obj)
|
public override Task<bool> CreateAsync(Template obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user