feat(test): очистил тестовый проект

This commit is contained in:
Mikhail Kuznetsov
2025-08-26 12:24:57 +10:00
parent 0c2bcd188b
commit ba01ebb206

View File

@@ -2,7 +2,7 @@ using Microsoft.EntityFrameworkCore;
using PARR.BLL.Services.Interfaces; using PARR.BLL.Services.Interfaces;
using PARR.Constants; using PARR.Constants;
using PARR.DAL.DomainServices.Interfaces; using PARR.DAL.DomainServices.Interfaces;
using PARR.DAL.Services.Interfaces.Unit; using PARR.DAL.Services.Interfaces;
using PARR.EsppApi; using PARR.EsppApi;
using PARR.EsppApi.Constants; using PARR.EsppApi.Constants;
using PARR.EsppApi.Models.Query; using PARR.EsppApi.Models.Query;
@@ -35,29 +35,57 @@ namespace PARR.Test
protected override async Task ExecuteAsync(CancellationToken stoppingToken) protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{ {
#region test #region test
using (var scope = serviceProvider.CreateScope()) //using (var scope = serviceProvider.CreateScope())
{ //{
var unitFilterService = scope.ServiceProvider.GetService<IUnitFilterService>(); // var templateService = scope.ServiceProvider.GetService<ITemplateService>();
// var shortcodesService = scope.ServiceProvider.GetService<IShortcodesService>();
// var robotConfigurationService = scope.ServiceProvider.GetService<IRobotConfigurationService>();
if (unitFilterService == null)
return;
var jobId = Guid.Parse("926793f7-c6d3-4f08-b5ce-517ce1a1ac37"); // var ts = await templateService.Get().Include(t => t.Job).Where(t => t.ScheduleEsppId != null && t.Name.Contains("ЭИТИ-ПТК-ПАРР") && !t.Name.Contains("!!!")).ToListAsync();
//var unitsId = await unitFilterService.GetUnitsIdByJobFilterAsync(jobId);
var unitService = scope.ServiceProvider.GetService<IUnitService>(); // if (!ts.Any())
// return;
if (unitService == null)
return;
var tForCreate = await unitFilterService.GetUnitsIdForExistTemplatesByJobFilterAsync(jobId); // var jobIds = ts.Select(t => t.JobId).Distinct();
if (tForCreate == null) // foreach (var template in ts)
return; // {
// var isExistSameKeyValueTemplate = await templateService.Get().AsNoTracking().AnyAsync(t => t.JobId == template.JobId && t.UnitId == template.UnitId && t.Name != template.Name);
var units = await unitService // var templateName = await shortcodesService.ApplyShortcodesAsync(template.Job.TemplateNameMask, template.UnitId, template.JobId);
.Get().AsNoTracking()
.Where(t => tForCreate.Any(x => x == t.Id)).ToListAsync(); // if (isExistSameKeyValueTemplate)
} // {
// template.IsActiveTemplate = false;
// template.IsActiveSchedule = false;
// template.Name = string.Concat("!!!", templateName.ToUpper());
// template.DateModified = DateTimeOffset.UtcNow;
// if (!(await templateService.CommitAsync(template)))
// _logger.LogInformation($"Не удалось сохнаить изменения {template.ToString()}");
// continue;
// }
// var oldName = template.Name;
// var rt = await robotConfigurationService.Get().FirstOrDefaultAsync(t => t.TemplateId == template.Id);
// if (rt != null)
// {
// template.IsActiveTemplate = true;
// template.IsActiveSchedule = false;
// template.Name = templateName.ToUpper();
// template.DateModified = DateTimeOffset.UtcNow;
// robotConfigurationService.ChangeTaskStatus(DAL.Contracts.TaskStatusEnum.Updating, ref rt);
// //_logger.LogInformation(templateName);
// }
// if (!(await templateService.CommitAsync(template)))
// _logger.LogInformation($"Не удалось сохранить изменения {template.ToString()}");
// }
// _logger.LogInformation($"Опа опа опа...");
//}
#endregion #endregion
#region unit #region unit