From 7c9d9b34e5b9abacae3efb0bd9889a4f37d9907d Mon Sep 17 00:00:00 2001 From: Mikhail Trubnikov Date: Tue, 3 Mar 2026 10:19:59 +1000 Subject: [PATCH] =?UTF-8?q?feat(esppScheduleSync,=20esppTemplateSync):=20?= =?UTF-8?q?=D0=B2=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=D0=B0=D1=85=20?= =?UTF-8?q?=D1=81=D0=B8=D0=BD=D1=85=D1=80=D0=BE=D0=BD=D0=B8=D0=B7=D0=B8?= =?UTF-8?q?=D1=80=D1=83=D0=B5=D1=82=D1=81=D1=8F=20=D0=BF=D0=BE=D0=BB=D0=B5?= =?UTF-8?q?=20=D0=98=D1=81=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D1=8C.=20=D0=92=20=D1=80=D0=B0=D1=81=D0=BF=D0=B8=D1=81=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=D1=85=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=B8=D1=81=D0=BA=D0=B0=20=D1=81=D0=B2=D1=8F?= =?UTF-8?q?=D0=B7=D0=B0=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=88=D0=B0=D0=B1?= =?UTF-8?q?=D0=BB=D0=BE=D0=BD=D0=B0.=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20=D0=B0=D1=82=D1=80=D0=B8=D0=B1=D1=83=D1=82?= =?UTF-8?q?=20SkipComparision=20-=20=D0=B8=D1=81=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D0=BF=D0=BE=D0=BB=D1=8F=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=81=D1=80=D0=B0=D0=B2=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Domain/EsppObjectSchedule.cs | 12 +++++- .../EsppScheduleSyncInstaller.cs | 2 +- PARR.EsppScheduleSync/ScheduleSyncher.cs | 37 ++++++++++++++----- .../Attributes/SkipComparisonAttribute.cs | 11 ++++++ PARR.EsppSync/SyncService.cs | 8 ++++ .../Domain/EsppObjectTemplate.cs | 10 ++++- PARR.EsppTemplateSync/TemplateMQSyncer.cs | 8 ++-- 7 files changed, 70 insertions(+), 18 deletions(-) rename {PARR.EsppSync => PARR.EsppScheduleSync}/Domain/EsppObjectSchedule.cs (89%) create mode 100644 PARR.EsppSync/Attributes/SkipComparisonAttribute.cs diff --git a/PARR.EsppSync/Domain/EsppObjectSchedule.cs b/PARR.EsppScheduleSync/Domain/EsppObjectSchedule.cs similarity index 89% rename from PARR.EsppSync/Domain/EsppObjectSchedule.cs rename to PARR.EsppScheduleSync/Domain/EsppObjectSchedule.cs index f047cec6..a2f45892 100644 --- a/PARR.EsppSync/Domain/EsppObjectSchedule.cs +++ b/PARR.EsppScheduleSync/Domain/EsppObjectSchedule.cs @@ -1,9 +1,11 @@ using PARR.Constants; using PARR.DAL.Contracts; +using PARR.EsppSync; +using PARR.EsppSync.Attributes; -namespace PARR.EsppSync.Domain +namespace PARR.EsppScheduleSync.Domain { - public class EsppObjectSchedule : IEsppObject + internal class EsppObjectSchedule : IEsppObject { //Все поля описаны в документации по роботам: http://gitlab.dvgd.oao.rzd/devptk/parr/parr_api/-/wikis/EsppRobots @@ -13,15 +15,20 @@ namespace PARR.EsppSync.Domain /// /// ИД расписания + /// Не сраваниваем ЕСПП ИД, потому что У НАС РЕАЛЬНЫЙ ЕСПП ИД И ЕСПП ИД В БД МОГУ РАСХОДИТЬСЯ!!! УЖАССС!!! /// + [SkipComparison] public string Code { get; set; } = string.Empty; + [SkipComparison] public string ScheduleName { get; set; } = string.Empty; public bool IsActive { get; set; } + [SkipComparison] public string ResponseArea { get; set; } = string.Empty; + [SkipComparison] public string WorkGroup { get; set; } = string.Empty; /// @@ -103,6 +110,7 @@ namespace PARR.EsppSync.Domain /// /// Завершение после: 0 /// + [SkipComparison] public string CompleteAfter { get; set; } = string.Empty; /// diff --git a/PARR.EsppScheduleSync/EsppScheduleSyncInstaller.cs b/PARR.EsppScheduleSync/EsppScheduleSyncInstaller.cs index 4dfc8041..4a0e01a9 100644 --- a/PARR.EsppScheduleSync/EsppScheduleSyncInstaller.cs +++ b/PARR.EsppScheduleSync/EsppScheduleSyncInstaller.cs @@ -2,9 +2,9 @@ using Microsoft.Extensions.DependencyInjection; using PARR.BLL; using PARR.DAL; +using PARR.EsppScheduleSync.Domain; using PARR.EsppScheduleSync.Settings; using PARR.EsppSync; -using PARR.EsppSync.Domain; namespace PARR.EsppScheduleSync { diff --git a/PARR.EsppScheduleSync/ScheduleSyncher.cs b/PARR.EsppScheduleSync/ScheduleSyncher.cs index 6fc936b9..d3410738 100644 --- a/PARR.EsppScheduleSync/ScheduleSyncher.cs +++ b/PARR.EsppScheduleSync/ScheduleSyncher.cs @@ -10,9 +10,9 @@ using PARR.DAL.Models; using PARR.DAL.NextRunServices; using PARR.DAL.Services.Interfaces; using PARR.DAL.Services.Interfaces.Schedule; +using PARR.EsppScheduleSync.Domain; using PARR.EsppScheduleSync.Settings; using PARR.EsppSync; -using PARR.EsppSync.Domain; using PARR.EsppSync.Helpers; namespace PARR.EsppScheduleSync @@ -125,10 +125,24 @@ namespace PARR.EsppScheduleSync using var scope = serviceProvider.CreateScope(); var templateService = scope.ServiceProvider.GetRequiredService(); - var candidates = await templateService.Get() - .Include(t => t.RobotConfigurations) - .Where(t => t.Name == esppTemplateName || t.ScheduleEsppId == esppScheduleId) - .ToListAsync(); + // это не очень, так как esppScheduleId может быть null или empty, а в БД таких значений может быть много + //var candidates = await templateService.Get() + // .Include(t => t.RobotConfigurations) + // .Where(t => t.Name == esppTemplateName || t.ScheduleEsppId == esppScheduleId) + // .ToListAsync(); + + IQueryable