diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eb75642f..3f663dd7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ variables: PROD_NAME_API: "parr/parr-api" PROD_NAME_AIHIT_LOADER: "parr/parr-aihit-loader" PROD_NAME_AIHIT_SYNCER: "parr/parr-aihit-syncer" + PROD_NAME_AIHIT_RELATIONSHIPS_SYNCER: "parr/parr-aihit-relationships-syncer" PROD_NAME_ESPP_TEMPLATE: "parr/parr-espp-template-sync" PROD_NAME_ESPP_SCHEDULE: "parr/parr-espp-schedule-sync" PROD_NAME_GENERATOR_TEMPLATES: "parr/parr-generator-templates" @@ -170,6 +171,55 @@ prod_aihit_syncer_deploy: tags: - ${RUNNER} +### AIHIT RELATIONSHPS SYNCER PROD ### +prod_aihit_relationships_syncer_build: + stage: build + only: + - /^ars[0-9]+\.[0-9]+\.[0-9]+$/ + except: + - branches + services: + - name: docker:20.10.21-dind + command: [ + "--insecure-registry=10.99.253.167:8090", + "--registry-mirror=http://c:8090", + "--insecure-registry=10.99.253.167:8088", + "--registry-mirror=http://10.99.253.167:8088", + "--insecure-registry=harbor.dvgd.rzd", + "--tls=false" + ] + variables: + DOCKER_HOST: tcp://docker:2375 + DOCKER_DRIVER: overlay2 + DOCKER_TLS_CERTDIR: "" + script: + - APP_VERSION=$(echo $CI_COMMIT_TAG | tr -d ars) + - IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/ars/v/g') + - docker build -t $REPO/$PROD_NAME_AIHIT_RELATIONSHIPS_SYNCER:$IMAGE_VERSION -t $REPO/$PROD_NAME_AIHIT_RELATIONSHIPS_SYNCER:latest -t $PROD_NAME_AIHIT_RELATIONSHIPS_SYNCER:$IMAGE_VERSION -t $PROD_NAME_AIHIT_RELATIONSHIPS_SYNCER:latest --build-arg app_version=$APP_VERSION -f PARR.AIHITrelationshipsSyncerWorker/Dockerfile . + - docker login -u $HARBOR_PUSH_USER -p $HARBOR_PUSH_PASS $REPO + - docker push --all-tags $REPO/$PROD_NAME_AIHIT_RELATIONSHIPS_SYNCER + tags: + - docker + + +prod_aihit_relationships_syncer_deploy: + stage: deploy + environment: + name: parr-aihit-relationships-syncer + only: + - /^ars[0-9]+\.[0-9]+\.[0-9]+$/ + except: + - branches + script: + - IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/ars/v/g') + - docker login -u $HARBOR_PULL_USER -p $HARBOR_PULL_PASS $REPO + - tag=$IMAGE_VERSION docker compose -f docker-compose.aihit-relationships-syncer.yml up -d + parallel: + matrix: + - RUNNER: shell-as-1 + tags: + - ${RUNNER} + ### ESPP TEMPLATE PROD ### prod_espp-template_build: diff --git a/PARR.AIHITRelationshipsSyncer/AihitRelationshpsSyncerInstaller.cs b/PARR.AIHITRelationshipsSyncer/AihitRelationshpsSyncerInstaller.cs new file mode 100644 index 00000000..1b6939fb --- /dev/null +++ b/PARR.AIHITRelationshipsSyncer/AihitRelationshpsSyncerInstaller.cs @@ -0,0 +1,49 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using PARR.AIHITRelationshipsSyncer.Context; +using PARR.AIHITRelationshipsSyncer.Services.Implementations; +using PARR.AIHITRelationshipsSyncer.Services.Interfaces; +using PARR.AIHITRelationshipsSyncer.Settings; +using PARR.BLL; +using PARR.DAL; + +namespace PARR.AIHITRelationshipsSyncer +{ + public static class AihitRelationshpsSyncerInstaller + { + public static void InstallAihitRelationshpsSyncerServices(this IServiceCollection services, IConfiguration configuration) + { + services.InstallBllServices(configuration); + services.InstallDalServices(configuration); + + var settings = new WorkerSettings(); + configuration.GetSection(nameof(WorkerSettings)).Bind(settings); + services.AddSingleton(settings); + + services.AddDbContext(options => + options.UseSqlServer( + configuration.GetConnectionString("AihitConnection"), + sqlServerOptions => sqlServerOptions.CommandTimeout(1800) + )); + + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + } + + + public static IConfigurationBuilder AddAihitRelationshpsSyncerConfigurations(this IConfigurationBuilder builder, IServiceCollection services) + { + builder.AddDalConfigurations(services); + + return builder; + } + + + public static void AddAihitRelationshpsSyncerSettings(this IServiceCollection services, IConfiguration configuration) + { + services.AddDallSettings(configuration); + } + } +} diff --git a/PARR.AIHITRelationshipsSyncer/Context/AIHITContext.cs b/PARR.AIHITRelationshipsSyncer/Context/AIHITContext.cs new file mode 100644 index 00000000..529660cd --- /dev/null +++ b/PARR.AIHITRelationshipsSyncer/Context/AIHITContext.cs @@ -0,0 +1,13 @@ +using Microsoft.EntityFrameworkCore; +using PARR.AIHITRelationshipsSyncer.Models; + +namespace PARR.AIHITRelationshipsSyncer.Context +{ + internal class AIHITContext : DbContext + { + public AIHITContext(DbContextOptions options) : base(options) { } + + + public DbSet AihitDatas { get; set; } + } +} diff --git a/PARR.AIHITRelationshipsSyncer/IRelationshipsSyncer.cs b/PARR.AIHITRelationshipsSyncer/IRelationshipsSyncer.cs new file mode 100644 index 00000000..71e409a4 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncer/IRelationshipsSyncer.cs @@ -0,0 +1,7 @@ +namespace PARR.AIHITRelationshipsSyncer +{ + public interface IRelationshipsSyncer + { + Task StartAsync(); + } +} diff --git a/PARR.AIHITRelationshipsSyncer/Models/AihitData.cs b/PARR.AIHITRelationshipsSyncer/Models/AihitData.cs new file mode 100644 index 00000000..f61e0961 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncer/Models/AihitData.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; + +namespace PARR.AIHITRelationshipsSyncer.Models +{ + [PrimaryKey(nameof(EKFindCode), nameof(ChildEk))] + public class AihitData + { + [Column("КОД_ПОИСКА_ЭК")] + public string? EKFindCode { get; set; } + + //[Column("СТАТУС")] + //public string? Status { get; set; } + + //[Column("ЗОНА_ОТВЕТСТВЕННОСТИ")] + //public string? ResponseArea { get; set; } + + //[Column("ПОДКАТЕГОРИЯ_ЭК")] + //public string? EKSubCategory { get; set; } + + //[Column("ТИП_ЭК")] + //public string? EKType { get; set; } + [Column("Дочерний ЭК")] + public string? ChildEk { get; set; } + } +} diff --git a/PARR.AIHITRelationshipsSyncer/PARR.AIHITRelationshipsSyncer.csproj b/PARR.AIHITRelationshipsSyncer/PARR.AIHITRelationshipsSyncer.csproj new file mode 100644 index 00000000..5471f1d2 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncer/PARR.AIHITRelationshipsSyncer.csproj @@ -0,0 +1,18 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + diff --git a/PARR.AIHITRelationshipsSyncer/RelationshipsSyncer.cs b/PARR.AIHITRelationshipsSyncer/RelationshipsSyncer.cs new file mode 100644 index 00000000..787e4546 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncer/RelationshipsSyncer.cs @@ -0,0 +1,71 @@ +using Microsoft.Extensions.Logging; +using PARR.AIHITRelationshipsSyncer.Services.Interfaces; +using PARR.AIHITRelationshipsSyncer.Settings; +using PARR.BLL.Services.Interfaces; + +namespace PARR.AIHITRelationshipsSyncer +{ + internal class RelationshipsSyncer : IRelationshipsSyncer + { + private readonly ILogger logger; + private readonly IIntervalService intervalService; + private readonly IAihitService aihitService; + private readonly IRelationshipsSyncService relationshipsSyncService; + private readonly WorkerSettings workerSettings; + + public RelationshipsSyncer( + ILogger logger, + IIntervalService intervalService, + IAihitService aihitService, + IRelationshipsSyncService relationshipsSyncService, + WorkerSettings workerSettings + ) + { + this.logger = logger; + this.intervalService = intervalService; + this.aihitService = aihitService; + this.relationshipsSyncService = relationshipsSyncService; + this.workerSettings = workerSettings; + } + + + public async Task StartAsync() + { + logger.LogInformation("Запуск сервиса синхронизации связей иерархии ЭК из АИХ ИТ в ПАРР"); + + await intervalService.IntervalInitAsync(async () => + { + try + { + logger.LogInformation($"Начата загрузка иерархических связей между ЭК из АИХ ИТ"); + + var aihitdata = aihitService.GetData(); + + var aihitDataCount = aihitdata?.Count(); + + if (aihitdata == null || aihitDataCount == 0) + { + logger.LogInformation("АИХ ИТ вернул пустые данные"); + return; + } + + //File.WriteAllText("MockData.json", aihitdata.ToJson()); + //string text = File.OpenText("MockData.json").ReadToEnd(); + //var aihitdata = JsonSerializer.Deserialize>(text); + + await relationshipsSyncService.SyncAsync(aihitdata.ToList()); + + } + catch (Exception ex) + { + logger.LogError(ex, "Ошибка синхронизации иерархических данных Unit из АИХ ИТ в ПАРР"); + } + finally + { + logger.LogInformation($"Завершена загрузка иерархических связей между ЭК из АИХ ИТ"); + } + + }, workerSettings.RepeatEvery); + } + } +} diff --git a/PARR.AIHITRelationshipsSyncer/Services/Implementations/AihitService.cs b/PARR.AIHITRelationshipsSyncer/Services/Implementations/AihitService.cs new file mode 100644 index 00000000..37c8d124 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncer/Services/Implementations/AihitService.cs @@ -0,0 +1,48 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using PARR.AIHITRelationshipsSyncer.Context; +using PARR.AIHITRelationshipsSyncer.Models; +using PARR.AIHITRelationshipsSyncer.Services.Interfaces; + +namespace PARR.AIHITRelationshipsSyncer.Services.Implementations +{ + internal class AihitService : IAihitService + { + private readonly ILogger logger; + private readonly AIHITContext context; + + public AihitService( + ILogger logger, + AIHITContext context + ) + { + this.logger = logger; + this.context = context; + } + + /// + /// Получение данных из АИХ ИТ вызовом хранимой процедуры в базе данных + /// + /// + public IEnumerable? GetData() + { + try + { + var result = context.AihitDatas.FromSqlRaw($"EXEC mao2.dbo.sp_IPP_PARR_PTK_get_Relationships").ToList(); + + if (result == null || !result.Any()) + { + logger.LogWarning($"Процедура sp_IPP_PARR_PTK_get_Relationships вернула пустой список ЭК"); + } + + return result; + } + catch (Exception ex) + { + logger.LogError(ex, $"Ошибка при выполнении ХП sp_IPP_PARR_PTK_get_Relationships"); + } + + return null; + } + } +} diff --git a/PARR.AIHITRelationshipsSyncer/Services/Implementations/RelationshipsSyncSrevice.cs b/PARR.AIHITRelationshipsSyncer/Services/Implementations/RelationshipsSyncSrevice.cs new file mode 100644 index 00000000..1166d194 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncer/Services/Implementations/RelationshipsSyncSrevice.cs @@ -0,0 +1,162 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using PARR.AIHITRelationshipsSyncer.Models; +using PARR.AIHITRelationshipsSyncer.Services.Interfaces; +using PARR.DAL.Models.Unit; +using PARR.DAL.Services.Interfaces.Unit; + +namespace PARR.AIHITRelationshipsSyncer.Services.Implementations +{ + internal class RelationshipsSyncSrevice : IRelationshipsSyncService + { + private readonly ILogger logger; + private readonly IUnitService unitService; + + public RelationshipsSyncSrevice(ILogger logger, + IUnitService unitService + ) + { + this.logger = logger; + this.unitService = unitService; + } + + + public async Task SyncAsync(List aihitdata) + { + var groupedData = aihitdata.GroupBy(ad => ad.EKFindCode); + + var units = await GetUnitsWithChildrens(); + + //Перебираем сгруппированные по родительскому ЭК данные + foreach (var item in groupedData) + { + //Получаем имя родителя + var parentName = item.Select(t => t.EKFindCode).First(); + if (parentName == null) + continue; + + //if (parentName.ToLower() != "ас-рп-рцку-гор") + // continue; + + //По имени получаем экземпляр Unit со всеми дочерними связями + var unit = await GetUnitByNameAsync(parentName); + + //Из данных АИХ ИТ получаем имена всех дочерних ЭК + var childsName = item.Select(t => t.ChildEk).ToList(); + if (childsName == null || childsName.Count == 0) + continue; + + //Проходим циклом по полученному списку для актуализации связей в полученном нами экземпляре Unit + foreach (var childName in childsName) + { + if (childName == null) + continue; + + //if (childName.ToLower() != "рпа-робин-рцку-спиуи-прочее-26-гор") + // continue; + //Ищем детей по имени + var child = unit.ChildUnits.FirstOrDefault(t => t.ChildUnit?.Name.ToLower() == childName.ToLower().Trim()); + + //не нашли создаём и сразу пишем в базу, чтобы если попадуться дубликаты в списке они были созданы + if (child == null) + { + var childUnit = await GetUnitByNameAsync(childName!); + unit.ChildUnits.Add( + new UnitInUnit + { + ParentUnitId = unit.Id, + ChildUnitId = childUnit.Id, + DateCreated = DateTimeOffset.UtcNow, + DateSynced = DateTimeOffset.UtcNow + } + ); + + if (!await unitService.CommitAsync()) + logger.LogError($"Не удалось создать связь Unit {unit.Name} с {childUnit.Name}"); + else + logger.LogDebug($"----- Изменене связи Unit: {unit.Name} -----"); + } + //Для всех обновляем дату синхронизации + else + child.DateSynced = DateTimeOffset.UtcNow; + } + + //После проверки пришедших к нам из АИХ ИТ дочерних связей удаляем лишние/уже не существующие в базе + var childsToDelete = unit.ChildUnits.Where(t => childsName.All(a => t.ChildUnit?.Name != a)).ToList(); + if (childsToDelete != null && childsToDelete.Count() > 0) + DeleteChilds(unit, childsToDelete); + + //применяем изменения в базе данных + if (!await unitService.CommitAsync()) + logger.LogError($"Не удалось изменить связи Unit {unit.Name}"); + else + logger.LogDebug($"----- Изменены связи Unit: {unit.Name} -----"); + } + } + + + /// + /// Удаление дочерних связей у ЭК + /// + /// + /// + private void DeleteChilds(Unit unit, List unitToDeleteChilds) + { + foreach (var childUnit in unitToDeleteChilds) + { + logger.LogInformation($"----- Удаление связи Unit: {childUnit.ParentUnit!.Name} - {childUnit.ChildUnit!.Name} -----"); + unit.ChildUnits.Remove(childUnit); + } + } + + + /// + /// Получение списка ЭК с дочерними связями + /// + /// + private async Task> GetUnitsWithChildrens() + { + return await unitService.Get() + .Include(t => t.ChildUnits).ToListAsync(); + } + + + /// + /// Создать новый ЭК по имени + /// + /// + /// + private async Task CreateUnit(string ekName) + { + var unit = new Unit + { + Name = ekName.Trim() + }; + + if (!await unitService.CreateAsync(unit) || !await unitService.CommitAsync()) + logger.LogError($"Не удалось создать Unit {unit.Name}"); + else + logger.LogDebug($"----- Создан Unit: {unit.Name} -----"); + + return unit; + } + + + /// + /// Получить ЭК с дочерними связями по имени, если такого ещё нет создать + /// + /// + /// + private async Task GetUnitByNameAsync(string ekName) + { + if (!unitService.Get().AsNoTracking().Any(u => u.Name.ToLower() == ekName.ToLower().Trim())) + { + return await CreateUnit(ekName); + } + + return await unitService.Get() + .Include(u => u.ChildUnits) + .FirstAsync(u => u.Name.ToLower() == ekName.ToLower().Trim()); + } + } +} diff --git a/PARR.AIHITRelationshipsSyncer/Services/Interfaces/IAihitService.cs b/PARR.AIHITRelationshipsSyncer/Services/Interfaces/IAihitService.cs new file mode 100644 index 00000000..602cebb4 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncer/Services/Interfaces/IAihitService.cs @@ -0,0 +1,9 @@ +using PARR.AIHITRelationshipsSyncer.Models; + +namespace PARR.AIHITRelationshipsSyncer.Services.Interfaces +{ + public interface IAihitService + { + IEnumerable? GetData(); + } +} diff --git a/PARR.AIHITRelationshipsSyncer/Services/Interfaces/IRelationshipsSyncService.cs b/PARR.AIHITRelationshipsSyncer/Services/Interfaces/IRelationshipsSyncService.cs new file mode 100644 index 00000000..06ad24f7 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncer/Services/Interfaces/IRelationshipsSyncService.cs @@ -0,0 +1,9 @@ +using PARR.AIHITRelationshipsSyncer.Models; + +namespace PARR.AIHITRelationshipsSyncer.Services.Interfaces +{ + public interface IRelationshipsSyncService + { + Task SyncAsync(List aihitdata); + } +} diff --git a/PARR.AIHITRelationshipsSyncer/Settings/WorkerSettings.cs b/PARR.AIHITRelationshipsSyncer/Settings/WorkerSettings.cs new file mode 100644 index 00000000..52136d30 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncer/Settings/WorkerSettings.cs @@ -0,0 +1,7 @@ +namespace PARR.AIHITRelationshipsSyncer.Settings +{ + internal class WorkerSettings + { + public TimeSpan RepeatEvery { get; set; } + } +} diff --git a/PARR.AIHITRelationshipsSyncerWorker/Dockerfile b/PARR.AIHITRelationshipsSyncerWorker/Dockerfile new file mode 100644 index 00000000..c699eced --- /dev/null +++ b/PARR.AIHITRelationshipsSyncerWorker/Dockerfile @@ -0,0 +1,34 @@ +# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +# This stage is used when running from VS in fast mode (Default for Debug configuration) +FROM 10.99.253.167:8090/dotnet/runtime:7.0 AS base +WORKDIR /app + + +# This stage is used to build the service project +FROM 10.99.253.167:8090/dotnet/sdk:7.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["NuGet.config", "."] +COPY ["PARR.AIHITRelationshipsSyncerWorker/PARR.AIHITRelationshipsSyncerWorker.csproj", "PARR.AIHITRelationshipsSyncerWorker/"] +COPY ["PARR.AIHITRelationshipsSyncer/PARR.AIHITRelationshipsSyncer.csproj", "PARR.AIHITRelationshipsSyncer/"] +COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"] +COPY ["PARR.Common/PARR.Common.csproj", "PARR.Common/"] +COPY ["PARR.Constants/PARR.Constants.csproj", "PARR.Constants/"] +COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"] +RUN dotnet restore "./PARR.AIHITRelationshipsSyncerWorker/PARR.AIHITRelationshipsSyncerWorker.csproj" +COPY . . +WORKDIR "/src/PARR.AIHITRelationshipsSyncerWorker" +RUN dotnet build "./PARR.AIHITRelationshipsSyncerWorker.csproj" -c $BUILD_CONFIGURATION -o /app/build + +# This stage is used to publish the service project to be copied to the final stage +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +ARG app_version=0.0.0-default +RUN dotnet publish "./PARR.AIHITRelationshipsSyncerWorker.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false /p:Version=$app_version + +# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "PARR.AIHITRelationshipsSyncerWorker.dll"] \ No newline at end of file diff --git a/PARR.AIHITRelationshipsSyncerWorker/PARR.AIHITRelationshipsSyncerWorker.csproj b/PARR.AIHITRelationshipsSyncerWorker/PARR.AIHITRelationshipsSyncerWorker.csproj new file mode 100644 index 00000000..2ad42412 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncerWorker/PARR.AIHITRelationshipsSyncerWorker.csproj @@ -0,0 +1,24 @@ + + + + net7.0 + enable + enable + dotnet-PARR.AIHITRelationshipsSyncerWorker-529ba045-500b-4aca-9aad-871e85ded4d6 + Linux + + + + + + + + + + + + + + + + diff --git a/PARR.AIHITRelationshipsSyncerWorker/Program.cs b/PARR.AIHITRelationshipsSyncerWorker/Program.cs new file mode 100644 index 00000000..efd2a421 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncerWorker/Program.cs @@ -0,0 +1,31 @@ +using Elastic.CommonSchema.Serilog; +using PARR.AIHITRelationshipsSyncer; +using PARR.AIHITRelationshipsSyncerWorker; +using Serilog; + +var builder = Host.CreateApplicationBuilder(); + +builder.Services.AddLogging(config => +{ + config.ClearProviders(); + + var logger = new LoggerConfiguration(); + + if (builder.Environment.IsProduction()) + logger.WriteTo.Console(new EcsTextFormatter()); + else + logger.WriteTo.Console(); + + logger.ReadFrom.Configuration(builder.Configuration); + + config.AddSerilog(logger.CreateLogger()); +}); + +builder.Services.InstallAihitRelationshpsSyncerServices(builder.Configuration); +builder.Configuration.AddAihitRelationshpsSyncerConfigurations(builder.Services); +builder.Services.AddAihitRelationshpsSyncerSettings(builder.Configuration); + +builder.Services.AddHostedService(); + +var host = builder.Build(); +host.Run(); diff --git a/PARR.AIHITRelationshipsSyncerWorker/Properties/launchSettings.json b/PARR.AIHITRelationshipsSyncerWorker/Properties/launchSettings.json new file mode 100644 index 00000000..fb03d5fd --- /dev/null +++ b/PARR.AIHITRelationshipsSyncerWorker/Properties/launchSettings.json @@ -0,0 +1,14 @@ +{ + "profiles": { + "PARR.AIHITRelationshipsSyncerWorker": { + "commandName": "Project", + "environmentVariables": { + "DOTNET_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true + }, + "Container (Dockerfile)": { + "commandName": "Docker" + } + } +} \ No newline at end of file diff --git a/PARR.AIHITRelationshipsSyncerWorker/Worker.cs b/PARR.AIHITRelationshipsSyncerWorker/Worker.cs new file mode 100644 index 00000000..356da42c --- /dev/null +++ b/PARR.AIHITRelationshipsSyncerWorker/Worker.cs @@ -0,0 +1,27 @@ +using PARR.AIHITRelationshipsSyncer; + +namespace PARR.AIHITRelationshipsSyncerWorker; + +public class Worker : BackgroundService +{ + private readonly IServiceProvider serviceProvider; + + public Worker(IServiceProvider serviceProvider) + { + this.serviceProvider = serviceProvider; + } + + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + using (var scope = serviceProvider.CreateScope()) + { + var relationshipsSyncer = scope.ServiceProvider.GetService(); + + if (relationshipsSyncer == null) + throw new Exception($" {nameof(IRelationshipsSyncer)}"); + + await relationshipsSyncer.StartAsync(); + } + } +} diff --git a/PARR.AIHITRelationshipsSyncerWorker/appsettings.Development.json b/PARR.AIHITRelationshipsSyncerWorker/appsettings.Development.json new file mode 100644 index 00000000..b2dcdb67 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncerWorker/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/PARR.AIHITRelationshipsSyncerWorker/appsettings.json b/PARR.AIHITRelationshipsSyncerWorker/appsettings.json new file mode 100644 index 00000000..659d9d27 --- /dev/null +++ b/PARR.AIHITRelationshipsSyncerWorker/appsettings.json @@ -0,0 +1,15 @@ +{ + "ConnectionStrings": { + "AihitConnection": "Data Source=10.248.19.97; Initial Catalog=mao2;User ID=awhit-ipp-parr;pwd=ET3h$9y1LH#D;TrustServerCertificate=true;", + "DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "WorkerSettings": { + "RepeatEvery": "12:00:00" + } +} diff --git a/PARR.API.sln b/PARR.API.sln index af5a834a..38dd4826 100644 --- a/PARR.API.sln +++ b/PARR.API.sln @@ -86,6 +86,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITMainLoader", "PAR EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITMainSyncer", "PARR.AIHITMainSyncer\PARR.AIHITMainSyncer.csproj", "{173E33B2-A10B-4FE9-802C-B22940326DEB}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITRelationshipsSyncer", "PARR.AIHITRelationshipsSyncer\PARR.AIHITRelationshipsSyncer.csproj", "{45974F9B-FB99-4EFA-BE32-88EA0FAD1B9D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITRelationshipsSyncerWorker", "PARR.AIHITRelationshipsSyncerWorker\PARR.AIHITRelationshipsSyncerWorker.csproj", "{64010D07-4053-4EA9-B0F0-E773B5749DBD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -238,6 +242,14 @@ Global {173E33B2-A10B-4FE9-802C-B22940326DEB}.Debug|Any CPU.Build.0 = Debug|Any CPU {173E33B2-A10B-4FE9-802C-B22940326DEB}.Release|Any CPU.ActiveCfg = Release|Any CPU {173E33B2-A10B-4FE9-802C-B22940326DEB}.Release|Any CPU.Build.0 = Release|Any CPU + {45974F9B-FB99-4EFA-BE32-88EA0FAD1B9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {45974F9B-FB99-4EFA-BE32-88EA0FAD1B9D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {45974F9B-FB99-4EFA-BE32-88EA0FAD1B9D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {45974F9B-FB99-4EFA-BE32-88EA0FAD1B9D}.Release|Any CPU.Build.0 = Release|Any CPU + {64010D07-4053-4EA9-B0F0-E773B5749DBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {64010D07-4053-4EA9-B0F0-E773B5749DBD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {64010D07-4053-4EA9-B0F0-E773B5749DBD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {64010D07-4053-4EA9-B0F0-E773B5749DBD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/PARR.API/Contracts/V1/ApiRoutes.cs b/PARR.API/Contracts/V1/ApiRoutes.cs index 5ca8e0b7..03ebe157 100644 --- a/PARR.API/Contracts/V1/ApiRoutes.cs +++ b/PARR.API/Contracts/V1/ApiRoutes.cs @@ -55,6 +55,8 @@ public const string IsWorkDay = Base + "/tests/is-work-day/"; + public const string TestHandler = Base + "/tests/test/"; + public const string GetWorkDay = Base + "/tests/get-work-day/{date}"; public const string paramDate = "{lastRunDate}"; diff --git a/PARR.API/Controllers/V1/TestController.cs b/PARR.API/Controllers/V1/TestController.cs index 0540731a..e313be09 100644 --- a/PARR.API/Controllers/V1/TestController.cs +++ b/PARR.API/Controllers/V1/TestController.cs @@ -1,11 +1,13 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using PARR.API.Contracts.V1; using PARR.API.Contracts.V1.Responses.Base; using PARR.API.Controllers.V1.Base; using PARR.API.Services.Interfaces; using PARR.DAL.CacheServices; using PARR.DAL.Services.Interfaces; +using PARR.DAL.Services.Interfaces.Unit; using PARR.DAL.TransformServices; namespace PARR.API.Controllers.V1 @@ -17,18 +19,21 @@ namespace PARR.API.Controllers.V1 private readonly IEsppScheduleTransformService esppScheduleTransformService; private readonly IRedisCacheService redisCacheService; private readonly IWeekendDayService weekendDayService; + private readonly IUnitService unitService; public TestController( IClientService clientService, IEsppScheduleTransformService esppScheduleTransformService, IRedisCacheService redisCacheService, - IWeekendDayService weekendDayService + IWeekendDayService weekendDayService, + IUnitService unitService ) { this.clientService = clientService; this.esppScheduleTransformService = esppScheduleTransformService; this.redisCacheService = redisCacheService; this.weekendDayService = weekendDayService; + this.unitService = unitService; } @@ -103,6 +108,22 @@ namespace PARR.API.Controllers.V1 } + /// + /// Тестовый метод + /// + /// + [HttpGet(ApiRoutes.Test.TestHandler)] + public async Task Test() + { + //var unit = await unitService.Get().Include(t => t.Parents).Include(t => t.Childs).FirstOrDefaultAsync(t => t.Id == Guid.Parse("01fda0bd-3423-4b12-965b-2947153d1d87")); + + //var parent = unit?.Parents; + //var child = unit?.Childs; + + return Ok(); + } + + //[HttpGet(ApiRoutes.Test.GetWorkDay)] //public async Task GetWorkDay([FromRoute] DateTimeOffset date) //{ diff --git a/PARR.DAL/Context/DataContext.cs b/PARR.DAL/Context/DataContext.cs index b6e19515..07a6c6aa 100644 --- a/PARR.DAL/Context/DataContext.cs +++ b/PARR.DAL/Context/DataContext.cs @@ -78,6 +78,8 @@ namespace PARR.DAL.Context public DbSet UnitFieldInUnitFieldValues { get; set; } + public DbSet UnitInUnits { get; set; } + #endregion diff --git a/PARR.DAL/Migrations/20250522042529_tblUnitInUnits.Designer.cs b/PARR.DAL/Migrations/20250522042529_tblUnitInUnits.Designer.cs new file mode 100644 index 00000000..b2f56ecd --- /dev/null +++ b/PARR.DAL/Migrations/20250522042529_tblUnitInUnits.Designer.cs @@ -0,0 +1,3534 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using PARR.DAL.Context; + +#nullable disable + +namespace PARR.DAL.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20250522042529_tblUnitInUnits")] + partial class tblUnitInUnits + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("HistoryLevelId") + .HasColumnType("integer"); + + b.Property("Message") + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("TemplateId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("HistoryLevelId"); + + b.HasIndex("OrderId"); + + b.HasIndex("TemplateId"); + + b.ToTable("AgentHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistoryLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AgentHistoryLevels"); + + b.HasData( + new + { + Id = 1, + Description = "Агент начал выполнять задание", + Name = "Start" + }, + new + { + Id = 5, + Description = "Агент завершил выполнение задания", + Name = "End" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.AppInWorkInWorkGroup", b => + { + b.Property("ApplicationsInWorkId") + .HasColumnType("uuid"); + + b.Property("WorkGroupId") + .HasColumnType("uuid"); + + b.HasKey("ApplicationsInWorkId", "WorkGroupId"); + + b.HasIndex("WorkGroupId"); + + b.ToTable("AppInWorkInWorkGroups"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Application", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationTypeId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationTypeId"); + + b.HasIndex("Name", "ApplicationTypeId") + .IsUnique(); + + b.ToTable("Applications"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId"); + + b.HasIndex("HostId"); + + b.ToTable("ApplicationsInHost"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("ApplicationTypes"); + + b.HasData( + new + { + Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Сервер приложений", + Name = "APP" + }, + new + { + Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "ОС", + Name = "OS" + }, + new + { + Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "СУБД", + Name = "DB" + }, + new + { + Id = new Guid("749f4c34-b883-4f28-90dd-c161dd3c4270"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "ЦК БС", + Name = "CKBS" + }, + new + { + Id = new Guid("0bd96f9b-d36b-4dfb-bd8a-9c356bc6912b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "ИБ", + Name = "IB" + }, + new + { + Id = new Guid("4466148b-510d-4423-a58f-ce878152ff01"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Инфраструктура", + Name = "SI" + }, + new + { + Id = new Guid("725a96db-358e-489b-a7c9-a84b06ec15df"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Мониторинг", + Name = "SM" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AgentName") + .HasColumnType("text"); + + b.Property("AgentScript") + .HasColumnType("text"); + + b.Property("AgentTimeOutSec") + .HasColumnType("integer"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("FullDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsAgent") + .HasColumnType("boolean"); + + b.Property("IsAutoDistributionEnabled") + .HasColumnType("boolean"); + + b.Property("ReferenceDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("Solution") + .IsRequired() + .HasColumnType("text"); + + b.Property("TemplateDuration") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId"); + + b.HasIndex("WorkId", "ApplicationId") + .IsUnique(); + + b.ToTable("ApplicationsInWorks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.DistributionPeriod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Duration") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Type"); + + b.ToTable("DistributionPeriods"); + + b.HasData( + new + { + Id = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + Duration = "1", + Name = "Ежемесячно", + Type = "Month" + }, + new + { + Id = new Guid("0ad2dfdb-3833-46d9-979a-c408b7eadc6c"), + Duration = "90", + Name = "Каждые 90 дней", + Type = "Day" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.DistributionPeriodType", b => + { + b.Property("Type") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Type"); + + b.ToTable("DistributionPeriodTypes"); + + b.HasData( + new + { + Type = "Day", + Description = "День" + }, + new + { + Type = "Month", + Description = "Месяц" + }, + new + { + Type = "Year", + Description = "Год" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EkStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("EkStatuses"); + + b.HasData( + new + { + Code = 1, + Name = "1-Новый" + }, + new + { + Code = 2, + Name = "2-Подготовка к эксплуатации" + }, + new + { + Code = 3, + Name = "3-В эксплуатации" + }, + new + { + Code = 4, + Name = "4-В ремонте" + }, + new + { + Code = 5, + Name = "5-В резерве" + }, + new + { + Code = 6, + Name = "6-Выведен из эксплуатации" + }, + new + { + Code = 7, + Name = "7-Тестовый" + }, + new + { + Code = 9, + Name = "9-В разработке" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EsppSchTypes"); + + b.HasData( + new + { + Id = 1, + Description = "Через интервал", + Name = "Interval" + }, + new + { + Id = 2, + Description = "День недели: пнд, вт...", + Name = "DayOfWeek" + }, + new + { + Id = 3, + Description = "Число месяца: 1,2,3,4", + Name = "DayOfMonth" + }, + new + { + Id = 4, + Description = "Каждый: первый, второй, третий, четвертый, последний", + Name = "Order" + }, + new + { + Id = 5, + Description = "Месяц: январь, февраль...", + Name = "Month" + }, + new + { + Id = 6, + Description = "Месяц (родительный падеж): января, февраля...", + Name = "MonthGenitive" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeConfig", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("TypeScheduleId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.HasIndex("TypeScheduleId", "TypeId") + .IsUnique(); + + b.ToTable("EsppSchTypeConfigs"); + + b.HasData( + new + { + Id = new Guid("d2693562-b3eb-41e9-97db-c6b5d2ef1bea"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 1, + TypeScheduleId = 1 + }, + new + { + Id = new Guid("06b2e7aa-6927-4fbf-99fb-67c92a4fce8a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 2, + TypeScheduleId = 2 + }, + new + { + Id = new Guid("78079071-ff80-417e-9bb0-d928cec853e7"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 3, + TypeScheduleId = 3 + }, + new + { + Id = new Guid("accb1d46-e1c1-4396-9182-4c0766155921"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 4, + TypeScheduleId = 4 + }, + new + { + Id = new Guid("162ffe73-2428-4abe-8f83-235c2593664c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 1, + TypeId = 2, + TypeScheduleId = 4 + }, + new + { + Id = new Guid("8470d1ef-165d-42fc-ab05-8203e4d263cf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 5, + TypeScheduleId = 5 + }, + new + { + Id = new Guid("006900b5-f65c-413e-bc67-09e6dae60b7c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 1, + TypeId = 3, + TypeScheduleId = 5 + }, + new + { + Id = new Guid("85635bc8-f17a-46b8-9c15-8615761be3d9"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 0, + TypeId = 4, + TypeScheduleId = 6 + }, + new + { + Id = new Guid("439460c2-deca-4b54-80e7-2f20806696ec"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 1, + TypeId = 2, + TypeScheduleId = 6 + }, + new + { + Id = new Guid("5c63ad8c-e9b4-43fd-9d24-5c2eed80dadd"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Order = 2, + TypeId = 6, + TypeScheduleId = 6 + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeSchedule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EsppSchTypeSchedules"); + + b.HasData( + new + { + Id = 1, + Description = "Регулярно", + Name = "Regularly" + }, + new + { + Id = 2, + Description = "Еженедельно", + Name = "Weekly" + }, + new + { + Id = 3, + Description = "Ежемесячно", + Name = "Monthly" + }, + new + { + Id = 4, + Description = "Ежемесячно-2", + Name = "Monthly2" + }, + new + { + Id = 5, + Description = "Ежегодно", + Name = "Annually" + }, + new + { + Id = 6, + Description = "Ежегодно-2", + Name = "Annually2" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DistributionPeriodId") + .HasColumnType("uuid"); + + b.Property("EsppExportValue") + .IsRequired() + .HasColumnType("text"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("DistributionPeriodId"); + + b.HasIndex("TypeId"); + + b.ToTable("EsppSchTypeValues"); + + b.HasData( + new + { + Id = new Guid("6e3b5dd2-b2f7-40bc-bace-15bfa6bbd4ff"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "01:00:00", + Order = 0, + TypeId = 1, + Value = "Каждый час" + }, + new + { + Id = new Guid("4df04834-f14f-43d9-8984-334f080f4107"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "02:00:00", + Order = 1, + TypeId = 1, + Value = "Каждые 2 часа" + }, + new + { + Id = new Guid("dab6e3f9-2385-4966-b77c-133ad233c592"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "03:00:00", + Order = 2, + TypeId = 1, + Value = "Каждые 3 часа" + }, + new + { + Id = new Guid("035f485d-8451-47df-bfaa-ba4dd36cf146"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "04:00:00", + Order = 3, + TypeId = 1, + Value = "Каждые 4 часа" + }, + new + { + Id = new Guid("d627daa7-3eed-4571-acae-ffbb3c5bedb9"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "06:00:00", + Order = 4, + TypeId = 1, + Value = "Каждые 6 часов" + }, + new + { + Id = new Guid("ae0a0015-0f1e-4496-b71e-6244f7e321e7"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "12:00:00", + Order = 5, + TypeId = 1, + Value = "Каждые 12 часов" + }, + new + { + Id = new Guid("8df097aa-9860-4a62-9675-a8eecd3f2ce7"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1 00:00:00", + Order = 6, + TypeId = 1, + Value = "Ежедневно" + }, + new + { + Id = new Guid("dee32e60-c1a1-4206-98bc-aa03deabfdf6"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3 00:00:00", + Order = 7, + TypeId = 1, + Value = "Каждые 72 часа" + }, + new + { + Id = new Guid("e0465fbf-e3a5-4486-9f53-5bb85c6feeca"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4 00:00:00", + Order = 8, + TypeId = 1, + Value = "Каждые 96 часов" + }, + new + { + Id = new Guid("4e3f73d1-a0f3-4dd1-bca9-68ada0dd5ce2"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "14 00:00:00", + Order = 9, + TypeId = 1, + Value = "Каждые 2 недели" + }, + new + { + Id = new Guid("55833417-6a24-42f6-bcc2-5d032f883202"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "60 00:00:00", + Order = 10, + TypeId = 1, + Value = "Каждые 60 дней" + }, + new + { + Id = new Guid("7fefa052-29db-4ce5-9c57-2fd9ff855f21"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "80 00:00:00", + Order = 11, + TypeId = 1, + Value = "Каждые 80 дней" + }, + new + { + Id = new Guid("b0ca99f9-5ee0-45b3-bb80-948f82b1fcb1"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("0ad2dfdb-3833-46d9-979a-c408b7eadc6c"), + EsppExportValue = "90 00:00:00", + Order = 12, + TypeId = 1, + Value = "Каждые 90 дней" + }, + new + { + Id = new Guid("086f7a37-9848-423a-a3cc-36dbb5ad43e3"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "182 00:00:00", + Order = 13, + TypeId = 1, + Value = "Каждые полгода" + }, + new + { + Id = new Guid("f2da9e02-d619-4517-a598-374880a8c8e8"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "540 00:00:00", + Order = 14, + TypeId = 1, + Value = "Каждые 1,5 года" + }, + new + { + Id = new Guid("f38d7d30-8923-4ea0-aa7c-5b251e19ab61"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1095 00:00:00", + Order = 15, + TypeId = 1, + Value = "Каждые 3 года" + }, + new + { + Id = new Guid("b7303461-9a30-43fa-8e55-305aa13f186f"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 2, + Value = "Понедельник" + }, + new + { + Id = new Guid("e951135e-71f2-4262-9342-df4d5315ab6c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 2, + Value = "Вторник" + }, + new + { + Id = new Guid("c34d5375-70e7-4632-b3af-30e279a0621a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 2, + Value = "Среда" + }, + new + { + Id = new Guid("ec9540df-c2de-4bda-a063-34d02d4b6e03"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 2, + Value = "Четверг" + }, + new + { + Id = new Guid("2ed85534-4684-4eb2-9ccb-e264d212c945"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 2, + Value = "Пятница" + }, + new + { + Id = new Guid("a6804315-96ef-484e-82ee-c5795694468b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "6", + Order = 5, + TypeId = 2, + Value = "Суббота" + }, + new + { + Id = new Guid("eb71e699-937f-4894-9688-f7a7f95e5e58"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "7", + Order = 6, + TypeId = 2, + Value = "Воскресенье" + }, + new + { + Id = new Guid("e86adbfb-3345-4e0c-aa3b-b4418f9cfe88"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "1", + Order = 0, + TypeId = 3, + Value = "1" + }, + new + { + Id = new Guid("5b4d7ca6-31e7-475b-b7c8-13c6680c3dc3"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "2", + Order = 1, + TypeId = 3, + Value = "2" + }, + new + { + Id = new Guid("0da03db0-9404-425d-bea1-5da0c9b60b59"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "3", + Order = 2, + TypeId = 3, + Value = "3" + }, + new + { + Id = new Guid("199474c8-0a77-47e5-aab8-ba33c216cc9e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "4", + Order = 3, + TypeId = 3, + Value = "4" + }, + new + { + Id = new Guid("e6619da1-f7e8-45b9-bbd3-9c17bec2ccd3"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "5", + Order = 4, + TypeId = 3, + Value = "5" + }, + new + { + Id = new Guid("a8708763-c838-49a5-95fe-bf4f73518d71"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "6", + Order = 5, + TypeId = 3, + Value = "6" + }, + new + { + Id = new Guid("7ec056aa-820c-4900-96cb-4564d2ea6398"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "7", + Order = 6, + TypeId = 3, + Value = "7" + }, + new + { + Id = new Guid("554d7d0c-91b1-4b81-b94d-1ee864192962"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "8", + Order = 7, + TypeId = 3, + Value = "8" + }, + new + { + Id = new Guid("8b7847a4-23de-4199-8aad-3b5c0323b5a2"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "9", + Order = 8, + TypeId = 3, + Value = "9" + }, + new + { + Id = new Guid("fb7f41ca-950b-4dc1-a0a6-bd9a221ab2ad"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "10", + Order = 9, + TypeId = 3, + Value = "10" + }, + new + { + Id = new Guid("a28b530f-ea38-4a2c-a16b-0b7fa3770d3c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "11", + Order = 10, + TypeId = 3, + Value = "11" + }, + new + { + Id = new Guid("7a004a11-32e1-40ae-ab35-0d3dc3a69785"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "12", + Order = 11, + TypeId = 3, + Value = "12" + }, + new + { + Id = new Guid("e0f2f4d1-4a5e-4997-8336-83c3c35f38df"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "13", + Order = 12, + TypeId = 3, + Value = "13" + }, + new + { + Id = new Guid("9c5aaf48-88ec-4c67-b936-2be45550f8bf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "14", + Order = 13, + TypeId = 3, + Value = "14" + }, + new + { + Id = new Guid("8dbd680c-ce49-4d2e-8a1a-05619685e240"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "15", + Order = 14, + TypeId = 3, + Value = "15" + }, + new + { + Id = new Guid("2f476f70-b1ef-419d-aad5-3911f1e3231f"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "16", + Order = 15, + TypeId = 3, + Value = "16" + }, + new + { + Id = new Guid("2c635ce2-fc18-47be-b3e9-98c211abf312"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "17", + Order = 16, + TypeId = 3, + Value = "17" + }, + new + { + Id = new Guid("f9d5b03b-624a-4f9f-8da3-1490ea5d2914"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "18", + Order = 17, + TypeId = 3, + Value = "18" + }, + new + { + Id = new Guid("4f4b249c-db60-4582-86ed-75cfee4edd0c"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "19", + Order = 18, + TypeId = 3, + Value = "19" + }, + new + { + Id = new Guid("220a1464-4d39-416c-b4b2-3093eb007298"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "20", + Order = 19, + TypeId = 3, + Value = "20" + }, + new + { + Id = new Guid("c887ca60-b05d-4d3c-ad1f-223c879b1a6d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "21", + Order = 20, + TypeId = 3, + Value = "21" + }, + new + { + Id = new Guid("2905765d-63fb-41fe-a111-ee2f1d03d62e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "22", + Order = 21, + TypeId = 3, + Value = "22" + }, + new + { + Id = new Guid("dbbe704a-8d6d-40e7-bd30-6974035b1fab"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "23", + Order = 22, + TypeId = 3, + Value = "23" + }, + new + { + Id = new Guid("cf7b9645-52ed-43a2-8267-267e0aed19b1"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "24", + Order = 23, + TypeId = 3, + Value = "24" + }, + new + { + Id = new Guid("454788d6-d0ad-4c07-878c-da3fd3cd05e1"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "25", + Order = 24, + TypeId = 3, + Value = "25" + }, + new + { + Id = new Guid("40d70d73-8582-4be6-a9e6-503b96ae3d49"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "26", + Order = 25, + TypeId = 3, + Value = "26" + }, + new + { + Id = new Guid("8f6610dc-ef46-4842-a57e-18d7aaa75931"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "27", + Order = 26, + TypeId = 3, + Value = "27" + }, + new + { + Id = new Guid("03858472-d4ce-47fd-9497-8051728766e4"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "28", + Order = 27, + TypeId = 3, + Value = "28" + }, + new + { + Id = new Guid("b1018e07-e90e-42ee-b399-19f3d0c14dd6"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "29", + Order = 28, + TypeId = 3, + Value = "29" + }, + new + { + Id = new Guid("a1669207-aa31-40fe-98d0-d941008d1655"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "30", + Order = 29, + TypeId = 3, + Value = "30" + }, + new + { + Id = new Guid("0936aa99-73e0-43de-b6df-334c1228a226"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + DistributionPeriodId = new Guid("3a7341a8-085c-461c-babc-6b78dd5d2c67"), + EsppExportValue = "31", + Order = 30, + TypeId = 3, + Value = "31" + }, + new + { + Id = new Guid("626ca076-f09e-4a7a-8610-b7de6337b24a"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 4, + Value = "Первый" + }, + new + { + Id = new Guid("032fbd02-67d0-4b8c-bed0-42629ab7113b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 4, + Value = "Второй" + }, + new + { + Id = new Guid("fa8a8f60-e41e-495e-ac86-35174d9976bf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 4, + Value = "Третий" + }, + new + { + Id = new Guid("d2f90168-2b49-42f2-820b-79db2c522adf"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 4, + Value = "Четвертый" + }, + new + { + Id = new Guid("12bb8db2-cf7f-4113-baff-6883770f1ba5"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 4, + Value = "Последний" + }, + new + { + Id = new Guid("18260e91-3fbe-4401-9edc-78dbc419370e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 5, + Value = "Январь" + }, + new + { + Id = new Guid("361526aa-3e1c-452e-bb44-0ade8521830d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 5, + Value = "Февраль" + }, + new + { + Id = new Guid("fad4bdb0-6c51-4810-a30b-6d031a0d4c46"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 5, + Value = "Март" + }, + new + { + Id = new Guid("06ab835d-3d3e-4057-8422-a553b6b40995"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 5, + Value = "Апрель" + }, + new + { + Id = new Guid("83f56b5d-b16b-4aa5-89d7-a253fee4e4ad"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 5, + Value = "Май" + }, + new + { + Id = new Guid("e679ec84-a9ee-4bed-a051-2b14edddcb18"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "6", + Order = 5, + TypeId = 5, + Value = "Июнь" + }, + new + { + Id = new Guid("d439808a-6a10-409b-8809-a755b7cca60b"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "7", + Order = 6, + TypeId = 5, + Value = "Июль" + }, + new + { + Id = new Guid("6e9972c4-6bf7-4fe4-b4ea-bbb333fb69c8"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "8", + Order = 7, + TypeId = 5, + Value = "Август" + }, + new + { + Id = new Guid("0883aac2-9d5b-4098-b672-c684d2a3a0c9"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "9", + Order = 8, + TypeId = 5, + Value = "Сентябрь" + }, + new + { + Id = new Guid("5e6592bc-acb2-45a4-979b-fdecf8457453"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "10", + Order = 9, + TypeId = 5, + Value = "Октябрь" + }, + new + { + Id = new Guid("edd7cb49-d6a0-4969-b2d6-1967da69b336"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "11", + Order = 10, + TypeId = 5, + Value = "Ноябрь" + }, + new + { + Id = new Guid("dd695fb2-4ad0-4cda-a4df-e15059c56b24"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "12", + Order = 11, + TypeId = 5, + Value = "Декабрь" + }, + new + { + Id = new Guid("2f473624-4eb3-49b4-a4b9-cc7fc08a50f5"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "1", + Order = 0, + TypeId = 6, + Value = "Января" + }, + new + { + Id = new Guid("f0003490-a249-44bd-814f-4566999915d8"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "2", + Order = 1, + TypeId = 6, + Value = "Февраля" + }, + new + { + Id = new Guid("f4c3fe38-aeaa-42f7-a9ba-190ea2dfe339"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "3", + Order = 2, + TypeId = 6, + Value = "Марта" + }, + new + { + Id = new Guid("06a8bd2f-68e1-42f5-961c-ac3b98a2181e"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "4", + Order = 3, + TypeId = 6, + Value = "Апреля" + }, + new + { + Id = new Guid("963b9c41-d607-444a-9fe0-fe429590e326"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "5", + Order = 4, + TypeId = 6, + Value = "Мая" + }, + new + { + Id = new Guid("ec8554c8-dee4-49a1-b1b7-474ad8ec1473"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "6", + Order = 5, + TypeId = 6, + Value = "Июня" + }, + new + { + Id = new Guid("e15c7c63-e29f-41a3-9c82-f70eb6c24fde"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "7", + Order = 6, + TypeId = 6, + Value = "Июля" + }, + new + { + Id = new Guid("0b1f3cea-301a-4d74-9ce1-2cd93b41897d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "8", + Order = 7, + TypeId = 6, + Value = "Августа" + }, + new + { + Id = new Guid("e2fa3769-f66f-4753-a161-35adad7717a5"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "9", + Order = 8, + TypeId = 6, + Value = "Сентября" + }, + new + { + Id = new Guid("c1de4aca-9f49-48ae-9279-cf9ec4092112"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "10", + Order = 9, + TypeId = 6, + Value = "Октября" + }, + new + { + Id = new Guid("a74b9ebd-bcd8-4537-b371-194de2fe0a4d"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "11", + Order = 10, + TypeId = 6, + Value = "Ноября" + }, + new + { + Id = new Guid("852a5ebd-4545-494b-bc69-c27409a41adc"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + EsppExportValue = "12", + Order = 11, + TypeId = 6, + Value = "Декабря" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchValue", b => + { + b.Property("ApplicationsInWorkId") + .HasColumnType("uuid"); + + b.Property("TypeValueId") + .HasColumnType("uuid"); + + b.Property("TypeConfigId") + .HasColumnType("uuid"); + + b.HasKey("ApplicationsInWorkId", "TypeValueId", "TypeConfigId"); + + b.HasIndex("TypeConfigId"); + + b.HasIndex("TypeValueId"); + + b.ToTable("EsppSchValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Host", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Ek") + .IsRequired() + .HasColumnType("text"); + + b.Property("EkStatusCode") + .HasColumnType("integer"); + + b.Property("IP") + .HasColumnType("text"); + + b.Property("LastLogon") + .HasColumnType("timestamp with time zone"); + + b.Property("ResponseAreaCode") + .HasColumnType("integer"); + + b.Property("WorkGroupId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("Ek") + .IsUnique(); + + b.HasIndex("EkStatusCode"); + + b.HasIndex("IP"); + + b.HasIndex("ResponseAreaCode"); + + b.HasIndex("WorkGroupId"); + + b.ToTable("Hosts"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Activate") + .HasColumnType("boolean"); + + b.Property("ApplicationInWorkId") + .HasColumnType("uuid"); + + b.Property("CreateNew") + .HasColumnType("boolean"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Deactivate") + .HasColumnType("boolean"); + + b.Property("OffScheduleIsActive") + .HasColumnType("boolean"); + + b.Property("OffTemplateIsActive") + .HasColumnType("boolean"); + + b.Property("OnScheduleIsActive") + .HasColumnType("boolean"); + + b.Property("OnTemplateIsActive") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationInWorkId") + .IsUnique(); + + b.ToTable("JobAutoControls"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobAutoControlInEkStatus", b => + { + b.Property("JobAutoControlId") + .HasColumnType("uuid"); + + b.Property("EkStatusCode") + .HasColumnType("integer"); + + b.HasKey("JobAutoControlId", "EkStatusCode"); + + b.HasIndex("EkStatusCode"); + + b.ToTable("JobAutoControlInEkStatus"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobEkMask", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("JobAutoControlId") + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("JobAutoControlId", "Name") + .IsUnique(); + + b.ToTable("JobEkMasks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpirationDate") + .HasColumnType("timestamp with time zone"); + + b.Property("GenerateDate") + .HasColumnType("timestamp with time zone"); + + b.Property("NextStatusCode") + .HasColumnType("integer"); + + b.Property("Number") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("text"); + + b.Property("StatusCode") + .HasColumnType("integer"); + + b.Property("TemplateId") + .HasColumnType("uuid"); + + b.Property("WorkGroup") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("NextStatusCode"); + + b.HasIndex("Number") + .IsUnique(); + + b.HasIndex("StatusCode"); + + b.HasIndex("TemplateId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("PARR.DAL.Models.OrderStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("OrderStatuses"); + + b.HasData( + new + { + Code = 1, + Description = "1-Направлен в группу", + Name = "New" + }, + new + { + Code = 2, + Description = "2-В работе", + Name = "InWork" + }, + new + { + Code = 3, + Description = "3-Приостановлен", + Name = "Stop" + }, + new + { + Code = 4, + Description = "4-Выполнен", + Name = "Complete" + }, + new + { + Code = 5, + Description = "5-Закрыт", + Name = "Closed" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.ParrComponent", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("ParrComponents"); + + b.HasData( + new + { + Id = 0, + Description = "API", + Name = "Api" + }, + new + { + Id = 1, + Description = "Загрузчик из АИХИТ", + Name = "AihitLoader" + }, + new + { + Id = 2, + Description = "Синхронизатор АИХИТ", + Name = "AihitSyncer" + }, + new + { + Id = 3, + Description = "Загрузчик нарядов из ЕСПП", + Name = "EsppOrderLoader" + }, + new + { + Id = 4, + Description = "Управление нарядами ЕСПП", + Name = "EsppOrderManager" + }, + new + { + Id = 5, + Description = "Синхронизатор расписаний", + Name = "EsppScheduleSync" + }, + new + { + Id = 6, + Description = "Синхронизатор шаблонов", + Name = "EsppTemplateSync" + }, + new + { + Id = 7, + Description = "Генератор шаблонов", + Name = "GeneratorTemplates" + }, + new + { + Id = 8, + Description = "Авто-контроль РР", + Name = "JobAutoControl" + }, + new + { + Id = 9, + Description = "Связывание нарядов ЕСПП с ПАРР (шаблонами, агентами)", + Name = "Master" + }, + new + { + Id = 10, + Description = "Рассчет даты следующего срабатывания", + Name = "NextRun" + }, + new + { + Id = 11, + Description = "Активатор шаблонов / расписаний", + Name = "TemplateActivator" + }, + new + { + Id = 12, + Description = "Автораспределение РР", + Name = "TemplateDistributor" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Process", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("EsppId") + .IsUnique(); + + b.ToTable("Processes"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("ResponseAreas"); + + b.HasData( + new + { + Code = 96, + Name = "96-ДВС" + }, + new + { + Code = 94, + Name = "94-ЗАБ" + }, + new + { + Code = 92, + Name = "92-ВСИБ" + }, + new + { + Code = 88, + Name = "88-КРАСН" + }, + new + { + Code = 83, + Name = "83-ЗСИБ" + }, + new + { + Code = 80, + Name = "80-ЮУР" + }, + new + { + Code = 76, + Name = "76-СВРД" + }, + new + { + Code = 63, + Name = "63-КБШ" + }, + new + { + Code = 61, + Name = "61-ПРИВ" + }, + new + { + Code = 58, + Name = "58-ЮВСТ" + }, + new + { + Code = 51, + Name = "51-СКВ" + }, + new + { + Code = 28, + Name = "28-СЕВ" + }, + new + { + Code = 24, + Name = "24-ГОР" + }, + new + { + Code = 17, + Name = "17-МСК" + }, + new + { + Code = 10, + Name = "10-КЛГ" + }, + new + { + Code = 1, + Name = "01-ОКТ" + }, + new + { + Code = 99, + Name = "00-ГВЦ" + }, + new + { + Code = 100, + Name = "ОБЩЕЕ" + }, + new + { + Code = 110, + Name = "ВП" + }, + new + { + Code = 111, + Name = "ОСК" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Robot", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Robots"); + + b.HasData( + new + { + Code = 1, + Description = "Робот по созданию/изменению шаблона наряда ЕСПП", + Name = "TemplateOrder" + }, + new + { + Code = 2, + Description = "Робот по созданию/изменению расписания шаблона наряда в ЕСПП", + Name = "ScheduleOrder" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotConfiguration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AttemptsNumber") + .HasColumnType("integer"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("LastRobotStatusUpdated") + .HasColumnType("timestamp with time zone"); + + b.Property("RobotCode") + .HasColumnType("integer"); + + b.Property("RobotStatusCode") + .HasColumnType("integer"); + + b.Property("TaskStatusCode") + .HasColumnType("integer"); + + b.Property("TemplateId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RobotCode"); + + b.HasIndex("RobotStatusCode"); + + b.HasIndex("TaskStatusCode"); + + b.HasIndex("TemplateId", "RobotCode") + .IsUnique(); + + b.ToTable("RobotConfigurations"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppMessage") + .HasColumnType("text"); + + b.Property("HistoryLevel") + .HasColumnType("integer"); + + b.Property("RobotConfigurationId") + .HasColumnType("uuid"); + + b.Property("RobotIp") + .HasColumnType("text"); + + b.Property("RobotMessage") + .HasColumnType("text"); + + b.Property("TaskStatusCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("HistoryLevel"); + + b.HasIndex("RobotConfigurationId"); + + b.HasIndex("TaskStatusCode"); + + b.ToTable("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistoryLevel", b => + { + b.Property("Level") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Level")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Level"); + + b.ToTable("RobotHistoryLevels"); + + b.HasData( + new + { + Level = 1, + Description = "Робот начал работу ", + Name = "Start" + }, + new + { + Level = 5, + Description = "Информация", + Name = "Information" + }, + new + { + Level = 10, + Description = "Ошибка", + Name = "Error" + }, + new + { + Level = 15, + Description = "Успешно завершил работу", + Name = "Complete" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("RobotStatuses"); + + b.HasData( + new + { + Code = 11, + Description = "Ожидание, ждет пока робот возьмет в работу.", + Name = "Wait" + }, + new + { + Code = 22, + Description = "Робот взял в работу.", + Name = "InProgress" + }, + new + { + Code = 33, + Description = "Ошибка отработки роботом. Требует ручного вмешательства.", + Name = "Error" + }, + new + { + Code = 44, + Description = "Робот успешно отработал.", + Name = "Complete" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Roles"); + + b.HasData( + new + { + Id = new Guid("c8f2f144-e6c2-45d7-ba66-5e9bbd376376"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Администратор", + Name = "administrator" + }, + new + { + Id = new Guid("13bca225-7fa4-42fa-9d80-d2d46de261fe"), + DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)), + Description = "Робот ЕСПП", + Name = "espp-robot" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Setting", b => + { + b.Property("Name") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Name"); + + b.ToTable("Settings"); + + b.HasData( + new + { + Name = "Initiator", + Description = "Инициатор регламентной работы, указывается при создании шаблона в ЕСПП.", + Value = "СТАРОСТИНА СВЕТЛАНА БОРИСОВНА (STAROSTINASB@GVC.OAO.RZD)" + }, + new + { + Name = "ClosingCode", + Description = "Код закрытия регламентной работы, указывается при создании шаблона в ЕСПП.", + Value = "выполнен" + }, + new + { + Name = "Category", + Description = "Категория создаваемого объекта в ЕСПП", + Value = "регламентная работа" + }, + new + { + Name = "TemplatePrefixName", + Description = "Префикс имени шаблона в ЕСПП", + Value = "%PREFIX%-ЭИТИ-ПТК-ПАРР" + }, + new + { + Name = "RobotAttemptsNumber", + Description = "Количество попыток выполнения задания роботом", + Value = "3" + }, + new + { + Name = "RobotWaitTime", + Description = "Время ожидания выполнения роботом задания", + Value = "00:15:00" + }, + new + { + Name = "ScheduleTimezone", + Description = "Расписание регламентной работы - В каком часовом поясе", + Value = "MSK" + }, + new + { + Name = "ScheduleExclude", + Description = "Расписание регламентной работы - Тип исключения", + Value = "Нет исключений" + }, + new + { + Name = "ScheduleRepeatRange", + Description = "Расписание регламентной работы - Диапазн повторов", + Value = "Отсутствует дата завершения" + }, + new + { + Name = "OrderSearchDeltaDate", + Description = "Промежуток времени для поиска нарядов в ЕСПП", + Value = "01:30:00" + }, + new + { + Name = "EsppRobotAccountTimeZoneHour", + Description = "Таймзона УЗ роботов в ЕСПП, в часах (может быть положительная и отрицательная)", + Value = "3" + }, + new + { + Name = "WeekendCacheTtl", + Description = "Время хранения в кэше данных о выходных и рабочих днях", + Value = "01:00:00" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Subprocess", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProcessId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("EsppId") + .IsUnique(); + + b.HasIndex("ProcessId"); + + b.ToTable("Subprocesses"); + }); + + modelBuilder.Entity("PARR.DAL.Models.TaskStatus", b => + { + b.Property("Code") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Code")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Code"); + + b.ToTable("TaskStatuses"); + + b.HasData( + new + { + Code = 10, + Description = "Требуется создание объекта в ЕСПП", + Name = "Creating" + }, + new + { + Code = 20, + Description = "Требуется обновление объекта в ЕСПП", + Name = "Updating" + }, + new + { + Code = 30, + Description = "Нормальное состояние объекта в ЕСПП и ПАРР. Объект в ПАРР соответствует объекту в ЕСПП", + Name = "Ok" + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Template", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationInWorkId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("HostId") + .HasColumnType("uuid"); + + b.Property("InitiatorComment") + .HasColumnType("text"); + + b.Property("InitiatorIp") + .HasColumnType("text"); + + b.Property("InitiatorParrComponentId") + .HasColumnType("integer"); + + b.Property("IsActiveSchedule") + .HasColumnType("boolean"); + + b.Property("IsActiveTemplate") + .HasColumnType("boolean"); + + b.Property("LastRun") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("NextRun") + .HasColumnType("timestamp with time zone"); + + b.Property("ScheduleEsppId") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationInWorkId"); + + b.HasIndex("HostId"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Templates"); + }); + + modelBuilder.Entity("PARR.DAL.Models.TemplateHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateAddedToHistory") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("InitiatorComment") + .HasColumnType("text"); + + b.Property("InitiatorIp") + .HasColumnType("text"); + + b.Property("InitiatorParrComponentId") + .HasColumnType("integer"); + + b.Property("IsActiveSchedule") + .HasColumnType("boolean"); + + b.Property("IsActiveTemplate") + .HasColumnType("boolean"); + + b.Property("LastRun") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("NextRun") + .HasColumnType("timestamp with time zone"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("TemplateHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Tnk", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("SubprocessId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("EsppId") + .IsUnique(); + + b.HasIndex("SubprocessId"); + + b.ToTable("Tnks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("Units", "unit", t => + { + t.HasComment("Таблица с ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitField", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AihitName") + .IsRequired() + .HasColumnType("text"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("EsppName") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AihitName"); + + b.HasIndex("EsppName"); + + b.ToTable("Fields", "unit", t => + { + t.HasComment("Справочник полей ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldInUnitFieldValue", b => + { + b.Property("FieldId") + .HasColumnType("uuid"); + + b.Property("FieldValueId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.HasKey("FieldId", "FieldValueId"); + + b.HasIndex("FieldValueId"); + + b.ToTable("FieldInFieldValues", "unit", t => + { + t.HasComment("Значения полей ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Value") + .IsUnique(); + + b.ToTable("FieldValues", "unit", t => + { + t.HasComment("Значения полей ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInField", b => + { + b.Property("UnitId") + .HasColumnType("uuid"); + + b.Property("FieldId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.HasKey("UnitId", "FieldId"); + + b.HasIndex("FieldId"); + + b.ToTable("UnitInFields", "unit", t => + { + t.HasComment("Справочник полей ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInUnit", b => + { + b.Property("ParentUnitId") + .HasColumnType("uuid"); + + b.Property("ChildUnitId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateSynced") + .HasColumnType("timestamp with time zone"); + + b.HasKey("ParentUnitId", "ChildUnitId"); + + b.HasIndex("ChildUnitId"); + + b.ToTable("UnitInUnits", "unit", t => + { + t.HasComment("Таблица связей иерархии между ЭК"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInValue", b => + { + b.Property("UnitId") + .HasColumnType("uuid"); + + b.Property("FieldId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("ValueId") + .HasColumnType("uuid"); + + b.HasKey("UnitId", "FieldId"); + + b.HasIndex("FieldId"); + + b.HasIndex("ValueId"); + + b.ToTable("UnitInValues", "unit", t => + { + t.HasComment("Таблица связи ЭК с полями и со значениями"); + }); + }); + + modelBuilder.Entity("PARR.DAL.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Ip") + .IsRequired() + .HasColumnType("text"); + + b.Property("LastLogon") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Ip") + .IsUnique(); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("PARR.DAL.Models.UsersInRole", b => + { + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("RoleId", "UserId"); + + b.HasIndex("UserId"); + + b.ToTable("UsersInRoles"); + }); + + modelBuilder.Entity("PARR.DAL.Models.WeekendDay", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Date") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.HasIndex("Date") + .IsUnique(); + + b.ToTable("WeekendDays"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Work", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateModified") + .HasColumnType("timestamp with time zone"); + + b.Property("EsppId") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("TemplateNameMask") + .IsRequired() + .HasColumnType("text"); + + b.Property("TemplateSuffix") + .HasColumnType("text"); + + b.Property("TnkId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("EsppId") + .IsUnique(); + + b.HasIndex("TnkId"); + + b.ToTable("Works"); + }); + + modelBuilder.Entity("PARR.DAL.Models.WorkGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ResponseAreaCode") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ResponseAreaCode"); + + b.ToTable("WorkGroups"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistory", b => + { + b.HasOne("PARR.DAL.Models.AgentHistoryLevel", "AgentHistoryLevel") + .WithMany("AgentHistories") + .HasForeignKey("HistoryLevelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Order", "Order") + .WithMany("AgentHistories") + .HasForeignKey("OrderId"); + + b.HasOne("PARR.DAL.Models.Template", "Template") + .WithMany("AgentHistories") + .HasForeignKey("TemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AgentHistoryLevel"); + + b.Navigation("Order"); + + b.Navigation("Template"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AppInWorkInWorkGroup", b => + { + b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork") + .WithMany("WorkGroups") + .HasForeignKey("ApplicationsInWorkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.WorkGroup", "WorkGroup") + .WithMany("AppInWorks") + .HasForeignKey("WorkGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationsInWork"); + + b.Navigation("WorkGroup"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Application", b => + { + b.HasOne("PARR.DAL.Models.ApplicationType", "ApplicationType") + .WithMany("Applications") + .HasForeignKey("ApplicationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationType"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b => + { + b.HasOne("PARR.DAL.Models.Application", "Application") + .WithMany("ApplicationsInHosts") + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Host", "Host") + .WithMany("ApplicationsInHosts") + .HasForeignKey("HostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Application"); + + b.Navigation("Host"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b => + { + b.HasOne("PARR.DAL.Models.Application", "Application") + .WithMany("ApplicationsInWorks") + .HasForeignKey("ApplicationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Work", "Work") + .WithMany("ApplicationsInWorks") + .HasForeignKey("WorkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Application"); + + b.Navigation("Work"); + }); + + modelBuilder.Entity("PARR.DAL.Models.DistributionPeriod", b => + { + b.HasOne("PARR.DAL.Models.DistributionPeriodType", "DistributionPeriodType") + .WithMany("Periods") + .HasForeignKey("Type") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DistributionPeriodType"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeConfig", b => + { + b.HasOne("PARR.DAL.Models.EsppSchType", "EsppSchType") + .WithMany("EsppSchTypeConfigs") + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.EsppSchTypeSchedule", "EsppSchTypeSchedule") + .WithMany("EsppSchTypeConfigs") + .HasForeignKey("TypeScheduleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EsppSchType"); + + b.Navigation("EsppSchTypeSchedule"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeValue", b => + { + b.HasOne("PARR.DAL.Models.DistributionPeriod", "DistributionPeriod") + .WithMany("EsppSchTypeValues") + .HasForeignKey("DistributionPeriodId"); + + b.HasOne("PARR.DAL.Models.EsppSchType", "EsppSchType") + .WithMany("EsppSchTypeValues") + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DistributionPeriod"); + + b.Navigation("EsppSchType"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchValue", b => + { + b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork") + .WithMany("EsppSchValues") + .HasForeignKey("ApplicationsInWorkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.EsppSchTypeConfig", "EsppSchTypeConfig") + .WithMany("EsppSchValues") + .HasForeignKey("TypeConfigId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.EsppSchTypeValue", "EsppSchTypeValue") + .WithMany("EsppSchValues") + .HasForeignKey("TypeValueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationsInWork"); + + b.Navigation("EsppSchTypeConfig"); + + b.Navigation("EsppSchTypeValue"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Host", b => + { + b.HasOne("PARR.DAL.Models.EkStatus", "EkStatus") + .WithMany("Hosts") + .HasForeignKey("EkStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.ResponseArea", "ResponseArea") + .WithMany("Hosts") + .HasForeignKey("ResponseAreaCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.WorkGroup", "WorkGroup") + .WithMany("Hosts") + .HasForeignKey("WorkGroupId"); + + b.Navigation("EkStatus"); + + b.Navigation("ResponseArea"); + + b.Navigation("WorkGroup"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b => + { + b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork") + .WithOne("JobAutoControl") + .HasForeignKey("PARR.DAL.Models.JobAutoControl", "ApplicationInWorkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationsInWork"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobAutoControlInEkStatus", b => + { + b.HasOne("PARR.DAL.Models.EkStatus", "EkStatus") + .WithMany("JobAutoControlInEkStatuses") + .HasForeignKey("EkStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.JobAutoControl", "JobAutoControl") + .WithMany("JobAutoControlInEkStatuses") + .HasForeignKey("JobAutoControlId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EkStatus"); + + b.Navigation("JobAutoControl"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobEkMask", b => + { + b.HasOne("PARR.DAL.Models.JobAutoControl", "JobAutoControl") + .WithMany("JobEkMasks") + .HasForeignKey("JobAutoControlId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("JobAutoControl"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Order", b => + { + b.HasOne("PARR.DAL.Models.OrderStatus", "NextStatus") + .WithMany("OrdersNext") + .HasForeignKey("NextStatusCode"); + + b.HasOne("PARR.DAL.Models.OrderStatus", "OrderStatus") + .WithMany("Orders") + .HasForeignKey("StatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Template", "Template") + .WithMany("Orders") + .HasForeignKey("TemplateId"); + + b.Navigation("NextStatus"); + + b.Navigation("OrderStatus"); + + b.Navigation("Template"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotConfiguration", b => + { + b.HasOne("PARR.DAL.Models.Robot", "Robot") + .WithMany("RobotConfigurations") + .HasForeignKey("RobotCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.RobotStatus", "RobotStatus") + .WithMany("RobotConfigurations") + .HasForeignKey("RobotStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.TaskStatus", "TaskStatus") + .WithMany("RobotConfigurations") + .HasForeignKey("TaskStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Template", "Template") + .WithMany("RobotConfigurations") + .HasForeignKey("TemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Robot"); + + b.Navigation("RobotStatus"); + + b.Navigation("TaskStatus"); + + b.Navigation("Template"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistory", b => + { + b.HasOne("PARR.DAL.Models.RobotHistoryLevel", "RobotHistoryLevel") + .WithMany("RobotHistories") + .HasForeignKey("HistoryLevel") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.RobotConfiguration", "RobotConfiguration") + .WithMany("RobotHistories") + .HasForeignKey("RobotConfigurationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.TaskStatus", "StatusTask") + .WithMany("RobotHistories") + .HasForeignKey("TaskStatusCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("RobotConfiguration"); + + b.Navigation("RobotHistoryLevel"); + + b.Navigation("StatusTask"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Subprocess", b => + { + b.HasOne("PARR.DAL.Models.Process", "Process") + .WithMany("Subprocesses") + .HasForeignKey("ProcessId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Process"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Template", b => + { + b.HasOne("PARR.DAL.Models.ApplicationsInWork", "ApplicationsInWork") + .WithMany("Templates") + .HasForeignKey("ApplicationInWorkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Host", "Host") + .WithMany("Templates") + .HasForeignKey("HostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApplicationsInWork"); + + b.Navigation("Host"); + }); + + modelBuilder.Entity("PARR.DAL.Models.TemplateHistory", b => + { + b.HasOne("PARR.DAL.Models.Template", "Template") + .WithMany("TemplateHistories") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Template"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Tnk", b => + { + b.HasOne("PARR.DAL.Models.Subprocess", "Subprocess") + .WithMany("Tnks") + .HasForeignKey("SubprocessId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subprocess"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldInUnitFieldValue", b => + { + b.HasOne("PARR.DAL.Models.Unit.UnitField", "Field") + .WithMany("FieldValues") + .HasForeignKey("FieldId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.UnitFieldValue", "FieldValue") + .WithMany("FieldValues") + .HasForeignKey("FieldValueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Field"); + + b.Navigation("FieldValue"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInField", b => + { + b.HasOne("PARR.DAL.Models.Unit.UnitField", "UnitField") + .WithMany("Units") + .HasForeignKey("FieldId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.Unit", "Unit") + .WithMany("UnitFields") + .HasForeignKey("UnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Unit"); + + b.Navigation("UnitField"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInUnit", b => + { + b.HasOne("PARR.DAL.Models.Unit.Unit", "Child") + .WithMany("Parents") + .HasForeignKey("ChildUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.Unit", "Parent") + .WithMany("Childs") + .HasForeignKey("ParentUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Child"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInValue", b => + { + b.HasOne("PARR.DAL.Models.Unit.UnitField", "Field") + .WithMany("UnitInValues") + .HasForeignKey("FieldId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.Unit", "Unit") + .WithMany("UnitValues") + .HasForeignKey("UnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.UnitFieldValue", "Value") + .WithMany("UnitInValues") + .HasForeignKey("ValueId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Field"); + + b.Navigation("Unit"); + + b.Navigation("Value"); + }); + + modelBuilder.Entity("PARR.DAL.Models.UsersInRole", b => + { + b.HasOne("PARR.DAL.Models.Role", "Role") + .WithMany("Users") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.User", "User") + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Work", b => + { + b.HasOne("PARR.DAL.Models.Tnk", "Tnk") + .WithMany("Works") + .HasForeignKey("TnkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Tnk"); + }); + + modelBuilder.Entity("PARR.DAL.Models.WorkGroup", b => + { + b.HasOne("PARR.DAL.Models.ResponseArea", "ResponseArea") + .WithMany("WorkGroups") + .HasForeignKey("ResponseAreaCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ResponseArea"); + }); + + modelBuilder.Entity("PARR.DAL.Models.AgentHistoryLevel", b => + { + b.Navigation("AgentHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Application", b => + { + b.Navigation("ApplicationsInHosts"); + + b.Navigation("ApplicationsInWorks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b => + { + b.Navigation("Applications"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ApplicationsInWork", b => + { + b.Navigation("EsppSchValues"); + + b.Navigation("JobAutoControl"); + + b.Navigation("Templates"); + + b.Navigation("WorkGroups"); + }); + + modelBuilder.Entity("PARR.DAL.Models.DistributionPeriod", b => + { + b.Navigation("EsppSchTypeValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.DistributionPeriodType", b => + { + b.Navigation("Periods"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EkStatus", b => + { + b.Navigation("Hosts"); + + b.Navigation("JobAutoControlInEkStatuses"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchType", b => + { + b.Navigation("EsppSchTypeConfigs"); + + b.Navigation("EsppSchTypeValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeConfig", b => + { + b.Navigation("EsppSchValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeSchedule", b => + { + b.Navigation("EsppSchTypeConfigs"); + }); + + modelBuilder.Entity("PARR.DAL.Models.EsppSchTypeValue", b => + { + b.Navigation("EsppSchValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Host", b => + { + b.Navigation("ApplicationsInHosts"); + + b.Navigation("Templates"); + }); + + modelBuilder.Entity("PARR.DAL.Models.JobAutoControl", b => + { + b.Navigation("JobAutoControlInEkStatuses"); + + b.Navigation("JobEkMasks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Order", b => + { + b.Navigation("AgentHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.OrderStatus", b => + { + b.Navigation("Orders"); + + b.Navigation("OrdersNext"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Process", b => + { + b.Navigation("Subprocesses"); + }); + + modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b => + { + b.Navigation("Hosts"); + + b.Navigation("WorkGroups"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Robot", b => + { + b.Navigation("RobotConfigurations"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotConfiguration", b => + { + b.Navigation("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotHistoryLevel", b => + { + b.Navigation("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.RobotStatus", b => + { + b.Navigation("RobotConfigurations"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Role", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Subprocess", b => + { + b.Navigation("Tnks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.TaskStatus", b => + { + b.Navigation("RobotConfigurations"); + + b.Navigation("RobotHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Template", b => + { + b.Navigation("AgentHistories"); + + b.Navigation("Orders"); + + b.Navigation("RobotConfigurations"); + + b.Navigation("TemplateHistories"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Tnk", b => + { + b.Navigation("Works"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b => + { + b.Navigation("Childs"); + + b.Navigation("Parents"); + + b.Navigation("UnitFields"); + + b.Navigation("UnitValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitField", b => + { + b.Navigation("FieldValues"); + + b.Navigation("UnitInValues"); + + b.Navigation("Units"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitFieldValue", b => + { + b.Navigation("FieldValues"); + + b.Navigation("UnitInValues"); + }); + + modelBuilder.Entity("PARR.DAL.Models.User", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("PARR.DAL.Models.Work", b => + { + b.Navigation("ApplicationsInWorks"); + }); + + modelBuilder.Entity("PARR.DAL.Models.WorkGroup", b => + { + b.Navigation("AppInWorks"); + + b.Navigation("Hosts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/PARR.DAL/Migrations/20250522042529_tblUnitInUnits.cs b/PARR.DAL/Migrations/20250522042529_tblUnitInUnits.cs new file mode 100644 index 00000000..67c47b04 --- /dev/null +++ b/PARR.DAL/Migrations/20250522042529_tblUnitInUnits.cs @@ -0,0 +1,59 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PARR.DAL.Migrations +{ + /// + public partial class tblUnitInUnits : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "UnitInUnits", + schema: "unit", + columns: table => new + { + ParentUnitId = table.Column(type: "uuid", nullable: false), + ChildUnitId = table.Column(type: "uuid", nullable: false), + DateCreated = table.Column(type: "timestamp with time zone", nullable: false), + DateSynced = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_UnitInUnits", x => new { x.ParentUnitId, x.ChildUnitId }); + table.ForeignKey( + name: "FK_UnitInUnits_Units_ChildUnitId", + column: x => x.ChildUnitId, + principalSchema: "unit", + principalTable: "Units", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_UnitInUnits_Units_ParentUnitId", + column: x => x.ParentUnitId, + principalSchema: "unit", + principalTable: "Units", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }, + comment: "Таблица связей иерархии между ЭК"); + + migrationBuilder.CreateIndex( + name: "IX_UnitInUnits_ChildUnitId", + schema: "unit", + table: "UnitInUnits", + column: "ChildUnitId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "UnitInUnits", + schema: "unit"); + } + } +} diff --git a/PARR.DAL/Migrations/DataContextModelSnapshot.cs b/PARR.DAL/Migrations/DataContextModelSnapshot.cs index 6922c5c4..6c47956e 100644 --- a/PARR.DAL/Migrations/DataContextModelSnapshot.cs +++ b/PARR.DAL/Migrations/DataContextModelSnapshot.cs @@ -2651,6 +2651,30 @@ namespace PARR.DAL.Migrations }); }); + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInUnit", b => + { + b.Property("ParentUnitId") + .HasColumnType("uuid"); + + b.Property("ChildUnitId") + .HasColumnType("uuid"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone"); + + b.Property("DateSynced") + .HasColumnType("timestamp with time zone"); + + b.HasKey("ParentUnitId", "ChildUnitId"); + + b.HasIndex("ChildUnitId"); + + b.ToTable("UnitInUnits", "unit", t => + { + t.HasComment("Таблица связей иерархии между ЭК"); + }); + }); + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInValue", b => { b.Property("UnitId") @@ -3213,6 +3237,25 @@ namespace PARR.DAL.Migrations b.Navigation("UnitField"); }); + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInUnit", b => + { + b.HasOne("PARR.DAL.Models.Unit.Unit", "Child") + .WithMany("Parents") + .HasForeignKey("ChildUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PARR.DAL.Models.Unit.Unit", "Parent") + .WithMany("Childs") + .HasForeignKey("ParentUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Child"); + + b.Navigation("Parent"); + }); + modelBuilder.Entity("PARR.DAL.Models.Unit.UnitInValue", b => { b.HasOne("PARR.DAL.Models.Unit.UnitField", "Field") @@ -3441,6 +3484,10 @@ namespace PARR.DAL.Migrations modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b => { + b.Navigation("Childs"); + + b.Navigation("Parents"); + b.Navigation("UnitFields"); b.Navigation("UnitValues"); diff --git a/PARR.DAL/Models/Unit/Unit.cs b/PARR.DAL/Models/Unit/Unit.cs index 86705e9c..647546d3 100644 --- a/PARR.DAL/Models/Unit/Unit.cs +++ b/PARR.DAL/Models/Unit/Unit.cs @@ -31,5 +31,18 @@ namespace PARR.DAL.Models.Unit public ICollection UnitFields { get; set; } = new HashSet(); public ICollection UnitValues { get; set; } = new HashSet(); + + + /// + /// Получить всех родителей + /// + [InverseProperty(nameof(UnitInUnit.ChildUnit))] + public ICollection ParentUnits { get; set; } = new HashSet(); + + /// + /// Получить детей + /// + [InverseProperty(nameof(UnitInUnit.ParentUnit))] + public ICollection ChildUnits { get; set; } = new HashSet(); } } diff --git a/PARR.DAL/Models/Unit/UnitInUnit.cs b/PARR.DAL/Models/Unit/UnitInUnit.cs new file mode 100644 index 00000000..b7ad819b --- /dev/null +++ b/PARR.DAL/Models/Unit/UnitInUnit.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore; +using PARR.DAL.Context; +using System.ComponentModel.DataAnnotations.Schema; + +namespace PARR.DAL.Models.Unit +{ + /// + /// Связи иерархии между ЭК + /// + [Table("UnitInUnits", Schema = DataContextSettings.Unit)] + [Comment("Таблица связей иерархии между ЭК")] + [PrimaryKey(nameof(ParentUnitId), nameof(ChildUnitId))] + public class UnitInUnit + { + public Guid ParentUnitId { get; set; } + + public Guid ChildUnitId { get; set; } + + public DateTimeOffset DateCreated { get; set; } + + public DateTimeOffset? DateSynced { get; set; } + + + [ForeignKey(nameof(ParentUnitId))] + public Unit? ParentUnit { get; set; } + + [ForeignKey(nameof(ChildUnitId))] + public Unit? ChildUnit { get; set; } + } +} diff --git a/PARR.Test/Program.cs b/PARR.Test/Program.cs index 0eb40025..1fa0985f 100644 --- a/PARR.Test/Program.cs +++ b/PARR.Test/Program.cs @@ -8,10 +8,10 @@ using PARR.TemplateDistributor; IHost host = Host.CreateDefaultBuilder(args) .ConfigureServices((hostContext, services) => { - services.InstallEsppApiServices(hostContext.Configuration); - services.InstallBllServices(hostContext.Configuration); + //services.InstallEsppApiServices(hostContext.Configuration); + //services.InstallBllServices(hostContext.Configuration); services.InstallDalServices(hostContext.Configuration); - services.InstallTemplateDistributorSerivces(hostContext.Configuration); + //services.InstallTemplateDistributorSerivces(hostContext.Configuration); services.AddHostedService(); }) diff --git a/PARR.Test/Worker.cs b/PARR.Test/Worker.cs index d6622365..3b437594 100644 --- a/PARR.Test/Worker.cs +++ b/PARR.Test/Worker.cs @@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore; using PARR.BLL.Services.Interfaces; using PARR.Constants; using PARR.DAL.Services.Interfaces; +using PARR.DAL.Services.Interfaces.Unit; using PARR.EsppApi; using PARR.EsppApi.Constants; using PARR.EsppApi.Models.Query; @@ -42,6 +43,23 @@ namespace PARR.Test #endregion + #region unit + + + //using (var scope = serviceProvider.CreateScope()) + //{ + // var service = scope.ServiceProvider.GetService(); + + + // var unit = await service.Get().Include(t => t.Parents).Include(t => t.Childs).FirstOrDefaultAsync(t => t.Id == Guid.Parse("0f89e2ec-0e4d-4de6-b990-c55e8308accf")); + + // var parent = unit?.Parents; + + + //} + + #endregion + #region Calendar //var testCalendar = new BLL.Services.Implementations.Test(calendarService); diff --git a/README.md b/README.md index c01890f5..5118f964 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,11 @@ - ~~PARR.AIHIT - логика синхронизации АИХ ИТ с БД PARR~~ - ~~PARR.AIHITWorker - worker для PARR.AIHIT~~ -- PARR.AIHITLoader - загрузка из АИХ ИТ в очередь по расписанию +~~- PARR.AIHITLoader - загрузка из АИХ ИТ в очередь по расписанию~~ +- PARR.AIHITMainLoader - загрузка из АИХ ИТ в очередь по расписанию - PARR.AIHITLoaderWorker -- PARR.AIHITSyncer - синхронизация АИХ ИТ из очереди в ПАРР +~~- PARR.AIHITSyncer - синхронизация АИХ ИТ из очереди в ПАРР~~ +- PARR.AIHITMainSyncer - синхронизация АИХ ИТ из очереди в ПАРР - PARR.AIHITSyncerWorker - PARR.API - API - PARR.BLL - общие методы и настройки для проектов diff --git a/docker-compose.aihit-relationship-syncer.yml b/docker-compose.aihit-relationship-syncer.yml new file mode 100644 index 00000000..f1e24b12 --- /dev/null +++ b/docker-compose.aihit-relationship-syncer.yml @@ -0,0 +1,20 @@ +version: '3.4' + +#AIHIT RELATIONSHIPS SYNCER +services: + aihit-loader: + image: harbor.dvgd.rzd/parr/parr-aihit-relationships-syncer:${tag:-latest} + container_name: parr-aihit-relationships-syncer + restart: unless-stopped + environment: + - ASPNETCORE_ENVIRONMENT=Production + - TZ=Europe/Moscow + volumes: + - /var/log/parr-aihit-relationships-syncer:/app/log + logging: + driver: fluentd + options: + fluentd-address: dvgd-efk-01.dvgd.oao.rzd:24224 + fluentd-retry-wait: '30s' + fluentd-max-retries: '30' + tag: parr.aihit-relationships-syncer.serilog \ No newline at end of file diff --git a/docker-compose.dcproj b/docker-compose.dcproj index 185887b9..429ee251 100644 --- a/docker-compose.dcproj +++ b/docker-compose.dcproj @@ -10,6 +10,7 @@ +