diff --git a/PARR.DAL/Context/DataContext.cs b/PARR.DAL/Context/DataContext.cs index 8a222949..d6cad437 100644 --- a/PARR.DAL/Context/DataContext.cs +++ b/PARR.DAL/Context/DataContext.cs @@ -3,8 +3,6 @@ using PARR.DAL.Contracts; using PARR.DAL.Models; using PARR.DAL.Models.AIHIT; using PARR.DAL.Models.V1; -using System.ComponentModel; -using System.Xml.Linq; namespace PARR.DAL.Context { @@ -118,7 +116,8 @@ namespace PARR.DAL.Context f.HasData( new { Name = nameof(SettingsFromDb.Initiator), Description = "Инициатор регламентной работы, указывается при создании шаблона в ЕСПП.", Value = "КУЗНЕЦОВ МИХАИЛ ВАЛЕРЬЕВИЧ (IVC_KUZNETSOVMV@DVGD.OAO.RZD)" }, new { Name = nameof(SettingsFromDb.ClosingCode), Description = "Код закрытия регламентной работы, указывается при создании шаблона в ЕСПП.", Value = "выполнен" }, - new { Name = nameof(SettingsFromDb.Category), Description = "Категория создаваемого объекта в ЕСПП", Value = "регламентная работа" } + new { Name = nameof(SettingsFromDb.Category), Description = "Категория создаваемого объекта в ЕСПП", Value = "регламентная работа" }, + new { Name = nameof(SettingsFromDb.TemplatePrefixName), Description = "Префикс имени шаблона в ЕСПП", Value = "ПАРР-ДВС-ПТК__" } ); }); diff --git a/PARR.DAL/Contracts/SettingsFromDb.cs b/PARR.DAL/Contracts/SettingsFromDb.cs index 7c906c34..02a2ba94 100644 --- a/PARR.DAL/Contracts/SettingsFromDb.cs +++ b/PARR.DAL/Contracts/SettingsFromDb.cs @@ -22,5 +22,10 @@ /// Категория создаваемого объекта в ЕСПП /// public string Category { get; set; } = string.Empty; + + /// + /// Префикс имени шаблона в ЕСПП + /// + public string TemplatePrefixName { get; set; } = string.Empty; } } diff --git a/PARR.DAL/ParrDalInstaller.cs b/PARR.DAL/ParrDalInstaller.cs index e160a6e2..443f9368 100644 --- a/PARR.DAL/ParrDalInstaller.cs +++ b/PARR.DAL/ParrDalInstaller.cs @@ -33,6 +33,7 @@ namespace PARR.DAL services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/PARR.DAL/Services/Implementations/ApplicationInWorkService.cs b/PARR.DAL/Services/Implementations/ApplicationInWorkService.cs new file mode 100644 index 00000000..74efb3fa --- /dev/null +++ b/PARR.DAL/Services/Implementations/ApplicationInWorkService.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using PARR.DAL.Context; +using PARR.DAL.Models; +using PARR.DAL.Services.Abstracts; +using PARR.DAL.Services.Interfaces; + +namespace PARR.DAL.Services.Implementations +{ + internal class ApplicationInWorkService : BaseService, IApplicationInWorkService + { + private readonly DataContext dataContext; + private readonly ILogger logger; + + public ApplicationInWorkService(DataContext dataContext, ILogger logger) : base(logger) + { + this.dataContext = dataContext; + this.logger = logger; + } + + + protected override DbSet EntitySet => dataContext.ApplicationsInWorks; + + protected override DataContext EntitiContext => dataContext; + } +} diff --git a/PARR.DAL/Services/Interfaces/IApplicationInWorkService.cs b/PARR.DAL/Services/Interfaces/IApplicationInWorkService.cs new file mode 100644 index 00000000..a9cab74b --- /dev/null +++ b/PARR.DAL/Services/Interfaces/IApplicationInWorkService.cs @@ -0,0 +1,9 @@ +using PARR.DAL.Models; +using PARR.DAL.Services.Interfaces.Base; + +namespace PARR.DAL.Services.Interfaces +{ + public interface IApplicationInWorkService : IBaseService + { + } +} diff --git a/PARR.EsppTemplateSync/Services/Manager.cs b/PARR.EsppTemplateSync/Services/Manager.cs index a64fcced..858b6b3b 100644 --- a/PARR.EsppTemplateSync/Services/Manager.cs +++ b/PARR.EsppTemplateSync/Services/Manager.cs @@ -103,13 +103,13 @@ namespace PARR.EsppTemplateSync.Services else { var isChanged = false; - var ignoreTemplateFieldsList = globalSettings.IgnoreTemplateFields?.Split(",").ToList().Select(t => t.Trim().ToLower()); + //var ignoreTemplateFieldsList = globalSettings.IgnoreTemplateFields?.Split(",").ToList().Select(t => t.Trim().ToLower()); foreach (var prop in template.GetType().GetProperties()) { if (prop == null) continue; - if (ignoreTemplateFieldsList != null && ignoreTemplateFieldsList.Contains(prop.Name.Trim().ToLower())) continue; + if (globalSettings.IgnoreTemplateFields != null && globalSettings.IgnoreTemplateFields.Contains(prop.Name)) continue; //if (prop.Name == "Id" || // prop.Name == "Status" || // prop.Name == "DateCreated" || diff --git a/PARR.EsppTemplateSync/Settings/GlobalSettings.cs b/PARR.EsppTemplateSync/Settings/GlobalSettings.cs index 789a0d00..fdf69ec4 100644 --- a/PARR.EsppTemplateSync/Settings/GlobalSettings.cs +++ b/PARR.EsppTemplateSync/Settings/GlobalSettings.cs @@ -5,7 +5,7 @@ public MqSettings? MqSettings { get; set; } public StorageSettings? StorageSettings { get; set; } - public string? IgnoreTemplateFields { get; set; } + public List? IgnoreTemplateFields { get; set; } } internal class MqSettings diff --git a/PARR.EsppTemplateSyncWorker/appsettings.json b/PARR.EsppTemplateSyncWorker/appsettings.json index d243317d..6cda1658 100644 --- a/PARR.EsppTemplateSyncWorker/appsettings.json +++ b/PARR.EsppTemplateSyncWorker/appsettings.json @@ -44,6 +44,6 @@ "StorageSettings": { "CheckIntervalSeconds": 30 }, - "IgnoreTemplateFields": "Id,Status,DateCreated,DateModified,StatusCode" + "IgnoreTemplateFields": [ "Id","Status","DateCreated","DateModified","StatusCode" ] } } diff --git a/PARR.MockData/Services/TemplatesInitializer.cs b/PARR.MockData/Services/TemplatesInitializer.cs index f21d25e8..a3573d47 100644 --- a/PARR.MockData/Services/TemplatesInitializer.cs +++ b/PARR.MockData/Services/TemplatesInitializer.cs @@ -10,7 +10,10 @@ namespace PARR.MockData.Services private readonly ILogger logger; private readonly ITemplateService templateService; - public TemplatesInitializer(ILogger logger, ITemplateService templateService) + public TemplatesInitializer( + ILogger logger, + ITemplateService templateService + ) { this.logger = logger; this.templateService = templateService; @@ -18,28 +21,30 @@ namespace PARR.MockData.Services public async Task InitAsync() { var templates = new List