feat(all): ! Критические изменения логики работы всех сервисорв, База Данных имееет неокончательную версию. Template, Scheduler переведены на работу с Unit+Job+JobGroup вместо Host+ApplicationsInWork

This commit is contained in:
Mikhail Kuznetsov
2025-06-25 14:17:34 +10:00
parent 1b867585d8
commit 03c7852378
54 changed files with 5176 additions and 989 deletions

View File

@@ -31,17 +31,27 @@ namespace PARR.DAL.Services.Implementations
.ThenInclude(t => t!.EsppSchValues);
}
public async Task<EsppScheduleDto?> GetEsppScheduleDtoAsync(Guid applicationInWorksId)
public async Task<EsppScheduleDto?> GetEsppScheduleDtoAsync(Guid jobGroupId)
{
//Формирует расписание в нормальном понятном виде из БД
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
.Include(t => t.EsppSchTypeConfig)
.ThenInclude(t => t!.EsppSchTypeSchedule)
.Include(t => t.EsppSchTypeConfig)
.ThenInclude(t=>t.EsppSchType)
.ThenInclude(t => t.EsppSchType)
.Include(t => t.EsppSchTypeValue)
.Where(t => t.ApplicationsInWorkId == applicationInWorksId)
.Include(t => t.JobGroup)
.Where(t => t.JobGroup!.Id == jobGroupId)//TODO Migration to job
.OrderBy(t => t.EsppSchTypeConfig!.Order)
.ToListAsync();
@@ -94,11 +104,11 @@ namespace PARR.DAL.Services.Implementations
return dto;
}
public EsppScheduleDto? GetEsppScheduleDto(Guid applicationInWorksId)
public EsppScheduleDto? GetEsppScheduleDto(Guid jobGroupId)
{
var result = Task.Run(async () =>
{
return await GetEsppScheduleDtoAsync(applicationInWorksId);
return await GetEsppScheduleDtoAsync(jobGroupId);
}).Result;
return result;

View File

@@ -7,15 +7,15 @@ using PARR.DAL.Services.Interfaces.Job;
namespace PARR.DAL.Services.Implementations.Job
{
internal class JobDetailsService : BaseService<Models.Job.JobUnitFilter>, IJobDetailsService
internal class JobUnitFilterService : BaseService<JobUnitFilter>, IJobUnitFilterService
{
private readonly DataContext dataContext;
protected override DbSet<JobUnitFilter> EntitySet => dataContext.JobDetails;
protected override DbSet<JobUnitFilter> EntitySet => dataContext.JobUnitFilters;
protected override DataContext EntitiContext => dataContext;
public JobDetailsService(DataContext dataContext, ILogger<JobDetailsService> logger) : base(logger)
public JobUnitFilterService(DataContext dataContext, ILogger<JobUnitFilterService> logger) : base(logger)
{
this.dataContext = dataContext;
}

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.DAL.Context;
using PARR.DAL.Models.Job;
using PARR.DAL.Services.Abstracts;
using PARR.DAL.Services.Interfaces.Job;
namespace PARR.DAL.Services.Implementations.Job
{
internal class JobGroupService : BaseService<Models.Job.JobGroup>, IJobGroupService
{
private readonly DataContext dataContext;
public JobGroupService(DataContext dataContext, ILogger<JobGroupService> logger) : base(logger)
{
this.dataContext = dataContext;
}
protected override DbSet<JobGroup> EntitySet => dataContext.JobGroups;
protected override DataContext EntitiContext => dataContext;
}
}

View File

@@ -34,18 +34,24 @@ namespace PARR.DAL.Services.Implementations
public IQueryable<Template> GetWithIncludes()
{
return Get()
.Include(h => h.Host)
.ThenInclude(t => t!.ResponseArea)
.Include(h => h.Host)
.ThenInclude(t => t!.WorkGroup)
.ThenInclude(t => t!.ResponseArea)
.Include(h => h.Host)
.ThenInclude(t => t!.EkStatus)
.Include(a => a.ApplicationsInWork)
.ThenInclude(w => w!.Work)
.Include(h => h.Unit)
.Include(a => a.Job)
.ThenInclude(t => t!.Tnk)
.ThenInclude(s => s!.Subprocess)
.ThenInclude(p => p!.Process);
//return Get()
// .Include(h => h.Host)
// .ThenInclude(t => t!.ResponseArea)
// .Include(h => h.Host)
// .ThenInclude(t => t!.WorkGroup)
// .ThenInclude(t => t!.ResponseArea)
// .Include(h => h.Host)
// .ThenInclude(t => t!.EkStatus)
// .Include(a => a.ApplicationsInWork)
// .ThenInclude(w => w!.Work)
// .ThenInclude(t => t!.Tnk)
// .ThenInclude(s => s!.Subprocess)
// .ThenInclude(p => p!.Process);
}
public override Task<bool> CreateAsync(Template obj)

View File

@@ -18,5 +18,15 @@ namespace PARR.DAL.Services.Implementations.Unit
{
this.dataContext = dataContext;
}
public IQueryable<Models.Unit.Unit> GetWithIncludes()
{
return Get()
.Include(t => t.UnitValues)
.ThenInclude(t => t.Field)
.Include(t => t.UnitValues)
.ThenInclude(t => t.Value);
}
}
}