fix(api,dal,nextRun): исправлена логика рассчета nextRun для шаблонов с параметром IsResponseAreaTimezone

This commit is contained in:
Mikhail Trubnikov
2026-02-05 15:41:36 +10:00
parent 0264ac9d52
commit 930e215089
13 changed files with 352 additions and 143 deletions

View File

@@ -1,6 +1,10 @@
using PARR.DAL.NextRunServices;
using Microsoft.EntityFrameworkCore;
using PARR.DAL.DomainServices.Shortcodes;
using PARR.DAL.NextRunServices;
using PARR.DAL.NextRunServices.Models;
using PARR.DAL.NextRunServices.Subservices;
using PARR.DAL.Services.Interfaces;
using System.Threading.Tasks;
namespace PARR.Test.NextRun
{
@@ -8,11 +12,15 @@ namespace PARR.Test.NextRun
{
//private readonly ITemplateDistributor templateDistributor;
private readonly INextRunService nextRunService;
private readonly ITemplateService templateService;
private readonly IShortcodesService shortcodesService;
public NextRunTest(/*ITemplateDistributor templateDistributor, */INextRunService nextRunService)
public NextRunTest(/*ITemplateDistributor templateDistributor, */INextRunService nextRunService, ITemplateService templateService, IShortcodesService shortcodesService)
{
//this.templateDistributor = templateDistributor;
this.nextRunService = nextRunService;
this.templateService = templateService;
this.shortcodesService = shortcodesService;
}
int periodDays = 10;
@@ -20,6 +28,24 @@ namespace PARR.Test.NextRun
public async Task Test()
{
//var template = await templateService.Get().Include(t => t.Job).ThenInclude(t => t.Group).FirstAsync(t => t.Name == "ЭИТИ-ПАРРКИТВЦ_СХД ТО-1_СХД-AERODISK-432-2-4-U26-EN4SAG022-ГВЦ");
//var responseAreae = await shortcodesService.ApplyShortcodesAsync(template.Job.ResponseAreaMask, template);
//var nextRunWithTimezone = nextRunService.GetNextRunWithTimezoneEsppAndResponseArea(template.NextRun, template.Job?.Group?.IsResponseAreaTimezone, responseAreae);
//DateTimeOffset dbNextRun = new DateTimeOffset(2026, 2, 2, 4, 0, 0, TimeSpan.Zero);
//var result = nextRunService.GetNextRunWithTimezoneEsppAndResponseArea(dbNextRun, true, "96-ДВС");
//var template = await templateService.Get()
// .AsNoTracking()
// .FirstAsync(t => t.Name == "ЭИТИ-ПАРРКИТВС_ТО-1 ОСМОТР ОБОРУД. (15-29 СТОЕК)_СРВ-МАШЗАЛ-315-01-ДВС");
//var newNextRun = await nextRunService.GetNextRunForTemplateAsync(template.Id, false);
//var esppResult = nextRunService.GetNextRunWithTimezoneEsppAndResponseArea(newNextRun, true, "96-ДВС");
// GetWorkDaysTESTAsync
//var aaa = await templateDistributor.GetWorkDaysTESTAsync(GetDateStart(), GetDateStart().AddDays(periodDays), true, referenceDate);
@@ -66,7 +92,7 @@ namespace PARR.Test.NextRun
// исключать выходные и праздники
var excludeWeekends = true;
// var templates = await templateDistributor.DistributeTemplatesAsync(GetDateStart(), periodDays, referenceDate, GetTemplates(), excludeWeekends);
// var templates = await templateDistributor.DistributeTemplatesAsync(GetDateStart(), periodDays, referenceDate, GetTemplates(), excludeWeekends);
//await GetValidNextRunForTemplateAsync(templates);
}