feat(api): jobGroup - управление автораспределением

This commit is contained in:
Mikhail Trubnikov
2026-01-23 16:18:56 +10:00
parent 9964e3388d
commit 21c957c3ca
13 changed files with 223 additions and 40 deletions

View File

@@ -8,7 +8,6 @@ using PARR.DAL.NextRunServices.Models;
using PARR.DAL.NextRunServices.Subservices;
using PARR.DAL.Services.Interfaces;
using PARR.DAL.Services.Interfaces.Job;
using PARR.DAL.TransformServices;
namespace PARR.DAL.NextRunServices
{

View File

@@ -1,16 +1,15 @@
using Microsoft.Extensions.Logging;
using PARR.Constants;
using PARR.DAL.Contracts;
using PARR.DAL.DomainModels;
using PARR.DAL.Extensions;
using PARR.DAL.Services.Interfaces;
using PARR.DAL.TransformServices;
namespace PARR.DAL.TransformServices
namespace PARR.DAL.NextRunServices.Subservices
{
internal class EsppScheduleTransformService : IEsppScheduleTransformService
{
private readonly IEsppSchTypeConfigService esppSchTypeConfigService;
private readonly INextRunModifierService nextRunModifierService;
//private readonly INextRunModifierService nextRunModifierService;
private readonly ILogger<EsppScheduleTransformService> logger;
private static readonly Dictionary<string, int> monthDict = new Dictionary<string, int>()
@@ -52,12 +51,12 @@ namespace PARR.DAL.TransformServices
public EsppScheduleTransformService(
ILogger<EsppScheduleTransformService> logger,
IEsppSchTypeConfigService esppSchTypeConfigService,
INextRunModifierService nextRunModifierService
IEsppSchTypeConfigService esppSchTypeConfigService
//INextRunModifierService nextRunModifierService
)
{
this.esppSchTypeConfigService = esppSchTypeConfigService;
this.nextRunModifierService = nextRunModifierService;
//this.nextRunModifierService = nextRunModifierService;
this.logger = logger;
}
@@ -493,18 +492,18 @@ namespace PARR.DAL.TransformServices
//}
private int ParseInt(string value)
{
try
{
return int.Parse(value);
}
catch (Exception ex)
{
logger.LogError(ex, $"{nameof(this.GetType)}, получение конца периода. Не смог распарсить string в int для значения {value}.");
return 0;
}
}
//private int ParseInt(string value)
//{
// try
// {
// return int.Parse(value);
// }
// catch (Exception ex)
// {
// logger.LogError(ex, $"{nameof(this.GetType)}, получение конца периода. Не смог распарсить string в int для значения {value}.");
// return 0;
// }
//}
//private DistributionPeriodTypeEnum ParseDistributionPeriodType(string value)

View File

@@ -1,4 +1,4 @@
namespace PARR.DAL.TransformServices
namespace PARR.DAL.NextRunServices.Subservices
{
/// <summary>
/// Сервис трансформации расписания ЕСПП в дату/расписание

View File

@@ -2,8 +2,7 @@
namespace PARR.DAL.NextRunServices.Subservices
{
//todo: public -> internal!!!
public interface ITemplateDistributor
internal interface ITemplateDistributor
{
/// <summary>
/// Распределяет все шаблоны на указанный период, учитывая план нагрузки.

View File

@@ -18,5 +18,11 @@ namespace PARR.DAL.Services.Implementations.Job
protected override DbSet<JobGroup> EntitySet => dataContext.JobGroups;
protected override DataContext EntitiContext => dataContext;
public void DeleteDistributionConfig(JobGroupDistributionConfig distributionConfig)
{
EntitiContext.JobGroupDistributionConfigs.Remove(distributionConfig);
}
}
}

View File

@@ -1,8 +1,14 @@
using PARR.DAL.Services.Interfaces.Base;
using PARR.DAL.Models.Job;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces.Job
{
public interface IJobGroupService : IBaseService<Models.Job.JobGroup>
{
/// <summary>
/// Удалить настройки автораспределения
/// </summary>
/// <param name="distributionConfig"></param>
void DeleteDistributionConfig(JobGroupDistributionConfig distributionConfig);
}
}