From 7d369f84990aa9a71a9a635731f96afa78a8f767 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Thu, 3 Oct 2024 11:09:38 +0500 Subject: [PATCH 01/22] =?UTF-8?q?=D0=9D=D0=B0=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B8=20=D0=BF=D0=BE=20=D0=BA=D0=B0=D1=87=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=B2=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Data/DataSaubStatDto.cs | 135 ---------- .../Repositories/IDataSaubStatRepository.cs | 2 +- .../Services/ITelemetryDataSaubService.cs | 3 +- .../Services/DataSaubStatServiceTest.cs | 2 +- AsbCloudInfrastructure/DependencyInjection.cs | 3 +- .../Repository/DataSaubStatRepository.cs | 2 +- .../DataSaubStatDrillingQualityService.cs | 239 ++++++++++++++++++ .../Services/DataSaubStatService.cs | 2 +- .../Report/ProcessMapReportDrillingService.cs | 1 + .../Services/SAUB/TelemetryDataSaubService.cs | 14 +- .../Repository/DataSaubStatRepositoryTest.cs | 2 +- AsbCloudWebApi/appsettings.json | 10 +- 12 files changed, 267 insertions(+), 148 deletions(-) delete mode 100644 AsbCloudApp/Data/DataSaubStatDto.cs create mode 100644 AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs diff --git a/AsbCloudApp/Data/DataSaubStatDto.cs b/AsbCloudApp/Data/DataSaubStatDto.cs deleted file mode 100644 index 3bb46d6d..00000000 --- a/AsbCloudApp/Data/DataSaubStatDto.cs +++ /dev/null @@ -1,135 +0,0 @@ -using System; -using AsbCloudApp.Data.WellOperation; - -namespace AsbCloudApp.Data; - -/// -/// dto для хранения данных статистики сауб -/// -public class DataSaubStatDto:IId -{ - /// - /// - /// - public int Id { get; set; } - - /// - /// Дата и время начала - /// - public DateTimeOffset DateStart { get; set; } - - /// - /// Дата и время окончания - /// - public DateTimeOffset DateEnd { get; set; } - - /// - /// Глубина забоя по стволу начальная - /// - public double DepthStart { get; set; } - - /// - /// Глубина забоя по стволу конечная - /// - public double DepthEnd { get; set; } - - /// - /// Скорость бурения - /// - public double Speed { get; set; } - - /// - /// Ограничение скорости блока - /// - public double? BlockSpeedSp { get; set; } - - /// - /// Давление - /// - public double Pressure { get; set; } - - /// - /// Давление холостого хода - /// - public double? PressureIdle { get; set; } - - /// - /// Ограничение фактического давления - /// - public double? PressureSp { get; set; } - - /// - /// Фактическая нагрузка - /// - public double AxialLoad { get; set; } - - /// - /// Ограничение факт. нагрузки - /// - public double? AxialLoadSp { get; set; } - - /// - /// Максимально допустимая нагрузка - /// - public double? AxialLoadLimitMax { get; set; } - - /// - /// Фактический момент - /// - public double RotorTorque { get; set; } - - /// - /// Ограничение факт. момента - /// - public double? RotorTorqueSp { get; set; } - - /// - /// Максимально допустимый момент - /// - public double? RotorTorqueLimitMax { get; set; } - - /// - /// Работа при достижении ограничения - /// - public short? IdFeedRegulator { get; set; } - - /// - /// Фактическая скорость оборотов ВСП - /// - public double RotorSpeed { get; set; } - - /// - /// Название автоопределённой операции - /// - public int IdCategory { get; set; } - - /// - /// Флаги подсистем - /// - public int EnabledSubsystems { get; set; } - - /// - /// Наличие или отсутствие осцилляции - /// - public bool HasOscillation { get; set; } - - /// - /// Фактический расход - /// - public double Flow { get; set; } - - /// - /// Ключ телеметрии - /// - public int IdTelemetry { get; set; } - - /// - /// Телеметрия - /// - public TelemetryDto Telemetry { get; set; } = null!; - - /// - /// Категория автоопределенной операции - /// - public WellOperationCategoryDto OperationCategory { get; set; } = null!; -} diff --git a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs index d419ad82..628276bc 100644 --- a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs +++ b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data; +using AsbCloudApp.Data.DataSaubStat; using AsbCloudApp.Services; using System; using System.Collections.Generic; diff --git a/AsbCloudApp/Services/ITelemetryDataSaubService.cs b/AsbCloudApp/Services/ITelemetryDataSaubService.cs index 4a23ee87..fc4bbda8 100644 --- a/AsbCloudApp/Services/ITelemetryDataSaubService.cs +++ b/AsbCloudApp/Services/ITelemetryDataSaubService.cs @@ -21,8 +21,9 @@ public interface ITelemetryDataSaubService : ITelemetryDataService /// /// + /// /// - Task> Get(IEnumerable idsTelemetries, bool isBitOnBottom, DateTimeOffset geDate, DateTimeOffset leDate, int take, CancellationToken token); + Task> Get(IEnumerable idsTelemetries, bool isBitOnBottom, DateTimeOffset geDate, DateTimeOffset leDate, int take, CancellationToken token, IEnumerable? idsFeedRegulators = null); /// /// усредненная статистика по 1м за весь период diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs index 80783c73..1e507f6f 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data; +using AsbCloudApp.Data.DataSaubStat; using AsbCloudApp.Data.DetectedOperation; using AsbCloudApp.Data.SAUB; using AsbCloudApp.Repositories; diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 859cfba5..86e4df64 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -319,7 +319,8 @@ public static class DependencyInjection services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); + //services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient< diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs index d8932b28..cb986215 100644 --- a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs +++ b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data; +using AsbCloudApp.Data.DataSaubStat; using AsbCloudApp.Repositories; using AsbCloudApp.Requests; using AsbCloudApp.Services; diff --git a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs new file mode 100644 index 00000000..1726af5c --- /dev/null +++ b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs @@ -0,0 +1,239 @@ +using AsbCloudApp.Data; +using AsbCloudApp.Data.DataSaubStat; +using AsbCloudApp.Data.DetectedOperation; +using AsbCloudApp.Data.SAUB; +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; +using AsbCloudApp.Services; +using AsbCloudDb.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace AsbCloudInfrastructure.Services; + + +public class DataSaubStatDrillingQualityService : IDataSaubStatService +{ + private IDataSaubStatRepository dataSaubStatRepository; + private ITelemetryDataCache telemetryDataCache; + private ITelemetryDataSaubService dataSaubService; + private IDetectedOperationRepository detectedOperationRepository; + + public DataSaubStatDrillingQualityService( + IDataSaubStatRepository dataSaubStatRepository, + ITelemetryDataCache telemetryDataCache, + ITelemetryDataSaubService dataSaubService, + IDetectedOperationRepository detectedOperationRepository) + { + this.dataSaubStatRepository = dataSaubStatRepository; + this.telemetryDataCache = telemetryDataCache; + this.dataSaubService = dataSaubService; + this.detectedOperationRepository = detectedOperationRepository; + } + + public async Task CreateStatAsync(int lastDaysFilter, Action onProgressCallback, CancellationToken token) + { + //to do + var cacheRequest = new TelemetryDataRequest() + { + GeDate = DateTime.UtcNow.AddDays(-5000) + }; + var idTelemetries = telemetryDataCache.GetIds(cacheRequest).ToArray(); + + if (!idTelemetries.Any()) + return; + + var stats = new List(); + //await dataSaubStatRepository.GetLastsAsync(idTelemetries, token); + + //for (var i = 0; i < idTelemetries.Length; i++) + //{ + // var idTelemetry = idTelemetries[i]; + // var lastDate = stats.FirstOrDefault(s => s.IdTelemetry == idTelemetry)?.DateEnd.ToUniversalTime() ?? DateTimeOffset.UnixEpoch; + // var statsCount = await CreateStatForTelemetryFromDate(idTelemetry, lastDate, token); + // if(onProgressCallback != null) + // onProgressCallback($"Calculate stat for telemetry: {idTelemetry}; from {lastDate}; results count: {statsCount};", 1d * i / idTelemetries.Length); + //} + } + + private async Task CreateStatForTelemetryFromDate( + int idTelemetry, + DateTimeOffset geDate, + CancellationToken token) + { + var leDate = DateTimeOffset.UtcNow; + + var dataSaub = await dataSaubService.Get([idTelemetry], true, geDate, leDate, 100_000, token); + + if (!dataSaub.Any()) + return 0; + + if (dataSaub is not TelemetryDataSaubDto[] dataSaubArray) + dataSaubArray = dataSaub.ToArray(); + + var dataSaubStats = CreateDataSaubStat(dataSaubArray); + + return 0; + + //return await dataSaubStatRepository.InsertRangeAsync(dataSaubStats, token); + } + + private static IEnumerable CreateDataSaubStat2(int idFeedRegulator, TelemetryDataSaubDto[] dataSaub) + { + var result = new List(); + + var indexStart = 0; + var indexEnd = 0; + + while (indexEnd < dataSaub.Count()) + { + indexStart = Array.FindIndex(dataSaub, indexEnd, t => t.IdFeedRegulator == idFeedRegulator); + if (indexStart < 0) + break; + + indexEnd = Array.FindIndex(dataSaub, indexStart, t => t.IdFeedRegulator != idFeedRegulator); + + if (indexEnd < 0) + indexEnd = dataSaub.Length - 1; + + if (indexEnd == indexStart) + { + continue; + } + + + var length = indexEnd - indexStart + 1; + + var subset = dataSaub.AsSpan(indexStart, length); + + if (length <= 2 || (subset[^1].WellDepth - subset[0].WellDepth) < 0.001) + continue; // мелкие выборки не учитываем. + + var stats = CalcStats(subset); + result.Add(stats); + + } + return result; + } + + private static Dictionary> CreateDataSaubStat(TelemetryDataSaubDto[] dataSaub) + { + + var dict = new Dictionary>() { + { 1, new List() }, + { 2, new List() }, + { 3, new List() }, + { 4, new List() }, + }; + + foreach (var item in dict) + { + var data = CreateDataSaubStat2(item.Key, dataSaub); + item.Value.AddRange(data); + } + + return dict; + } + + private static DataSaubStatDrillingQualityDto CalcStats(Span dataSaub) + { + var depthDrillingQuality = CalcAggregate(dataSaub); + + var result = new DataSaubStatDrillingQualityDto(); + result.DepthStart = dataSaub[0].WellDepth; + result.DepthEnd = dataSaub[^1].WellDepth; + result.DateStart = dataSaub[0].DateTime; + result.DateEnd = dataSaub[^1].DateTime; + result.DepthDrillingQuality = depthDrillingQuality; + + return result; + } + + private static DataSaubStatDto CalcStat(DetectedOperationDto operation, Span span) + { + var aggregatedValues = CalcAggregate(span); + var dateStart = span[0].DateTime; + var dateEnd = span[^1].DateTime; + var depthStart = span[0].WellDepth; + var depthEnd = span[^1].WellDepth; + var speed = ((depthEnd - depthStart) / (dateEnd - dateStart).TotalHours); + + var processMapDrillingCacheItem = new DataSaubStatDto + { + DateStart = dateStart, + DateEnd = dateEnd, + DepthStart = depthStart, + DepthEnd = depthEnd, + Speed = speed, + BlockSpeedSp = span[0].BlockSpeedSp, + Pressure = aggregatedValues.Pressure, + PressureIdle = span[0].PressureIdle, + PressureSp = span[0].PressureSp, + AxialLoad = aggregatedValues.AxialLoad, + AxialLoadSp = span[0].AxialLoadSp, + AxialLoadLimitMax = span[0].AxialLoadLimitMax, + RotorTorque = aggregatedValues.RotorTorque, + RotorTorqueSp = span[0].RotorTorqueSp, + RotorTorqueLimitMax = span[0].RotorTorqueLimitMax, + IdFeedRegulator = span[0].IdFeedRegulator, + RotorSpeed = aggregatedValues.RotorSpeed, + IdCategory = operation.IdCategory, + EnabledSubsystems = operation.EnabledSubsystems, + HasOscillation = operation.EnabledSubsystems.IsAutoOscillation, + IdTelemetry = operation.IdTelemetry, + Flow = aggregatedValues.Flow + }; + return processMapDrillingCacheItem; + } + + private static ( + double Pressure, + double AxialLoad, + double RotorTorque, + double RotorSpeed, + double Flow + ) CalcAggregate(Span span) + { + var sumPressure = 0.0; + var sumAxialLoad = 0.0; + var sumRotorTorque = 0.0; + var sumRotorSpeed = 0.0; + var flow = span[0].Flow ?? 0.0; + var diffDepthTotal = span[^1].WellDepth - span[0].WellDepth; + for (var i = 0; i < span.Length - 1; i++) + { + var diffDepth = span[i + 1].WellDepth - span[i].WellDepth; + sumPressure += diffDepth * span[i].Pressure; + sumAxialLoad += diffDepth * span[i].AxialLoad; + sumRotorTorque += diffDepth * span[i].RotorTorque; + sumRotorSpeed += diffDepth * span[i].RotorSpeed; + flow = span[i + 1].Flow > flow ? span[i + 1].Flow ?? 0.0 : flow; + } + return ( + Pressure: sumPressure / diffDepthTotal, + AxialLoad: sumAxialLoad / diffDepthTotal, + RotorTorque: sumRotorTorque / diffDepthTotal, + RotorSpeed: sumRotorSpeed / diffDepthTotal, + Flow: flow + ); + } + + private static bool IsNewCacheItem(TelemetryDataSaubDto previous, TelemetryDataSaubDto current) + { + return !(current.Mode == previous.Mode) + || !(current.WellDepth >= previous.WellDepth) + || !(current.BlockSpeedSp == previous.BlockSpeedSp) + || !(current.PressureIdle == previous.PressureIdle) + || !(current.PressureSp == previous.PressureSp) + || !(current.AxialLoadSp == previous.AxialLoadSp) + || !(current.AxialLoadLimitMax == previous.AxialLoadLimitMax) + || !(current.HookWeightIdle == previous.HookWeightIdle) + || !(current.RotorTorqueIdle == previous.RotorTorqueIdle) + || !(current.RotorTorqueSp == previous.RotorTorqueSp) + || !(current.RotorTorqueLimitMax == previous.RotorTorqueLimitMax) + || !(current.IdFeedRegulator == previous.IdFeedRegulator); + } +} diff --git a/AsbCloudInfrastructure/Services/DataSaubStatService.cs b/AsbCloudInfrastructure/Services/DataSaubStatService.cs index 82ee0416..f1722ba5 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatService.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data; +using AsbCloudApp.Data.DataSaubStat; using AsbCloudApp.Data.DetectedOperation; using AsbCloudApp.Data.SAUB; using AsbCloudApp.Repositories; diff --git a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs index cae5bdce..574a320e 100644 --- a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs @@ -1,4 +1,5 @@ using AsbCloudApp.Data; +using AsbCloudApp.Data.DataSaubStat; using AsbCloudApp.Data.ProcessMaps; using AsbCloudApp.Data.ProcessMaps.Operations; using AsbCloudApp.Data.ProcessMaps.Report; diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs index 0abd8fdf..c864eb7d 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs @@ -37,7 +37,14 @@ public class TelemetryDataSaubService : TelemetryDataBaseService> Get(IEnumerable idsTelemetries, bool isBitOnBottom, DateTimeOffset geDate, DateTimeOffset leDate, int take, CancellationToken token) + public async Task> Get( + IEnumerable idsTelemetries, + bool isBitOnBottom, + DateTimeOffset geDate, + DateTimeOffset leDate, + int take, + CancellationToken token, + IEnumerable? idsFeedRegulators) { var offsetDict = new Dictionary(); foreach (var idTelemetry in idsTelemetries) @@ -56,6 +63,11 @@ public class TelemetryDataSaubService : TelemetryDataBaseService Math.Abs(t.BitDepth - t.WellDepth) < 0.0001); + if (idsFeedRegulators != null && idsFeedRegulators.Any()) + query = query + .Where(t => t.IdFeedRegulator.HasValue) + .Where(t => idsFeedRegulators.Contains(t.IdFeedRegulator!.Value)); + query = query .OrderBy(t => t.DateTime) .Take(take); diff --git a/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs b/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs index e69cc692..7919a445 100644 --- a/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs +++ b/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data; +using AsbCloudApp.Data.DataSaubStat; using AsbCloudApp.Repositories; using AsbCloudDb.Model; using Mapster; diff --git a/AsbCloudWebApi/appsettings.json b/AsbCloudWebApi/appsettings.json index 72d50f57..ae879099 100644 --- a/AsbCloudWebApi/appsettings.json +++ b/AsbCloudWebApi/appsettings.json @@ -7,10 +7,10 @@ } }, "ConnectionStrings": { - "DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True", - "DebugConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True", - "TestConnection": "Host=localhost;Database=test;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True", - "LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True" + "DefaultConnection": "Host=192.168.0.10;Database=postgres;Username=postgres;Password=q;Persist Security Info=True", + "DebugConnection": "Host=192.168.0.10;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True", + "TestConnection": "Host=192.168.0.10;Database=test;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True", + "LocalConnection": "Host=192.168.0.10;Database=postgres;Username=postgres;Password=q;Persist Security Info=True" }, "AllowedHosts": "*", "ContentPath": "../data", @@ -26,5 +26,5 @@ }, "DirectoryNameHelpPageFiles": "helpPages", "DirectoryManualFiles": "manuals", - "Urls": "http://0.0.0.0:5000" + "Urls": "http://0.0.0.0:5010" } From 97cca9cb5a5ee8d8d64e75454f36d209d35fa007 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Thu, 3 Oct 2024 11:10:37 +0500 Subject: [PATCH 02/22] =?UTF-8?q?=D0=9D=D0=B0=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B8=20=D0=BF=D0=BE=20=D0=BA=D0=B0=D1=87=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=B2=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataSaubStatDrillingQualityDto.cs | 36 +++++ .../Data/DataSaubStat/DataSaubStatDto.cs | 135 ++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 AsbCloudApp/Data/DataSaubStat/DataSaubStatDrillingQualityDto.cs create mode 100644 AsbCloudApp/Data/DataSaubStat/DataSaubStatDto.cs diff --git a/AsbCloudApp/Data/DataSaubStat/DataSaubStatDrillingQualityDto.cs b/AsbCloudApp/Data/DataSaubStat/DataSaubStatDrillingQualityDto.cs new file mode 100644 index 00000000..fa8c6560 --- /dev/null +++ b/AsbCloudApp/Data/DataSaubStat/DataSaubStatDrillingQualityDto.cs @@ -0,0 +1,36 @@ +using System; +using AsbCloudApp.Data.WellOperation; + +namespace AsbCloudApp.Data; + +/// +/// dto для хранения данных статистики качества бурения +/// +public class DataSaubStatDrillingQualityDto : IId +{ + /// + /// + /// + public int Id { get; set; } + + /// + /// Дата и время начала + /// + public DateTimeOffset DateStart { get; set; } + + /// + /// Дата и время окончания + /// + public DateTimeOffset DateEnd { get; set; } + + /// + /// Глубина забоя по стволу начальная + /// + public double DepthStart { get; set; } + + /// + /// Глубина забоя по стволу конечная + /// + public double DepthEnd { get; set; } + public object DepthDrillingQuality { get; set; } +} diff --git a/AsbCloudApp/Data/DataSaubStat/DataSaubStatDto.cs b/AsbCloudApp/Data/DataSaubStat/DataSaubStatDto.cs new file mode 100644 index 00000000..7fa58e48 --- /dev/null +++ b/AsbCloudApp/Data/DataSaubStat/DataSaubStatDto.cs @@ -0,0 +1,135 @@ +using System; +using AsbCloudApp.Data.WellOperation; + +namespace AsbCloudApp.Data.DataSaubStat; + +/// +/// dto для хранения данных статистики сауб +/// +public class DataSaubStatDto : IId +{ + /// + /// + /// + public int Id { get; set; } + + /// + /// Дата и время начала + /// + public DateTimeOffset DateStart { get; set; } + + /// + /// Дата и время окончания + /// + public DateTimeOffset DateEnd { get; set; } + + /// + /// Глубина забоя по стволу начальная + /// + public double DepthStart { get; set; } + + /// + /// Глубина забоя по стволу конечная + /// + public double DepthEnd { get; set; } + + /// + /// Скорость бурения + /// + public double Speed { get; set; } + + /// + /// Ограничение скорости блока + /// + public double? BlockSpeedSp { get; set; } + + /// + /// Давление + /// + public double Pressure { get; set; } + + /// + /// Давление холостого хода + /// + public double? PressureIdle { get; set; } + + /// + /// Ограничение фактического давления + /// + public double? PressureSp { get; set; } + + /// + /// Фактическая нагрузка + /// + public double AxialLoad { get; set; } + + /// + /// Ограничение факт. нагрузки + /// + public double? AxialLoadSp { get; set; } + + /// + /// Максимально допустимая нагрузка + /// + public double? AxialLoadLimitMax { get; set; } + + /// + /// Фактический момент + /// + public double RotorTorque { get; set; } + + /// + /// Ограничение факт. момента + /// + public double? RotorTorqueSp { get; set; } + + /// + /// Максимально допустимый момент + /// + public double? RotorTorqueLimitMax { get; set; } + + /// + /// Работа при достижении ограничения + /// + public short? IdFeedRegulator { get; set; } + + /// + /// Фактическая скорость оборотов ВСП + /// + public double RotorSpeed { get; set; } + + /// + /// Название автоопределённой операции + /// + public int IdCategory { get; set; } + + /// + /// Флаги подсистем + /// + public int EnabledSubsystems { get; set; } + + /// + /// Наличие или отсутствие осцилляции + /// + public bool HasOscillation { get; set; } + + /// + /// Фактический расход + /// + public double Flow { get; set; } + + /// + /// Ключ телеметрии + /// + public int IdTelemetry { get; set; } + + /// + /// Телеметрия + /// + public TelemetryDto Telemetry { get; set; } = null!; + + /// + /// Категория автоопределенной операции + /// + public WellOperationCategoryDto OperationCategory { get; set; } = null!; +} From af43828d57918595ec500648aaa7d44f7827ef7f Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Fri, 4 Oct 2024 15:22:43 +0500 Subject: [PATCH 03/22] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=20=D0=B1=D0=B0=D0=B7=D1=83=20?= =?UTF-8?q?=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=83=20=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D1=82=D0=B8=D1=81=D1=82=D0=B8=D0=BA=D0=B8=20=D0=BF=D0=BE=20"?= =?UTF-8?q?=D0=9A=D0=B0=D1=87=D0=B5=D1=81=D1=82=D0=B2=D1=83"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataSaubStatDrillingQualityDto.cs | 36 ---- .../Data/DataSaubStat/DataSaubStatDto.cs | 135 ------------ .../IDataSaubStatDrillingQualityRepository.cs | 40 ++++ .../Repositories/IDataSaubStatRepository.cs | 2 +- AsbCloudDb/Model/AsbCloudDbContext.cs | 1 + AsbCloudDb/Model/IAsbCloudDbContext.cs | 1 + .../Model/{ => SaubStat}/DataSaubStat.cs | 0 .../SaubStat/DataSaubStatDrillingQuality.cs | 34 +++ .../Services/DataSaubStatServiceTest.cs | 2 +- .../DataSaubStatDrillingQualityRepository.cs | 114 ++++++++++ .../Repository/DataSaubStatRepository.cs | 2 +- .../DataSaubStatDrillingQualityService.cs | 196 ++++++------------ .../Services/DataSaubStatService.cs | 2 +- .../Report/ProcessMapReportDrillingService.cs | 1 - .../Repository/DataSaubStatRepositoryTest.cs | 2 +- 15 files changed, 259 insertions(+), 309 deletions(-) delete mode 100644 AsbCloudApp/Data/DataSaubStat/DataSaubStatDrillingQualityDto.cs delete mode 100644 AsbCloudApp/Data/DataSaubStat/DataSaubStatDto.cs create mode 100644 AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs rename AsbCloudDb/Model/{ => SaubStat}/DataSaubStat.cs (100%) create mode 100644 AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs create mode 100644 AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs diff --git a/AsbCloudApp/Data/DataSaubStat/DataSaubStatDrillingQualityDto.cs b/AsbCloudApp/Data/DataSaubStat/DataSaubStatDrillingQualityDto.cs deleted file mode 100644 index fa8c6560..00000000 --- a/AsbCloudApp/Data/DataSaubStat/DataSaubStatDrillingQualityDto.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using AsbCloudApp.Data.WellOperation; - -namespace AsbCloudApp.Data; - -/// -/// dto для хранения данных статистики качества бурения -/// -public class DataSaubStatDrillingQualityDto : IId -{ - /// - /// - /// - public int Id { get; set; } - - /// - /// Дата и время начала - /// - public DateTimeOffset DateStart { get; set; } - - /// - /// Дата и время окончания - /// - public DateTimeOffset DateEnd { get; set; } - - /// - /// Глубина забоя по стволу начальная - /// - public double DepthStart { get; set; } - - /// - /// Глубина забоя по стволу конечная - /// - public double DepthEnd { get; set; } - public object DepthDrillingQuality { get; set; } -} diff --git a/AsbCloudApp/Data/DataSaubStat/DataSaubStatDto.cs b/AsbCloudApp/Data/DataSaubStat/DataSaubStatDto.cs deleted file mode 100644 index 7fa58e48..00000000 --- a/AsbCloudApp/Data/DataSaubStat/DataSaubStatDto.cs +++ /dev/null @@ -1,135 +0,0 @@ -using System; -using AsbCloudApp.Data.WellOperation; - -namespace AsbCloudApp.Data.DataSaubStat; - -/// -/// dto для хранения данных статистики сауб -/// -public class DataSaubStatDto : IId -{ - /// - /// - /// - public int Id { get; set; } - - /// - /// Дата и время начала - /// - public DateTimeOffset DateStart { get; set; } - - /// - /// Дата и время окончания - /// - public DateTimeOffset DateEnd { get; set; } - - /// - /// Глубина забоя по стволу начальная - /// - public double DepthStart { get; set; } - - /// - /// Глубина забоя по стволу конечная - /// - public double DepthEnd { get; set; } - - /// - /// Скорость бурения - /// - public double Speed { get; set; } - - /// - /// Ограничение скорости блока - /// - public double? BlockSpeedSp { get; set; } - - /// - /// Давление - /// - public double Pressure { get; set; } - - /// - /// Давление холостого хода - /// - public double? PressureIdle { get; set; } - - /// - /// Ограничение фактического давления - /// - public double? PressureSp { get; set; } - - /// - /// Фактическая нагрузка - /// - public double AxialLoad { get; set; } - - /// - /// Ограничение факт. нагрузки - /// - public double? AxialLoadSp { get; set; } - - /// - /// Максимально допустимая нагрузка - /// - public double? AxialLoadLimitMax { get; set; } - - /// - /// Фактический момент - /// - public double RotorTorque { get; set; } - - /// - /// Ограничение факт. момента - /// - public double? RotorTorqueSp { get; set; } - - /// - /// Максимально допустимый момент - /// - public double? RotorTorqueLimitMax { get; set; } - - /// - /// Работа при достижении ограничения - /// - public short? IdFeedRegulator { get; set; } - - /// - /// Фактическая скорость оборотов ВСП - /// - public double RotorSpeed { get; set; } - - /// - /// Название автоопределённой операции - /// - public int IdCategory { get; set; } - - /// - /// Флаги подсистем - /// - public int EnabledSubsystems { get; set; } - - /// - /// Наличие или отсутствие осцилляции - /// - public bool HasOscillation { get; set; } - - /// - /// Фактический расход - /// - public double Flow { get; set; } - - /// - /// Ключ телеметрии - /// - public int IdTelemetry { get; set; } - - /// - /// Телеметрия - /// - public TelemetryDto Telemetry { get; set; } = null!; - - /// - /// Категория автоопределенной операции - /// - public WellOperationCategoryDto OperationCategory { get; set; } = null!; -} diff --git a/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs new file mode 100644 index 00000000..67b1070f --- /dev/null +++ b/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs @@ -0,0 +1,40 @@ +using AsbCloudApp.Data; +using AsbCloudApp.Services; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace AsbCloudApp.Repositories; + +/// +/// Репозиторий работы с данными из таблицы t_data_daub_stat_drilling_quality +/// +public interface IDataSaubStatDrillingQualityRepository : ITelemetryDataEditorService +{ + /// + /// Получение записей по ключу телеметрии + /// + /// ключ телеметрии + /// начальная дата + /// конечная дата + /// + /// + Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token); + + /// + /// Получение последних по дате окончания бурения записей в разрезе телеметрий + /// + /// ключи телеметрий + /// + /// + Task> GetLastsAsync(int[] idTelemetries, CancellationToken token); + + /// + /// Вставка записей статистики + /// + /// + /// + /// + Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token); +} diff --git a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs index 628276bc..d419ad82 100644 --- a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs +++ b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data.DataSaubStat; +using AsbCloudApp.Data; using AsbCloudApp.Services; using System; using System.Collections.Generic; diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index 94ddf0d0..3f234fc8 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -110,6 +110,7 @@ namespace AsbCloudDb.Model public DbSet DrillTests => Set(); public DbSet DataSaubStat => Set(); + public DbSet DataSaubStatDrillingQuality => Set(); public AsbCloudDbContext() : base() { Interlocked.Increment(ref referenceCount); diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs index ab1fb60d..94879ec1 100644 --- a/AsbCloudDb/Model/IAsbCloudDbContext.cs +++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs @@ -81,6 +81,7 @@ namespace AsbCloudDb.Model DbSet TrajectoriesFact { get; } DbSet WellSectionsPlan { get; } DbSet DataSaubStat { get; } + DbSet DataSaubStatDrillingQuality { get; } DatabaseFacade Database { get; } DbSet ProcessMapPlanRotor { get; } DbSet ProcessMapPlanSlide { get; } diff --git a/AsbCloudDb/Model/DataSaubStat.cs b/AsbCloudDb/Model/SaubStat/DataSaubStat.cs similarity index 100% rename from AsbCloudDb/Model/DataSaubStat.cs rename to AsbCloudDb/Model/SaubStat/DataSaubStat.cs diff --git a/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs b/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs new file mode 100644 index 00000000..a49dc29e --- /dev/null +++ b/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs @@ -0,0 +1,34 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text.Json.Serialization; + +namespace AsbCloudDb.Model +{ + [Table("t_data_saub_stat_drilling_quality"), Comment("Кеш-таблица для хранения данных для построения страницы \"Качество\"")] + public class DataSaubStatDrillingQuality : IId + { + [Key] + [Column("id")] + public int Id { get; set; } + + [Column("id_telemetry"), Comment("Ключ телеметрии")] + public int IdTelemetry { get; set; } + + [Column("date_start", TypeName = "timestamp with time zone"), Comment("Дата и время начала")] + public DateTimeOffset DateStart { get; set; } + + [Column("date_end", TypeName = "timestamp with time zone"), Comment("Дата и время окончания")] + public DateTimeOffset DateEnd { get; set; } + + [Column("depth_start"), Comment("Глубина забоя по стволу начальная")] + public double DepthStart { get; set; } + + [Column("depth_end"), Comment("Глубина забоя по стволу конечная")] + public double DepthEnd { get; set; } + + [ForeignKey(nameof(IdTelemetry))] + public virtual Telemetry Telemetry { get; set; } = null!; + } +} diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs index 1e507f6f..80783c73 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data.DataSaubStat; +using AsbCloudApp.Data; using AsbCloudApp.Data.DetectedOperation; using AsbCloudApp.Data.SAUB; using AsbCloudApp.Repositories; diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs new file mode 100644 index 00000000..d51ada62 --- /dev/null +++ b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs @@ -0,0 +1,114 @@ +using AsbCloudApp.Data; +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; +using AsbCloudApp.Services; +using AsbCloudDb.Model; +using Mapster; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace AsbCloudInfrastructure.Repository; + +public class DataSaubStatDrillingQualityRepository : IDataSaubStatDrillingQualityRepository +{ + private readonly IAsbCloudDbContext db; + private readonly ITelemetryService telemetryService; + + public DataSaubStatDrillingQualityRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) + { + db = dbContext; + this.telemetryService = telemetryService; + + } + + public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token) + { + var timeZoneOffsets = idTelemetries + .Distinct() + .ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours)); + + var stats = await db.Set() + .Where(s => idTelemetries.Contains(s.IdTelemetry)) + .GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First()) + .ToArrayAsync(token); + //todo + //var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry])); + + //return result; + return null; + } + + public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token) + { + var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours); + var geDateUtc = geDate.ToUniversalTime(); + var leDateUtc = leDate.ToUniversalTime(); + + var stats = await db.Set() + .Where(s => s.IdTelemetry == idTelemetry) + .Where(s => s.DateStart >= geDateUtc) + .Where(s => s.DateEnd <= leDateUtc) + .ToArrayAsync(token); + //todo + //var result = stats.Select(s => ConvertToDto(s, timeSpan)); + + //return result; + return null; + } + + public async Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token) + { + var entities = dataSaubStats.Select(data => ConvertToEntity(data)); + db.Set().AddRange(entities); + return await db.SaveChangesAsync(token); + } + + private static DataSaubStatDrillingQualityDto ConvertToDto(DataSaubStatDrillingQuality entity, TimeSpan timeSpan) + { + var dto = entity.Adapt(); + dto.DateStart = dto.DateStart.ToOffset(timeSpan); + dto.DateEnd = dto.DateEnd.ToOffset(timeSpan); + + return dto; + } + + private static DataSaubStatDrillingQuality ConvertToEntity(DataSaubStatDrillingQualityDto dto) + { + var entity = dto.Adapt(); + entity.DateStart = dto.DateStart.ToUniversalTime(); + entity.DateEnd = dto.DateEnd.ToUniversalTime(); + + return entity; + } + + private IQueryable BuildQuery(TelemetryPartDeleteRequest request) + { + var query = db.Set() + .Where(o => o.IdTelemetry == request.IdTelemetry); + + if (request.LeDate is not null) + { + var leDate = request.LeDate.Value.ToUniversalTime(); + query = query.Where(o => o.DateStart <= leDate); + } + + if (request.GeDate is not null) + { + var geDate = request.GeDate.Value.ToUniversalTime(); + query = query.Where(o => o.DateEnd >= geDate); + } + + return query; + } + + public async Task DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token) + { + var query = BuildQuery(request); + db.Set().RemoveRange(query); + return await db.SaveChangesAsync(token); + } +} diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs index cb986215..d8932b28 100644 --- a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs +++ b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data.DataSaubStat; +using AsbCloudApp.Data; using AsbCloudApp.Repositories; using AsbCloudApp.Requests; using AsbCloudApp.Services; diff --git a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs index 1726af5c..9458145d 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs @@ -1,11 +1,8 @@ using AsbCloudApp.Data; -using AsbCloudApp.Data.DataSaubStat; -using AsbCloudApp.Data.DetectedOperation; using AsbCloudApp.Data.SAUB; using AsbCloudApp.Repositories; using AsbCloudApp.Requests; using AsbCloudApp.Services; -using AsbCloudDb.Model; using System; using System.Collections.Generic; using System.Linq; @@ -17,21 +14,43 @@ namespace AsbCloudInfrastructure.Services; public class DataSaubStatDrillingQualityService : IDataSaubStatService { - private IDataSaubStatRepository dataSaubStatRepository; + private IDataSaubStatDrillingQualityRepository dataSaubStatDrillingQualityRepository; private ITelemetryDataCache telemetryDataCache; private ITelemetryDataSaubService dataSaubService; - private IDetectedOperationRepository detectedOperationRepository; + + public Dictionary> QualitySettingsForFeedRegulators { get; } public DataSaubStatDrillingQualityService( - IDataSaubStatRepository dataSaubStatRepository, + IDataSaubStatDrillingQualityRepository dataSaubStatDrillingQualityRepository, ITelemetryDataCache telemetryDataCache, - ITelemetryDataSaubService dataSaubService, - IDetectedOperationRepository detectedOperationRepository) + ITelemetryDataSaubService dataSaubService) { - this.dataSaubStatRepository = dataSaubStatRepository; + this.dataSaubStatDrillingQualityRepository = dataSaubStatDrillingQualityRepository; this.telemetryDataCache = telemetryDataCache; this.dataSaubService = dataSaubService; - this.detectedOperationRepository = detectedOperationRepository; + + Predicate hasQualityWithIdFeedRegulator1 = (TelemetryDataSaubDto spanItem) + => (spanItem.BlockSpeed >= spanItem.BlockSpeedSp * 0.95 + && spanItem.BlockSpeed <= spanItem.BlockSpeedSp * 1.05); + + Predicate hasQualityWithIdFeedRegulator2 = (TelemetryDataSaubDto spanItem) + => (spanItem.Pressure >= (spanItem.PressureSp - spanItem.PressureIdle) - 5 + && spanItem.Pressure <= (spanItem.PressureSp - spanItem.PressureIdle) + 5); + + Predicate hasQualityWithIdFeedRegulator3 = (TelemetryDataSaubDto spanItem) + => (spanItem.AxialLoad >= (spanItem.AxialLoadSp - 0.5) + && spanItem.AxialLoad <= (spanItem.AxialLoadSp + 0.5)); + + Predicate hasQualityWithIdFeedRegulator4 = (TelemetryDataSaubDto spanItem) + => (spanItem.RotorTorque >= (spanItem.RotorTorqueSp - 0.5) + && spanItem.RotorTorque <= (spanItem.RotorTorqueSp + 0.5)); + + QualitySettingsForFeedRegulators = new Dictionary>() { + { 1, hasQualityWithIdFeedRegulator1 }, + { 2, hasQualityWithIdFeedRegulator2 }, + { 3, hasQualityWithIdFeedRegulator3 }, + { 4, hasQualityWithIdFeedRegulator4 }, + }; } public async Task CreateStatAsync(int lastDaysFilter, Action onProgressCallback, CancellationToken token) @@ -47,19 +66,19 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService return; var stats = new List(); - //await dataSaubStatRepository.GetLastsAsync(idTelemetries, token); + //await dataSaubStatRepository.GetLastsAsync(idTelemetries, token); //for (var i = 0; i < idTelemetries.Length; i++) //{ // var idTelemetry = idTelemetries[i]; // var lastDate = stats.FirstOrDefault(s => s.IdTelemetry == idTelemetry)?.DateEnd.ToUniversalTime() ?? DateTimeOffset.UnixEpoch; - // var statsCount = await CreateStatForTelemetryFromDate(idTelemetry, lastDate, token); - // if(onProgressCallback != null) + // var statsCount = await CreateStatDrillingQualityForTelemetry(idTelemetry, lastDate, token); + // if (onProgressCallback != null) // onProgressCallback($"Calculate stat for telemetry: {idTelemetry}; from {lastDate}; results count: {statsCount};", 1d * i / idTelemetries.Length); //} } - private async Task CreateStatForTelemetryFromDate( + private async Task CreateStatDrillingQualityForTelemetry( int idTelemetry, DateTimeOffset geDate, CancellationToken token) @@ -74,14 +93,20 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService if (dataSaub is not TelemetryDataSaubDto[] dataSaubArray) dataSaubArray = dataSaub.ToArray(); - var dataSaubStats = CreateDataSaubStat(dataSaubArray); + var result = new List(); + foreach (var item in QualitySettingsForFeedRegulators) + { + var data = CreateDataSaubStatDrillingQuality(item.Key, item.Value, dataSaubArray); + result.AddRange(data); + } - return 0; - - //return await dataSaubStatRepository.InsertRangeAsync(dataSaubStats, token); + return await dataSaubStatDrillingQualityRepository.InsertRangeAsync(result, token); } - private static IEnumerable CreateDataSaubStat2(int idFeedRegulator, TelemetryDataSaubDto[] dataSaub) + private static IEnumerable CreateDataSaubStatDrillingQuality( + int idFeedRegulator, + Predicate checkQuality, + TelemetryDataSaubDto[] dataSaub) { var result = new List(); @@ -100,140 +125,47 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService indexEnd = dataSaub.Length - 1; if (indexEnd == indexStart) - { continue; - } - var length = indexEnd - indexStart + 1; var subset = dataSaub.AsSpan(indexStart, length); - if (length <= 2 || (subset[^1].WellDepth - subset[0].WellDepth) < 0.001) + if (length <= 2 || (subset[^1].WellDepth - subset[0].WellDepth) < 0.3) continue; // мелкие выборки не учитываем. - var stats = CalcStats(subset); + + var stats = CalcStatsDrillingQuality(idFeedRegulator, subset, checkQuality); result.Add(stats); } return result; } - private static Dictionary> CreateDataSaubStat(TelemetryDataSaubDto[] dataSaub) + private static DataSaubStatDrillingQualityDto CalcStatsDrillingQuality( + int idFeedRegulator, + Span dataSaub, + Predicate predicate + ) { - - var dict = new Dictionary>() { - { 1, new List() }, - { 2, new List() }, - { 3, new List() }, - { 4, new List() }, - }; - - foreach (var item in dict) - { - var data = CreateDataSaubStat2(item.Key, dataSaub); - item.Value.AddRange(data); - } - - return dict; - } - - private static DataSaubStatDrillingQualityDto CalcStats(Span dataSaub) - { - var depthDrillingQuality = CalcAggregate(dataSaub); - var result = new DataSaubStatDrillingQualityDto(); + result.IdTelemetry = dataSaub[0].IdTelemetry; + result.IdFeedRegulator = idFeedRegulator; result.DepthStart = dataSaub[0].WellDepth; result.DepthEnd = dataSaub[^1].WellDepth; result.DateStart = dataSaub[0].DateTime; result.DateEnd = dataSaub[^1].DateTime; + + var depthDrillingQuality = 0.0; + for (var i = 0; i < dataSaub.Length - 1; i++) + { + if (predicate(dataSaub[i])) + { + depthDrillingQuality += dataSaub[i + 1].WellDepth - dataSaub[i].WellDepth; + } + } result.DepthDrillingQuality = depthDrillingQuality; - + return result; } - - private static DataSaubStatDto CalcStat(DetectedOperationDto operation, Span span) - { - var aggregatedValues = CalcAggregate(span); - var dateStart = span[0].DateTime; - var dateEnd = span[^1].DateTime; - var depthStart = span[0].WellDepth; - var depthEnd = span[^1].WellDepth; - var speed = ((depthEnd - depthStart) / (dateEnd - dateStart).TotalHours); - - var processMapDrillingCacheItem = new DataSaubStatDto - { - DateStart = dateStart, - DateEnd = dateEnd, - DepthStart = depthStart, - DepthEnd = depthEnd, - Speed = speed, - BlockSpeedSp = span[0].BlockSpeedSp, - Pressure = aggregatedValues.Pressure, - PressureIdle = span[0].PressureIdle, - PressureSp = span[0].PressureSp, - AxialLoad = aggregatedValues.AxialLoad, - AxialLoadSp = span[0].AxialLoadSp, - AxialLoadLimitMax = span[0].AxialLoadLimitMax, - RotorTorque = aggregatedValues.RotorTorque, - RotorTorqueSp = span[0].RotorTorqueSp, - RotorTorqueLimitMax = span[0].RotorTorqueLimitMax, - IdFeedRegulator = span[0].IdFeedRegulator, - RotorSpeed = aggregatedValues.RotorSpeed, - IdCategory = operation.IdCategory, - EnabledSubsystems = operation.EnabledSubsystems, - HasOscillation = operation.EnabledSubsystems.IsAutoOscillation, - IdTelemetry = operation.IdTelemetry, - Flow = aggregatedValues.Flow - }; - return processMapDrillingCacheItem; - } - - private static ( - double Pressure, - double AxialLoad, - double RotorTorque, - double RotorSpeed, - double Flow - ) CalcAggregate(Span span) - { - var sumPressure = 0.0; - var sumAxialLoad = 0.0; - var sumRotorTorque = 0.0; - var sumRotorSpeed = 0.0; - var flow = span[0].Flow ?? 0.0; - var diffDepthTotal = span[^1].WellDepth - span[0].WellDepth; - for (var i = 0; i < span.Length - 1; i++) - { - var diffDepth = span[i + 1].WellDepth - span[i].WellDepth; - sumPressure += diffDepth * span[i].Pressure; - sumAxialLoad += diffDepth * span[i].AxialLoad; - sumRotorTorque += diffDepth * span[i].RotorTorque; - sumRotorSpeed += diffDepth * span[i].RotorSpeed; - flow = span[i + 1].Flow > flow ? span[i + 1].Flow ?? 0.0 : flow; - } - return ( - Pressure: sumPressure / diffDepthTotal, - AxialLoad: sumAxialLoad / diffDepthTotal, - RotorTorque: sumRotorTorque / diffDepthTotal, - RotorSpeed: sumRotorSpeed / diffDepthTotal, - Flow: flow - ); - } - - private static bool IsNewCacheItem(TelemetryDataSaubDto previous, TelemetryDataSaubDto current) - { - return !(current.Mode == previous.Mode) - || !(current.WellDepth >= previous.WellDepth) - || !(current.BlockSpeedSp == previous.BlockSpeedSp) - || !(current.PressureIdle == previous.PressureIdle) - || !(current.PressureSp == previous.PressureSp) - || !(current.AxialLoadSp == previous.AxialLoadSp) - || !(current.AxialLoadLimitMax == previous.AxialLoadLimitMax) - || !(current.HookWeightIdle == previous.HookWeightIdle) - || !(current.RotorTorqueIdle == previous.RotorTorqueIdle) - || !(current.RotorTorqueSp == previous.RotorTorqueSp) - || !(current.RotorTorqueLimitMax == previous.RotorTorqueLimitMax) - || !(current.IdFeedRegulator == previous.IdFeedRegulator); - } } diff --git a/AsbCloudInfrastructure/Services/DataSaubStatService.cs b/AsbCloudInfrastructure/Services/DataSaubStatService.cs index f1722ba5..82ee0416 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatService.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data.DataSaubStat; +using AsbCloudApp.Data; using AsbCloudApp.Data.DetectedOperation; using AsbCloudApp.Data.SAUB; using AsbCloudApp.Repositories; diff --git a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs index 574a320e..cae5bdce 100644 --- a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs @@ -1,5 +1,4 @@ using AsbCloudApp.Data; -using AsbCloudApp.Data.DataSaubStat; using AsbCloudApp.Data.ProcessMaps; using AsbCloudApp.Data.ProcessMaps.Operations; using AsbCloudApp.Data.ProcessMaps.Report; diff --git a/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs b/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs index 7919a445..e69cc692 100644 --- a/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs +++ b/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data.DataSaubStat; +using AsbCloudApp.Data; using AsbCloudApp.Repositories; using AsbCloudDb.Model; using Mapster; From 73d60d146423ff03dabd585ccb0780c786bffabf Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Fri, 4 Oct 2024 16:54:18 +0500 Subject: [PATCH 04/22] =?UTF-8?q?=D0=9C=D0=B8=D0=B3=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BD=D0=B0=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=8B?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D1=83=D1=87=D0=B5=D1=82=D0=B0=20=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D1=82=D0=B8=D1=81=D1=82=D0=B8=D0=BA=D0=B8=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=87=D0=B5=D1=81=D1=82=D0=B2=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataSaubStatDrillingQualityDto.cs | 50 + AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs | 135 + .../IDataSaubStatDrillingQualityRepository.cs | 6 +- ...le_DataSaubStatDrillingQuality.Designer.cs | 12464 ++++++++++++++++ ...5_Add_Table_DataSaubStatDrillingQuality.cs | 54 + .../AsbCloudDbContextModelSnapshot.cs | 67 +- .../SaubStat/DataSaubStatDrillingQuality.cs | 7 + AsbCloudInfrastructure/DependencyInjection.cs | 3 +- .../DataSaubStatDrillingQualityRepository.cs | 11 +- .../DataSaubStatDrillingQualityService.cs | 29 +- 10 files changed, 12802 insertions(+), 24 deletions(-) create mode 100644 AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs create mode 100644 AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs create mode 100644 AsbCloudDb/Migrations/20241004110355_Add_Table_DataSaubStatDrillingQuality.Designer.cs create mode 100644 AsbCloudDb/Migrations/20241004110355_Add_Table_DataSaubStatDrillingQuality.cs diff --git a/AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs b/AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs new file mode 100644 index 00000000..2e74d3c4 --- /dev/null +++ b/AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs @@ -0,0 +1,50 @@ +using System; +using AsbCloudApp.Data.WellOperation; + +namespace AsbCloudApp.Data; + +/// +/// dto для хранения данных статистики качества бурения +/// +public class DataSaubStatDrillingQualityDto : IId +{ + /// + /// + /// + public int Id { get; set; } + + /// + /// Дата и время начала + /// + public DateTimeOffset DateStart { get; set; } + + /// + /// Дата и время окончания + /// + public DateTimeOffset DateEnd { get; set; } + + /// + /// Глубина забоя по стволу начальная + /// + public double DepthStart { get; set; } + + /// + /// Глубина забоя по стволу конечная + /// + public double DepthEnd { get; set; } + + /// + /// Качественная проходка + /// + public double DepthDrillingQuality { get; set; } + + /// + /// Флаг + /// + public int IdFeedRegulator { get; set; } + + /// + /// Ключ телеметрии + /// + public int IdTelemetry { get; set; } +} diff --git a/AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs b/AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs new file mode 100644 index 00000000..fc880869 --- /dev/null +++ b/AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs @@ -0,0 +1,135 @@ +using System; +using AsbCloudApp.Data.WellOperation; + +namespace AsbCloudApp.Data; + +/// +/// dto для хранения данных статистики сауб +/// +public class DataSaubStatDto : IId +{ + /// + /// + /// + public int Id { get; set; } + + /// + /// Дата и время начала + /// + public DateTimeOffset DateStart { get; set; } + + /// + /// Дата и время окончания + /// + public DateTimeOffset DateEnd { get; set; } + + /// + /// Глубина забоя по стволу начальная + /// + public double DepthStart { get; set; } + + /// + /// Глубина забоя по стволу конечная + /// + public double DepthEnd { get; set; } + + /// + /// Скорость бурения + /// + public double Speed { get; set; } + + /// + /// Ограничение скорости блока + /// + public double? BlockSpeedSp { get; set; } + + /// + /// Давление + /// + public double Pressure { get; set; } + + /// + /// Давление холостого хода + /// + public double? PressureIdle { get; set; } + + /// + /// Ограничение фактического давления + /// + public double? PressureSp { get; set; } + + /// + /// Фактическая нагрузка + /// + public double AxialLoad { get; set; } + + /// + /// Ограничение факт. нагрузки + /// + public double? AxialLoadSp { get; set; } + + /// + /// Максимально допустимая нагрузка + /// + public double? AxialLoadLimitMax { get; set; } + + /// + /// Фактический момент + /// + public double RotorTorque { get; set; } + + /// + /// Ограничение факт. момента + /// + public double? RotorTorqueSp { get; set; } + + /// + /// Максимально допустимый момент + /// + public double? RotorTorqueLimitMax { get; set; } + + /// + /// Работа при достижении ограничения + /// + public short? IdFeedRegulator { get; set; } + + /// + /// Фактическая скорость оборотов ВСП + /// + public double RotorSpeed { get; set; } + + /// + /// Название автоопределённой операции + /// + public int IdCategory { get; set; } + + /// + /// Флаги подсистем + /// + public int EnabledSubsystems { get; set; } + + /// + /// Наличие или отсутствие осцилляции + /// + public bool HasOscillation { get; set; } + + /// + /// Фактический расход + /// + public double Flow { get; set; } + + /// + /// Ключ телеметрии + /// + public int IdTelemetry { get; set; } + + /// + /// Телеметрия + /// + public TelemetryDto Telemetry { get; set; } = null!; + + /// + /// Категория автоопределенной операции + /// + public WellOperationCategoryDto OperationCategory { get; set; } = null!; +} diff --git a/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs index 67b1070f..d607775a 100644 --- a/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs +++ b/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs @@ -23,15 +23,15 @@ public interface IDataSaubStatDrillingQualityRepository : ITelemetryDataEditorSe Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token); /// - /// Получение последних по дате окончания бурения записей в разрезе телеметрий + /// Получение последних по дате окончания бурения записей качества в разрезе телеметрий /// /// ключи телеметрий /// /// - Task> GetLastsAsync(int[] idTelemetries, CancellationToken token); + Task> GetLastsAsync(int[] idTelemetries, CancellationToken token); /// - /// Вставка записей статистики + /// Вставка записей статистики качества /// /// /// diff --git a/AsbCloudDb/Migrations/20241004110355_Add_Table_DataSaubStatDrillingQuality.Designer.cs b/AsbCloudDb/Migrations/20241004110355_Add_Table_DataSaubStatDrillingQuality.Designer.cs new file mode 100644 index 00000000..1fc752a3 --- /dev/null +++ b/AsbCloudDb/Migrations/20241004110355_Add_Table_DataSaubStatDrillingQuality.Designer.cs @@ -0,0 +1,12464 @@ +// +using System; +using System.Text.Json; +using AsbCloudDb.Model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace AsbCloudDb.Migrations +{ + [DbContext(typeof(AsbCloudDbContext))] + [Migration("20241004110355_Add_Table_DataSaubStatDrillingQuality")] + partial class Add_Table_DataSaubStatDrillingQuality + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("Russian_Russia.1251") + .HasAnnotation("ProductVersion", "8.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("IdDeposit") + .HasColumnType("integer") + .HasColumnName("id_deposit"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex("IdDeposit"); + + b.ToTable("t_cluster", t => + { + t.HasComment("Кусты"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IdCompanyType") + .HasMaxLength(255) + .HasColumnType("integer") + .HasColumnName("id_company_type") + .HasComment("вид деятельности"); + + b.HasKey("Id"); + + b.HasIndex("IdCompanyType"); + + b.ToTable("t_company"); + + b.HasData( + new + { + Id = 1, + Caption = "ООО \"АСБ\"", + IdCompanyType = 3 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IsContact") + .HasColumnType("boolean") + .HasColumnName("is_contact"); + + b.Property("Order") + .HasColumnType("integer") + .HasColumnName("order"); + + b.HasKey("Id"); + + b.ToTable("t_company_type"); + + b.HasData( + new + { + Id = 1, + Caption = "Недропользователь", + IsContact = true, + Order = 3 + }, + new + { + Id = 2, + Caption = "Буровой подрядчик", + IsContact = true, + Order = 2 + }, + new + { + Id = 3, + Caption = "Сервис автоматизации бурения", + IsContact = true, + Order = 0 + }, + new + { + Id = 4, + Caption = "Сервис по ГТИ", + IsContact = true, + Order = 6 + }, + new + { + Id = 5, + Caption = "Растворный сервис", + IsContact = true, + Order = 4 + }, + new + { + Id = 6, + Caption = "Сервис по ННБ", + IsContact = true, + Order = 5 + }, + new + { + Id = 7, + Caption = "Служба супервайзинга", + IsContact = false, + Order = 1 + }, + new + { + Id = 9, + Caption = "Сервис по цементированию", + IsContact = true, + Order = 7 + }, + new + { + Id = 11, + Caption = "Дизельный сервис", + IsContact = false, + Order = 9 + }, + new + { + Id = 12, + Caption = "Сервис по обслуживанию верхних силовых приводов", + IsContact = true, + Order = 8 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Company") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("company") + .HasComment("компания"); + + b.Property("Email") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("email") + .HasComment("email"); + + b.Property("FullName") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("full_name") + .HasComment("ФИО"); + + b.Property("IdCompanyType") + .HasMaxLength(255) + .HasColumnType("integer") + .HasColumnName("id_company_type") + .HasComment("вид деятельности"); + + b.Property("IdWell") + .HasMaxLength(255) + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("ключ скважины"); + + b.Property("Phone") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("phone") + .HasComment("номер телефона"); + + b.Property("Position") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("position") + .HasComment("должность"); + + b.HasKey("Id"); + + b.HasIndex("IdCompanyType"); + + b.HasIndex("IdWell"); + + b.ToTable("t_contact", t => + { + t.HasComment("Контакты"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DailyReports.DailyReport", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Date") + .HasColumnType("date") + .HasColumnName("date") + .HasComment("Дата формирования отчёта"); + + b.Property("DateLastUpdate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_update") + .HasComment("Дата последнего обновления"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("ID скважины"); + + b.Property("SignBlock") + .HasColumnType("jsonb") + .HasColumnName("sign_block") + .HasComment("Подпись"); + + b.Property("SubsystemBlock") + .HasColumnType("jsonb") + .HasColumnName("subsystem_block") + .HasComment("Наработкой подсистем"); + + b.Property("TimeBalanceBlock") + .HasColumnType("jsonb") + .HasColumnName("time_balance_block") + .HasComment("Баланс времени"); + + b.HasKey("Id"); + + b.HasIndex("IdWell", "Date") + .IsUnique(); + + b.ToTable("t_daily_report", t => + { + t.HasComment("Ежедневные отчёты"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DataSaubStat", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AxialLoad") + .HasColumnType("double precision") + .HasColumnName("axial_load") + .HasComment("Фактическая нагрузка"); + + b.Property("AxialLoadLimitMax") + .HasColumnType("double precision") + .HasColumnName("axial_load_limit_max") + .HasComment("Максимально допустимая нагрузка"); + + b.Property("AxialLoadSp") + .HasColumnType("double precision") + .HasColumnName("axial_load_sp") + .HasComment("Ограничение факт. нагрузки"); + + b.Property("BlockSpeedSp") + .HasColumnType("double precision") + .HasColumnName("block_speed_sp") + .HasComment("Ограничение скорости блока"); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end") + .HasComment("Дата и время окончания"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("Дата и время начала"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина забоя по стволу конечная"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина забоя по стволу начальная"); + + b.Property("EnabledSubsystems") + .HasColumnType("integer") + .HasColumnName("enabled_subsystems") + .HasComment("Флаги подсистем"); + + b.Property("Flow") + .HasColumnType("double precision") + .HasColumnName("flow") + .HasComment("Фактический расход"); + + b.Property("HasOscillation") + .HasColumnType("boolean") + .HasColumnName("has_oscillation") + .HasComment("Наличие или отсутствие осцилляции"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Название автоопределённой операции"); + + b.Property("IdFeedRegulator") + .HasColumnType("smallint") + .HasColumnName("id_feed_regulator") + .HasComment("Работа при достижении ограничения"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("Ключ телеметрии"); + + b.Property("Pressure") + .HasColumnType("double precision") + .HasColumnName("pressure") + .HasComment("Давление"); + + b.Property("PressureIdle") + .HasColumnType("double precision") + .HasColumnName("pressure_idle") + .HasComment("Давление холостого хода"); + + b.Property("PressureSp") + .HasColumnType("double precision") + .HasColumnName("pressure_sp") + .HasComment("Ограничение фактического давления"); + + b.Property("RotorSpeed") + .HasColumnType("double precision") + .HasColumnName("rotor_speed") + .HasComment("Фактическая скорость оборотов ВСП"); + + b.Property("RotorTorque") + .HasColumnType("double precision") + .HasColumnName("rotor_torque") + .HasComment("Фактический момент"); + + b.Property("RotorTorqueLimitMax") + .HasColumnType("double precision") + .HasColumnName("rotor_torque_limit_max") + .HasComment("Максимально допустимый момент"); + + b.Property("RotorTorqueSp") + .HasColumnType("double precision") + .HasColumnName("rotor_torque_sp") + .HasComment("Ограничение факт. момента"); + + b.Property("Speed") + .HasColumnType("double precision") + .HasColumnName("speed") + .HasComment("Скорость бурения"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_data_saub_stat", t => + { + t.HasComment("Кеш-таблица для хранения данных для РТК-отчета"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DataSaubStatDrillingQuality", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end") + .HasComment("Дата и время окончания"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("Дата и время начала"); + + b.Property("DepthDrillingQuality") + .HasColumnType("double precision") + .HasColumnName("depth_drilling_quality") + .HasComment("Качественная проходка"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина забоя по стволу конечная"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина забоя по стволу начальная"); + + b.Property("IdFeedRegulator") + .HasColumnType("integer") + .HasColumnName("id_feed_regulator") + .HasComment("Флаг"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("Ключ телеметрии"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_data_saub_stat_drilling_quality", t => + { + t.HasComment("Кеш-таблица для хранения данных для построения страницы \"Качество\""); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.ToTable("t_deposit", t => + { + t.HasComment("Месторождение"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end") + .HasComment("Дата начала операции"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("Дата начала операции"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина после завершения операции, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина на начало операции, м"); + + b.Property("EnabledSubsystems") + .HasColumnType("integer") + .HasColumnName("enabled_subsystems") + .HasComment("флаги включенных подсистем"); + + b.Property("ExtraData") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("extra_data") + .HasComment("доп. инфо по операции"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdUsersAtStart") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя по телеметрии на момент начала операции"); + + b.Property("Value") + .HasColumnType("double precision") + .HasColumnName("value") + .HasComment("Ключевой показатель операции"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_detected_operation", t => + { + t.HasComment("автоматически определенные операции по телеметрии"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillTest", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("Идентификатор телеметрии"); + + b.Property("DepthStart") + .HasColumnType("real") + .HasColumnName("depthStart") + .HasComment("Глубина начала"); + + b.Property("Params") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("t_drill_test_params") + .HasComment("Параметры записи drill test"); + + b.Property("TimeStampStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("timestamp_start") + .HasComment("Время начала"); + + b.HasKey("Id", "IdTelemetry"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_drill_test", t => + { + t.HasComment("Drill_test"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Driller", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("Имя"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic") + .HasComment("Отчество"); + + b.Property("Surname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname") + .HasComment("Фамилия"); + + b.HasKey("Id"); + + b.ToTable("t_driller", t => + { + t.HasComment("Бурильщик"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdFileCategory") + .HasColumnType("integer") + .HasColumnName("id_file_category"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.HasKey("Id"); + + b.HasIndex("IdFileCategory"); + + b.HasIndex("IdWell", "IdFileCategory") + .IsUnique(); + + b.ToTable("t_drilling_program_part", t => + { + t.HasComment("части программ бурения"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Faq", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Answer") + .HasColumnType("text") + .HasColumnName("answer") + .HasComment("Текст ответа"); + + b.Property("CounterQuestion") + .HasColumnType("integer") + .HasColumnName("counter_question") + .HasComment("Счетчик повторений вопроса"); + + b.Property("DateAnswer") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_answer") + .HasComment("Дата ответа"); + + b.Property("DateCreatedQuestion") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created_question") + .HasComment("Дата создания вопроса"); + + b.Property("DateLastEditedQuestion") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_edited_question") + .HasComment("Дата последнего редактирования вопроса"); + + b.Property("IdAuthorAnswer") + .HasColumnType("integer") + .HasColumnName("id_author_answer") + .HasComment("id автора ответа"); + + b.Property("IdAuthorQuestion") + .HasColumnType("integer") + .HasColumnName("id_author_question") + .HasComment("id автора вопроса"); + + b.Property("IdReplacementQuestion") + .HasColumnType("integer") + .HasColumnName("id_replacement_question") + .HasComment("Ключ заменяющего вопроса"); + + b.Property("IsFrequently") + .HasColumnType("boolean") + .HasColumnName("is_frequently") + .HasComment("Частый вопрос"); + + b.Property("Question") + .IsRequired() + .HasColumnType("text") + .HasColumnName("question") + .HasComment("Текст вопроса"); + + b.Property("State") + .HasColumnType("integer") + .HasColumnName("state") + .HasComment("Статус вопроса"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthorAnswer"); + + b.HasIndex("IdAuthorQuestion"); + + b.ToTable("t_faq", t => + { + t.HasComment("вопросы пользователей"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории"); + + b.Property("ShortName") + .HasColumnType("text") + .HasColumnName("short_name") + .HasComment("Короткое название категории"); + + b.HasKey("Id"); + + b.ToTable("t_file_category", t => + { + t.HasComment("Категории файлов"); + }); + + b.HasData( + new + { + Id = 1, + Name = "Растворный сервис", + ShortName = "fluidService" + }, + new + { + Id = 2, + Name = "Цементирование", + ShortName = "cement" + }, + new + { + Id = 3, + Name = "ННБ", + ShortName = "nnb" + }, + new + { + Id = 4, + Name = "ГТИ", + ShortName = "gti" + }, + new + { + Id = 5, + Name = "Документы по скважине", + ShortName = "wellDocuments" + }, + new + { + Id = 6, + Name = "Супервайзер", + ShortName = "supervisor" + }, + new + { + Id = 7, + Name = "Мастер", + ShortName = "master" + }, + new + { + Id = 8, + Name = "Долотный сервис", + ShortName = "toolService" + }, + new + { + Id = 9, + Name = "Буровой подрядчик", + ShortName = "drillService" + }, + new + { + Id = 10, + Name = "Сервис по заканчиванию скважины", + ShortName = "closingService" + }, + new + { + Id = 12, + Name = "Рапорт", + ShortName = "report" + }, + new + { + Id = 1000, + Name = "Программа бурения" + }, + new + { + Id = 1001, + Name = "Задание от геологов" + }, + new + { + Id = 1002, + Name = "Профиль ствола скважины (ННБ)" + }, + new + { + Id = 1003, + Name = "Технологические расчеты (ННБ)" + }, + new + { + Id = 1004, + Name = "Долотная программа" + }, + new + { + Id = 1005, + Name = "Программа по растворам" + }, + new + { + Id = 1006, + Name = "Программа геофизических исследований" + }, + new + { + Id = 1007, + Name = "Планы спусков обсадных колонн" + }, + new + { + Id = 1008, + Name = "Программы цементирования обсадных колонн" + }, + new + { + Id = 10000, + Name = "Проект на бурение транспортного и горизонтального участков скважины" + }, + new + { + Id = 10001, + Name = "Программа на бурение транспортного и горизонтального участков скважины" + }, + new + { + Id = 10002, + Name = "Акт о начале бурения" + }, + new + { + Id = 10003, + Name = "План работ спуска и цементирования направления" + }, + new + { + Id = 10004, + Name = "Программа цементирования направления" + }, + new + { + Id = 10005, + Name = "Мера обсадных труб (направление)" + }, + new + { + Id = 10006, + Name = "Акт на выполненные работы по цементированию направления" + }, + new + { + Id = 10007, + Name = "Отчет по цементированию направления (график)" + }, + new + { + Id = 10008, + Name = "План работ спуска и цементирования кондуктора" + }, + new + { + Id = 10009, + Name = "Программа цементирования (кондуктор)" + }, + new + { + Id = 10010, + Name = "Мера обсадных труб (кондуктор)" + }, + new + { + Id = 10011, + Name = "Карта крепления кондуктора" + }, + new + { + Id = 10012, + Name = "Акт на выполненные работы по цементированию кондуктора" + }, + new + { + Id = 10013, + Name = "Отчет по цементированию кондуктора (график)" + }, + new + { + Id = 10014, + Name = "Акт о замере расстояния от стола ротора до муфты кондуктора" + }, + new + { + Id = 10015, + Name = "Акт опресовки цементного кольца за кондуктором" + }, + new + { + Id = 10016, + Name = "Акт опресовки ППГ с глухими плашками совместно с кондуктором" + }, + new + { + Id = 10017, + Name = "Акт опресовки ПУГ, ППГ с трубными плашками совместно с кондуктором" + }, + new + { + Id = 10018, + Name = "План работ на крепление обсадной колонны (эк. колонна)" + }, + new + { + Id = 10019, + Name = "Программа цементирования (эк. колонна)" + }, + new + { + Id = 10020, + Name = "Мера труб эксплуатационной колонны" + }, + new + { + Id = 10021, + Name = "Карта по креплению скважины (эк. колонна)" + }, + new + { + Id = 10022, + Name = "Акт на установку пружинных центраторов" + }, + new + { + Id = 10023, + Name = "Отчет по цементированию эксплуатационной колонны (график)" + }, + new + { + Id = 10024, + Name = "Акт на выполненные работы по цементированию эксплуатационной колонны" + }, + new + { + Id = 10025, + Name = "Акт об испытании эк. колонны на герметичность (СТОП)" + }, + new + { + Id = 10026, + Name = "Акт опресовки ППГ с глухими плашками совместно с э/колонной" + }, + new + { + Id = 10027, + Name = "Акт опресовки ПУГ, ППГ с трубными плашками совместно с э/колонной" + }, + new + { + Id = 10028, + Name = "Акт на вскрытие продуктивного пласта" + }, + new + { + Id = 10029, + Name = "Акт замера параметров раствора при бурении горизонтального участка" + }, + new + { + Id = 10030, + Name = "Разрешение на спуск «хвостовика» (телефонограмма)" + }, + new + { + Id = 10031, + Name = "План работ на спуск «хвостовика»" + }, + new + { + Id = 10032, + Name = "Акт готовности бурового и энергетического оборудования к спуску «хвостовика»" + }, + new + { + Id = 10033, + Name = "Акт шаблонировки ствола скважины перед спуском «хвостовика»" + }, + new + { + Id = 10034, + Name = "Мера обсадных труб (хвостовик)" + }, + new + { + Id = 10035, + Name = "Акт выполненных работ по спуску хвостовика с закачкой (нефти, солевого раствора" + }, + new + { + Id = 10036, + Name = "Акт о переводе скважины на тех. воду" + }, + new + { + Id = 10037, + Name = "Акт об окончании бурения" + }, + new + { + Id = 10038, + Name = "Акт на передачу скважины в освоение (КРС)" + }, + new + { + Id = 10039, + Name = "Акт на опресовку межколонного пространства с КРС" + }, + new + { + Id = 10040, + Name = "Акт на сдачу скважины в ЦДНГ" + }, + new + { + Id = 10041, + Name = "Паспорт ОУС (заполняется геологами)" + }, + new + { + Id = 10042, + Name = "Паспорт скважины (заполняется геологами)" + }, + new + { + Id = 10043, + Name = "Фактические данные бурения (вставляются в паспорт скважины)" + }, + new + { + Id = 20000, + Name = "Справки по страницам" + }, + new + { + Id = 30000, + Name = "Инструкции" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Id пользователя, загрузившего файл"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("id категории файла"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Удален ли файл"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название файла"); + + b.Property("Size") + .HasColumnType("bigint") + .HasColumnName("file_size") + .HasComment("Размер файла"); + + b.Property("UploadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_file_info", t => + { + t.HasComment("Файлы всех категорий"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileMark", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created") + .HasComment("Дата совершенного действия"); + + b.Property("IdFile") + .HasColumnType("integer") + .HasColumnName("id_file") + .HasComment("id файла"); + + b.Property("IdMarkType") + .HasColumnType("integer") + .HasColumnName("id_mark_type") + .HasComment("0 - отклонен, 1 - согласован"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("id пользователя"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Помечен ли файл как удаленный"); + + b.HasKey("Id"); + + b.HasIndex("IdFile"); + + b.HasIndex("IdUser"); + + b.ToTable("t_file_mark", t => + { + t.HasComment("Действия с файлами."); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemFloat", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .HasColumnType("real") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_float", t => + { + t.HasComment("таблица данных ГТИ с типом значения float"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemInt", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .HasColumnType("integer") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_int", t => + { + t.HasComment("таблица данных ГТИ с типом значения int"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemString", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_string", t => + { + t.HasComment("таблица данных ГТИ с типом значения string"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.HelpPage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории файла"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название файла"); + + b.Property("Size") + .HasColumnType("bigint") + .HasColumnName("file_size") + .HasComment("Размер файла"); + + b.Property("UrlPage") + .IsRequired() + .HasColumnType("text") + .HasColumnName("url_page") + .HasComment("Url страницы"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.ToTable("t_help_page", t => + { + t.HasComment("Справки"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start"); + + b.Property("DepthEnd") + .HasColumnType("real") + .HasColumnName("depth_end"); + + b.Property("DepthStart") + .HasColumnType("real") + .HasColumnName("depth_start"); + + b.Property("IdFeedRegulator") + .HasColumnType("smallint") + .HasColumnName("id_feed_regulator"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_limiting_parameter", t => + { + t.HasComment("Ограничения по параметрам телеметрии"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.Manual", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateDownload") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_download") + .HasComment("Дата загрузки"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Id автора"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории файла"); + + b.Property("IdDirectory") + .HasColumnType("integer") + .HasColumnName("id_directory") + .HasComment("Id директории"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdDirectory"); + + b.ToTable("t_manual", t => + { + t.HasComment("Инструкции"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdParent") + .HasColumnType("integer") + .HasColumnName("id_parent") + .HasComment("Id родительской директории"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название"); + + b.HasKey("Id"); + + b.HasIndex("IdParent"); + + b.ToTable("t_manual_directory", t => + { + t.HasComment("Директория для инструкций"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Measure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Data") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("data") + .HasComment("Данные таблицы последних данных"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("id категории"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Пометка удаленным"); + + b.Property("Timestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("timestamp") + .HasComment("время добавления"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_measure", t => + { + t.HasComment("Таблица c данными для вкладки 'Последние данные'"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории"); + + b.Property("ShortName") + .HasColumnType("text") + .HasColumnName("short_name") + .HasComment("Короткое название категории"); + + b.HasKey("Id"); + + b.ToTable("t_measure_category", t => + { + t.HasComment("Категория последних данных"); + }); + + b.HasData( + new + { + Id = 1, + Name = "Показатели бурового раствора", + ShortName = "Раствор" + }, + new + { + Id = 2, + Name = "Шламограмма", + ShortName = "Шламограмма" + }, + new + { + Id = 3, + Name = "ННБ", + ShortName = "ННБ" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdNotificationCategory") + .HasColumnType("integer") + .HasColumnName("id_notification_category") + .HasComment("Id категории уведомления"); + + b.Property("IdTransportType") + .HasColumnType("integer") + .HasColumnName("id_transport_type") + .HasComment("Id типа доставки уведомления"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id получателя"); + + b.Property("Message") + .IsRequired() + .HasColumnType("text") + .HasColumnName("message") + .HasComment("Сообщение уведомления"); + + b.Property("ReadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("read_date") + .HasComment("Дата прочтения уведомления"); + + b.Property("RegistrationDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("registration_date") + .HasComment("Дата регистрации уведомления"); + + b.Property("SentDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("sent_date") + .HasComment("Дата отправки уведомления"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasColumnName("title") + .HasComment("Заголовок уведомления"); + + b.HasKey("Id"); + + b.HasIndex("IdNotificationCategory"); + + b.HasIndex("IdUser"); + + b.ToTable("t_notification", t => + { + t.HasComment("Уведомления"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.NotificationCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.HasKey("Id"); + + b.ToTable("t_notification_category", t => + { + t.HasComment("Категории уведомлений"); + }); + + b.HasData( + new + { + Id = 1, + Name = "Системные уведомления" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.OperationValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Конечная глубина"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Старотовая глубина"); + + b.Property("IdOperationCategory") + .HasColumnType("integer") + .HasColumnName("id_operation_category") + .HasComment("Ид категории операции"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Ид скважины"); + + b.Property("StandardValue") + .HasColumnType("double precision") + .HasColumnName("standard_value") + .HasComment("Нормативный показатель"); + + b.Property("TargetValue") + .HasColumnType("double precision") + .HasColumnName("target_value") + .HasComment("Целевой показатель"); + + b.HasKey("Id"); + + b.HasIndex("IdOperationCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_operationvalue", t => + { + t.HasComment("Целевые/нормативные показатели операции"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description") + .HasComment("Краткое описание"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_permission", t => + { + t.HasComment("Разрешения на доступ к данным"); + }); + + b.HasData( + new + { + Id = 100, + Description = "Разрешение удалять админ. Кусты", + Name = "AdminCluster.delete" + }, + new + { + Id = 101, + Description = "Разрешение редактировать админ. Кусты", + Name = "AdminCluster.edit" + }, + new + { + Id = 102, + Description = "Разрешение просматривать админ. Кусты", + Name = "AdminCluster.get" + }, + new + { + Id = 103, + Description = "Разрешение удалять админ. Компании", + Name = "AdminCompany.delete" + }, + new + { + Id = 104, + Description = "Разрешение редактировать админ. Компании", + Name = "AdminCompany.edit" + }, + new + { + Id = 105, + Description = "Разрешение просматривать админ. Компании", + Name = "AdminCompany.get" + }, + new + { + Id = 106, + Description = "Разрешение удалять админ. Типы компаний", + Name = "AdminCompanyType.delete" + }, + new + { + Id = 107, + Description = "Разрешение редактировать админ. Типы компаний", + Name = "AdminCompanyType.edit" + }, + new + { + Id = 108, + Description = "Разрешение просматривать админ. Типы компаний", + Name = "AdminCompanyType.get" + }, + new + { + Id = 109, + Description = "Разрешение удалять админ. Месторождения", + Name = "AdminDeposit.delete" + }, + new + { + Id = 110, + Description = "Разрешение редактировать админ. Месторождения", + Name = "AdminDeposit.edit" + }, + new + { + Id = 111, + Description = "Разрешение просматривать админ. Месторождения", + Name = "AdminDeposit.get" + }, + new + { + Id = 112, + Description = "Разрешение удалять админ. Разрешения", + Name = "AdminPermission.delete" + }, + new + { + Id = 113, + Description = "Разрешение редактировать админ. Разрешения", + Name = "AdminPermission.edit" + }, + new + { + Id = 114, + Description = "Разрешение просматривать админ. Разрешения", + Name = "AdminPermission.get" + }, + new + { + Id = 115, + Description = "Разрешение удалять админ. Телеметрию", + Name = "AdminTelemetry.delete" + }, + new + { + Id = 116, + Description = "Разрешение редактировать админ. Телеметрию", + Name = "AdminTelemetry.edit" + }, + new + { + Id = 117, + Description = "Разрешение просматривать админ. Телеметрию", + Name = "AdminTelemetry.get" + }, + new + { + Id = 118, + Description = "Разрешение удалять админ. Пользователей", + Name = "AdminUser.delete" + }, + new + { + Id = 119, + Description = "Разрешение редактировать админ. Пользователей", + Name = "AdminUser.edit" + }, + new + { + Id = 120, + Description = "Разрешение просматривать админ. Пользователей", + Name = "AdminUser.get" + }, + new + { + Id = 121, + Description = "Разрешение удалять админ. Роли пользователей", + Name = "AdminUserRole.delete" + }, + new + { + Id = 122, + Description = "Разрешение редактировать админ. Роли пользователей", + Name = "AdminUserRole.edit" + }, + new + { + Id = 123, + Description = "Разрешение просматривать админ. Роли пользователей", + Name = "AdminUserRole.get" + }, + new + { + Id = 124, + Description = "Разрешение удалять админ. Скважины", + Name = "AdminWell.delete" + }, + new + { + Id = 125, + Description = "Разрешение редактировать админ. Скважины", + Name = "AdminWell.edit" + }, + new + { + Id = 126, + Description = "Разрешение просматривать админ. Скважины", + Name = "AdminWell.get" + }, + new + { + Id = 127, + Description = "Разрешение удалять админ. Подсистемы", + Name = "AdminSubsytem.delete" + }, + new + { + Id = 128, + Description = "Разрешение редактировать админ. Подсистемы", + Name = "AdminSubsytem.edit" + }, + new + { + Id = 129, + Description = "Разрешение просматривать админ. Подсистемы", + Name = "AdminSubsytem.get" + }, + new + { + Id = 200, + Description = "Разрешение редактировать 0", + Name = "Auth.edit" + }, + new + { + Id = 201, + Description = "Разрешение просматривать 0", + Name = "Auth.get" + }, + new + { + Id = 202, + Description = "Разрешение просматривать Кусты", + Name = "Cluster.get" + }, + new + { + Id = 203, + Description = "Разрешение просматривать Месторождения", + Name = "Deposit.get" + }, + new + { + Id = 204, + Description = "Разрешение удалять РТК", + Name = "DrillFlowChart.delete" + }, + new + { + Id = 205, + Description = "Разрешение редактировать РТК", + Name = "DrillFlowChart.edit" + }, + new + { + Id = 206, + Description = "Разрешение просматривать РТК", + Name = "DrillFlowChart.get" + }, + new + { + Id = 207, + Description = "Разрешение удалять Программу бурения", + Name = "DrillingProgram.delete" + }, + new + { + Id = 208, + Description = "Разрешение редактировать Программу бурения", + Name = "DrillingProgram.edit" + }, + new + { + Id = 209, + Description = "Разрешение просматривать Программу бурения", + Name = "DrillingProgram.get" + }, + new + { + Id = 210, + Description = "Разрешение удалять Режимы бурения", + Name = "DrillParams.delete" + }, + new + { + Id = 211, + Description = "Разрешение редактировать Режимы бурения", + Name = "DrillParams.edit" + }, + new + { + Id = 212, + Description = "Разрешение просматривать Режимы бурения", + Name = "DrillParams.get" + }, + new + { + Id = 213, + Description = "Разрешение удалять Файлы", + Name = "File.delete" + }, + new + { + Id = 214, + Description = "Разрешение редактировать Файлы", + Name = "File.edit" + }, + new + { + Id = 215, + Description = "Разрешение просматривать Файлы", + Name = "File.get" + }, + new + { + Id = 216, + Description = "Разрешение удалять Измерения", + Name = "Measure.delete" + }, + new + { + Id = 217, + Description = "Разрешение редактировать Измерения", + Name = "Measure.edit" + }, + new + { + Id = 218, + Description = "Разрешение просматривать Измерения", + Name = "Measure.get" + }, + new + { + Id = 219, + Description = "Разрешение просматривать Сообщения телеметрии", + Name = "Message.get" + }, + new + { + Id = 220, + Description = "Разрешение просматривать Статистику по операциям", + Name = "OperationStat.get" + }, + new + { + Id = 221, + Description = "Разрешение редактировать Рапорта", + Name = "Report.edit" + }, + new + { + Id = 222, + Description = "Разрешение просматривать Рапорта", + Name = "Report.get" + }, + new + { + Id = 223, + Description = "Разрешение просматривать админ. Системная статистика", + Name = "RequestTracker.get" + }, + new + { + Id = 224, + Description = "Разрешение удалять Рекомендации уставок", + Name = "Setpoints.delete" + }, + new + { + Id = 225, + Description = "Разрешение редактировать Рекомендации уставок", + Name = "Setpoints.edit" + }, + new + { + Id = 226, + Description = "Разрешение просматривать Рекомендации уставок", + Name = "Setpoints.get" + }, + new + { + Id = 227, + Description = "Разрешение редактировать Телеметрии", + Name = "Telemetry.edit" + }, + new + { + Id = 228, + Description = "Разрешение просматривать Анализ телеметрии", + Name = "TelemetryAnalytics.get" + }, + new + { + Id = 229, + Description = "Разрешение редактировать Данные телеметрии по САУБ", + Name = "TelemetryDataSaub.edit" + }, + new + { + Id = 230, + Description = "Разрешение просматривать Данные телеметрии по САУБ", + Name = "TelemetryDataSaub.get" + }, + new + { + Id = 231, + Description = "Разрешение редактировать Данные телеметрии по SpinMaster", + Name = "TelemetryDataSpin.edit" + }, + new + { + Id = 232, + Description = "Разрешение просматривать Данные телеметрии по SpinMaster", + Name = "TelemetryDataSpin.get" + }, + new + { + Id = 233, + Description = "Разрешение редактировать Скважины", + Name = "Well.edit" + }, + new + { + Id = 234, + Description = "Разрешение просматривать Скважины", + Name = "Well.get" + }, + new + { + Id = 235, + Description = "Разрешение редактировать Композитные скважины", + Name = "WellComposite.edit" + }, + new + { + Id = 236, + Description = "Разрешение просматривать Композитные скважины", + Name = "WellComposite.get" + }, + new + { + Id = 237, + Description = "Разрешение удалять Операции по скважинам", + Name = "WellOperation.delete" + }, + new + { + Id = 238, + Description = "Разрешение редактировать Операции по скважинам", + Name = "WellOperation.edit" + }, + new + { + Id = 239, + Description = "Разрешение просматривать Операции по скважинам", + Name = "WellOperation.get" + }, + new + { + Id = 240, + Description = "Разрешение редактировать Файлы категории 1 (Растворный сервис)", + Name = "File.edit1" + }, + new + { + Id = 241, + Description = "Разрешение редактировать Файлы категории 2 (Цементирование)", + Name = "File.edit2" + }, + new + { + Id = 242, + Description = "Разрешение редактировать Файлы категории 3 (ННБ)", + Name = "File.edit3" + }, + new + { + Id = 243, + Description = "Разрешение редактировать Файлы категории 4 (ГТИ)", + Name = "File.edit4" + }, + new + { + Id = 244, + Description = "Разрешение редактировать Файлы категории 5 (Документы по скважине)", + Name = "File.edit5" + }, + new + { + Id = 245, + Description = "Разрешение редактировать Файлы категории 6 (Супервайзер)", + Name = "File.edit6" + }, + new + { + Id = 246, + Description = "Разрешение редактировать Файлы категории 7 (Мастер)", + Name = "File.edit7" + }, + new + { + Id = 247, + Description = "Разрешение редактировать Файлы категории 8 (Долотный сервис)", + Name = "File.edit8" + }, + new + { + Id = 248, + Description = "Разрешение редактировать Файлы категории 9 (Буровой подрядчик)", + Name = "File.edit9" + }, + new + { + Id = 249, + Description = "Разрешение редактировать Файлы категории 10 (Сервис по заканчиванию скважины)", + Name = "File.edit10" + }, + new + { + Id = 250, + Description = "Разрешение редактировать Файлы категории 11 (Рапорт)", + Name = "File.edit11" + }, + new + { + Id = 251, + Description = "Разрешение редактировать Файлы категории 12", + Name = "File.edit12" + }, + new + { + Id = 252, + Description = "Разрешение редактировать Файлы категории 12", + Name = "File.edit13" + }, + new + { + Id = 253, + Description = "Разрешение редактировать Файлы категории 13", + Name = "File.edit14" + }, + new + { + Id = 254, + Description = "Разрешение редактировать Файлы категории 14", + Name = "File.edit15" + }, + new + { + Id = 255, + Description = "Разрешение редактировать Файлы категории 15", + Name = "File.edit16" + }, + new + { + Id = 256, + Description = "Разрешение редактировать Файлы категории 16", + Name = "File.edit17" + }, + new + { + Id = 257, + Description = "Разрешение редактировать Файлы категории 17", + Name = "File.edit18" + }, + new + { + Id = 258, + Description = "Разрешение редактировать Файлы категории 18", + Name = "File.edit19" + }, + new + { + Id = 259, + Description = "Разрешение редактировать Файлы категории 19", + Name = "File.edit20" + }, + new + { + Id = 260, + Description = "Разрешение редактировать Файлы категории 20", + Name = "File.edit21" + }, + new + { + Id = 261, + Description = "Разрешение редактировать Файлы категории 21", + Name = "File.edit22" + }, + new + { + Id = 262, + Description = "Разрешение редактировать Файлы категории 22", + Name = "File.edit23" + }, + new + { + Id = 263, + Description = "Разрешение редактировать Файлы категории 23", + Name = "File.edit24" + }, + new + { + Id = 264, + Description = "Разрешение редактировать Файлы категории 24", + Name = "File.edit25" + }, + new + { + Id = 265, + Description = "Разрешение редактировать Файлы категории 25", + Name = "File.edit26" + }, + new + { + Id = 266, + Description = "Разрешение редактировать Файлы категории 26", + Name = "File.edit27" + }, + new + { + Id = 267, + Description = "Разрешение редактировать Файлы категории 27", + Name = "File.edit28" + }, + new + { + Id = 268, + Description = "Разрешение редактировать Файлы категории 28", + Name = "File.edit29" + }, + new + { + Id = 269, + Description = "Разрешение редактировать Файлы категории 29", + Name = "File.edit30" + }, + new + { + Id = 380, + Description = "Разрешение просматривать список бурильщиков", + Name = "Driller.get" + }, + new + { + Id = 381, + Description = "Разрешение редактировать бурильщика", + Name = "Driller.edit" + }, + new + { + Id = 382, + Description = "Разрешение удалять бурильщик", + Name = "Driller.delete" + }, + new + { + Id = 383, + Description = "Разрешение просматривать графики бурильщиков", + Name = "Schedule.get" + }, + new + { + Id = 384, + Description = "Разрешение редактировать график бурильщика", + Name = "Schedule.edit" + }, + new + { + Id = 385, + Description = "Разрешение удалять график бурильщика", + Name = "Schedule.delete" + }, + new + { + Id = 386, + Description = "Разрешение просматривать суточный рапорт", + Name = "DailyReport.get" + }, + new + { + Id = 387, + Description = "Разрешение редактировать суточный рапорт", + Name = "DailyReport.edit" + }, + new + { + Id = 388, + Description = "Разрешение просматривать авто. определенные операции", + Name = "DetectedOperation.get" + }, + new + { + Id = 389, + Description = "Разрешение просматривать целевые значения", + Name = "OperationValue.get" + }, + new + { + Id = 390, + Description = "Разрешение редактировать целевые значения", + Name = "OperationValue.edit" + }, + new + { + Id = 391, + Description = "Разрешение удалять целевые значения", + Name = "OperationValue.delete" + }, + new + { + Id = 400, + Description = "Разрешение просматривать инфо по wits параметрам", + Name = "WitsInfo.get" + }, + new + { + Id = 401, + Description = "Разрешение просматривать WITS record 1", + Name = "WitsRecord1.get" + }, + new + { + Id = 407, + Description = "Разрешение просматривать WITS record 7", + Name = "WitsRecord7.get" + }, + new + { + Id = 408, + Description = "Разрешение просматривать WITS record 8", + Name = "WitsRecord8.get" + }, + new + { + Id = 450, + Description = "Разрешение просматривать WITS record 50", + Name = "WitsRecord50.get" + }, + new + { + Id = 460, + Description = "Разрешение просматривать WITS record 60", + Name = "WitsRecord60.get" + }, + new + { + Id = 461, + Description = "Разрешение просматривать WITS record 61", + Name = "WitsRecord61.get" + }, + new + { + Id = 500, + Description = "Разрешение удалять Категорий документов файлов", + Name = "FileCategory.delete" + }, + new + { + Id = 501, + Description = "Разрешение редактировать Категорий документов файлов", + Name = "FileCategory.edit" + }, + new + { + Id = 502, + Description = "Разрешение просматривать Категорий документов файлов", + Name = "FileCategory.get" + }, + new + { + Id = 503, + Description = "Разрешение удалять Дело скважины", + Name = "WellFinalDocuments.delete" + }, + new + { + Id = 504, + Description = "Разрешение редактировать Дело скважины", + Name = "WellFinalDocuments.edit" + }, + new + { + Id = 505, + Description = "Разрешение просматривать Дело скважины", + Name = "WellFinalDocuments.get" + }, + new + { + Id = 506, + Description = "Разрешение редактировать ответственных за загрузку файла Дело скважины", + Name = "WellFinalDocuments.editPublisher" + }, + new + { + Id = 507, + Description = "Разрешение просматривать наработка талевого каната", + Name = "TelemetryWirelineRunOut.get" + }, + new + { + Id = 510, + Description = "Разрешение просматривать плановая траектория", + Name = "PlannedTrajectory.get" + }, + new + { + Id = 511, + Description = "Разрешение редактировать плановая траектория", + Name = "PlannedTrajectory.edit" + }, + new + { + Id = 512, + Description = "Разрешение удалять плановая траектория", + Name = "PlannedTrajectory.delete" + }, + new + { + Id = 516, + Description = "Разрешение просматривать статистику вопросов", + Name = "FaqStatistics.get" + }, + new + { + Id = 517, + Description = "Разрешение редактировать вопрос", + Name = "FaqStatistics.edit" + }, + new + { + Id = 518, + Description = "Разрешение удалять вопрос", + Name = "FaqStatistics.delete" + }, + new + { + Id = 519, + Description = "Разрешение просматривать список контактов", + Name = "WellContact.get" + }, + new + { + Id = 520, + Description = "Разрешение редактировать список контактов", + Name = "WellContact.edit" + }, + new + { + Id = 521, + Description = "Разрешить создание справок по страницам", + Name = "HelpPage.edit" + }, + new + { + Id = 522, + Description = "Разрешить удаление всех настроек пользователя", + Name = "UserSettings.delete" + }, + new + { + Id = 523, + Description = "Разрешить редактирование инструкций", + Name = "Manual.edit" + }, + new + { + Id = 524, + Description = "Разрешить получение инструкций", + Name = "Manual.get" + }, + new + { + Id = 525, + Description = "Разрешение на редактирование РТК у завершенной скважины", + Name = "ProcessMap.editCompletedWell" + }, + new + { + Id = 526, + Description = "Разрешение на редактирование операций у завершенной скважины", + Name = "WellOperation.editCompletedWell" + }, + new + { + Id = 527, + Description = "Разрешение на удаление инструкций", + Name = "Manual.delete" + }, + new + { + Id = 528, + Description = "Разрешение на удаление контакта", + Name = "WellContact.delete" + }, + new + { + Id = 530, + Description = "Разрешение на редактирование плановой конструкции скважины", + Name = "WellSectionPlan.edit" + }, + new + { + Id = 531, + Description = "Разрешение на удаление плановой конструкции скважины", + Name = "WellSectionPlan.delete" + }, + new + { + Id = 532, + Description = "Разрешение просматривать информацию о телеметрии", + Name = "Version.get" + }, + new + { + Id = 533, + Description = "Разрешение просматривать критические сообщения", + Name = "CriticalMessage.get" + }, + new + { + Id = 534, + Description = "Разрешение просматривать статистику по плановым и фактическим подсистемам на скважинах", + Name = "SubsystemStatPlanFact.get" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanAntiCrashRotation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("TopDriveRpmMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_rpm_min") + .HasComment("Минимальные обороты ВСП, об/мин"); + + b.Property("TopDriveStartMinFlowRate") + .HasColumnType("double precision") + .HasColumnName("top_drive_start_min_flow_rate") + .HasComment("Минимальный расход для запуска оборотов ВСП, л/сек"); + + b.Property("TopDriveTorqueMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_max") + .HasComment("Максимально допустимый момент на ВСП при противоаварийном вращении, кН*м"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_anti_crash_rotation", t => + { + t.HasComment("Противоаварийное вращение"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanAutoHoldTF", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("ZenithAngle") + .HasColumnType("double precision") + .HasColumnName("zenit_angle") + .HasComment("Зенитный угол, градусы"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_auto_hold_tf", t => + { + t.HasComment("Автоудержание TF"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanDamper", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("StickSlip") + .HasColumnType("double precision") + .HasColumnName("stick_slip") + .HasComment("StickSlip"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_functions_damper", t => + { + t.HasComment("Демпфер"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanDrillTest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("LengthStep") + .HasColumnType("double precision") + .HasColumnName("length_step") + .HasComment("Величина проходки шага, м."); + + b.Property("Note") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("RpmMin") + .HasColumnType("double precision") + .HasColumnName("rpm_min") + .HasComment("Минимальные обороты на ВСП, об/мин."); + + b.Property("RpmStepsCount") + .HasColumnType("integer") + .HasColumnName("rpm_steps_count") + .HasComment("Количество шагов оборотов на ВСП, об/мин."); + + b.Property("WeightOnBitMin") + .HasColumnType("double precision") + .HasColumnName("weight_on_bit_min") + .HasComment("Нагрузка минимальная, т"); + + b.Property("WeightOnBitStepsCount") + .HasColumnType("integer") + .HasColumnName("weight_on_bit_steps_count") + .HasComment("Количество шагов по нагрузке"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_drilltest", t => + { + t.HasComment("DrillTest"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanOscillation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Mode") + .HasColumnType("integer") + .HasColumnName("mode") + .HasComment("Режим Авто/Руч"); + + b.Property("Note") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("OptimalOscillationAngle") + .HasColumnType("double precision") + .HasColumnName("optimal_oscillation_angle") + .HasComment("Оптимальный угол осцилляции, градусы"); + + b.Property("RpmLeft") + .HasColumnType("double precision") + .HasColumnName("Rpm_left") + .HasComment("Скорость влево, об/мин"); + + b.Property("RpmRight") + .HasColumnType("double precision") + .HasColumnName("Rpm_right") + .HasComment("Скорость вправо, об/мин"); + + b.Property("TorqueMaxLeft") + .HasColumnType("double precision") + .HasColumnName("torque_max_left") + .HasComment("Ограничение момента влево, кН*м"); + + b.Property("TorqueMaxRight") + .HasColumnType("double precision") + .HasColumnName("torque_max_right") + .HasComment("Ограничение момента вправо, кН*м"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_oscillation", t => + { + t.HasComment("Осцилляция"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanShockTest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AxialVibrations") + .HasColumnType("double precision") + .HasColumnName("axial_vibrations") + .HasComment("Осевые вибрации"); + + b.Property("CombinedVibrations") + .HasColumnType("double precision") + .HasColumnName("combined_vibrations") + .HasComment("Комбинированные вибрации"); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("RpmMin") + .HasColumnType("double precision") + .HasColumnName("rpm_min") + .HasComment("Минимальные обороты на ВСП, об/мин."); + + b.Property("StickSlip") + .HasColumnType("double precision") + .HasColumnName("stick_slip") + .HasComment("stickSlip"); + + b.Property("WeightOnBitMin") + .HasColumnType("double precision") + .HasColumnName("weight_on_bit_min") + .HasComment("Нагрузка минимальная, т"); + + b.Property("Whirl") + .HasColumnType("double precision") + .HasColumnName("whirl") + .HasComment("Whirl"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_shock_test", t => + { + t.HasComment("ShockTest"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanStaticMeasurementOutput", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("SignalWaitingTime") + .HasColumnType("double precision") + .HasColumnName("signal_waiting_time") + .HasComment("Время ожидания выхода сигнала с ТМС, сек."); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_static_measurement_output", t => + { + t.HasComment("Выход статического замера"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanLoadCapacity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("DifferentialPressureMin") + .HasColumnType("double precision") + .HasColumnName("differential_pressure_min") + .HasComment("Перепад давления минимальный, атм"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("TimeLoadCapacityMin") + .HasColumnType("double precision") + .HasColumnName("time_load_capacity_min") + .HasComment("Время выработки минимальное, сек"); + + b.Property("WeightOnBitMin") + .HasColumnType("double precision") + .HasColumnName("weight_on_bit_min") + .HasComment("Нагрузка минимальная, т"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_load_capacity", t => + { + t.HasComment("РТК выработка нагрузки"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanOscillationAngles", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("Rpm") + .HasColumnType("double precision") + .HasColumnName("rpm") + .HasComment("Обороты на ВСП, об/мин., Уставка"); + + b.Property("RpmMax") + .HasColumnType("double precision") + .HasColumnName("rpm_max") + .HasComment("Обороты на ВСП, об/мин., Ограничение"); + + b.Property("TopDriveTorque") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque") + .HasComment("Момент на ВСП, кН*м., Уставка"); + + b.Property("TopDriveTorqueMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_max") + .HasComment("Момент на ВСП, кН*м., Ограничение"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_operation_oscillation_angels", t => + { + t.HasComment("Определение углов осцилляции"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanPositioningOffTheBottom", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("DifferentialPressure") + .HasColumnType("double precision") + .HasColumnName("differential_pressure") + .HasComment("Перепад давления уставка, атм."); + + b.Property("FlowRateDown") + .HasColumnType("double precision") + .HasColumnName("flow_rate_down") + .HasComment("Расход вниз, л/с."); + + b.Property("FlowRateUp") + .HasColumnType("double precision") + .HasColumnName("flow_rate_up") + .HasComment("Расход вверх, л/с."); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("PressureMax") + .HasColumnType("double precision") + .HasColumnName("pressure_max") + .HasComment("Максимально допустимое давление, атм."); + + b.Property("RopDown") + .HasColumnType("double precision") + .HasColumnName("rop_down") + .HasComment("Скорость вниз, м/ч."); + + b.Property("RopUp") + .HasColumnType("double precision") + .HasColumnName("rop_up") + .HasComment("Скорость вверх, м/ч."); + + b.Property("RpmDown") + .HasColumnType("double precision") + .HasColumnName("rpm_down") + .HasComment("Обороты вниз, об/мин."); + + b.Property("RpmUp") + .HasColumnType("double precision") + .HasColumnName("rpm_up") + .HasComment("Обороты вверх, об/мин."); + + b.Property("SlackingOff") + .HasColumnType("double precision") + .HasColumnName("slacking_off") + .HasComment("Посадка, т."); + + b.Property("StopOffTheBottom") + .HasColumnType("double precision") + .HasColumnName("stop_off_the_bottom") + .HasComment("Остановка над забоем, м."); + + b.Property("Tight") + .HasColumnType("double precision") + .HasColumnName("tight") + .HasComment("Затяжка, т."); + + b.Property("TorqueMax") + .HasColumnType("double precision") + .HasColumnName("torque_max") + .HasComment("Максимально допустимый момент, кН*м."); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_positioning_off_the_bottom", t => + { + t.HasComment("Позиционирование над забоем"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanReamingRotor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("DifferentialPressure") + .HasColumnType("double precision") + .HasColumnName("differential_pressure") + .HasComment("Перепад давления уставка, атм."); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("PressureMax") + .HasColumnType("double precision") + .HasColumnName("pressure_max") + .HasComment("Максимально допустимое давление, атм."); + + b.Property("Reaming1FlowRateDown") + .HasColumnType("double precision") + .HasColumnName("reaming1_flow_rate_down") + .HasComment("Проработка 1, Расход, л/с., Вниз"); + + b.Property("Reaming1FlowRateUp") + .HasColumnType("double precision") + .HasColumnName("reaming1_flow_rate_up") + .HasComment("Проработка 1, Расход, л/с., Вверх"); + + b.Property("Reaming1Interval") + .HasColumnType("double precision") + .HasColumnName("reaming1_interval") + .HasComment("Проработка 1, Интервал проработки, м."); + + b.Property("Reaming1RepetitionsCount") + .HasColumnType("integer") + .HasColumnName("reaming1_repetitions_count") + .HasComment("Проработка 1. Количество повторений, шт."); + + b.Property("Reaming1RopDown") + .HasColumnType("double precision") + .HasColumnName("reaming1_rop_down") + .HasComment("Проработка 1, Скорость, м/ч., Вниз"); + + b.Property("Reaming1RopUp") + .HasColumnType("double precision") + .HasColumnName("reaming1_rop_up") + .HasComment("Проработка 1. Скорость вверх, м/ч."); + + b.Property("Reaming1RpmDown") + .HasColumnType("double precision") + .HasColumnName("reaming1_rpm_down") + .HasComment("Проработка 1, Обороты, об/мин., Вниз"); + + b.Property("Reaming1RpmUp") + .HasColumnType("double precision") + .HasColumnName("reaming1_rpm_up") + .HasComment("Проработка 1, Обороты, об/мин., Вверх"); + + b.Property("Reaming1StopPointOffBottom") + .HasColumnType("double precision") + .HasColumnName("reaming1_stop_point_off_bottom") + .HasComment("Остановка над забоем, м."); + + b.Property("Reaming2FlowRateDown") + .HasColumnType("double precision") + .HasColumnName("reaming2_flow_rate_down") + .HasComment("Проработка 2, Расход, л/с., Вниз"); + + b.Property("Reaming2FlowRateUp") + .HasColumnType("double precision") + .HasColumnName("reaming2_flow_rate_up") + .HasComment("Проработка 2, Расход, л/с., Вверх"); + + b.Property("Reaming2Interval") + .HasColumnType("double precision") + .HasColumnName("reaming2_interval") + .HasComment("Проработка 2, Интервал проработки, м."); + + b.Property("Reaming2RepetitionsCount") + .HasColumnType("integer") + .HasColumnName("reaming2_repetitions_count") + .HasComment("Проработка 2, Количество повторений, шт."); + + b.Property("Reaming2RopDown") + .HasColumnType("double precision") + .HasColumnName("reaming2_rop_down") + .HasComment("Проработка 2, Скорость, м/ч., Вниз"); + + b.Property("Reaming2RopUp") + .HasColumnType("double precision") + .HasColumnName("reaming2_rop_up") + .HasComment("Проработка 2, Скорость, м/ч., Вверх"); + + b.Property("Reaming2RpmDown") + .HasColumnType("double precision") + .HasColumnName("reaming2_rpm_down") + .HasComment("Проработка 2, Обороты, об/мин., Вниз"); + + b.Property("Reaming2RpmUp") + .HasColumnType("double precision") + .HasColumnName("reaming2_rpm_up") + .HasComment("Проработка 2, Обороты, об/мин., Вверх"); + + b.Property("Reaming2StopPointOffBottom") + .HasColumnType("double precision") + .HasColumnName("reaming2_stop_point_off_bottom") + .HasComment("Остановка над забоем, м."); + + b.Property("Reaming3FlowRateDown") + .HasColumnType("double precision") + .HasColumnName("reaming3_flow_rate_down") + .HasComment("Проработка 3, Расход, л/с., Вниз"); + + b.Property("Reaming3FlowRateUp") + .HasColumnType("double precision") + .HasColumnName("reaming3_flow_rate_up") + .HasComment("Проработка 3, Расход, л/с., Вверх"); + + b.Property("Reaming3Interval") + .HasColumnType("double precision") + .HasColumnName("reaming3_interval") + .HasComment("Проработка 3, Интервал проработки, м."); + + b.Property("Reaming3RepetitionsCount") + .HasColumnType("integer") + .HasColumnName("reaming3_repetitions_count") + .HasComment("Проработка 3, Количество повторений, шт."); + + b.Property("Reaming3RopDown") + .HasColumnType("double precision") + .HasColumnName("reaming3_rop_down") + .HasComment("Проработка 3, Скорость, м/ч., Вниз"); + + b.Property("Reaming3RopUp") + .HasColumnType("double precision") + .HasColumnName("reaming3_rop_up") + .HasComment("Проработка 3, Скорость, м/ч., Вверх"); + + b.Property("Reaming3RpmDown") + .HasColumnType("double precision") + .HasColumnName("reaming3_rpm_down") + .HasComment("Проработка 3, Обороты, об/мин., Вниз"); + + b.Property("Reaming3RpmUp") + .HasColumnType("double precision") + .HasColumnName("reaming3_rpm_up") + .HasComment("Проработка 3, Обороты, об/мин., Вверх"); + + b.Property("Reaming3StopPointOffBottom") + .HasColumnType("double precision") + .HasColumnName("reaming3_stop_point_off_bottom") + .HasComment("Остановка над забоем, м."); + + b.Property("SlackingOff") + .HasColumnType("double precision") + .HasColumnName("slacking_off") + .HasComment("Посадка, т."); + + b.Property("Tight") + .HasColumnType("double precision") + .HasColumnName("tight") + .HasComment("Затяжка, т."); + + b.Property("TorqueMax") + .HasColumnType("double precision") + .HasColumnName("torque_max") + .HasComment("Максимально допустимый момент, кН*м."); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_operation_reaming_rotor", t => + { + t.HasComment("РТК проработка ротор"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanReamingSlide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("DifferentialPressure") + .HasColumnType("double precision") + .HasColumnName("differential_pressure") + .HasComment("Перепад давления уставка, атм."); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("PressureMax") + .HasColumnType("double precision") + .HasColumnName("pressure_max") + .HasComment("Максимально допустимое давление, атм."); + + b.Property("Reaming1FlowRateDown") + .HasColumnType("double precision") + .HasColumnName("reaming1_flow_rate_down") + .HasComment("Проработка 1, Расход, л/с., Вниз"); + + b.Property("Reaming1FlowRateUp") + .HasColumnType("double precision") + .HasColumnName("reaming1_flow_rate_up") + .HasComment("Проработка 1, Расход, л/с., Вверх"); + + b.Property("Reaming1Interval") + .HasColumnType("double precision") + .HasColumnName("reaming1_interval") + .HasComment("Проработка 1, Интервал проработки, м."); + + b.Property("Reaming1RepetitionsCount") + .HasColumnType("integer") + .HasColumnName("reaming1_repetitions_count") + .HasComment("Проработка 1. Количество повторений, шт."); + + b.Property("Reaming1RopDown") + .HasColumnType("double precision") + .HasColumnName("reaming1_rop_down") + .HasComment("Проработка 1. Скорость вниз, м/ч."); + + b.Property("Reaming1RopUp") + .HasColumnType("double precision") + .HasColumnName("reaming1_rop_up") + .HasComment("Проработка 1. Скорость вверх, м/ч."); + + b.Property("Reaming1RpmDown") + .HasColumnType("double precision") + .HasColumnName("reaming1_rpm_down") + .HasComment("Проработка 1, Обороты, об/мин., Вниз"); + + b.Property("Reaming1RpmUp") + .HasColumnType("double precision") + .HasColumnName("reaming1_rpm_up") + .HasComment("Проработка 1, Обороты, об/мин., Вверх"); + + b.Property("Reaming1StopPointOffBottom") + .HasColumnType("double precision") + .HasColumnName("reaming1_stop_point_off_bottom") + .HasComment("Остановка над забоем, м."); + + b.Property("Reaming2FlowRateDown") + .HasColumnType("double precision") + .HasColumnName("reaming2_flow_rate_down") + .HasComment("Проработка 2, Расход, л/с., Вниз"); + + b.Property("Reaming2FlowRateUp") + .HasColumnType("double precision") + .HasColumnName("reaming2_flow_rate_up") + .HasComment("Проработка 2, Расход, л/с., Вверх"); + + b.Property("Reaming2Interval") + .HasColumnType("double precision") + .HasColumnName("reaming2_interval") + .HasComment("Проработка 2, Интервал проработки, м."); + + b.Property("Reaming2RepetitionsCount") + .HasColumnType("integer") + .HasColumnName("reaming2_repetitions_count") + .HasComment("Проработка 2, Количество повторений, шт."); + + b.Property("Reaming2RopDown") + .HasColumnType("double precision") + .HasColumnName("reaming2_rop_down") + .HasComment("Проработка 2, Скорость, м/ч., Вниз"); + + b.Property("Reaming2RopUp") + .HasColumnType("double precision") + .HasColumnName("reaming2_rop_up") + .HasComment("Проработка 2, Скорость, м/ч., Вверх"); + + b.Property("Reaming2RpmDown") + .HasColumnType("double precision") + .HasColumnName("reaming2_rpm_down") + .HasComment("Проработка 2, Обороты, об/мин., Вниз"); + + b.Property("Reaming2RpmUp") + .HasColumnType("double precision") + .HasColumnName("reaming2_rpm_up") + .HasComment("Проработка 2, Обороты, об/мин., Вверх"); + + b.Property("Reaming2StopPointOffBottom") + .HasColumnType("double precision") + .HasColumnName("reaming2_stop_point_off_bottom") + .HasComment("Остановка над забоем, м."); + + b.Property("Reaming3FlowRateDown") + .HasColumnType("double precision") + .HasColumnName("reaming3_flow_rate_down") + .HasComment("Проработка 3, Расход, л/с., Вниз"); + + b.Property("Reaming3FlowRateUp") + .HasColumnType("double precision") + .HasColumnName("reaming3_flow_rate_up") + .HasComment("Проработка 3, Расход, л/с., Вверх"); + + b.Property("Reaming3Interval") + .HasColumnType("double precision") + .HasColumnName("reaming3_interval") + .HasComment("Проработка 3, Интервал проработки, м."); + + b.Property("Reaming3RepetitionsCount") + .HasColumnType("integer") + .HasColumnName("reaming3_repetitions_count") + .HasComment("Проработка 3, Количество повторений, шт."); + + b.Property("Reaming3RopDown") + .HasColumnType("double precision") + .HasColumnName("reaming3_rop_down") + .HasComment("Проработка 3, Скорость, м/ч., Вниз"); + + b.Property("Reaming3RopUp") + .HasColumnType("double precision") + .HasColumnName("reaming3_rop_up") + .HasComment("Проработка 3, Скорость, м/ч., Вверх"); + + b.Property("Reaming3RpmDown") + .HasColumnType("double precision") + .HasColumnName("reaming3_rpm_down") + .HasComment("Проработка 3, Обороты, об/мин., Вниз"); + + b.Property("Reaming3RpmUp") + .HasColumnType("double precision") + .HasColumnName("reaming3_rpm_up") + .HasComment("Проработка 3, Обороты, об/мин., Вверх"); + + b.Property("Reaming3StopPointOffBottom") + .HasColumnType("double precision") + .HasColumnName("reaming3_stop_point_off_bottom") + .HasComment("Остановка над забоем, м."); + + b.Property("SlackingOff") + .HasColumnType("double precision") + .HasColumnName("slacking_off") + .HasComment("Посадка, т."); + + b.Property("Tight") + .HasColumnType("double precision") + .HasColumnName("tight") + .HasComment("Затяжка, т."); + + b.Property("TorqueMax") + .HasColumnType("double precision") + .HasColumnName("torque_max") + .HasComment("Максимально допустимый момент, кН*м."); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_reaming_slide", t => + { + t.HasComment("РТК проработка слайд"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanRecordingStaticMeasurement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("MeasurementRecordingTime") + .HasColumnType("double precision") + .HasColumnName("measurement_recording_time") + .HasComment("Время записи замера, сек"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_recording_static_measurement", t => + { + t.HasComment("Запись статического замера"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanRotor", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("DifferentialPressure") + .HasColumnType("double precision") + .HasColumnName("differential_pressure") + .HasComment("Перепад давления, атм. Уставка"); + + b.Property("DifferentialPressureMax") + .HasColumnType("double precision") + .HasColumnName("differential_pressure_max") + .HasComment("Перепад давления, атм. Ограничение"); + + b.Property("FlowRate") + .HasColumnType("double precision") + .HasColumnName("flow_rate") + .HasComment("Расход л/с. Уставка"); + + b.Property("FlowRateMax") + .HasColumnType("double precision") + .HasColumnName("flow_rate_max") + .HasComment("Расход л/с. Ограничение"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("PressureMax") + .HasColumnType("double precision") + .HasColumnName("pressure_max") + .HasComment("Максимально допустимое давление, атм"); + + b.Property("RopMax") + .HasColumnType("double precision") + .HasColumnName("rop_max") + .HasComment("Максимально допустимая скорость, м/ч"); + + b.Property("Rpm") + .HasColumnType("double precision") + .HasColumnName("rpm") + .HasComment("Обороты на ВСП, об/мин. Уставка"); + + b.Property("RpmMax") + .HasColumnType("double precision") + .HasColumnName("rpm_max") + .HasComment("Обороты на ВСП, об/мин. Ограничение"); + + b.Property("TopDriveTorque") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque") + .HasComment("Момент на ВСП, кН*м. Уставка"); + + b.Property("TopDriveTorqueMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_max") + .HasComment("Момент на ВСП, кН*м. Ограничение"); + + b.Property("WeightOnBit") + .HasColumnType("double precision") + .HasColumnName("weight_on_bit") + .HasComment("Нагрузка, т. Уставка"); + + b.Property("WeightOnBitMax") + .HasColumnType("double precision") + .HasColumnName("weight_on_bit_max") + .HasComment("Нагрузка, т. Ограничение"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_rotor", t => + { + t.HasComment("РТК план бурение ротор"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanSlide", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Buckling") + .HasColumnType("double precision") + .HasColumnName("buckling") + .HasComment("Складывание инструмента, м."); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("DifferentialPressure") + .HasColumnType("double precision") + .HasColumnName("differential_pressure") + .HasComment("Перепад давления уставка, атм."); + + b.Property("DifferentialPressureMax") + .HasColumnType("double precision") + .HasColumnName("differential_pressure_max") + .HasComment("Перепад давления ограничение, атм."); + + b.Property("FlowRate") + .HasColumnType("double precision") + .HasColumnName("flow_rate") + .HasComment("Расход уставка, л/с."); + + b.Property("FlowRateMax") + .HasColumnType("double precision") + .HasColumnName("flow_rate_max") + .HasComment("Расход ограничение, л/с."); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("PressureMax") + .HasColumnType("double precision") + .HasColumnName("pressure_max") + .HasComment("Максимально допустимое давление, атм."); + + b.Property("RopMax") + .HasColumnType("double precision") + .HasColumnName("rop_max") + .HasComment("Максимально допустимая скорость, м/ч."); + + b.Property("Spring") + .HasColumnType("double precision") + .HasColumnName("spring") + .HasComment("Расчётная пружина, градус"); + + b.Property("WeightOnBit") + .HasColumnType("double precision") + .HasColumnName("weight_on_bit") + .HasComment("Нагрузка уставка, т."); + + b.Property("WeightOnBitMax") + .HasColumnType("double precision") + .HasColumnName("weight_on_bit_max") + .HasComment("Нагрузка ограничение, т."); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_slide", t => + { + t.HasComment("РТК план бурение слайд"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanSwitchingOffThePump", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("Duration") + .HasColumnType("double precision") + .HasColumnName("duration") + .HasComment("Продолжительность, сек."); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("ResidualPressureLimit") + .HasColumnType("double precision") + .HasColumnName("residual_pressure_limit") + .HasComment("Лимит остаточного давления, атм."); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_operation_switching_off_the_pump", t => + { + t.HasComment("Выключение насоса"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanSwitchingToTheMode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("FlowRate") + .HasColumnType("double precision") + .HasColumnName("flow_rate") + .HasComment("Расход, л/с"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("PressureMax") + .HasColumnType("double precision") + .HasColumnName("pressure_limit") + .HasComment("Максимально допустимое давление, атм."); + + b.Property("RampTime") + .HasColumnType("double precision") + .HasColumnName("ramp_time") + .HasComment("Время выхода буровых насосов на плановый расход, сек."); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_switching_to_the_mode", t => + { + t.HasComment("Выход на плановый расход"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanTFOrientation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("DifferentialPressure") + .HasColumnType("double precision") + .HasColumnName("differential_pressure") + .HasComment("Перепад давления, атм."); + + b.Property("FlowRateDown") + .HasColumnType("double precision") + .HasColumnName("flow_rate_down") + .HasComment("Расход вниз, л/с."); + + b.Property("FlowRateUp") + .HasColumnType("double precision") + .HasColumnName("flow_rate_up") + .HasComment("Расход вверх, л/с."); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Interval") + .HasColumnType("double precision") + .HasColumnName("interval") + .HasComment("Интервал расхаживания, м."); + + b.Property("Note") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.Property("PressureMax") + .HasColumnType("double precision") + .HasColumnName("pressure_max") + .HasComment("Максимальное давление, атм."); + + b.Property("RepetitionsCount") + .HasColumnType("integer") + .HasColumnName("repetitions_count") + .HasComment("Количество расхаживаний, шт."); + + b.Property("RopDown") + .HasColumnType("double precision") + .HasColumnName("rop_down") + .HasComment("Скорость вниз, м/ч."); + + b.Property("RopUp") + .HasColumnType("double precision") + .HasColumnName("rop_up") + .HasComment("Скорость вверх, м/ч."); + + b.Property("SlackingOff") + .HasColumnType("double precision") + .HasColumnName("slacking_off") + .HasComment("Посадка, т."); + + b.Property("Spring") + .HasColumnType("double precision") + .HasColumnName("spring") + .HasComment("Пружина, град."); + + b.Property("StopPointOffBottom") + .HasColumnType("double precision") + .HasColumnName("stop_point_off_bottom") + .HasComment("Остановка над забоем, м."); + + b.Property("TFSetpoint") + .HasColumnType("double precision") + .HasColumnName("tf_setpoint") + .HasComment("Задание TF, град."); + + b.Property("Tight") + .HasColumnType("double precision") + .HasColumnName("tight") + .HasComment("Затяжка, т."); + + b.Property("TorqueMax") + .HasColumnType("double precision") + .HasColumnName("torque_max") + .HasComment("Максимально допустимый момент, кН*м."); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdPrevious"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_tf_orientation", t => + { + t.HasComment("Выставление"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.ProcessMapPlanSubsystems", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AutoOscillation") + .HasColumnType("double precision") + .HasColumnName("auto_oscillation") + .HasComment("Процент использования слайда с осцилляцией"); + + b.Property("AutoRotor") + .HasColumnType("double precision") + .HasColumnName("auto_rotor") + .HasComment("Процент использования ротора"); + + b.Property("AutoSlide") + .HasColumnType("double precision") + .HasColumnName("auto_slide") + .HasComment("Процент использования слайда"); + + b.Property("Creation") + .HasColumnType("timestamp with time zone") + .HasColumnName("creation") + .HasComment("дата создания"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Автор"); + + b.Property("IdEditor") + .HasColumnType("integer") + .HasColumnName("id_editor") + .HasComment("Редактор"); + + b.Property("IdPrevious") + .HasColumnType("integer") + .HasColumnName("id_previous") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("Note") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)") + .HasColumnName("note") + .HasComment("Примечание"); + + b.Property("Obsolete") + .HasColumnType("timestamp with time zone") + .HasColumnName("obsolete") + .HasComment("дата устаревания"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdEditor"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_plan_subsystems", t => + { + t.HasComment("РТК план использование подсистем"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b => + { + b.Property("IdCompany") + .HasColumnType("integer") + .HasColumnName("id_company"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.HasKey("IdCompany", "IdWell"); + + b.HasIndex("IdWell"); + + b.ToTable("t_relation_company_well", t => + { + t.HasComment("отношение скважин и компаний"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationContactWell", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.HasKey("IdWell", "IdUser"); + + b.HasIndex("IdUser"); + + b.ToTable("t_relation_contact_well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserDrillingProgramPart", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdDrillingProgramPart") + .HasColumnType("integer") + .HasColumnName("id_drilling_program_part"); + + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_role") + .HasComment("1 - publisher, 2 - approver"); + + b.HasKey("IdUser", "IdDrillingProgramPart") + .HasName("t_relation_user_drilling_program_part_pk"); + + b.HasIndex("IdDrillingProgramPart"); + + b.ToTable("t_relation_user_drilling_program_part", t => + { + t.HasComment("Отношение пользователей и частей ПБ"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRolePermission", b => + { + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.Property("IdPermission") + .HasColumnType("integer") + .HasColumnName("id_permission"); + + b.HasKey("IdUserRole", "IdPermission"); + + b.HasIndex("IdPermission"); + + b.ToTable("t_relation_user_role_permission", t => + { + t.HasComment("Отношение ролей пользователей и разрешений доступа"); + }); + + b.HasData( + new + { + IdUserRole = 1100, + IdPermission = 102 + }, + new + { + IdUserRole = 1100, + IdPermission = 111 + }, + new + { + IdUserRole = 1101, + IdPermission = 101 + }, + new + { + IdUserRole = 1101, + IdPermission = 100 + }, + new + { + IdUserRole = 1102, + IdPermission = 105 + }, + new + { + IdUserRole = 1102, + IdPermission = 108 + }, + new + { + IdUserRole = 1103, + IdPermission = 104 + }, + new + { + IdUserRole = 1103, + IdPermission = 103 + }, + new + { + IdUserRole = 1104, + IdPermission = 108 + }, + new + { + IdUserRole = 1105, + IdPermission = 107 + }, + new + { + IdUserRole = 1105, + IdPermission = 106 + }, + new + { + IdUserRole = 1106, + IdPermission = 111 + }, + new + { + IdUserRole = 1107, + IdPermission = 110 + }, + new + { + IdUserRole = 1107, + IdPermission = 109 + }, + new + { + IdUserRole = 1108, + IdPermission = 114 + }, + new + { + IdUserRole = 1109, + IdPermission = 113 + }, + new + { + IdUserRole = 1109, + IdPermission = 112 + }, + new + { + IdUserRole = 1110, + IdPermission = 123 + }, + new + { + IdUserRole = 1110, + IdPermission = 114 + }, + new + { + IdUserRole = 1111, + IdPermission = 122 + }, + new + { + IdUserRole = 1111, + IdPermission = 121 + }, + new + { + IdUserRole = 1112, + IdPermission = 117 + }, + new + { + IdUserRole = 1113, + IdPermission = 105 + }, + new + { + IdUserRole = 1113, + IdPermission = 123 + }, + new + { + IdUserRole = 1113, + IdPermission = 120 + }, + new + { + IdUserRole = 1114, + IdPermission = 119 + }, + new + { + IdUserRole = 1114, + IdPermission = 118 + }, + new + { + IdUserRole = 1114, + IdPermission = 200 + }, + new + { + IdUserRole = 1115, + IdPermission = 223 + }, + new + { + IdUserRole = 1116, + IdPermission = 105 + }, + new + { + IdUserRole = 1116, + IdPermission = 102 + }, + new + { + IdUserRole = 1116, + IdPermission = 117 + }, + new + { + IdUserRole = 1116, + IdPermission = 126 + }, + new + { + IdUserRole = 1117, + IdPermission = 125 + }, + new + { + IdUserRole = 1117, + IdPermission = 124 + }, + new + { + IdUserRole = 1200, + IdPermission = 203 + }, + new + { + IdUserRole = 1200, + IdPermission = 230 + }, + new + { + IdUserRole = 1201, + IdPermission = 202 + }, + new + { + IdUserRole = 1201, + IdPermission = 203 + }, + new + { + IdUserRole = 1201, + IdPermission = 220 + }, + new + { + IdUserRole = 1202, + IdPermission = 203 + }, + new + { + IdUserRole = 1202, + IdPermission = 220 + }, + new + { + IdUserRole = 1202, + IdPermission = 236 + }, + new + { + IdUserRole = 1202, + IdPermission = 212 + }, + new + { + IdUserRole = 1203, + IdPermission = 235 + }, + new + { + IdUserRole = 1204, + IdPermission = 202 + }, + new + { + IdUserRole = 1204, + IdPermission = 203 + }, + new + { + IdUserRole = 1205, + IdPermission = 215 + }, + new + { + IdUserRole = 1206, + IdPermission = 203 + }, + new + { + IdUserRole = 1206, + IdPermission = 206 + }, + new + { + IdUserRole = 1207, + IdPermission = 205 + }, + new + { + IdUserRole = 1208, + IdPermission = 218 + }, + new + { + IdUserRole = 1209, + IdPermission = 217 + }, + new + { + IdUserRole = 1210, + IdPermission = 203 + }, + new + { + IdUserRole = 1210, + IdPermission = 230 + }, + new + { + IdUserRole = 1210, + IdPermission = 219 + }, + new + { + IdUserRole = 1211, + IdPermission = 203 + }, + new + { + IdUserRole = 1211, + IdPermission = 220 + }, + new + { + IdUserRole = 1211, + IdPermission = 239 + }, + new + { + IdUserRole = 1212, + IdPermission = 238 + }, + new + { + IdUserRole = 1212, + IdPermission = 237 + }, + new + { + IdUserRole = 1213, + IdPermission = 203 + }, + new + { + IdUserRole = 1213, + IdPermission = 239 + }, + new + { + IdUserRole = 1213, + IdPermission = 212 + }, + new + { + IdUserRole = 1214, + IdPermission = 211 + }, + new + { + IdUserRole = 1214, + IdPermission = 210 + }, + new + { + IdUserRole = 1215, + IdPermission = 203 + }, + new + { + IdUserRole = 1215, + IdPermission = 222 + }, + new + { + IdUserRole = 1216, + IdPermission = 221 + }, + new + { + IdUserRole = 1217, + IdPermission = 226 + }, + new + { + IdUserRole = 1218, + IdPermission = 225 + }, + new + { + IdUserRole = 1218, + IdPermission = 224 + }, + new + { + IdUserRole = 1219, + IdPermission = 203 + }, + new + { + IdUserRole = 1219, + IdPermission = 206 + }, + new + { + IdUserRole = 1219, + IdPermission = 230 + }, + new + { + IdUserRole = 1219, + IdPermission = 232 + }, + new + { + IdUserRole = 1220, + IdPermission = 203 + }, + new + { + IdUserRole = 1220, + IdPermission = 228 + }, + new + { + IdUserRole = 1221, + IdPermission = 202 + }, + new + { + IdUserRole = 1221, + IdPermission = 203 + }, + new + { + IdUserRole = 1221, + IdPermission = 220 + }, + new + { + IdUserRole = 1221, + IdPermission = 234 + }, + new + { + IdUserRole = 1500, + IdPermission = 507 + }, + new + { + IdUserRole = 1500, + IdPermission = 510 + }, + new + { + IdUserRole = 1501, + IdPermission = 214 + }, + new + { + IdUserRole = 1501, + IdPermission = 213 + }, + new + { + IdUserRole = 1502, + IdPermission = 207 + }, + new + { + IdUserRole = 1502, + IdPermission = 208 + }, + new + { + IdUserRole = 2000, + IdPermission = 205 + }, + new + { + IdUserRole = 2000, + IdPermission = 204 + }, + new + { + IdUserRole = 2000, + IdPermission = 245 + }, + new + { + IdUserRole = 2001, + IdPermission = 244 + }, + new + { + IdUserRole = 2001, + IdPermission = 245 + }, + new + { + IdUserRole = 2002, + IdPermission = 244 + }, + new + { + IdUserRole = 2002, + IdPermission = 246 + }, + new + { + IdUserRole = 2002, + IdPermission = 237 + }, + new + { + IdUserRole = 2002, + IdPermission = 238 + }, + new + { + IdUserRole = 2003, + IdPermission = 240 + }, + new + { + IdUserRole = 2003, + IdPermission = 217 + }, + new + { + IdUserRole = 2003, + IdPermission = 216 + }, + new + { + IdUserRole = 2004, + IdPermission = 242 + }, + new + { + IdUserRole = 2004, + IdPermission = 217 + }, + new + { + IdUserRole = 2004, + IdPermission = 216 + }, + new + { + IdUserRole = 2004, + IdPermission = 205 + }, + new + { + IdUserRole = 2004, + IdPermission = 204 + }, + new + { + IdUserRole = 2005, + IdPermission = 247 + }, + new + { + IdUserRole = 2005, + IdPermission = 205 + }, + new + { + IdUserRole = 2005, + IdPermission = 204 + }, + new + { + IdUserRole = 2006, + IdPermission = 243 + }, + new + { + IdUserRole = 2006, + IdPermission = 205 + }, + new + { + IdUserRole = 2006, + IdPermission = 204 + }, + new + { + IdUserRole = 2007, + IdPermission = 241 + }, + new + { + IdUserRole = 2007, + IdPermission = 205 + }, + new + { + IdUserRole = 2007, + IdPermission = 204 + }, + new + { + IdUserRole = 1, + IdPermission = 100 + }, + new + { + IdUserRole = 1, + IdPermission = 101 + }, + new + { + IdUserRole = 1, + IdPermission = 102 + }, + new + { + IdUserRole = 1, + IdPermission = 103 + }, + new + { + IdUserRole = 1, + IdPermission = 104 + }, + new + { + IdUserRole = 1, + IdPermission = 105 + }, + new + { + IdUserRole = 1, + IdPermission = 106 + }, + new + { + IdUserRole = 1, + IdPermission = 107 + }, + new + { + IdUserRole = 1, + IdPermission = 108 + }, + new + { + IdUserRole = 1, + IdPermission = 109 + }, + new + { + IdUserRole = 1, + IdPermission = 110 + }, + new + { + IdUserRole = 1, + IdPermission = 111 + }, + new + { + IdUserRole = 1, + IdPermission = 112 + }, + new + { + IdUserRole = 1, + IdPermission = 113 + }, + new + { + IdUserRole = 1, + IdPermission = 114 + }, + new + { + IdUserRole = 1, + IdPermission = 115 + }, + new + { + IdUserRole = 1, + IdPermission = 116 + }, + new + { + IdUserRole = 1, + IdPermission = 117 + }, + new + { + IdUserRole = 1, + IdPermission = 118 + }, + new + { + IdUserRole = 1, + IdPermission = 119 + }, + new + { + IdUserRole = 1, + IdPermission = 120 + }, + new + { + IdUserRole = 1, + IdPermission = 121 + }, + new + { + IdUserRole = 1, + IdPermission = 122 + }, + new + { + IdUserRole = 1, + IdPermission = 123 + }, + new + { + IdUserRole = 1, + IdPermission = 124 + }, + new + { + IdUserRole = 1, + IdPermission = 125 + }, + new + { + IdUserRole = 1, + IdPermission = 126 + }, + new + { + IdUserRole = 1, + IdPermission = 127 + }, + new + { + IdUserRole = 1, + IdPermission = 128 + }, + new + { + IdUserRole = 1, + IdPermission = 129 + }, + new + { + IdUserRole = 1, + IdPermission = 200 + }, + new + { + IdUserRole = 1, + IdPermission = 201 + }, + new + { + IdUserRole = 1, + IdPermission = 202 + }, + new + { + IdUserRole = 1, + IdPermission = 203 + }, + new + { + IdUserRole = 1, + IdPermission = 204 + }, + new + { + IdUserRole = 1, + IdPermission = 205 + }, + new + { + IdUserRole = 1, + IdPermission = 206 + }, + new + { + IdUserRole = 1, + IdPermission = 207 + }, + new + { + IdUserRole = 1, + IdPermission = 208 + }, + new + { + IdUserRole = 1, + IdPermission = 209 + }, + new + { + IdUserRole = 1, + IdPermission = 210 + }, + new + { + IdUserRole = 1, + IdPermission = 211 + }, + new + { + IdUserRole = 1, + IdPermission = 212 + }, + new + { + IdUserRole = 1, + IdPermission = 213 + }, + new + { + IdUserRole = 1, + IdPermission = 214 + }, + new + { + IdUserRole = 1, + IdPermission = 215 + }, + new + { + IdUserRole = 1, + IdPermission = 216 + }, + new + { + IdUserRole = 1, + IdPermission = 217 + }, + new + { + IdUserRole = 1, + IdPermission = 218 + }, + new + { + IdUserRole = 1, + IdPermission = 219 + }, + new + { + IdUserRole = 1, + IdPermission = 220 + }, + new + { + IdUserRole = 1, + IdPermission = 221 + }, + new + { + IdUserRole = 1, + IdPermission = 222 + }, + new + { + IdUserRole = 1, + IdPermission = 223 + }, + new + { + IdUserRole = 1, + IdPermission = 224 + }, + new + { + IdUserRole = 1, + IdPermission = 225 + }, + new + { + IdUserRole = 1, + IdPermission = 226 + }, + new + { + IdUserRole = 1, + IdPermission = 227 + }, + new + { + IdUserRole = 1, + IdPermission = 228 + }, + new + { + IdUserRole = 1, + IdPermission = 229 + }, + new + { + IdUserRole = 1, + IdPermission = 230 + }, + new + { + IdUserRole = 1, + IdPermission = 231 + }, + new + { + IdUserRole = 1, + IdPermission = 232 + }, + new + { + IdUserRole = 1, + IdPermission = 233 + }, + new + { + IdUserRole = 1, + IdPermission = 234 + }, + new + { + IdUserRole = 1, + IdPermission = 235 + }, + new + { + IdUserRole = 1, + IdPermission = 236 + }, + new + { + IdUserRole = 1, + IdPermission = 237 + }, + new + { + IdUserRole = 1, + IdPermission = 238 + }, + new + { + IdUserRole = 1, + IdPermission = 239 + }, + new + { + IdUserRole = 1, + IdPermission = 240 + }, + new + { + IdUserRole = 1, + IdPermission = 241 + }, + new + { + IdUserRole = 1, + IdPermission = 242 + }, + new + { + IdUserRole = 1, + IdPermission = 243 + }, + new + { + IdUserRole = 1, + IdPermission = 244 + }, + new + { + IdUserRole = 1, + IdPermission = 245 + }, + new + { + IdUserRole = 1, + IdPermission = 246 + }, + new + { + IdUserRole = 1, + IdPermission = 247 + }, + new + { + IdUserRole = 1, + IdPermission = 248 + }, + new + { + IdUserRole = 1, + IdPermission = 249 + }, + new + { + IdUserRole = 1, + IdPermission = 250 + }, + new + { + IdUserRole = 1, + IdPermission = 251 + }, + new + { + IdUserRole = 1, + IdPermission = 252 + }, + new + { + IdUserRole = 1, + IdPermission = 253 + }, + new + { + IdUserRole = 1, + IdPermission = 254 + }, + new + { + IdUserRole = 1, + IdPermission = 255 + }, + new + { + IdUserRole = 1, + IdPermission = 256 + }, + new + { + IdUserRole = 1, + IdPermission = 257 + }, + new + { + IdUserRole = 1, + IdPermission = 258 + }, + new + { + IdUserRole = 1, + IdPermission = 259 + }, + new + { + IdUserRole = 1, + IdPermission = 260 + }, + new + { + IdUserRole = 1, + IdPermission = 261 + }, + new + { + IdUserRole = 1, + IdPermission = 262 + }, + new + { + IdUserRole = 1, + IdPermission = 263 + }, + new + { + IdUserRole = 1, + IdPermission = 264 + }, + new + { + IdUserRole = 1, + IdPermission = 265 + }, + new + { + IdUserRole = 1, + IdPermission = 266 + }, + new + { + IdUserRole = 1, + IdPermission = 267 + }, + new + { + IdUserRole = 1, + IdPermission = 268 + }, + new + { + IdUserRole = 1, + IdPermission = 269 + }, + new + { + IdUserRole = 1, + IdPermission = 380 + }, + new + { + IdUserRole = 1, + IdPermission = 381 + }, + new + { + IdUserRole = 1, + IdPermission = 382 + }, + new + { + IdUserRole = 1, + IdPermission = 383 + }, + new + { + IdUserRole = 1, + IdPermission = 384 + }, + new + { + IdUserRole = 1, + IdPermission = 385 + }, + new + { + IdUserRole = 1, + IdPermission = 386 + }, + new + { + IdUserRole = 1, + IdPermission = 387 + }, + new + { + IdUserRole = 1, + IdPermission = 388 + }, + new + { + IdUserRole = 1, + IdPermission = 389 + }, + new + { + IdUserRole = 1, + IdPermission = 390 + }, + new + { + IdUserRole = 1, + IdPermission = 391 + }, + new + { + IdUserRole = 1, + IdPermission = 400 + }, + new + { + IdUserRole = 1, + IdPermission = 401 + }, + new + { + IdUserRole = 1, + IdPermission = 407 + }, + new + { + IdUserRole = 1, + IdPermission = 408 + }, + new + { + IdUserRole = 1, + IdPermission = 450 + }, + new + { + IdUserRole = 1, + IdPermission = 460 + }, + new + { + IdUserRole = 1, + IdPermission = 461 + }, + new + { + IdUserRole = 1, + IdPermission = 500 + }, + new + { + IdUserRole = 1, + IdPermission = 501 + }, + new + { + IdUserRole = 1, + IdPermission = 502 + }, + new + { + IdUserRole = 1, + IdPermission = 503 + }, + new + { + IdUserRole = 1, + IdPermission = 504 + }, + new + { + IdUserRole = 1, + IdPermission = 505 + }, + new + { + IdUserRole = 1, + IdPermission = 506 + }, + new + { + IdUserRole = 1, + IdPermission = 507 + }, + new + { + IdUserRole = 1, + IdPermission = 510 + }, + new + { + IdUserRole = 1, + IdPermission = 511 + }, + new + { + IdUserRole = 1, + IdPermission = 512 + }, + new + { + IdUserRole = 1, + IdPermission = 516 + }, + new + { + IdUserRole = 1, + IdPermission = 517 + }, + new + { + IdUserRole = 1, + IdPermission = 518 + }, + new + { + IdUserRole = 1, + IdPermission = 519 + }, + new + { + IdUserRole = 1, + IdPermission = 520 + }, + new + { + IdUserRole = 1, + IdPermission = 521 + }, + new + { + IdUserRole = 1, + IdPermission = 522 + }, + new + { + IdUserRole = 1, + IdPermission = 523 + }, + new + { + IdUserRole = 1, + IdPermission = 524 + }, + new + { + IdUserRole = 1, + IdPermission = 525 + }, + new + { + IdUserRole = 1, + IdPermission = 526 + }, + new + { + IdUserRole = 1, + IdPermission = 527 + }, + new + { + IdUserRole = 1, + IdPermission = 528 + }, + new + { + IdUserRole = 1, + IdPermission = 530 + }, + new + { + IdUserRole = 1, + IdPermission = 531 + }, + new + { + IdUserRole = 1, + IdPermission = 532 + }, + new + { + IdUserRole = 1, + IdPermission = 533 + }, + new + { + IdUserRole = 1, + IdPermission = 534 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRoleUserRole", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.Property("IdInclude") + .HasColumnType("integer") + .HasColumnName("id_include_user_role"); + + b.HasKey("Id", "IdInclude") + .HasName("t_relation_user_role_user_role_pk"); + + b.HasIndex("IdInclude"); + + b.ToTable("t_relation_user_role_user_role", t => + { + t.HasComment("Отношение ролей к ролям"); + }); + + b.HasData( + new + { + Id = 1101, + IdInclude = 1100 + }, + new + { + Id = 1103, + IdInclude = 1102 + }, + new + { + Id = 1105, + IdInclude = 1104 + }, + new + { + Id = 1107, + IdInclude = 1106 + }, + new + { + Id = 1109, + IdInclude = 1108 + }, + new + { + Id = 1111, + IdInclude = 1110 + }, + new + { + Id = 1114, + IdInclude = 1113 + }, + new + { + Id = 1117, + IdInclude = 1116 + }, + new + { + Id = 1203, + IdInclude = 1202 + }, + new + { + Id = 1207, + IdInclude = 1206 + }, + new + { + Id = 1209, + IdInclude = 1208 + }, + new + { + Id = 1212, + IdInclude = 1211 + }, + new + { + Id = 1214, + IdInclude = 1213 + }, + new + { + Id = 1216, + IdInclude = 1215 + }, + new + { + Id = 1218, + IdInclude = 1217 + }, + new + { + Id = 2000, + IdInclude = 1200 + }, + new + { + Id = 2000, + IdInclude = 1201 + }, + new + { + Id = 2000, + IdInclude = 1202 + }, + new + { + Id = 2000, + IdInclude = 1204 + }, + new + { + Id = 2000, + IdInclude = 1205 + }, + new + { + Id = 2000, + IdInclude = 1206 + }, + new + { + Id = 2000, + IdInclude = 1208 + }, + new + { + Id = 2000, + IdInclude = 1210 + }, + new + { + Id = 2000, + IdInclude = 1211 + }, + new + { + Id = 2000, + IdInclude = 1213 + }, + new + { + Id = 2000, + IdInclude = 1215 + }, + new + { + Id = 2000, + IdInclude = 1217 + }, + new + { + Id = 2000, + IdInclude = 1219 + }, + new + { + Id = 2000, + IdInclude = 1220 + }, + new + { + Id = 2000, + IdInclude = 1221 + }, + new + { + Id = 2000, + IdInclude = 1500 + }, + new + { + Id = 2000, + IdInclude = 1501 + }, + new + { + Id = 2000, + IdInclude = 1502 + }, + new + { + Id = 2001, + IdInclude = 1500 + }, + new + { + Id = 2001, + IdInclude = 1501 + }, + new + { + Id = 2001, + IdInclude = 1502 + }, + new + { + Id = 2002, + IdInclude = 1500 + }, + new + { + Id = 2002, + IdInclude = 1501 + }, + new + { + Id = 2002, + IdInclude = 1502 + }, + new + { + Id = 2003, + IdInclude = 1500 + }, + new + { + Id = 2003, + IdInclude = 1501 + }, + new + { + Id = 2003, + IdInclude = 1502 + }, + new + { + Id = 2004, + IdInclude = 1500 + }, + new + { + Id = 2004, + IdInclude = 1501 + }, + new + { + Id = 2004, + IdInclude = 1502 + }, + new + { + Id = 2005, + IdInclude = 1500 + }, + new + { + Id = 2005, + IdInclude = 1501 + }, + new + { + Id = 2005, + IdInclude = 1502 + }, + new + { + Id = 2006, + IdInclude = 1500 + }, + new + { + Id = 2006, + IdInclude = 1501 + }, + new + { + Id = 2006, + IdInclude = 1502 + }, + new + { + Id = 2007, + IdInclude = 1500 + }, + new + { + Id = 2007, + IdInclude = 1501 + }, + new + { + Id = 2007, + IdInclude = 1502 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserUserRole", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.HasKey("IdUser", "IdUserRole"); + + b.HasIndex("IdUserRole"); + + b.ToTable("t_relation_user_user_role", t => + { + t.HasComment("Отношение пользователей и ролей"); + }); + + b.HasData( + new + { + IdUser = 1, + IdUserRole = 1 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ReportProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Begin") + .HasColumnType("timestamp with time zone") + .HasColumnName("begin"); + + b.Property("End") + .HasColumnType("timestamp with time zone") + .HasColumnName("end") + .HasComment("timestamp with time zone"); + + b.Property("Format") + .HasColumnType("integer") + .HasColumnName("format") + .HasComment("Формат отчета"); + + b.Property("IdFile") + .HasColumnType("integer") + .HasColumnName("id_file") + .HasComment("id файла-родителя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("Step") + .HasColumnType("integer") + .HasColumnName("step") + .HasComment("размер шага в секундах"); + + b.HasKey("Id"); + + b.HasIndex("IdFile"); + + b.HasIndex("IdWell"); + + b.ToTable("t_report_property", t => + { + t.HasComment("Отчеты с данными по буровым"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Schedule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DrillEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("drill_end") + .HasComment("Конец вахты"); + + b.Property("DrillStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("drill_start") + .HasComment("Начало вахты"); + + b.Property("IdDriller") + .HasColumnType("integer") + .HasColumnName("id_driller") + .HasComment("Идентификатор бурильщика"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Идентификатор скважины"); + + b.Property("ShiftEnd") + .HasColumnType("time without time zone") + .HasColumnName("shift_end") + .HasComment("Конец смены"); + + b.Property("ShiftStart") + .HasColumnType("time without time zone") + .HasColumnName("shift_start") + .HasComment("Начало смены"); + + b.HasKey("Id"); + + b.HasIndex("IdDriller"); + + b.HasIndex("IdWell"); + + b.ToTable("t_schedule", t => + { + t.HasComment("График работы бурильщика"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.SetpointsRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("комментарий для оператора"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Id пользователя, загрузившего файл"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("0: неизвестно, 1:ожидает отправки, 2: отправлено, 3: принято оператором, 4: отклонено оператором, 5: устарело"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("ObsolescenceSec") + .HasColumnType("integer") + .HasColumnName("obsolescence") + .HasComment("сек. до устаревания"); + + b.Property("Setpoints") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("setpoint_set") + .HasComment("Набор уставок"); + + b.Property("UploadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdWell"); + + b.ToTable("t_setpoints_rquest", t => + { + t.HasComment("Запросы на изменение уставок панели оператора"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.HasKey("Id"); + + b.ToTable("t_subsystem", t => + { + t.HasComment("Описание подсистем"); + }); + + b.HasData( + new + { + Id = 1, + Description = "Совместная работа режимов \"Бурение в роторе\" и \"Бурение в слайде\"", + Name = "АПД" + }, + new + { + Id = 11, + Description = "Режим работы \"Бурение в роторе\"", + Name = "АПД ротор" + }, + new + { + Id = 12, + Description = "Режим работы \"Бурение в слайде\"", + Name = "АПД слайд" + }, + new + { + Id = 65536, + Description = "Осцилляция", + Name = "Осцилляция" + }, + new + { + Id = 65537, + Description = "Демпфер", + Name = "Демпфер" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Info") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("info") + .HasComment("Информация с панели о скважине"); + + b.Property("RemoteUid") + .IsRequired() + .HasColumnType("text") + .HasColumnName("remote_uid") + .HasComment("Идентификатор передающего устройства. Может повторяться в списке, так как комплекты оборудования переезжают от скв. к скв."); + + b.Property("TimeZone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index"); + + b.ToTable("t_telemetry", t => + { + t.HasComment("таблица привязки телеметрии от комплектов к конкретной скважине."); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("AxialLoad") + .HasColumnType("real") + .HasColumnName("axial_load") + .HasComment("Осевая нагрузка"); + + b.Property("AxialLoadLimitMax") + .HasColumnType("real") + .HasColumnName("axial_load_limit_max") + .HasComment("Осевая нагрузка. Аварийная макс."); + + b.Property("AxialLoadSp") + .HasColumnType("real") + .HasColumnName("axial_load_sp") + .HasComment("Осевая нагрузка. Задание"); + + b.Property("BitDepth") + .HasColumnType("real") + .HasColumnName("bit_depth") + .HasComment("Положение инструмента"); + + b.Property("BlockPosition") + .HasColumnType("real") + .HasColumnName("block_position") + .HasComment("Высота талевого блока"); + + b.Property("BlockPositionMax") + .HasColumnType("real") + .HasColumnName("block_position_max") + .HasComment("Талевый блок. Макс положение"); + + b.Property("BlockPositionMin") + .HasColumnType("real") + .HasColumnName("block_position_min") + .HasComment("Талевый блок. Мин положение"); + + b.Property("BlockSpeed") + .HasColumnType("real") + .HasColumnName("block_speed") + .HasComment("Скорость талевого блока"); + + b.Property("BlockSpeedSp") + .HasColumnType("real") + .HasColumnName("block_speed_sp") + .HasComment("Скорости талевого блока. Задание"); + + b.Property("BlockSpeedSpDevelop") + .HasColumnType("real") + .HasColumnName("block_speed_sp_develop") + .HasComment("Талевый блок. Задание скорости для проработки"); + + b.Property("BlockSpeedSpRotor") + .HasColumnType("real") + .HasColumnName("block_speed_sp_rotor") + .HasComment("Талевый блок. Задание скорости для роторного бурения"); + + b.Property("BlockSpeedSpSlide") + .HasColumnType("real") + .HasColumnName("block_speed_sp_slide") + .HasComment("Талевый блок. Задание скорости для режима слайда"); + + b.Property("Flow") + .HasColumnType("real") + .HasColumnName("flow") + .HasComment("Расход"); + + b.Property("FlowDeltaLimitMax") + .HasColumnType("real") + .HasColumnName("flow_delta_limit_max") + .HasComment("Расход. Аварийный макс."); + + b.Property("FlowIdle") + .HasColumnType("real") + .HasColumnName("flow_idle") + .HasComment("Расход. Холостой ход"); + + b.Property("HookWeight") + .HasColumnType("real") + .HasColumnName("hook_weight") + .HasComment("Вес на крюке"); + + b.Property("HookWeightIdle") + .HasColumnType("real") + .HasColumnName("hook_weight_idle") + .HasComment("Вес на крюке. Холостой ход"); + + b.Property("HookWeightLimitMax") + .HasColumnType("real") + .HasColumnName("hook_weight_limit_max") + .HasComment("Вес на крюке. Затяжка"); + + b.Property("HookWeightLimitMin") + .HasColumnType("real") + .HasColumnName("hook_weight_limit_min") + .HasComment("Вес на крюке. Посадка"); + + b.Property("IdFeedRegulator") + .HasColumnType("smallint") + .HasColumnName("id_feed_regulator") + .HasComment("Текущий критерий бурения"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Пользователь САУБ"); + + b.Property("Mode") + .HasColumnType("smallint") + .HasColumnName("mode") + .HasComment("Режим САУБ"); + + b.Property("Mse") + .HasColumnType("real") + .HasColumnName("mse") + .HasComment("MSE"); + + b.Property("MseState") + .HasColumnType("smallint") + .HasColumnName("mse_state") + .HasComment("Текущее состояние работы MSE"); + + b.Property("Pressure") + .HasColumnType("real") + .HasColumnName("pressure") + .HasComment("Давление"); + + b.Property("PressureDeltaLimitMax") + .HasColumnType("real") + .HasColumnName("pressure_delta_limit_max") + .HasComment("Давление дифф. Аварийное макс."); + + b.Property("PressureIdle") + .HasColumnType("real") + .HasColumnName("pressure_idle") + .HasComment("Давление. Холостой ход"); + + b.Property("PressureSp") + .HasColumnType("real") + .HasColumnName("pressure_sp") + .HasComment("Давление. Задание"); + + b.Property("PressureSpDevelop") + .HasColumnType("real") + .HasColumnName("pressure_sp_develop") + .HasComment("Давление. Задание для проработки"); + + b.Property("PressureSpRotor") + .HasColumnType("real") + .HasColumnName("pressure_sp_rotor") + .HasComment("Давление. Задание для роторного бурения"); + + b.Property("PressureSpSlide") + .HasColumnType("real") + .HasColumnName("pressure_sp_slide") + .HasComment("Давление. Задание для режима слайда"); + + b.Property("Pump0Flow") + .HasColumnType("real") + .HasColumnName("pump0_flow") + .HasComment("Расход. Буровой насос 1"); + + b.Property("Pump1Flow") + .HasColumnType("real") + .HasColumnName("pump1_flow") + .HasComment("Расход. Буровой насос 2"); + + b.Property("Pump2Flow") + .HasColumnType("real") + .HasColumnName("pump2_flow") + .HasComment("Расход. Буровой насос 3"); + + b.Property("RotorSpeed") + .HasColumnType("real") + .HasColumnName("rotor_speed") + .HasComment("Обороты ротора"); + + b.Property("RotorTorque") + .HasColumnType("real") + .HasColumnName("rotor_torque") + .HasComment("Момент на роторе"); + + b.Property("RotorTorqueIdle") + .HasColumnType("real") + .HasColumnName("rotor_torque_idle") + .HasComment("Момент на роторе. Холостой ход"); + + b.Property("RotorTorqueLimitMax") + .HasColumnType("real") + .HasColumnName("rotor_torque_limit_max") + .HasComment("Момент на роторе. Аварийный макс."); + + b.Property("RotorTorqueSp") + .HasColumnType("real") + .HasColumnName("rotor_torque_sp") + .HasComment("Момент на роторе. Задание"); + + b.Property("WellDepth") + .HasColumnType("real") + .HasColumnName("well_depth") + .HasComment("Глубина забоя"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_data_saub", t => + { + t.HasComment("набор основных данных по SAUB"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaubStat", b => + { + b.Property("Count") + .HasColumnType("bigint") + .HasColumnName("count_items"); + + b.Property("DateMax") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_max"); + + b.Property("DateMin") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_min"); + + b.Property("DepthMax") + .HasColumnType("real") + .HasColumnName("depth_max"); + + b.Property("DepthMin") + .HasColumnType("real") + .HasColumnName("depth_min"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.ToTable((string)null); + + b.ToView("mw_telemetry_datas_saub_stat", (string)null); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("Mode") + .HasColumnType("smallint") + .HasColumnName("mode") + .HasComment("Выбранный режим управления"); + + b.Property("PositionRight") + .HasColumnType("real") + .HasColumnName("position_right") + .HasComment("Крайний правый угол осцилляции"); + + b.Property("PositionZero") + .HasColumnType("real") + .HasColumnName("position_zero") + .HasComment("Нулевая позиция осцилляции"); + + b.Property("RevolsLeftLimit") + .HasColumnType("real") + .HasColumnName("revols_left_limit") + .HasComment("Ограничение числа оборотов влево"); + + b.Property("RevolsLeftTotal") + .HasColumnType("real") + .HasColumnName("revols_left_total") + .HasComment("Суммарное количество оборотов влево"); + + b.Property("RevolsRightLimit") + .HasColumnType("real") + .HasColumnName("revols_right_limit") + .HasComment("Ограничение числа оборотов вправо"); + + b.Property("RevolsRightTotal") + .HasColumnType("real") + .HasColumnName("revols_right_total") + .HasComment("Суммарное количество оборотов вправо"); + + b.Property("SpeedLeftSp") + .HasColumnType("real") + .HasColumnName("speed_left_sp") + .HasComment("Заданная скорость вращения влево"); + + b.Property("SpeedRightSp") + .HasColumnType("real") + .HasColumnName("speed_right_sp") + .HasComment("Заданная скорость вращения вправо"); + + b.Property("State") + .HasColumnType("smallint") + .HasColumnName("state") + .HasComment("Переменная этапа"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_data_spin", t => + { + t.HasComment("набор основных данных по SpinMaster"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdEvent") + .HasColumnType("integer") + .HasColumnName("id_event"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category"); + + b.Property("MessageTemplate") + .IsRequired() + .HasColumnType("text") + .HasColumnName("message_template"); + + b.HasKey("IdTelemetry", "IdEvent"); + + b.ToTable("t_telemetry_event", t => + { + t.HasComment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии."); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Arg0") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg0") + .HasComment("Аргумент №0 для вставки в шаблон сообщения"); + + b.Property("Arg1") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg1"); + + b.Property("Arg2") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg2"); + + b.Property("Arg3") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg3"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("IdEvent") + .HasColumnType("integer") + .HasColumnName("id_event"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdTelemetryUser") + .HasColumnType("integer") + .HasColumnName("id_telemetry_user") + .HasComment("Пользователь панели отправляющей телеметрию. не пользователь облака."); + + b.Property("WellDepth") + .HasColumnType("double precision") + .HasColumnName("well_depth"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_telemetry_message", t => + { + t.HasComment("Сообщения на буровых"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("Level") + .HasColumnType("integer") + .HasColumnName("level"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic"); + + b.Property("Surname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname"); + + b.HasKey("IdTelemetry", "IdUser"); + + b.ToTable("t_telemetry_user", t => + { + t.HasComment("Пользователи панели САУБ. Для сообщений."); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryWirelineRunOut", b => + { + b.Property("IdTelemetry") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("Идентификатор телеметрии"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("IdTelemetry")); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_time") + .HasComment("Отметка времени"); + + b.Property("Hauling") + .HasColumnType("real") + .HasColumnName("hauling") + .HasComment("Наработка талевого каната с момента перетяжки каната, т*км"); + + b.Property("HaulingWarnSp") + .HasColumnType("real") + .HasColumnName("hauling_warn_sp") + .HasComment("Наработка талевого каната до сигнализации о необходимости перетяжки, т*км"); + + b.Property("Replace") + .HasColumnType("real") + .HasColumnName("replace") + .HasComment("Наработка талевого каната с момента замены каната, т*км"); + + b.Property("ReplaceWarnSp") + .HasColumnType("real") + .HasColumnName("replace_warn_sp") + .HasComment("Наработка талевого каната до сигнализации о необходимости замены, т*км"); + + b.HasKey("IdTelemetry"); + + b.ToTable("t_telemetry_wireline_run_out", t => + { + t.HasComment("Наработка талевого каната"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryFact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AzimuthGeo") + .HasColumnType("double precision") + .HasColumnName("azimuth_geo") + .HasComment("Азимут Географ."); + + b.Property("AzimuthMagnetic") + .HasColumnType("double precision") + .HasColumnName("azimuth_magnetic") + .HasComment("Азимут Магнитный"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарии"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("ID пользователя который внес/изменил запись"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("ID скважины"); + + b.Property("UpdateDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("update_date") + .HasComment("Дата загрузки траектории"); + + b.Property("VerticalDepth") + .HasColumnType("double precision") + .HasColumnName("vertical_depth") + .HasComment("Глубина вертикальная"); + + b.Property("WellboreDepth") + .HasColumnType("double precision") + .HasColumnName("wellbore_depth") + .HasComment("Глубина по стволу"); + + b.Property("ZenithAngle") + .HasColumnType("double precision") + .HasColumnName("zenith_angle") + .HasComment("Угол зенитный"); + + b.HasKey("Id"); + + b.HasIndex("IdUser"); + + b.HasIndex("IdWell"); + + b.ToTable("t_trajectory_fact", t => + { + t.HasComment("Загрузка фактической траектории"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AzimuthGeo") + .HasColumnType("double precision") + .HasColumnName("azimuth_geo") + .HasComment("Азимут Географ."); + + b.Property("AzimuthMagnetic") + .HasColumnType("double precision") + .HasColumnName("azimuth_magnetic") + .HasComment("Азимут Магнитный"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарии"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("ID пользователя который внес/изменил запись"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("ID скважины"); + + b.Property("Radius") + .HasColumnType("double precision") + .HasColumnName("radius") + .HasComment("Радиус цели"); + + b.Property("UpdateDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("update_date") + .HasComment("Дата загрузки траектории"); + + b.Property("VerticalDepth") + .HasColumnType("double precision") + .HasColumnName("vertical_depth") + .HasComment("Глубина вертикальная"); + + b.Property("WellboreDepth") + .HasColumnType("double precision") + .HasColumnName("wellbore_depth") + .HasComment("Глубина по стволу"); + + b.Property("ZenithAngle") + .HasColumnType("double precision") + .HasColumnName("zenith_angle") + .HasComment("Угол зенитный"); + + b.HasKey("Id"); + + b.HasIndex("IdUser"); + + b.HasIndex("IdWell"); + + b.ToTable("t_trajectory_plan", t => + { + t.HasComment("Загрузка плановой траектории"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("email") + .HasComment("должность"); + + b.Property("IdCompany") + .HasColumnType("integer") + .HasColumnName("id_company"); + + b.Property("IdState") + .HasColumnType("smallint") + .HasColumnName("state") + .HasComment("состояние:\n0 - не активен, \n1 - активен, \n2 - заблокирован"); + + b.Property("Login") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("login"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("имя"); + + b.Property("PasswordHash") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("password_hash") + .HasComment("соленый хэш пароля.\nпервые 5 символов - соль"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic") + .HasComment("отчество"); + + b.Property("Phone") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("phone") + .HasComment("номер телефона"); + + b.Property("Position") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("position") + .HasComment("email"); + + b.Property("Surname") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname") + .HasComment("фамилия"); + + b.HasKey("Id"); + + b.HasIndex("IdCompany"); + + b.HasIndex("Login") + .IsUnique(); + + b.ToTable("t_user", t => + { + t.HasComment("Пользователи облака"); + }); + + b.HasData( + new + { + Id = 1, + Email = "", + IdCompany = 1, + IdState = (short)1, + Login = "dev", + Name = "Разработчик", + PasswordHash = "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("id_type") + .HasComment("0-роль из стандартной матрицы, \n1-специальная роль для какого-либо пользователя"); + + b.HasKey("Id"); + + b.ToTable("t_user_role", t => + { + t.HasComment("Роли пользователей в системе"); + }); + + b.HasData( + new + { + Id = 1, + Caption = "root", + IdType = 1 + }, + new + { + Id = 1100, + Caption = "admin_cluster.view", + IdType = 1 + }, + new + { + Id = 1101, + Caption = "admin_cluster.edit", + IdType = 1 + }, + new + { + Id = 1102, + Caption = "admin_company.view", + IdType = 1 + }, + new + { + Id = 1103, + Caption = "admin_company.edit", + IdType = 1 + }, + new + { + Id = 1104, + Caption = "admin_company_type.view", + IdType = 1 + }, + new + { + Id = 1105, + Caption = "admin_company_type.edit", + IdType = 1 + }, + new + { + Id = 1106, + Caption = "admin_deposit.view", + IdType = 1 + }, + new + { + Id = 1107, + Caption = "admin_deposit.edit", + IdType = 1 + }, + new + { + Id = 1108, + Caption = "admin_permission.view", + IdType = 1 + }, + new + { + Id = 1109, + Caption = "admin_permission.edit", + IdType = 1 + }, + new + { + Id = 1110, + Caption = "admin_role.view", + IdType = 1 + }, + new + { + Id = 1111, + Caption = "admin_role.edit", + IdType = 1 + }, + new + { + Id = 1112, + Caption = "admin_telemetry.view", + IdType = 1 + }, + new + { + Id = 1113, + Caption = "admin_user.view", + IdType = 1 + }, + new + { + Id = 1114, + Caption = "admin_user.edit", + IdType = 1 + }, + new + { + Id = 1115, + Caption = "admin_visit_log.view", + IdType = 1 + }, + new + { + Id = 1116, + Caption = "admin_well.view", + IdType = 1 + }, + new + { + Id = 1117, + Caption = "admin_well.edit", + IdType = 1 + }, + new + { + Id = 1200, + Caption = "archive.view", + IdType = 1 + }, + new + { + Id = 1201, + Caption = "cluster.view", + IdType = 1 + }, + new + { + Id = 1202, + Caption = "composite.view", + IdType = 1 + }, + new + { + Id = 1203, + Caption = "composite.edit", + IdType = 1 + }, + new + { + Id = 1204, + Caption = "deposit.view", + IdType = 1 + }, + new + { + Id = 1205, + Caption = "document.view", + IdType = 1 + }, + new + { + Id = 1206, + Caption = "drillProcessFlow.view", + IdType = 1 + }, + new + { + Id = 1207, + Caption = "drillProcessFlow.edit", + IdType = 1 + }, + new + { + Id = 1208, + Caption = "measure.view", + IdType = 1 + }, + new + { + Id = 1209, + Caption = "measure.edit", + IdType = 1 + }, + new + { + Id = 1210, + Caption = "message.view", + IdType = 1 + }, + new + { + Id = 1211, + Caption = "operations.view", + IdType = 1 + }, + new + { + Id = 1212, + Caption = "operations.edit", + IdType = 1 + }, + new + { + Id = 1213, + Caption = "params.view", + IdType = 1 + }, + new + { + Id = 1214, + Caption = "params.edit", + IdType = 1 + }, + new + { + Id = 1215, + Caption = "report.view", + IdType = 1 + }, + new + { + Id = 1216, + Caption = "report.edit", + IdType = 1 + }, + new + { + Id = 1217, + Caption = "setpoints.view", + IdType = 1 + }, + new + { + Id = 1218, + Caption = "setpoints.edit", + IdType = 1 + }, + new + { + Id = 1219, + Caption = "telemetry.view", + IdType = 1 + }, + new + { + Id = 1220, + Caption = "telemetryAnalysis.view", + IdType = 1 + }, + new + { + Id = 1221, + Caption = "well.view", + IdType = 1 + }, + new + { + Id = 1500, + Caption = "Просмотр всего", + IdType = 1 + }, + new + { + Id = 1501, + Caption = "file.edit", + IdType = 1 + }, + new + { + Id = 1502, + Caption = "drillingProgram.edit", + IdType = 1 + }, + new + { + Id = 2000, + Caption = "Заказчик", + IdType = 0 + }, + new + { + Id = 2001, + Caption = "Супервайзер", + IdType = 0 + }, + new + { + Id = 2002, + Caption = "Буровой подрядчик", + IdType = 0 + }, + new + { + Id = 2003, + Caption = "Растворщик", + IdType = 0 + }, + new + { + Id = 2004, + Caption = "Телеметрист", + IdType = 0 + }, + new + { + Id = 2005, + Caption = "Долотный сервис", + IdType = 0 + }, + new + { + Id = 2006, + Caption = "ГТИ", + IdType = 0 + }, + new + { + Id = 2007, + Caption = "Цементирование", + IdType = 0 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserSetting", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("Key") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("key") + .HasComment("Ключ настроек пользователя"); + + b.Property("Value") + .HasColumnType("jsonb") + .HasColumnName("setting_value") + .HasComment("Значение настроек пользователя"); + + b.HasKey("IdUser", "Key"); + + b.ToTable("t_user_settings", t => + { + t.HasComment("настройки интерфейса пользователя"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.RecordBase", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Actcod") + .HasColumnType("smallint") + .HasColumnName("ACTCOD"); + + b.Property("Date") + .HasColumnType("integer") + .HasColumnName("DATE"); + + b.Property("Recid") + .HasColumnType("smallint") + .HasColumnName("RECID"); + + b.Property("Seqid") + .HasColumnType("integer") + .HasColumnName("SEQID"); + + b.Property("Stknum") + .HasColumnType("smallint") + .HasColumnName("STKNUM"); + + b.Property("Time") + .HasColumnType("integer") + .HasColumnName("TIME"); + + b.Property("Wellid") + .HasColumnType("text") + .HasColumnName("WELLID"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_wits_base"); + + b.UseTptMappingStrategy(); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IdCluster") + .HasColumnType("integer") + .HasColumnName("id_cluster"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("state") + .HasComment("0 - неизвестно, 1 - в работе, 2 - завершена"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdWellType") + .HasColumnType("integer") + .HasColumnName("id_well_type"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex("IdCluster"); + + b.HasIndex("IdTelemetry") + .IsUnique(); + + b.HasIndex("IdWellType"); + + b.ToTable("t_well", t => + { + t.HasComment("скважины"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellComposite", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины получателя"); + + b.Property("IdWellSrc") + .HasColumnType("integer") + .HasColumnName("id_well_src") + .HasComment("Id скважины композита"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_well_section_type") + .HasComment("Id тип секции композита"); + + b.HasKey("IdWell", "IdWellSrc", "IdWellSectionType"); + + b.HasIndex("IdWellSectionType"); + + b.HasIndex("IdWellSrc"); + + b.ToTable("t_well_composite", t => + { + t.HasComment("Композитная скважина"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellFinalDocument", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category"); + + b.HasKey("IdWell", "IdUser", "IdCategory") + .HasName("t_well_final_documents_pk"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdUser"); + + b.ToTable("t_well_final_documents", t => + { + t.HasComment("Дело скважины"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategoryInfo") + .HasColumnType("text") + .HasColumnName("category_info") + .HasComment("Доп. информация к выбраной категории"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("Дата начала операции"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина после завершения операции, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина на начало операции, м"); + + b.Property("DurationHours") + .HasColumnType("double precision") + .HasColumnName("duration_hours") + .HasComment("Продолжительность, часы"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdPlan") + .HasColumnType("integer") + .HasColumnName("id_plan") + .HasComment("Id плановой операции"); + + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("id_type") + .HasComment("0 = План или 1 = Факт"); + + b.Property("IdUser") + .HasColumnType("integer"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_well_section_type") + .HasComment("Id тип секции скважины"); + + b.Property("LastUpdateDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("DateStart"); + + b.HasIndex("DepthEnd"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdPlan"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_well_operation", t => + { + t.HasComment("Данные по операциям на скважине"); + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdParent") + .HasColumnType("integer") + .HasColumnName("id_parent") + .HasComment("id родительской категории"); + + b.Property("IsHidden") + .HasColumnType("boolean"); + + b.Property("KeyValueName") + .HasMaxLength(32) + .HasColumnType("character varying(32)") + .HasColumnName("key_value_name") + .HasComment("Название ключевого показателя операции"); + + b.Property("KeyValueUnits") + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("key_value_units") + .HasComment("Единицы измерения ключевого показателя операции"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории операции"); + + b.HasKey("Id"); + + b.HasIndex("IdParent"); + + b.ToTable("t_well_operation_category", t => + { + t.HasComment("Справочник операций на скважине"); + }); + + b.HasData( + new + { + Id = 3000, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "БУРЕНИЕ" + }, + new + { + Id = 3001, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 3002, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КРЕПЛЕНИЕ" + }, + new + { + Id = 3003, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГФР" + }, + new + { + Id = 3004, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные операции" + }, + new + { + Id = 3005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Непроизводительное время (НПВ)" + }, + new + { + Id = 3006, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Заключительные работы" + }, + new + { + Id = 4000, + IdParent = 3000, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КНБК" + }, + new + { + Id = 4001, + IdParent = 3000, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "Механическое. бурение" + }, + new + { + Id = 4002, + IdParent = 3000, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Статический замер" + }, + new + { + Id = 4003, + IdParent = 3000, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Нормализация диаметра скважины" + }, + new + { + Id = 4004, + IdParent = 3000, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 4005, + IdParent = 3001, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4006, + IdParent = 3002, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск обсадной колонны" + }, + new + { + Id = 4018, + IdParent = 3002, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Крепление" + }, + new + { + Id = 4007, + IdParent = 3002, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 4008, + IdParent = 3002, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы при креплении" + }, + new + { + Id = 4009, + IdParent = 3003, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка/разборка приборов ГИС" + }, + new + { + Id = 4010, + IdParent = 3003, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4011, + IdParent = 3003, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГИС" + }, + new + { + Id = 4012, + IdParent = 3004, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка, ОБР" + }, + new + { + Id = 4013, + IdParent = 3004, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы" + }, + new + { + Id = 4014, + IdParent = 3005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт оборудования" + }, + new + { + Id = 4015, + IdParent = 3005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Аварийные работы" + }, + new + { + Id = 4016, + IdParent = 3005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Осложнение" + }, + new + { + Id = 4017, + IdParent = 3005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Незаложенные в ГГД операции" + }, + new + { + Id = 4019, + IdParent = 3006, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Заключительные операции" + }, + new + { + Id = 5000, + IdParent = 4000, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка КНБК" + }, + new + { + Id = 5001, + IdParent = 4000, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка КНБК" + }, + new + { + Id = 5002, + IdParent = 4001, + IsHidden = true, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение слайдом" + }, + new + { + Id = 5003, + IdParent = 4001, + IsHidden = true, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение ротором" + }, + new + { + Id = 5004, + IdParent = 4002, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Замер ЗТС (запись MWD)" + }, + new + { + Id = 5005, + IdParent = 4003, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка перед наращиванием" + }, + new + { + Id = 5006, + IdParent = 4003, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка во время бурения" + }, + new + { + Id = 5007, + IdParent = 4003, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка" + }, + new + { + Id = 5008, + IdParent = 4003, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка во время бурения" + }, + new + { + Id = 5009, + IdParent = 4003, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка перед наращиванием" + }, + new + { + Id = 5010, + IdParent = 4004, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 5011, + IdParent = 4004, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Удержание в клиньях" + }, + new + { + Id = 5012, + IdParent = 4005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем инструмента" + }, + new + { + Id = 5013, + IdParent = 4005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем КНБК" + }, + new + { + Id = 5014, + IdParent = 4005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента" + }, + new + { + Id = 5015, + IdParent = 4005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КНБК" + }, + new + { + Id = 5016, + IdParent = 4006, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка при спуске ОК" + }, + new + { + Id = 5017, + IdParent = 4006, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск ОК" + }, + new + { + Id = 5018, + IdParent = 4007, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ОЗЦ" + }, + new + { + Id = 5019, + IdParent = 4007, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 5020, + IdParent = 4008, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка БИ" + }, + new + { + Id = 5021, + IdParent = 4008, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ОК" + }, + new + { + Id = 5022, + IdParent = 4008, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при спуске ОК" + }, + new + { + Id = 5023, + IdParent = 4008, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при цементировании" + }, + new + { + Id = 5024, + IdParent = 4009, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка комплекса приборов ГИС" + }, + new + { + Id = 5025, + IdParent = 4009, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка комплекса приборов ГИС" + }, + new + { + Id = 5026, + IdParent = 4010, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем приборов ГИС (на трубах)" + }, + new + { + Id = 5027, + IdParent = 4010, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск приборов ГИС (на трубах)" + }, + new + { + Id = 5028, + IdParent = 4011, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на жестком кабеле" + }, + new + { + Id = 5029, + IdParent = 4011, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на кабеле" + }, + new + { + Id = 5030, + IdParent = 4011, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на трубах" + }, + new + { + Id = 5031, + IdParent = 4012, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Закачка/прокачка пачки" + }, + new + { + Id = 5032, + IdParent = 4012, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка БР" + }, + new + { + Id = 5033, + IdParent = 4012, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование ТС при бурении" + }, + new + { + Id = 5034, + IdParent = 4012, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перезапись гаммы-каротажа" + }, + new + { + Id = 5035, + IdParent = 4012, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Приготовление БР" + }, + new + { + Id = 5036, + IdParent = 4012, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка" + }, + new + { + Id = 5037, + IdParent = 4012, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разбуривание тех.оснастки" + }, + new + { + Id = 5038, + IdParent = 4012, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента с проработкой" + }, + new + { + Id = 5039, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ВМР" + }, + new + { + Id = 5040, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Демонтаж ПВО" + }, + new + { + Id = 5041, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Долив затруба при подъёме" + }, + new + { + Id = 5042, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж ПВО" + }, + new + { + Id = 5043, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наработка жёлоба" + }, + new + { + Id = 5044, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обвязка устья с циркуляционной системой" + }, + new + { + Id = 5045, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Оборудование устья" + }, + new + { + Id = 5046, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ПВО" + }, + new + { + Id = 5047, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перемонтаж ПВО " + }, + new + { + Id = 5048, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перетяжка талевого каната" + }, + new + { + Id = 5049, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при сборке КНБК" + }, + new + { + Id = 5050, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Полная замена талевого каната" + }, + new + { + Id = 5051, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПР перед забуркой направления" + }, + new + { + Id = 5052, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Продувка манифольда" + }, + new + { + Id = 5053, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Срезка" + }, + new + { + Id = 5054, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тайм-дриллинг" + }, + new + { + Id = 5055, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тех.отстой" + }, + new + { + Id = 5056, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Учебная тревога \"Выброс\"" + }, + new + { + Id = 5057, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Чистка ЦСГО/емкостного блока" + }, + new + { + Id = 5058, + IdParent = 4014, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт бурового оборудования" + }, + new + { + Id = 5059, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ловильные работы" + }, + new + { + Id = 5060, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ожидание" + }, + new + { + Id = 5061, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Определение места прихвата и ЛМ" + }, + new + { + Id = 5062, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Работа яссом" + }, + new + { + Id = 5063, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Расхаживание" + }, + new + { + Id = 5064, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - колокол" + }, + new + { + Id = 5065, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - метчик" + }, + new + { + Id = 5066, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - овершот" + }, + new + { + Id = 5067, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - труболовка" + }, + new + { + Id = 5068, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (встряхивание)" + }, + new + { + Id = 5069, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (отстрел)" + }, + new + { + Id = 5070, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Установка ванн" + }, + new + { + Id = 5071, + IdParent = 4015, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Фрезеровка" + }, + new + { + Id = 5072, + IdParent = 4016, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Контролируемое ГНВП" + }, + new + { + Id = 5073, + IdParent = 4016, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Поглощение" + }, + new + { + Id = 5074, + IdParent = 4016, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сальникообразование" + }, + new + { + Id = 5075, + IdParent = 4016, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Утяжеление БР" + }, + new + { + Id = 5076, + IdParent = 4017, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "НПВ / прочее" + }, + new + { + Id = 5077, + IdParent = 4017, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка раствора (несоответствие параметров)" + }, + new + { + Id = 5078, + IdParent = 4017, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "подъем ОК" + }, + new + { + Id = 5079, + IdParent = 4017, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ревизия КНБК/инструмента/ЗТС" + }, + new + { + Id = 5082, + IdParent = 4000, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка устройства ориентирования КО" + }, + new + { + Id = 5083, + IdParent = 4003, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка принудительная" + }, + new + { + Id = 5084, + IdParent = 4005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка подъем БИ, продувка" + }, + new + { + Id = 5085, + IdParent = 4005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск бурильного инструмента со сборкой с мостков" + }, + new + { + Id = 5086, + IdParent = 4005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем БИ с выбросом на мостки" + }, + new + { + Id = 5087, + IdParent = 4005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск БИ со сборкой с мостков" + }, + new + { + Id = 5088, + IdParent = 4005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка и спуск ТБТ" + }, + new + { + Id = 5089, + IdParent = 4005, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КО на транспортной колонне" + }, + new + { + Id = 5090, + IdParent = 4008, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Отворот допускной трубы" + }, + new + { + Id = 5091, + IdParent = 4008, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески, опрессовка" + }, + new + { + Id = 5092, + IdParent = 4008, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж, опрессовка ФА" + }, + new + { + Id = 5093, + IdParent = 4008, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка хвостовика 114мм (согласно схеме)" + }, + new + { + Id = 5094, + IdParent = 4008, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР к спуску УЭЦН" + }, + new + { + Id = 5095, + IdParent = 4008, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески (потайной колонны, хвостовика)" + }, + new + { + Id = 5096, + IdParent = 4008, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонирование перед спуском" + }, + new + { + Id = 5097, + IdParent = 4012, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка - перевод скважины на новый раствор" + }, + new + { + Id = 5098, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка БИ с мостков на подсвечник" + }, + new + { + Id = 5099, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подготовка ствола скважины. Перезапись ГК в интервале установки КО." + }, + new + { + Id = 5100, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Смена рабочего переводника ВСП" + }, + new + { + Id = 5101, + IdParent = 4014, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт" + }, + new + { + Id = 5102, + IdParent = 4018, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск пакера" + }, + new + { + Id = 5103, + IdParent = 4011, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Запись гамма-каратожа" + }, + new + { + Id = 5104, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонирование спуск БИ" + }, + new + { + Id = 5105, + IdParent = 4018, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка клин-отклонителя" + }, + new + { + Id = 5106, + IdParent = 4018, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование и посадка клина-отклонителя" + }, + new + { + Id = 5107, + IdParent = 4018, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Протяжка подъемного патрубка подвески" + }, + new + { + Id = 5108, + IdParent = 4018, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем клина-отклонителя" + }, + new + { + Id = 5109, + IdParent = 4018, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Стыковка стингера с хвостовиком основного ствола" + }, + new + { + Id = 5110, + IdParent = 4018, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование и установка стыковочного узла хвостовика" + }, + new + { + Id = 5111, + IdParent = 4001, + IsHidden = false, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение с отбором керна" + }, + new + { + Id = 5112, + IdParent = 4018, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Работа пакером в обсадной колонне" + }, + new + { + Id = 5113, + IdParent = 4001, + IsHidden = false, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение" + }, + new + { + Id = 5114, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ТО оборудования" + }, + new + { + Id = 5115, + IdParent = 4019, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск НКТ" + }, + new + { + Id = 5116, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вырезка окна" + }, + new + { + Id = 5117, + IdParent = 4013, + IsHidden = false, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Расширение ствола" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("Order") + .HasColumnType("real") + .HasColumnName("order") + .HasComment("Порядок"); + + b.HasKey("Id"); + + b.ToTable("t_well_section_type", t => + { + t.HasComment("конструкция секции скважины"); + }); + + b.HasData( + new + { + Id = 1, + Caption = "Пилотный ствол 1", + Order = 5f + }, + new + { + Id = 2, + Caption = "Направление 1", + Order = 0f + }, + new + { + Id = 3, + Caption = "Кондуктор 1", + Order = 1f + }, + new + { + Id = 4, + Caption = "Эксплуатационная колонна 1", + Order = 3f + }, + new + { + Id = 5, + Caption = "Транспортный ствол 1", + Order = 4f + }, + new + { + Id = 6, + Caption = "Хвостовик 1", + Order = 6f + }, + new + { + Id = 7, + Caption = "Пилотный ствол 2", + Order = 5.1f + }, + new + { + Id = 8, + Caption = "Направление 2", + Order = 0.1f + }, + new + { + Id = 9, + Caption = "Кондуктор 2", + Order = 1.1f + }, + new + { + Id = 10, + Caption = "Эксплуатационная колонна 2", + Order = 3.1f + }, + new + { + Id = 11, + Caption = "Транспортный ствол 2", + Order = 4.1f + }, + new + { + Id = 12, + Caption = "Хвостовик 2", + Order = 6.1f + }, + new + { + Id = 13, + Caption = "Пилотный ствол 3", + Order = 5.2f + }, + new + { + Id = 14, + Caption = "Направление 3", + Order = 0.2f + }, + new + { + Id = 15, + Caption = "Кондуктор 3", + Order = 1.2f + }, + new + { + Id = 16, + Caption = "Эксплуатационная колонна 3", + Order = 3.2f + }, + new + { + Id = 17, + Caption = "Транспортный ствол 3", + Order = 4.2f + }, + new + { + Id = 18, + Caption = "Хвостовик 3", + Order = 6.2f + }, + new + { + Id = 19, + Caption = "Пилотный ствол 4", + Order = 5.3f + }, + new + { + Id = 20, + Caption = "Направление 4", + Order = 0.3f + }, + new + { + Id = 21, + Caption = "Кондуктор 4", + Order = 1.3f + }, + new + { + Id = 22, + Caption = "Эксплуатационная колонна 4", + Order = 3.3f + }, + new + { + Id = 23, + Caption = "Транспортный ствол 4", + Order = 4.3f + }, + new + { + Id = 24, + Caption = "Хвостовик 4", + Order = 6.3f + }, + new + { + Id = 25, + Caption = "Пилотный ствол 5", + Order = 5.4f + }, + new + { + Id = 26, + Caption = "Направление 5", + Order = 0.4f + }, + new + { + Id = 27, + Caption = "Кондуктор 5", + Order = 1.4f + }, + new + { + Id = 28, + Caption = "Эксплуатационная колонна 5", + Order = 3.4f + }, + new + { + Id = 29, + Caption = "Транспортный ствол 5", + Order = 4.4f + }, + new + { + Id = 30, + Caption = "Хвостовик 5", + Order = 6.4f + }, + new + { + Id = 31, + Caption = "Техническая колонна 1", + Order = 2f + }, + new + { + Id = 32, + Caption = "Техническая колонна 2", + Order = 2.1f + }, + new + { + Id = 33, + Caption = "Техническая колонна 3", + Order = 2.2f + }, + new + { + Id = 34, + Caption = "Хвостовик 6", + Order = 6.5f + }, + new + { + Id = 35, + Caption = "Хвостовик 7", + Order = 6.6f + }, + new + { + Id = 36, + Caption = "Хвостовик 8", + Order = 6.7f + }, + new + { + Id = 37, + Caption = "Хвостовик 9", + Order = 6.8f + }, + new + { + Id = 38, + Caption = "Хвостовик 10", + Order = 6.9f + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSections.WellSectionPlan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Конечная глубина бурения, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Начальная глубина бурения, м"); + + b.Property("IdSectionType") + .HasColumnType("integer") + .HasColumnName("id_section_type") + .HasComment("Тип секции"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("InnerDiameter") + .HasColumnType("double precision") + .HasColumnName("inner_diameter") + .HasComment("Внутренний диаметр"); + + b.Property("LastUpdateDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_update") + .HasComment("Дата последнего обновления"); + + b.Property("OuterDiameter") + .HasColumnType("double precision") + .HasColumnName("outer_diameter") + .HasComment("Внешний диаметр"); + + b.HasKey("Id"); + + b.HasIndex("IdSectionType"); + + b.HasIndex("IdWell", "IdSectionType") + .IsUnique(); + + b.ToTable("t_well_section_plan"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_well_type", t => + { + t.HasComment("конструкция скважины"); + }); + + b.HasData( + new + { + Id = 1, + Caption = "Наклонно-направленная" + }, + new + { + Id = 2, + Caption = "Горизонтальная" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Blkpos") + .HasColumnType("real") + .HasColumnName("BLKPOS"); + + b.Property("Chkp") + .HasColumnType("real") + .HasColumnName("CHKP"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptbitv") + .HasColumnType("real") + .HasColumnName("DEPTBITV"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptretm") + .HasColumnType("real") + .HasColumnName("DEPTRETM"); + + b.Property("Deptvert") + .HasColumnType("real") + .HasColumnName("DEPTVERT"); + + b.Property("Gasa") + .HasColumnType("real") + .HasColumnName("GASA"); + + b.Property("Hkla") + .HasColumnType("real") + .HasColumnName("HKLA"); + + b.Property("Hklx") + .HasColumnType("real") + .HasColumnName("HKLX"); + + b.Property("Lagstks") + .HasColumnType("smallint") + .HasColumnName("LAGSTKS"); + + b.Property("Mcia") + .HasColumnType("real") + .HasColumnName("MCIA"); + + b.Property("Mcoa") + .HasColumnType("real") + .HasColumnName("MCOA"); + + b.Property("Mdia") + .HasColumnType("real") + .HasColumnName("MDIA"); + + b.Property("Mdoa") + .HasColumnType("real") + .HasColumnName("MDOA"); + + b.Property("Mfia") + .HasColumnType("real") + .HasColumnName("MFIA"); + + b.Property("Mfoa") + .HasColumnType("real") + .HasColumnName("MFOA"); + + b.Property("Mfop") + .HasColumnType("smallint") + .HasColumnName("MFOP"); + + b.Property("Mtia") + .HasColumnType("real") + .HasColumnName("MTIA"); + + b.Property("Mtoa") + .HasColumnType("real") + .HasColumnName("MTOA"); + + b.Property("Ropa") + .HasColumnType("real") + .HasColumnName("ROPA"); + + b.Property("Rpma") + .HasColumnType("smallint") + .HasColumnName("RPMA"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Spm1") + .HasColumnType("smallint") + .HasColumnName("SPM1"); + + b.Property("Spm2") + .HasColumnType("smallint") + .HasColumnName("SPM2"); + + b.Property("Spm3") + .HasColumnType("smallint") + .HasColumnName("SPM3"); + + b.Property("Sppa") + .HasColumnType("real") + .HasColumnName("SPPA"); + + b.Property("Stkc") + .HasColumnType("integer") + .HasColumnName("STKC"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.Property("Torqa") + .HasColumnType("real") + .HasColumnName("TORQA"); + + b.Property("Torqx") + .HasColumnType("real") + .HasColumnName("TORQX"); + + b.Property("Tvolact") + .HasColumnType("real") + .HasColumnName("TVOLACT"); + + b.Property("Tvolcact") + .HasColumnType("real") + .HasColumnName("TVOLCACT"); + + b.Property("Woba") + .HasColumnType("real") + .HasColumnName("WOBA"); + + b.Property("Wobx") + .HasColumnType("real") + .HasColumnName("WOBX"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_1"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("DeptmeasGdpMc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_GDP_mc"); + + b.Property("DeptmeasMcrstat") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_MCRSTAT"); + + b.Property("DeptmeasRa33Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33_mc"); + + b.Property("DeptmeasRa33f2Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33F2_mc"); + + b.Property("DeptmeasRa33f4Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33F4_mc"); + + b.Property("DeptmeasRp33Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33_mc"); + + b.Property("DeptmeasRp33f2Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33F2_mc"); + + b.Property("DeptmeasRp33f4Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33F4_mc"); + + b.Property("DeptmeasSlvlMc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_SLVL_mc"); + + b.Property("GdpMc") + .HasColumnType("real") + .HasColumnName("GDP_mc"); + + b.Property("Mcrstat") + .HasColumnType("real") + .HasColumnName("MCRSTAT"); + + b.Property("Ra33Mc") + .HasColumnType("real") + .HasColumnName("RA33_mc"); + + b.Property("Ra33f2Mc") + .HasColumnType("real") + .HasColumnName("RA33F2_mc"); + + b.Property("Ra33f4Mc") + .HasColumnType("real") + .HasColumnName("RA33F4_mc"); + + b.Property("Rp33Mc") + .HasColumnType("real") + .HasColumnName("RP33_mc"); + + b.Property("Rp33f2Mc") + .HasColumnType("real") + .HasColumnName("RP33F2_mc"); + + b.Property("Rp33f4Mc") + .HasColumnType("real") + .HasColumnName("RP33F4_mc"); + + b.Property("SlvlMc") + .HasColumnType("real") + .HasColumnName("SLVL_mc"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_50"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Btot") + .HasColumnType("real") + .HasColumnName("Btot"); + + b.Property("Bx") + .HasColumnType("real") + .HasColumnName("Bx"); + + b.Property("By") + .HasColumnType("real") + .HasColumnName("By"); + + b.Property("Bz") + .HasColumnType("real") + .HasColumnName("Bz"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Gtot") + .HasColumnType("real") + .HasColumnName("Gtot"); + + b.Property("Gx") + .HasColumnType("real") + .HasColumnName("Gx"); + + b.Property("Gy") + .HasColumnType("real") + .HasColumnName("Gy"); + + b.Property("Gz") + .HasColumnType("real") + .HasColumnName("Gz"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_60"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Att06h") + .HasColumnType("real") + .HasColumnName("ATT06H"); + + b.Property("Att06l") + .HasColumnType("real") + .HasColumnName("ATT06L"); + + b.Property("Att10h") + .HasColumnType("real") + .HasColumnName("ATT10H"); + + b.Property("Att10l") + .HasColumnType("real") + .HasColumnName("ATT10L"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Phl1f1") + .HasColumnType("real") + .HasColumnName("PHL1F1"); + + b.Property("Phl1f2") + .HasColumnType("real") + .HasColumnName("PHL1F2"); + + b.Property("Phl2f1") + .HasColumnType("real") + .HasColumnName("PHL2F1"); + + b.Property("Phl2f2") + .HasColumnType("real") + .HasColumnName("PHL2F2"); + + b.Property("Status") + .HasColumnType("real") + .HasColumnName("Status"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_61"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptsvym") + .HasColumnType("real") + .HasColumnName("DEPTSVYM"); + + b.Property("Deptsvyv") + .HasColumnType("real") + .HasColumnName("DEPTSVYV"); + + b.Property("Passnum") + .HasColumnType("smallint") + .HasColumnName("PASSNUM"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Svyazc") + .HasColumnType("real") + .HasColumnName("SVYAZC"); + + b.Property("Svyazu") + .HasColumnType("real") + .HasColumnName("SVYAZU"); + + b.Property("Svydls") + .HasColumnType("real") + .HasColumnName("SVYDLS"); + + b.Property("Svyew") + .HasColumnType("real") + .HasColumnName("SVYEW"); + + b.Property("Svygtf") + .HasColumnType("real") + .HasColumnName("SVYGTF"); + + b.Property("Svyinc") + .HasColumnType("real") + .HasColumnName("SVYINC"); + + b.Property("Svymtf") + .HasColumnType("real") + .HasColumnName("SVYMTF"); + + b.Property("Svyns") + .HasColumnType("real") + .HasColumnName("SVYNS"); + + b.Property("Svytype") + .HasColumnType("text") + .HasColumnName("SVYTYPE"); + + b.Property("Svywalk") + .HasColumnType("real") + .HasColumnName("SVYWALK"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_7"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptbitv") + .HasColumnType("real") + .HasColumnName("DEPTBITV"); + + b.Property("Deptcalm") + .HasColumnType("real") + .HasColumnName("DEPTCALM"); + + b.Property("Deptcalv") + .HasColumnType("real") + .HasColumnName("DEPTCALV"); + + b.Property("Deptfdm") + .HasColumnType("real") + .HasColumnName("DEPTFDM"); + + b.Property("Deptfdv") + .HasColumnType("real") + .HasColumnName("DEPTFDV"); + + b.Property("Deptgr1m") + .HasColumnType("real") + .HasColumnName("DEPTGR1M"); + + b.Property("Deptgr1v") + .HasColumnType("real") + .HasColumnName("DEPTGR1V"); + + b.Property("Deptgr2m") + .HasColumnType("real") + .HasColumnName("DEPTGR2M"); + + b.Property("Deptgr2v") + .HasColumnType("real") + .HasColumnName("DEPTGR2V"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptp1m") + .HasColumnType("real") + .HasColumnName("DEPTP1M"); + + b.Property("Deptp1v") + .HasColumnType("real") + .HasColumnName("DEPTP1V"); + + b.Property("Deptp2m") + .HasColumnType("real") + .HasColumnName("DEPTP2M"); + + b.Property("Deptp2v") + .HasColumnType("real") + .HasColumnName("DEPTP2V"); + + b.Property("Deptrs1m") + .HasColumnType("real") + .HasColumnName("DEPTRS1M"); + + b.Property("Deptrs1v") + .HasColumnType("real") + .HasColumnName("DEPTRS1V"); + + b.Property("Deptrs2m") + .HasColumnType("real") + .HasColumnName("DEPTRS2M"); + + b.Property("Deptrs2v") + .HasColumnType("real") + .HasColumnName("DEPTRS2V"); + + b.Property("Deptvert") + .HasColumnType("real") + .HasColumnName("DEPTVERT"); + + b.Property("Mclp") + .HasColumnType("real") + .HasColumnName("MCLP"); + + b.Property("Mfd") + .HasColumnType("real") + .HasColumnName("MFD"); + + b.Property("Mffp") + .HasColumnType("real") + .HasColumnName("MFFP"); + + b.Property("Mfpp") + .HasColumnType("real") + .HasColumnName("MFPP"); + + b.Property("Mfrann") + .HasColumnType("real") + .HasColumnName("MFRANN"); + + b.Property("Mfrpipe") + .HasColumnType("real") + .HasColumnName("MFRPIPE"); + + b.Property("Mftann") + .HasColumnType("real") + .HasColumnName("MFTANN"); + + b.Property("Mftpipe") + .HasColumnType("real") + .HasColumnName("MFTPIPE"); + + b.Property("Mg1") + .HasColumnType("real") + .HasColumnName("MG1"); + + b.Property("Mg1c") + .HasColumnType("real") + .HasColumnName("MG1C"); + + b.Property("Mg2") + .HasColumnType("real") + .HasColumnName("MG2"); + + b.Property("Mg2c") + .HasColumnType("real") + .HasColumnName("MG2C"); + + b.Property("Mpo1") + .HasColumnType("real") + .HasColumnName("MPO1"); + + b.Property("Mpo2") + .HasColumnType("real") + .HasColumnName("MPO2"); + + b.Property("Mr1") + .HasColumnType("real") + .HasColumnName("MR1"); + + b.Property("Mr1c") + .HasColumnType("real") + .HasColumnName("MR1C"); + + b.Property("Mr2") + .HasColumnType("real") + .HasColumnName("MR2"); + + b.Property("Mr2c") + .HasColumnType("real") + .HasColumnName("MR2C"); + + b.Property("Passnum") + .HasColumnType("smallint") + .HasColumnName("PASSNUM"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Spare6") + .HasColumnType("real") + .HasColumnName("SPARE6"); + + b.Property("Spare7") + .HasColumnType("real") + .HasColumnName("SPARE7"); + + b.Property("Spare8") + .HasColumnType("real") + .HasColumnName("SPARE8"); + + b.Property("Spare9") + .HasColumnType("real") + .HasColumnName("SPARE9"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_8"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.HasOne("AsbCloudDb.Model.Deposit", "Deposit") + .WithMany("Clusters") + .HasForeignKey("IdDeposit") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_cluster_t_deposit_id_fk"); + + b.Navigation("Deposit"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.HasOne("AsbCloudDb.Model.CompanyType", "CompanyType") + .WithMany("Companies") + .HasForeignKey("IdCompanyType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CompanyType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Contact", b => + { + b.HasOne("AsbCloudDb.Model.CompanyType", "CompanyType") + .WithMany("Contacts") + .HasForeignKey("IdCompanyType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("Contacts") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CompanyType"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DailyReports.DailyReport", b => + { + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DataSaubStat", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DataSaubStatDrillingQuality", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillTest", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdFileCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("DrillingProgramParts") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FileCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Faq", b => + { + b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer") + .WithMany() + .HasForeignKey("IdAuthorAnswer"); + + b.HasOne("AsbCloudDb.Model.User", "AuthorQuestion") + .WithMany() + .HasForeignKey("IdAuthorQuestion") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AuthorAnswer"); + + b.Navigation("AuthorQuestion"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany("Files") + .HasForeignKey("IdAuthor"); + + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("FileCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileMark", b => + { + b.HasOne("AsbCloudDb.Model.FileInfo", "FileInfo") + .WithMany("FileMarks") + .HasForeignKey("IdFile") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_file_mark_t_file_info_fk"); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("FileMarks") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_user_t_file_mark_fk"); + + b.Navigation("FileInfo"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemFloat", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemInt", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemString", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.HelpPage", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FileCategory"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.Manual", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.FileCategory", "Category") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Manuals.ManualDirectory", "Directory") + .WithMany("Manuals") + .HasForeignKey("IdDirectory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Category"); + + b.Navigation("Directory"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b => + { + b.HasOne("AsbCloudDb.Model.Manuals.ManualDirectory", "Parent") + .WithMany("Children") + .HasForeignKey("IdParent") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Measure", b => + { + b.HasOne("AsbCloudDb.Model.MeasureCategory", "Category") + .WithMany("Measures") + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Notification", b => + { + b.HasOne("AsbCloudDb.Model.NotificationCategory", "NotificationCategory") + .WithMany("Notifications") + .HasForeignKey("IdNotificationCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NotificationCategory"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.OperationValue", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdOperationCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanAntiCrashRotation", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanAntiCrashRotation", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanAutoHoldTF", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanAutoHoldTF", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanDamper", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanDamper", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanDrillTest", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanDrillTest", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanOscillation", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanOscillation", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanShockTest", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanShockTest", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanStaticMeasurementOutput", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Functions.ProcessMapPlanStaticMeasurementOutput", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanLoadCapacity", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanLoadCapacity", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanOscillationAngles", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanOscillationAngles", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanPositioningOffTheBottom", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanPositioningOffTheBottom", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanReamingRotor", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanReamingRotor", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanReamingSlide", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanReamingSlide", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanRecordingStaticMeasurement", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanRecordingStaticMeasurement", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanRotor", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanRotor", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanSlide", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanSlide", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanSwitchingOffThePump", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict) + .HasConstraintName("FK_t_process_map_plan_operation_switching_off_the_pump_t_user~1"); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanSwitchingOffThePump", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_t_process_map_plan_operation_switching_off_the_pump_t_well~1"); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanSwitchingToTheMode", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanSwitchingToTheMode", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanTFOrientation", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("AsbCloudDb.Model.ProcessMapPlan.Operations.ProcessMapPlanTFOrientation", "Previous") + .WithMany() + .HasForeignKey("IdPrevious"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Previous"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMapPlan.ProcessMapPlanSubsystems", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "Editor") + .WithMany() + .HasForeignKey("IdEditor"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Editor"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdCompany") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_relation_company_well_t_company_id_fk"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_relation_company_well_t_well_id_fk"); + + b.Navigation("Company"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationContactWell", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("RelationContactsWells") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserDrillingProgramPart", b => + { + b.HasOne("AsbCloudDb.Model.DrillingProgramPart", "DrillingProgramPart") + .WithMany("RelatedUsers") + .HasForeignKey("IdDrillingProgramPart") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrillingProgramPart"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRolePermission", b => + { + b.HasOne("AsbCloudDb.Model.Permission", "Permission") + .WithMany("RelationUserRolePermissions") + .HasForeignKey("IdPermission") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "UserRole") + .WithMany("RelationUserRolePermissions") + .HasForeignKey("IdUserRole") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Permission"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRoleUserRole", b => + { + b.HasOne("AsbCloudDb.Model.UserRole", "Role") + .WithMany("RelationUserRoleUserRoles") + .HasForeignKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "IncludeRole") + .WithMany() + .HasForeignKey("IdInclude") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IncludeRole"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserUserRole", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("RelationUsersUserRoles") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "UserRole") + .WithMany("RelationUsersUserRoles") + .HasForeignKey("IdUserRole") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ReportProperty", b => + { + b.HasOne("AsbCloudDb.Model.FileInfo", "File") + .WithMany() + .HasForeignKey("IdFile") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("File"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Schedule", b => + { + b.HasOne("AsbCloudDb.Model.Driller", "Driller") + .WithMany("Schedule") + .HasForeignKey("IdDriller") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_schedule_t_driller_id_driller"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Driller"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.SetpointsRequest", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSaub") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_data_saub_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSpin") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_data_spin_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Events") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_event_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Messages") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_messages_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Users") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_user_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryFact", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlan", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("Users") + .HasForeignKey("IdCompany") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("t_user_t_company_id_fk"); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserSetting", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.HasOne("AsbCloudDb.Model.Cluster", "Cluster") + .WithMany("Wells") + .HasForeignKey("IdCluster") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_t_cluster_id_fk"); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithOne("Well") + .HasForeignKey("AsbCloudDb.Model.Well", "IdTelemetry") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("t_well_t_telemetry_id_fk"); + + b.HasOne("AsbCloudDb.Model.WellType", "WellType") + .WithMany("Wells") + .HasForeignKey("IdWellType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cluster"); + + b.Navigation("Telemetry"); + + b.Navigation("WellType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellComposite", b => + { + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("WellComposites") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_t_well_id_fk"); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany("WellComposites") + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_t_well_section_type_id_fk"); + + b.HasOne("AsbCloudDb.Model.Well", "WellSrc") + .WithMany("WellCompositeSrcs") + .HasForeignKey("IdWellSrc") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_src_t_well_id_fk"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + + b.Navigation("WellSrc"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellFinalDocument", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "Category") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + + b.Navigation("User"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellOperation", "OperationPlan") + .WithMany() + .HasForeignKey("IdPlan") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("WellOperations") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany("WellOperations") + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("OperationPlan"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "Parent") + .WithMany() + .HasForeignKey("IdParent"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSections.WellSectionPlan", b => + { + b.HasOne("AsbCloudDb.Model.WellSectionType", "SectionType") + .WithMany() + .HasForeignKey("IdSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SectionType"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record1", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record50", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record60", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record61", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record7", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record8", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.Navigation("Wells"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.Navigation("RelationCompaniesWells"); + + b.Navigation("Users"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b => + { + b.Navigation("Companies"); + + b.Navigation("Contacts"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Navigation("Clusters"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Driller", b => + { + b.Navigation("Schedule"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.Navigation("RelatedUsers"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.Navigation("FileMarks"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b => + { + b.Navigation("Children"); + + b.Navigation("Manuals"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b => + { + b.Navigation("Measures"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.NotificationCategory", b => + { + b.Navigation("Notifications"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Permission", b => + { + b.Navigation("RelationUserRolePermissions"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b => + { + b.Navigation("DataSaub"); + + b.Navigation("DataSpin"); + + b.Navigation("Events"); + + b.Navigation("Messages"); + + b.Navigation("Users"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.Navigation("FileMarks"); + + b.Navigation("Files"); + + b.Navigation("RelationContactsWells"); + + b.Navigation("RelationUsersUserRoles"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Navigation("RelationUserRolePermissions"); + + b.Navigation("RelationUserRoleUserRoles"); + + b.Navigation("RelationUsersUserRoles"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Navigation("Contacts"); + + b.Navigation("DrillingProgramParts"); + + b.Navigation("RelationCompaniesWells"); + + b.Navigation("WellCompositeSrcs"); + + b.Navigation("WellComposites"); + + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Navigation("WellComposites"); + + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Navigation("Wells"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AsbCloudDb/Migrations/20241004110355_Add_Table_DataSaubStatDrillingQuality.cs b/AsbCloudDb/Migrations/20241004110355_Add_Table_DataSaubStatDrillingQuality.cs new file mode 100644 index 00000000..80547bde --- /dev/null +++ b/AsbCloudDb/Migrations/20241004110355_Add_Table_DataSaubStatDrillingQuality.cs @@ -0,0 +1,54 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace AsbCloudDb.Migrations +{ + /// + public partial class Add_Table_DataSaubStatDrillingQuality : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "t_data_saub_stat_drilling_quality", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + id_telemetry = table.Column(type: "integer", nullable: false, comment: "Ключ телеметрии"), + date_start = table.Column(type: "timestamp with time zone", nullable: false, comment: "Дата и время начала"), + date_end = table.Column(type: "timestamp with time zone", nullable: false, comment: "Дата и время окончания"), + depth_start = table.Column(type: "double precision", nullable: false, comment: "Глубина забоя по стволу начальная"), + depth_end = table.Column(type: "double precision", nullable: false, comment: "Глубина забоя по стволу конечная"), + id_feed_regulator = table.Column(type: "integer", nullable: false, comment: "Флаг"), + depth_drilling_quality = table.Column(type: "double precision", nullable: false, comment: "Качественная проходка") + }, + constraints: table => + { + table.PrimaryKey("PK_t_data_saub_stat_drilling_quality", x => x.id); + table.ForeignKey( + name: "FK_t_data_saub_stat_drilling_quality_t_telemetry_id_telemetry", + column: x => x.id_telemetry, + principalTable: "t_telemetry", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }, + comment: "Кеш-таблица для хранения данных для построения страницы \"Качество\""); + + migrationBuilder.CreateIndex( + name: "IX_t_data_saub_stat_drilling_quality_id_telemetry", + table: "t_data_saub_stat_drilling_quality", + column: "id_telemetry"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "t_data_saub_stat_drilling_quality"); + } + } +} diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index f721100b..f3ff78dd 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ namespace AsbCloudDb.Migrations #pragma warning disable 612, 618 modelBuilder .UseCollation("Russian_Russia.1251") - .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("ProductVersion", "8.0.4") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack"); @@ -451,6 +451,60 @@ namespace AsbCloudDb.Migrations }); }); + modelBuilder.Entity("AsbCloudDb.Model.DataSaubStatDrillingQuality", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end") + .HasComment("Дата и время окончания"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("Дата и время начала"); + + b.Property("DepthDrillingQuality") + .HasColumnType("double precision") + .HasColumnName("depth_drilling_quality") + .HasComment("Качественная проходка"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина забоя по стволу конечная"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина забоя по стволу начальная"); + + b.Property("IdFeedRegulator") + .HasColumnType("integer") + .HasColumnName("id_feed_regulator") + .HasComment("Флаг"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("Ключ телеметрии"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_data_saub_stat_drilling_quality", t => + { + t.HasComment("Кеш-таблица для хранения данных для построения страницы \"Качество\""); + }); + }); + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => { b.Property("Id") @@ -10720,6 +10774,17 @@ namespace AsbCloudDb.Migrations b.Navigation("Telemetry"); }); + modelBuilder.Entity("AsbCloudDb.Model.DataSaubStatDrillingQuality", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", b => { b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") diff --git a/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs b/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs index a49dc29e..6c657a99 100644 --- a/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs +++ b/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs @@ -28,7 +28,14 @@ namespace AsbCloudDb.Model [Column("depth_end"), Comment("Глубина забоя по стволу конечная")] public double DepthEnd { get; set; } + [Column("id_feed_regulator"), Comment("Флаг")] + public int IdFeedRegulator { get; set; } + + [Column("depth_drilling_quality"), Comment("Качественная проходка")] + public double DepthDrillingQuality { get; set; } + [ForeignKey(nameof(IdTelemetry))] public virtual Telemetry Telemetry { get; set; } = null!; + } } diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 86e4df64..a8137bfe 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -319,7 +319,8 @@ public static class DependencyInjection services.AddTransient(); services.AddTransient(); services.AddTransient(); - //services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs index d51ada62..6de63634 100644 --- a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs +++ b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs @@ -25,21 +25,20 @@ public class DataSaubStatDrillingQualityRepository : IDataSaubStatDrillingQualit } - public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token) + public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token) { var timeZoneOffsets = idTelemetries .Distinct() .ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours)); - var stats = await db.Set() + var stats = await db.Set() .Where(s => idTelemetries.Contains(s.IdTelemetry)) .GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First()) .ToArrayAsync(token); - //todo - //var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry])); - //return result; - return null; + var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry])); + + return result; } public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token) diff --git a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs index 9458145d..a22e1007 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs @@ -60,22 +60,22 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService { GeDate = DateTime.UtcNow.AddDays(-5000) }; - var idTelemetries = telemetryDataCache.GetIds(cacheRequest).ToArray(); + var idTelemetries = new int[119]; + //telemetryDataCache.GetIds(cacheRequest).ToArray(); if (!idTelemetries.Any()) return; - var stats = new List(); - //await dataSaubStatRepository.GetLastsAsync(idTelemetries, token); + var stats = await dataSaubStatDrillingQualityRepository.GetLastsAsync(idTelemetries, token); - //for (var i = 0; i < idTelemetries.Length; i++) - //{ - // var idTelemetry = idTelemetries[i]; - // var lastDate = stats.FirstOrDefault(s => s.IdTelemetry == idTelemetry)?.DateEnd.ToUniversalTime() ?? DateTimeOffset.UnixEpoch; - // var statsCount = await CreateStatDrillingQualityForTelemetry(idTelemetry, lastDate, token); - // if (onProgressCallback != null) - // onProgressCallback($"Calculate stat for telemetry: {idTelemetry}; from {lastDate}; results count: {statsCount};", 1d * i / idTelemetries.Length); - //} + for (var i = 0; i < idTelemetries.Length; i++) + { + var idTelemetry = idTelemetries[i]; + var lastDate = stats.FirstOrDefault(s => s.IdTelemetry == idTelemetry)?.DateEnd.ToUniversalTime() ?? DateTimeOffset.UnixEpoch; + var statsCount = await CreateStatDrillingQualityForTelemetry(idTelemetry, lastDate, token); + if (onProgressCallback != null) + onProgressCallback($"Calculate stat for telemetry: {idTelemetry}; from {lastDate}; results count: {statsCount};", 1d * i / idTelemetries.Length); + } } private async Task CreateStatDrillingQualityForTelemetry( @@ -100,7 +100,10 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService result.AddRange(data); } - return await dataSaubStatDrillingQualityRepository.InsertRangeAsync(result, token); + if(result.Any()) + return await dataSaubStatDrillingQualityRepository.InsertRangeAsync(result, token); + + return 0; } private static IEnumerable CreateDataSaubStatDrillingQuality( @@ -113,7 +116,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService var indexStart = 0; var indexEnd = 0; - while (indexEnd < dataSaub.Count()) + while (indexEnd < dataSaub.Count()-1) { indexStart = Array.FindIndex(dataSaub, indexEnd, t => t.IdFeedRegulator == idFeedRegulator); if (indexStart < 0) From d5a4b3d7fed344a910601e2ed360098eb9be6610 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 7 Oct 2024 11:26:41 +0500 Subject: [PATCH 05/22] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=20=D0=BB?= =?UTF-8?q?=D0=B8=D1=88=D0=BD=D0=B8=D0=B9=20=D0=BA=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IDataSaubStatDrillingQualityRepository.cs | 2 +- .../DataSaubStatDrillingQualityRepository.cs | 18 ++++++++---------- .../DataSaubStatDrillingQualityService.cs | 15 +++++++-------- AsbCloudWebApi/appsettings.json | 8 ++++---- 4 files changed, 20 insertions(+), 23 deletions(-) diff --git a/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs index d607775a..849f44c4 100644 --- a/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs +++ b/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs @@ -20,7 +20,7 @@ public interface IDataSaubStatDrillingQualityRepository : ITelemetryDataEditorSe /// конечная дата /// /// - Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token); + Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token); /// /// Получение последних по дате окончания бурения записей качества в разрезе телеметрий diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs index 6de63634..96cad607 100644 --- a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs +++ b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs @@ -22,7 +22,6 @@ public class DataSaubStatDrillingQualityRepository : IDataSaubStatDrillingQualit { db = dbContext; this.telemetryService = telemetryService; - } public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token) @@ -41,22 +40,21 @@ public class DataSaubStatDrillingQualityRepository : IDataSaubStatDrillingQualit return result; } - public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token) + public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token) { var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours); var geDateUtc = geDate.ToUniversalTime(); var leDateUtc = leDate.ToUniversalTime(); - var stats = await db.Set() + var stats = await db.Set() .Where(s => s.IdTelemetry == idTelemetry) .Where(s => s.DateStart >= geDateUtc) .Where(s => s.DateEnd <= leDateUtc) .ToArrayAsync(token); - //todo - //var result = stats.Select(s => ConvertToDto(s, timeSpan)); - //return result; - return null; + var result = stats.Select(s => ConvertToDto(s, timeSpan)); + + return result; } public async Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token) @@ -84,9 +82,9 @@ public class DataSaubStatDrillingQualityRepository : IDataSaubStatDrillingQualit return entity; } - private IQueryable BuildQuery(TelemetryPartDeleteRequest request) + private IQueryable BuildQuery(TelemetryPartDeleteRequest request) { - var query = db.Set() + var query = db.Set() .Where(o => o.IdTelemetry == request.IdTelemetry); if (request.LeDate is not null) @@ -107,7 +105,7 @@ public class DataSaubStatDrillingQualityRepository : IDataSaubStatDrillingQualit public async Task DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token) { var query = BuildQuery(request); - db.Set().RemoveRange(query); + db.Set().RemoveRange(query); return await db.SaveChangesAsync(token); } } diff --git a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs index a22e1007..e4ecf594 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs @@ -3,6 +3,7 @@ using AsbCloudApp.Data.SAUB; using AsbCloudApp.Repositories; using AsbCloudApp.Requests; using AsbCloudApp.Services; +using AsbCloudInfrastructure.Services.SAUB; using System; using System.Collections.Generic; using System.Linq; @@ -15,8 +16,8 @@ namespace AsbCloudInfrastructure.Services; public class DataSaubStatDrillingQualityService : IDataSaubStatService { private IDataSaubStatDrillingQualityRepository dataSaubStatDrillingQualityRepository; - private ITelemetryDataCache telemetryDataCache; private ITelemetryDataSaubService dataSaubService; + private ITelemetryDataCache telemetryDataCache; public Dictionary> QualitySettingsForFeedRegulators { get; } @@ -26,8 +27,8 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService ITelemetryDataSaubService dataSaubService) { this.dataSaubStatDrillingQualityRepository = dataSaubStatDrillingQualityRepository; - this.telemetryDataCache = telemetryDataCache; this.dataSaubService = dataSaubService; + this.telemetryDataCache = telemetryDataCache; Predicate hasQualityWithIdFeedRegulator1 = (TelemetryDataSaubDto spanItem) => (spanItem.BlockSpeed >= spanItem.BlockSpeedSp * 0.95 @@ -55,13 +56,11 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService public async Task CreateStatAsync(int lastDaysFilter, Action onProgressCallback, CancellationToken token) { - //to do var cacheRequest = new TelemetryDataRequest() { - GeDate = DateTime.UtcNow.AddDays(-5000) + GeDate = DateTime.UtcNow.AddDays(-lastDaysFilter) }; - var idTelemetries = new int[119]; - //telemetryDataCache.GetIds(cacheRequest).ToArray(); + var idTelemetries = telemetryDataCache.GetIds(cacheRequest).ToArray(); if (!idTelemetries.Any()) return; @@ -116,7 +115,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService var indexStart = 0; var indexEnd = 0; - while (indexEnd < dataSaub.Count()-1) + while (indexEnd < dataSaub.Count()) { indexStart = Array.FindIndex(dataSaub, indexEnd, t => t.IdFeedRegulator == idFeedRegulator); if (indexStart < 0) @@ -134,7 +133,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService var subset = dataSaub.AsSpan(indexStart, length); - if (length <= 2 || (subset[^1].WellDepth - subset[0].WellDepth) < 0.3) + if (length <= 2 || (subset[^1].WellDepth - subset[0].WellDepth) < 0.15) continue; // мелкие выборки не учитываем. diff --git a/AsbCloudWebApi/appsettings.json b/AsbCloudWebApi/appsettings.json index ae879099..06cd312e 100644 --- a/AsbCloudWebApi/appsettings.json +++ b/AsbCloudWebApi/appsettings.json @@ -7,10 +7,10 @@ } }, "ConnectionStrings": { - "DefaultConnection": "Host=192.168.0.10;Database=postgres;Username=postgres;Password=q;Persist Security Info=True", - "DebugConnection": "Host=192.168.0.10;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True", - "TestConnection": "Host=192.168.0.10;Database=test;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True", - "LocalConnection": "Host=192.168.0.10;Database=postgres;Username=postgres;Password=q;Persist Security Info=True" + "DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True", + "DebugConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True", + "TestConnection": "Host=localhost;Database=test;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True", + "LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True" }, "AllowedHosts": "*", "ContentPath": "../data", From 5e5453bd30d8b8a13ca7af28b4d364634737d369 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 7 Oct 2024 15:46:57 +0500 Subject: [PATCH 06/22] =?UTF-8?q?=D0=90=D0=B1=D1=81=D1=82=D1=80=D0=B0?= =?UTF-8?q?=D0=BA=D1=82=D0=BD=D1=8B=D0=B9=20=D1=80=D0=B5=D0=BF=D0=BE=D0=B7?= =?UTF-8?q?=D0=B8=D1=82=D0=BE=D1=80=D0=B8=D0=B9=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20data-saub-stat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataSaubStatDrillingQualityDto.cs | 3 +- AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs | 2 +- AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs | 19 +++ .../IDataSaubStatDrillingQualityRepository.cs | 40 ------- .../Repositories/IDataSaubStatRepository.cs | 15 +-- AsbCloudDb/Model/SaubStat/DataSaubStat.cs | 2 +- .../SaubStat/DataSaubStatDrillingQuality.cs | 3 +- AsbCloudDb/Model/SaubStat/IDataSaubStat.cs | 9 ++ .../Services/DataSaubStatServiceTest.cs | 2 +- AsbCloudInfrastructure/DependencyInjection.cs | 4 +- .../DataSaubStatAbstractRepository.cs | 111 ++++++++++++++++++ .../DataSaubStatDrillingQualityRepository.cs | 110 ++--------------- .../Repository/DataSaubStatRepository.cs | 108 ++--------------- .../DataSaubStatDrillingQualityService.cs | 9 +- .../Services/DataSaubStatService.cs | 4 +- .../Report/ProcessMapReportDrillingService.cs | 4 +- .../SAUB/TelemetryDataEditorService.cs | 3 +- .../Repository/DataSaubStatRepositoryTest.cs | 4 +- 18 files changed, 183 insertions(+), 269 deletions(-) create mode 100644 AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs delete mode 100644 AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs create mode 100644 AsbCloudDb/Model/SaubStat/IDataSaubStat.cs create mode 100644 AsbCloudInfrastructure/Repository/DataSaubStatAbstractRepository.cs diff --git a/AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs b/AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs index 2e74d3c4..653b9563 100644 --- a/AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs +++ b/AsbCloudApp/Data/SaubStat/DataSaubStatDrillingQualityDto.cs @@ -1,12 +1,11 @@ using System; -using AsbCloudApp.Data.WellOperation; namespace AsbCloudApp.Data; /// /// dto для хранения данных статистики качества бурения /// -public class DataSaubStatDrillingQualityDto : IId +public class DataSaubStatDrillingQualityDto : IId, IDataSaubStatDto { /// /// diff --git a/AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs b/AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs index fc880869..2ec9f959 100644 --- a/AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs +++ b/AsbCloudApp/Data/SaubStat/DataSaubStatDto.cs @@ -6,7 +6,7 @@ namespace AsbCloudApp.Data; /// /// dto для хранения данных статистики сауб /// -public class DataSaubStatDto : IId +public class DataSaubStatDto : IId, IDataSaubStatDto { /// /// diff --git a/AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs b/AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs new file mode 100644 index 00000000..d82e40bb --- /dev/null +++ b/AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs @@ -0,0 +1,19 @@ +using System; + +namespace AsbCloudApp.Data; + +/// +/// Dto для работы с данными dataSaubStat +/// +public interface IDataSaubStatDto +{ + /// + /// Дата и время начала + /// + public DateTimeOffset DateStart { get; set; } + + /// + /// Дата и время окончания + /// + public DateTimeOffset DateEnd { get; set; } +} diff --git a/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs deleted file mode 100644 index 849f44c4..00000000 --- a/AsbCloudApp/Repositories/IDataSaubStatDrillingQualityRepository.cs +++ /dev/null @@ -1,40 +0,0 @@ -using AsbCloudApp.Data; -using AsbCloudApp.Services; -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; - -namespace AsbCloudApp.Repositories; - -/// -/// Репозиторий работы с данными из таблицы t_data_daub_stat_drilling_quality -/// -public interface IDataSaubStatDrillingQualityRepository : ITelemetryDataEditorService -{ - /// - /// Получение записей по ключу телеметрии - /// - /// ключ телеметрии - /// начальная дата - /// конечная дата - /// - /// - Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token); - - /// - /// Получение последних по дате окончания бурения записей качества в разрезе телеметрий - /// - /// ключи телеметрий - /// - /// - Task> GetLastsAsync(int[] idTelemetries, CancellationToken token); - - /// - /// Вставка записей статистики качества - /// - /// - /// - /// - Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token); -} diff --git a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs index d419ad82..e854e9ce 100644 --- a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs +++ b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs @@ -8,9 +8,10 @@ using System.Threading.Tasks; namespace AsbCloudApp.Repositories; /// -/// Репозиторий работы с данными из таблицы t_data_daub_stat +/// Репозиторий работы с данными, реализующими интерфейс IDataSaubStatDto /// -public interface IDataSaubStatRepository : ITelemetryDataEditorService +public interface IDataSaubStatRepository : ITelemetryDataEditorService + where TDto : IDataSaubStatDto { /// /// Получение записей по ключу телеметрии @@ -20,21 +21,21 @@ public interface IDataSaubStatRepository : ITelemetryDataEditorService /// конечная дата /// /// - Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token); + Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token); /// - /// Получение последних по дате окончания бурения записей в разрезе телеметрий + /// Получение последних по дате окончания бурения записей качества в разрезе телеметрий /// /// ключи телеметрий /// /// - Task> GetLastsAsync(int[] idTelemetries, CancellationToken token); + Task> GetLastsAsync(int[] idTelemetries, CancellationToken token); /// - /// Вставка записей статистики + /// Вставка записей статистики качества /// /// /// /// - Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token); + Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token); } diff --git a/AsbCloudDb/Model/SaubStat/DataSaubStat.cs b/AsbCloudDb/Model/SaubStat/DataSaubStat.cs index b4017a8e..39cfc41a 100644 --- a/AsbCloudDb/Model/SaubStat/DataSaubStat.cs +++ b/AsbCloudDb/Model/SaubStat/DataSaubStat.cs @@ -7,7 +7,7 @@ using System.Text.Json.Serialization; namespace AsbCloudDb.Model { [Table("t_data_saub_stat"), Comment("Кеш-таблица для хранения данных для РТК-отчета")] - public class DataSaubStat : IId + public class DataSaubStat : IId, IDataSaubStat { [Key] [Column("id")] diff --git a/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs b/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs index 6c657a99..f721b45e 100644 --- a/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs +++ b/AsbCloudDb/Model/SaubStat/DataSaubStatDrillingQuality.cs @@ -2,12 +2,11 @@ using Microsoft.EntityFrameworkCore; using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; namespace AsbCloudDb.Model { [Table("t_data_saub_stat_drilling_quality"), Comment("Кеш-таблица для хранения данных для построения страницы \"Качество\"")] - public class DataSaubStatDrillingQuality : IId + public class DataSaubStatDrillingQuality : IId, IDataSaubStat { [Key] [Column("id")] diff --git a/AsbCloudDb/Model/SaubStat/IDataSaubStat.cs b/AsbCloudDb/Model/SaubStat/IDataSaubStat.cs new file mode 100644 index 00000000..07c57deb --- /dev/null +++ b/AsbCloudDb/Model/SaubStat/IDataSaubStat.cs @@ -0,0 +1,9 @@ +using System; + +namespace AsbCloudDb.Model; +public interface IDataSaubStat +{ + public int IdTelemetry { get; set; } + public DateTimeOffset DateStart { get; set; } + public DateTimeOffset DateEnd { get; set; } +} diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs index 80783c73..2246dc54 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs @@ -19,7 +19,7 @@ namespace AsbCloudInfrastructure.Tests.Services; public class DataSaubStatServiceTest { private readonly int Gap = 5; - private readonly IDataSaubStatRepository dataSaubStatRepositoryMock = Substitute.For(); + private readonly IDataSaubStatRepository dataSaubStatRepositoryMock = Substitute.For>(); private readonly ITelemetryDataCache telemetryDataCacheMock = Substitute.For>(); private readonly IDetectedOperationRepository detectedOperationRepositoryMock = Substitute.For(); private readonly ITelemetryDataSaubService dataSaubServiceMock = Substitute.For(); diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index a8137bfe..339f4736 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -318,8 +318,8 @@ public static class DependencyInjection services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + services.AddTransient, DataSaubStatRepository>(); + services.AddTransient, DataSaubStatDrillingQualityRepository>(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatAbstractRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatAbstractRepository.cs new file mode 100644 index 00000000..74000e43 --- /dev/null +++ b/AsbCloudInfrastructure/Repository/DataSaubStatAbstractRepository.cs @@ -0,0 +1,111 @@ +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; +using AsbCloudApp.Services; +using AsbCloudDb.Model; +using Mapster; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace AsbCloudInfrastructure.Repository; +public class DataSaubStatAbstractRepository : IDataSaubStatRepository + where TDto : AsbCloudApp.Data.IDataSaubStatDto + where TEntity : class, AsbCloudDb.Model.IDataSaubStat +{ + private readonly IAsbCloudDbContext db; + private readonly ITelemetryService telemetryService; + + public DataSaubStatAbstractRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) + { + db = dbContext; + this.telemetryService = telemetryService; + } + + public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token) + { + var timeZoneOffsets = idTelemetries + .Distinct() + .ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours)); + + var stats = await db.Set() + .Where(s => idTelemetries.Contains(s.IdTelemetry)) + .GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First()) + .ToArrayAsync(token); + + var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry])); + + return result; + } + + public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token) + { + var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours); + var geDateUtc = geDate.ToUniversalTime(); + var leDateUtc = leDate.ToUniversalTime(); + + var stats = await db.Set() + .Where(s => s.IdTelemetry == idTelemetry) + .Where(s => s.DateStart >= geDateUtc) + .Where(s => s.DateEnd <= leDateUtc) + .ToArrayAsync(token); + + var result = stats.Select(s => ConvertToDto(s, timeSpan)); + + return result; + } + + public async Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token) + { + var entities = dataSaubStats.Select(data => ConvertToEntity(data)); + db.Set().AddRange(entities); + return await db.SaveChangesAsync(token); + } + + private static TDto ConvertToDto(TEntity entity, TimeSpan timeSpan) + { + var dto = entity.Adapt(); + dto.DateStart = dto.DateStart.ToOffset(timeSpan); + dto.DateEnd = dto.DateEnd.ToOffset(timeSpan); + + return dto; + } + + private static TEntity ConvertToEntity(TDto dto) + { + var entity = dto.Adapt(); + entity.DateStart = dto.DateStart.ToUniversalTime(); + entity.DateEnd = dto.DateEnd.ToUniversalTime(); + + return entity; + } + + private IQueryable BuildQuery(TelemetryPartDeleteRequest request) + { + var query = db.Set() + .Where(o => o.IdTelemetry == request.IdTelemetry); + + if (request.LeDate is not null) + { + var leDate = request.LeDate.Value.ToUniversalTime(); + query = query.Where(o => o.DateStart <= leDate); + } + + if (request.GeDate is not null) + { + var geDate = request.GeDate.Value.ToUniversalTime(); + query = query.Where(o => o.DateEnd >= geDate); + } + + return query; + } + + public async Task DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token) + { + var query = BuildQuery(request); + db.Set().RemoveRange(query); + return await db.SaveChangesAsync(token); + } +} diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs index 96cad607..f16c9262 100644 --- a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs +++ b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs @@ -1,111 +1,21 @@ using AsbCloudApp.Data; -using AsbCloudApp.Repositories; -using AsbCloudApp.Requests; using AsbCloudApp.Services; using AsbCloudDb.Model; -using Mapster; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; namespace AsbCloudInfrastructure.Repository; -public class DataSaubStatDrillingQualityRepository : IDataSaubStatDrillingQualityRepository +/// +/// data_saub_stat +/// +public class DataSaubStatDrillingQualityRepository : DataSaubStatAbstractRepository { - private readonly IAsbCloudDbContext db; - private readonly ITelemetryService telemetryService; - - public DataSaubStatDrillingQualityRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) + /// + /// + /// + /// + /// + public DataSaubStatDrillingQualityRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) : base(dbContext, telemetryService) { - db = dbContext; - this.telemetryService = telemetryService; - } - public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token) - { - var timeZoneOffsets = idTelemetries - .Distinct() - .ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours)); - - var stats = await db.Set() - .Where(s => idTelemetries.Contains(s.IdTelemetry)) - .GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First()) - .ToArrayAsync(token); - - var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry])); - - return result; - } - - public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token) - { - var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours); - var geDateUtc = geDate.ToUniversalTime(); - var leDateUtc = leDate.ToUniversalTime(); - - var stats = await db.Set() - .Where(s => s.IdTelemetry == idTelemetry) - .Where(s => s.DateStart >= geDateUtc) - .Where(s => s.DateEnd <= leDateUtc) - .ToArrayAsync(token); - - var result = stats.Select(s => ConvertToDto(s, timeSpan)); - - return result; - } - - public async Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token) - { - var entities = dataSaubStats.Select(data => ConvertToEntity(data)); - db.Set().AddRange(entities); - return await db.SaveChangesAsync(token); - } - - private static DataSaubStatDrillingQualityDto ConvertToDto(DataSaubStatDrillingQuality entity, TimeSpan timeSpan) - { - var dto = entity.Adapt(); - dto.DateStart = dto.DateStart.ToOffset(timeSpan); - dto.DateEnd = dto.DateEnd.ToOffset(timeSpan); - - return dto; - } - - private static DataSaubStatDrillingQuality ConvertToEntity(DataSaubStatDrillingQualityDto dto) - { - var entity = dto.Adapt(); - entity.DateStart = dto.DateStart.ToUniversalTime(); - entity.DateEnd = dto.DateEnd.ToUniversalTime(); - - return entity; - } - - private IQueryable BuildQuery(TelemetryPartDeleteRequest request) - { - var query = db.Set() - .Where(o => o.IdTelemetry == request.IdTelemetry); - - if (request.LeDate is not null) - { - var leDate = request.LeDate.Value.ToUniversalTime(); - query = query.Where(o => o.DateStart <= leDate); - } - - if (request.GeDate is not null) - { - var geDate = request.GeDate.Value.ToUniversalTime(); - query = query.Where(o => o.DateEnd >= geDate); - } - - return query; - } - - public async Task DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token) - { - var query = BuildQuery(request); - db.Set().RemoveRange(query); - return await db.SaveChangesAsync(token); } } diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs index d8932b28..dbfaa6bd 100644 --- a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs +++ b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs @@ -1,112 +1,18 @@ using AsbCloudApp.Data; -using AsbCloudApp.Repositories; -using AsbCloudApp.Requests; using AsbCloudApp.Services; using AsbCloudDb.Model; -using Mapster; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; namespace AsbCloudInfrastructure.Repository; -public class DataSaubStatRepository : IDataSaubStatRepository +public class DataSaubStatRepository : DataSaubStatAbstractRepository { - private readonly IAsbCloudDbContext db; - private readonly ITelemetryService telemetryService; - - public DataSaubStatRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) + /// + /// + /// + /// + /// + public DataSaubStatRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) : base(dbContext, telemetryService) { - db = dbContext; - this.telemetryService = telemetryService; } - - public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token) - { - var timeZoneOffsets = idTelemetries - .Distinct() - .ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours)); - - var stats = await db.Set() - .Where(s => idTelemetries.Contains(s.IdTelemetry)) - .GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First()) - .ToArrayAsync(token); - - var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry])); - - return result; - } - - public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token) - { - var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours); - var geDateUtc = geDate.ToUniversalTime(); - var leDateUtc = leDate.ToUniversalTime(); - - var stats = await db.Set() - .Where(s => s.IdTelemetry == idTelemetry) - .Where(s => s.DateStart >= geDateUtc) - .Where(s => s.DateEnd <= leDateUtc) - .ToArrayAsync(token); - - var result = stats.Select(s => ConvertToDto(s, timeSpan)); - - return result; - } - - public async Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token) - { - var entities = dataSaubStats.Select(data => ConvertToEntity(data)); - db.Set().AddRange(entities); - return await db.SaveChangesAsync(token); - } - - private static DataSaubStatDto ConvertToDto(DataSaubStat entity, TimeSpan timeSpan) - { - var dto = entity.Adapt(); - dto.DateStart = dto.DateStart.ToOffset(timeSpan); - dto.DateEnd = dto.DateEnd.ToOffset(timeSpan); - - return dto; - } - - private static DataSaubStat ConvertToEntity(DataSaubStatDto dto) - { - var entity = dto.Adapt(); - entity.DateStart = dto.DateStart.ToUniversalTime(); - entity.DateEnd = dto.DateEnd.ToUniversalTime(); - - return entity; - } - - private IQueryable BuildQuery(TelemetryPartDeleteRequest request) - { - var query = db.Set() - .Where(o => o.IdTelemetry == request.IdTelemetry); - - if (request.LeDate is not null) - { - var leDate = request.LeDate.Value.ToUniversalTime(); - query = query.Where(o => o.DateStart <= leDate); - } - - if (request.GeDate is not null) - { - var geDate = request.GeDate.Value.ToUniversalTime(); - query = query.Where(o => o.DateEnd >= geDate); - } - - return query; - } - - public async Task DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token) - { - var query = BuildQuery(request); - db.Set().RemoveRange(query); - return await db.SaveChangesAsync(token); - } } diff --git a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs index e4ecf594..14be5340 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs @@ -3,7 +3,6 @@ using AsbCloudApp.Data.SAUB; using AsbCloudApp.Repositories; using AsbCloudApp.Requests; using AsbCloudApp.Services; -using AsbCloudInfrastructure.Services.SAUB; using System; using System.Collections.Generic; using System.Linq; @@ -15,14 +14,14 @@ namespace AsbCloudInfrastructure.Services; public class DataSaubStatDrillingQualityService : IDataSaubStatService { - private IDataSaubStatDrillingQualityRepository dataSaubStatDrillingQualityRepository; + private IDataSaubStatRepository dataSaubStatDrillingQualityRepository; private ITelemetryDataSaubService dataSaubService; private ITelemetryDataCache telemetryDataCache; public Dictionary> QualitySettingsForFeedRegulators { get; } public DataSaubStatDrillingQualityService( - IDataSaubStatDrillingQualityRepository dataSaubStatDrillingQualityRepository, + IDataSaubStatRepository dataSaubStatDrillingQualityRepository, ITelemetryDataCache telemetryDataCache, ITelemetryDataSaubService dataSaubService) { @@ -99,7 +98,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService result.AddRange(data); } - if(result.Any()) + if (result.Any()) return await dataSaubStatDrillingQualityRepository.InsertRangeAsync(result, token); return 0; @@ -115,7 +114,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService var indexStart = 0; var indexEnd = 0; - while (indexEnd < dataSaub.Count()) + while (indexEnd < dataSaub.Count() - 1) { indexStart = Array.FindIndex(dataSaub, indexEnd, t => t.IdFeedRegulator == idFeedRegulator); if (indexStart < 0) diff --git a/AsbCloudInfrastructure/Services/DataSaubStatService.cs b/AsbCloudInfrastructure/Services/DataSaubStatService.cs index 82ee0416..ab0492d3 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatService.cs @@ -16,13 +16,13 @@ namespace AsbCloudInfrastructure.Services; public class DataSaubStatService : IDataSaubStatService { - private IDataSaubStatRepository dataSaubStatRepository; + private IDataSaubStatRepository dataSaubStatRepository; private ITelemetryDataCache telemetryDataCache; private ITelemetryDataSaubService dataSaubService; private IDetectedOperationRepository detectedOperationRepository; public DataSaubStatService( - IDataSaubStatRepository dataSaubStatRepository, + IDataSaubStatRepository dataSaubStatRepository, ITelemetryDataCache telemetryDataCache, ITelemetryDataSaubService dataSaubService, IDetectedOperationRepository detectedOperationRepository) diff --git a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs index cae5bdce..ec166d5d 100644 --- a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs @@ -23,7 +23,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService private readonly IWellService wellService; private readonly IChangeLogRepository processMapPlanRotorRepository; private readonly IChangeLogRepository processMapPlanSlideRepository; - private readonly IDataSaubStatRepository dataSaubStatRepository; + private readonly IDataSaubStatRepository dataSaubStatRepository; private readonly IWellOperationRepository wellOperationRepository; private readonly IWellOperationCategoryRepository wellOperationCategoryRepository; private readonly IWellOperationService wellOperationService; @@ -31,7 +31,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService public ProcessMapReportDrillingService(IWellService wellService, IChangeLogRepository processMapPlanRotorRepository, IChangeLogRepository processMapPlanSlideRepository, - IDataSaubStatRepository dataSaubStatRepository, + IDataSaubStatRepository dataSaubStatRepository, IWellOperationRepository wellOperationRepository, IWellOperationCategoryRepository wellOperationCategoryRepository, IWellOperationService wellOperationService diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs index 442a68f6..27280426 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs @@ -1,3 +1,4 @@ +using AsbCloudApp.Data; using AsbCloudApp.Data.SAUB; using AsbCloudApp.Data.WITS; using AsbCloudApp.Repositories; @@ -35,7 +36,7 @@ public class TelemetryDataEditorService : ITelemetryDataEditorService public TelemetryDataEditorService( ITelemetryDataSaubService dataSaubService, ITelemetryDataService dataSpinService, - IDataSaubStatRepository dataSaubStatRepository, + IDataSaubStatRepository dataSaubStatRepository, IMessageRepository messageRepository, IDrillTestRepository drillTestRepository, ILimitingParameterRepository limitingParameterRepository, diff --git a/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs b/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs index e69cc692..6d946292 100644 --- a/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs +++ b/AsbCloudWebApi.IntegrationTests/Repository/DataSaubStatRepositoryTest.cs @@ -10,12 +10,12 @@ namespace AsbCloudWebApi.IntegrationTests.Repository; public class DataSaubStatRepositoryTest : BaseIntegrationTest { - private readonly IDataSaubStatRepository dataSaubStatRepository; + private readonly IDataSaubStatRepository dataSaubStatRepository; public DataSaubStatRepositoryTest(WebAppFactoryFixture factory) : base(factory) { - dataSaubStatRepository = scope.ServiceProvider.GetRequiredService(); + dataSaubStatRepository = scope.ServiceProvider.GetRequiredService>(); dbContext.CleanupDbSet(); } From f38a6ce26d8b442c22ea302948d9ae96dd810e4e Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 7 Oct 2024 15:48:25 +0500 Subject: [PATCH 07/22] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BD=D1=8B=D0=B9=20appsettings.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudWebApi/appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AsbCloudWebApi/appsettings.json b/AsbCloudWebApi/appsettings.json index 06cd312e..72d50f57 100644 --- a/AsbCloudWebApi/appsettings.json +++ b/AsbCloudWebApi/appsettings.json @@ -26,5 +26,5 @@ }, "DirectoryNameHelpPageFiles": "helpPages", "DirectoryManualFiles": "manuals", - "Urls": "http://0.0.0.0:5010" + "Urls": "http://0.0.0.0:5000" } From d3b1401b40ab559a5d86d837d896a5da6279717a Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 7 Oct 2024 16:09:50 +0500 Subject: [PATCH 08/22] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BB=D0=B8=D1=88=D0=BD=D0=B5=D0=B5=20=D1=81=D0=BB=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=20=D0=B2=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Repositories/IDataSaubStatRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs index e854e9ce..4b06a42b 100644 --- a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs +++ b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs @@ -24,7 +24,7 @@ public interface IDataSaubStatRepository : ITelemetryDataEditorService Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token); /// - /// Получение последних по дате окончания бурения записей качества в разрезе телеметрий + /// Получение последних по дате окончания бурения записей в разрезе телеметрий /// /// ключи телеметрий /// From 11d461f443e2a6a32f35c77b0822dd035eb25ea1 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 7 Oct 2024 16:10:32 +0500 Subject: [PATCH 09/22] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Repositories/IDataSaubStatRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs index 4b06a42b..edda1fab 100644 --- a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs +++ b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs @@ -32,7 +32,7 @@ public interface IDataSaubStatRepository : ITelemetryDataEditorService Task> GetLastsAsync(int[] idTelemetries, CancellationToken token); /// - /// Вставка записей статистики качества + /// Вставка записей /// /// /// From af8d26e47298752f9cf00c4938eaa8844cbf8f09 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 7 Oct 2024 16:12:29 +0500 Subject: [PATCH 10/22] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=208.?= =?UTF-8?q?0.4=20->8.0.8=20=D0=B2=20AsbCloudDbContextModelSnapshot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index f3ff78dd..0d687a1c 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ namespace AsbCloudDb.Migrations #pragma warning disable 612, 618 modelBuilder .UseCollation("Russian_Russia.1251") - .HasAnnotation("ProductVersion", "8.0.4") + .HasAnnotation("ProductVersion", "8.0.8") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack"); From 9708e8a27218d1aa905422c666e4c6174c39932c Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 7 Oct 2024 16:15:22 +0500 Subject: [PATCH 11/22] =?UTF-8?q?=D0=9A=D0=BE=D0=B4=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataSaubStatDrillingQualityRepository.cs | Bin 677 -> 1398 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs index f16c926200266a2cb4f945b27b8a3853450af40d..a7fb5d72dd854775cada3bbd804ee53dc10f33f5 100644 GIT binary patch literal 1398 zcmbtUO-sW-5S_!E1i_!M^wfg16)M&?jg96~iip;`q}Go@+Jt5!7V)pEZ#Ib<6Puze z+1>2Syfo|0mU@Ke~8f}mpsz=`m{?skW^bt=#EzO1ms)n zqAe_4FgNKO%rjW{sfF+@!MrdiA$EdS^mGKRdoX(7(pY2YY0N8VH|Yv<2xReFV_nhu z8-9yqD6$}r!L$I1XxJv&OuEMh?C>cMxy?PS10M4+D;n}4pRmnG+{LL4dDonGxX%|x z-iDRiLcB?KZ@}-tgDJ^Q@~v|oSn#sU!_e6HCf5pa`>>2K)Mwo$ zDefdibrIhjdSWA$zXXD3{xsq)%a)?v20RBoCwZ6p=u!mhkKXKW;N2XD3r~WyiZ3RU z3Rp6-nwD3*s3lo?L=Q>UH0l)~%2tY8)Gn`5QBS&AI(7k%vK}8$4ft{g1Dt7aK4Y$d zORE26k@V*Fn1bZvlY1ohV@>%RTE&p>vFttge_z#URCsmdCCJAwcjV`p^u>s-E8D5c z1qbn?!rCZHja96D&l0J*kt%hx=Xuc8Hj1!H{o?dC+vM5wGhc0&kiGw`KNk5qTP$Jz z^$Xc_w$8V(f%$Z`+I}w}baRe0wq&FYHviSUvRq<`;1sC9TEkA#(2+w228s*eG~Zb) zxJj#t;QEB?5jQrbrUJSb%Ct^$Ydr!ZeKbbk)~V()!sBPAxCtfo{EDm8lwg7tj$r5W zO(P_I85{O$8h+O+E{<}KLBj-#m{IBe32Xe`stf8W51NC+R|yW?p`4=ygNIrxsQ12d VHWRE_^C;_#DJ&SHVw<1|`UA85{>T6T From 1f2bf13a834893857025148e4689cafc9795730e Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 7 Oct 2024 16:17:00 +0500 Subject: [PATCH 12/22] =?UTF-8?q?=D0=9A=D0=BE=D0=B4=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20DataSaubS?= =?UTF-8?q?tatDrillingQualityRepository?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataSaubStatDrillingQualityRepository.cs | Bin 1398 -> 716 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs index a7fb5d72dd854775cada3bbd804ee53dc10f33f5..cf5ae36f451cb791282aac96e5dcd3d244b67277 100644 GIT binary patch literal 716 zcmaJw<6@M7I_&-L*+ww5e@z&+{rd7{H!nzlWnNC)W?d`QI;3#hF3JimRNgp_v>ib+Ie zN&;FQIEe2BkxJ-5X+hh!G)*K^iO4M5aU9&0I*N$M+@gXvSemJsnHN~Vx0%7(%;5{$ z@&mT8flpXjaAWJ0h2b53%xm6Vz|x{KGsk9{!wXm!qrb4ip|vxTMEfJDi24_GO4U^R zoCP@GL`s}HA6n+n5x9b#*gV{r(qMSxliEQ`MHU2KD sGw!MknuGn1^7iVuyhjTU?rKuFu6R literal 1398 zcmbtUO-sW-5S_!E1i_!M^wfg16)M&?jg96~iip;`q}Go@+Jt5!7V)pEZ#Ib<6Puze z+1>2Syfo|0mU@Ke~8f}mpsz=`m{?skW^bt=#EzO1ms)n zqAe_4FgNKO%rjW{sfF+@!MrdiA$EdS^mGKRdoX(7(pY2YY0N8VH|Yv<2xReFV_nhu z8-9yqD6$}r!L$I1XxJv&OuEMh?C>cMxy?PS10M4+D;n}4pRmnG+{LL4dDonGxX%|x z-iDRiLcB?KZ@}-tgDJ^Q@~v|oSn#sU!_e6HCf5pa`>>2K)Mwo$ zDefdibrIhjdSWA$zXXD3{xsq)%a)?v20RBoCwZ6p=u!mhkKXKW;N2XD3r~WyiZ3RU z3Rp6-nwD3*s3lo?L=Q>UH0l)~%2tY8)Gn`5QBS&AI(7k%vK}8$4ft{g1Dt7aK4Y$d zORE26k@V*Fn1bZvlY1ohV@>%RTE&p>vFttge_z#URCsmdCCJAwcjV`p^u>s-E8 Date: Tue, 8 Oct 2024 11:23:25 +0500 Subject: [PATCH 13/22] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0?= =?UTF-8?q?=D1=82=D0=B0=D0=BC=20PR=20+=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20backgroundWorker=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=81=D1=82=D0=B0=D1=80=D1=82=D0=B0=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=D0=B5=D1=80=D0=B2=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=20DataSaubStatDrillingQuality?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs | 15 +++ .../IDataSaubStatDrillingQualityService.cs | 23 ++++ .../IDataSaubStatService.cs | 2 +- .../PeriodicWorks/WorkDataSaubStat.cs | 15 +-- .../WorkDataSaubStatDrillingQuality.cs | 30 +++++ AsbCloudInfrastructure/DependencyInjection.cs | 20 ++-- .../DataSaubStatAbstractRepository.cs | 111 ----------------- .../DataSaubStatDrillingQualityRepository.cs | 21 ---- .../Repository/DataSaubStatRepository.cs | 113 ++++++++++++++++-- .../DataSaubStatDrillingQualityService.cs | 2 +- .../Services/DataSaubStatService.cs | 2 +- AsbCloudInfrastructure/Startup.cs | 1 + 12 files changed, 188 insertions(+), 167 deletions(-) create mode 100644 AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs rename AsbCloudApp/Services/{ => DataSaubStat}/IDataSaubStatService.cs (81%) create mode 100644 AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStatDrillingQuality.cs delete mode 100644 AsbCloudInfrastructure/Repository/DataSaubStatAbstractRepository.cs delete mode 100644 AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs diff --git a/AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs b/AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs index d82e40bb..74db0065 100644 --- a/AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs +++ b/AsbCloudApp/Data/SaubStat/IDataSaubStatDto.cs @@ -16,4 +16,19 @@ public interface IDataSaubStatDto /// Дата и время окончания /// public DateTimeOffset DateEnd { get; set; } + + /// + /// Глубина забоя по стволу начальная + /// + public double DepthStart { get; set; } + + /// + /// Глубина забоя по стволу конечная + /// + public double DepthEnd { get; set; } + + /// + /// Ключ телеметрии + /// + public int IdTelemetry { get; set; } } diff --git a/AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs b/AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs new file mode 100644 index 00000000..5db1ff71 --- /dev/null +++ b/AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs @@ -0,0 +1,23 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace AsbCloudApp.Services; + +/// +/// Сервис записи данных в таблицу t_data_saub_stat_drilling_quality, которая используется для построения РТК-отчета +/// +public interface IDataSaubStatDrillingQualityService +{ + /// + /// Расчет статистики DataSaubStat + /// + /// + /// Количество дней за которые должны были приходить данные, чтобы телеметрия попала в обработку. + /// + /// + /// + /// + Task CreateStatAsync(int lastDaysFilter, Action onProgressCallback, CancellationToken token); + +} diff --git a/AsbCloudApp/Services/IDataSaubStatService.cs b/AsbCloudApp/Services/DataSaubStat/IDataSaubStatService.cs similarity index 81% rename from AsbCloudApp/Services/IDataSaubStatService.cs rename to AsbCloudApp/Services/DataSaubStat/IDataSaubStatService.cs index 66088d31..4addcf88 100644 --- a/AsbCloudApp/Services/IDataSaubStatService.cs +++ b/AsbCloudApp/Services/DataSaubStat/IDataSaubStatService.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; namespace AsbCloudApp.Services; /// -/// Сервис записи данных в таблицу DataSaubStat, которая используется для построения РТК-отчета +/// Сервис записи данных в таблицу t_data_saub_stat, которая используется для построения РТК-отчета /// public interface IDataSaubStatService { diff --git a/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs b/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs index 444672ad..afafb7d6 100644 --- a/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs +++ b/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStat.cs @@ -1,22 +1,13 @@ -using AsbCloudApp.Data; -using AsbCloudApp.Data.DetectedOperation; -using AsbCloudApp.Data.SAUB; -using AsbCloudApp.Repositories; -using AsbCloudApp.Requests; using AsbCloudApp.Services; -using AsbCloudDb.Model; -using AsbCloudInfrastructure.Services.DetectOperations; using Microsoft.Extensions.DependencyInjection; using System; -using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; namespace AsbCloudInfrastructure.Background.PeriodicWorks; /// -/// задача по добавлению данных в таблицу DataSaubStat, которая используется для построения РТК-отчета +/// задача по добавлению данных в таблицу t_data_saub_stat, которая используется для построения РТК-отчета /// internal class WorkDataSaubStat : Work { @@ -31,8 +22,8 @@ internal class WorkDataSaubStat : Work { var dataSaubStatService = services.GetRequiredService(); - if (dataSaubStatService != null ) + if (dataSaubStatService != null) await dataSaubStatService.CreateStatAsync(Gap, onProgressCallback, token); - } + } } diff --git a/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStatDrillingQuality.cs b/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStatDrillingQuality.cs new file mode 100644 index 00000000..69b0ddd9 --- /dev/null +++ b/AsbCloudInfrastructure/Background/PeriodicWorks/WorkDataSaubStatDrillingQuality.cs @@ -0,0 +1,30 @@ +using AsbCloudApp.Services; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace AsbCloudInfrastructure.Background.PeriodicWorks; + +/// +/// задача по добавлению данных в таблицу t_data_saub_stat_drilling_quality, +/// которая используется для построения страницы "Качество" +/// +internal class WorkDataSaubStatDrillingQuality : Work +{ + private int Gap = 60; + + public WorkDataSaubStatDrillingQuality() : base("Generate DataSaubStatDrillingQuality entries and save them into Db") + { + Timeout = TimeSpan.FromMinutes(10); + } + + protected override async Task Action(string id, IServiceProvider services, Action onProgressCallback, CancellationToken token) + { + var dataSaubStatService = services.GetRequiredService(); + + if (dataSaubStatService != null) + await dataSaubStatService.CreateStatAsync(Gap, onProgressCallback, token); + + } +} diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 339f4736..03df1876 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -15,6 +15,7 @@ using AsbCloudApp.Services; using AsbCloudApp.Services.DailyReport; using AsbCloudApp.Services.Notifications; using AsbCloudApp.Services.ProcessMaps.WellDrilling; +using AsbCloudApp.Services.WellReport; using AsbCloudDb.Model; using AsbCloudDb.Model.DailyReports.Blocks.TimeBalance; using AsbCloudDb.Model.Manuals; @@ -41,14 +42,13 @@ using AsbCloudInfrastructure.Services.Trajectory.Parser; using AsbCloudInfrastructure.Services.WellOperations.Factories; using AsbCloudInfrastructure.Services.WellOperationService; using AsbCloudInfrastructure.Services.WellOperationService.WellOperationService; +using AsbCloudInfrastructure.Services.WellReport; using Mapster; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System; -using AsbCloudApp.Services.WellReport; -using AsbCloudInfrastructure.Services.WellReport; namespace AsbCloudInfrastructure; @@ -318,10 +318,10 @@ public static class DependencyInjection services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient, DataSaubStatRepository>(); - services.AddTransient, DataSaubStatDrillingQualityRepository>(); + services.AddTransient, DataSaubStatRepository>(); + services.AddTransient, DataSaubStatRepository>(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient< @@ -397,10 +397,10 @@ public static class DependencyInjection ProcessMapPlanBaseRepository>(); services.AddTransient< - IChangeLogRepository, - ProcessMapPlanBaseRepository>(); + IChangeLogRepository, + ProcessMapPlanBaseRepository>(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); @@ -475,7 +475,7 @@ public static class DependencyInjection services.AddTransient(); services.AddTransient, TrajectoryEditableRepository>(); services.AddTransient, TrajectoryEditableRepository>(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient, CrudCacheRepositoryBase(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatAbstractRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatAbstractRepository.cs deleted file mode 100644 index 74000e43..00000000 --- a/AsbCloudInfrastructure/Repository/DataSaubStatAbstractRepository.cs +++ /dev/null @@ -1,111 +0,0 @@ -using AsbCloudApp.Repositories; -using AsbCloudApp.Requests; -using AsbCloudApp.Services; -using AsbCloudDb.Model; -using Mapster; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace AsbCloudInfrastructure.Repository; -public class DataSaubStatAbstractRepository : IDataSaubStatRepository - where TDto : AsbCloudApp.Data.IDataSaubStatDto - where TEntity : class, AsbCloudDb.Model.IDataSaubStat -{ - private readonly IAsbCloudDbContext db; - private readonly ITelemetryService telemetryService; - - public DataSaubStatAbstractRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) - { - db = dbContext; - this.telemetryService = telemetryService; - } - - public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token) - { - var timeZoneOffsets = idTelemetries - .Distinct() - .ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours)); - - var stats = await db.Set() - .Where(s => idTelemetries.Contains(s.IdTelemetry)) - .GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First()) - .ToArrayAsync(token); - - var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry])); - - return result; - } - - public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token) - { - var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours); - var geDateUtc = geDate.ToUniversalTime(); - var leDateUtc = leDate.ToUniversalTime(); - - var stats = await db.Set() - .Where(s => s.IdTelemetry == idTelemetry) - .Where(s => s.DateStart >= geDateUtc) - .Where(s => s.DateEnd <= leDateUtc) - .ToArrayAsync(token); - - var result = stats.Select(s => ConvertToDto(s, timeSpan)); - - return result; - } - - public async Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token) - { - var entities = dataSaubStats.Select(data => ConvertToEntity(data)); - db.Set().AddRange(entities); - return await db.SaveChangesAsync(token); - } - - private static TDto ConvertToDto(TEntity entity, TimeSpan timeSpan) - { - var dto = entity.Adapt(); - dto.DateStart = dto.DateStart.ToOffset(timeSpan); - dto.DateEnd = dto.DateEnd.ToOffset(timeSpan); - - return dto; - } - - private static TEntity ConvertToEntity(TDto dto) - { - var entity = dto.Adapt(); - entity.DateStart = dto.DateStart.ToUniversalTime(); - entity.DateEnd = dto.DateEnd.ToUniversalTime(); - - return entity; - } - - private IQueryable BuildQuery(TelemetryPartDeleteRequest request) - { - var query = db.Set() - .Where(o => o.IdTelemetry == request.IdTelemetry); - - if (request.LeDate is not null) - { - var leDate = request.LeDate.Value.ToUniversalTime(); - query = query.Where(o => o.DateStart <= leDate); - } - - if (request.GeDate is not null) - { - var geDate = request.GeDate.Value.ToUniversalTime(); - query = query.Where(o => o.DateEnd >= geDate); - } - - return query; - } - - public async Task DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token) - { - var query = BuildQuery(request); - db.Set().RemoveRange(query); - return await db.SaveChangesAsync(token); - } -} diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs deleted file mode 100644 index cf5ae36f..00000000 --- a/AsbCloudInfrastructure/Repository/DataSaubStatDrillingQualityRepository.cs +++ /dev/null @@ -1,21 +0,0 @@ -using AsbCloudApp.Data; -using AsbCloudApp.Services; -using AsbCloudDb.Model; - -namespace AsbCloudInfrastructure.Repository; - -/// -/// Абстрактный репозиторий для работы с данными data_saub_stat -/// -public class DataSaubStatDrillingQualityRepository : DataSaubStatAbstractRepository -{ - /// - /// - /// - /// - /// - public DataSaubStatDrillingQualityRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) : base(dbContext, telemetryService) - { - - } -} diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs index dbfaa6bd..3a6c19e0 100644 --- a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs +++ b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs @@ -1,18 +1,111 @@ -using AsbCloudApp.Data; +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; using AsbCloudApp.Services; using AsbCloudDb.Model; +using Mapster; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; namespace AsbCloudInfrastructure.Repository; - -public class DataSaubStatRepository : DataSaubStatAbstractRepository +public class DataSaubStatRepository : IDataSaubStatRepository + where TDto : AsbCloudApp.Data.IDataSaubStatDto + where TEntity : class, AsbCloudDb.Model.IDataSaubStat { - /// - /// - /// - /// - /// - public DataSaubStatRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) : base(dbContext, telemetryService) - { + private readonly IAsbCloudDbContext db; + private readonly ITelemetryService telemetryService; + public DataSaubStatRepository(IAsbCloudDbContext dbContext, ITelemetryService telemetryService) + { + db = dbContext; + this.telemetryService = telemetryService; + } + + public async Task> GetLastsAsync(int[] idTelemetries, CancellationToken token) + { + var timeZoneOffsets = idTelemetries + .Distinct() + .ToDictionary(idTelemetry => idTelemetry, idTelemetry => TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours)); + + var stats = await db.Set() + .Where(s => idTelemetries.Contains(s.IdTelemetry)) + .GroupBy(s => s.IdTelemetry, (key, group) => group.OrderByDescending(el => el.DateEnd).First()) + .ToArrayAsync(token); + + var result = stats.Select(s => ConvertToDto(s, timeZoneOffsets[s.IdTelemetry])); + + return result; + } + + public async Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token) + { + var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours); + var geDateUtc = geDate.ToUniversalTime(); + var leDateUtc = leDate.ToUniversalTime(); + + var stats = await db.Set() + .Where(s => s.IdTelemetry == idTelemetry) + .Where(s => s.DateStart >= geDateUtc) + .Where(s => s.DateEnd <= leDateUtc) + .ToArrayAsync(token); + + var result = stats.Select(s => ConvertToDto(s, timeSpan)); + + return result; + } + + public async Task InsertRangeAsync(IEnumerable dataSaubStats, CancellationToken token) + { + var entities = dataSaubStats.Select(data => ConvertToEntity(data)); + db.Set().AddRange(entities); + return await db.SaveChangesAsync(token); + } + + private static TDto ConvertToDto(TEntity entity, TimeSpan timeSpan) + { + var dto = entity.Adapt(); + dto.DateStart = dto.DateStart.ToOffset(timeSpan); + dto.DateEnd = dto.DateEnd.ToOffset(timeSpan); + + return dto; + } + + private static TEntity ConvertToEntity(TDto dto) + { + var entity = dto.Adapt(); + entity.DateStart = dto.DateStart.ToUniversalTime(); + entity.DateEnd = dto.DateEnd.ToUniversalTime(); + + return entity; + } + + private IQueryable BuildQuery(TelemetryPartDeleteRequest request) + { + var query = db.Set() + .Where(o => o.IdTelemetry == request.IdTelemetry); + + if (request.LeDate is not null) + { + var leDate = request.LeDate.Value.ToUniversalTime(); + query = query.Where(o => o.DateStart <= leDate); + } + + if (request.GeDate is not null) + { + var geDate = request.GeDate.Value.ToUniversalTime(); + query = query.Where(o => o.DateEnd >= geDate); + } + + return query; + } + + public async Task DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token) + { + var query = BuildQuery(request); + db.Set().RemoveRange(query); + return await db.SaveChangesAsync(token); } } diff --git a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs index d5279a69..b51c69d6 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs @@ -12,7 +12,7 @@ using System.Threading.Tasks; namespace AsbCloudInfrastructure.Services; -public class DataSaubStatDrillingQualityService : IDataSaubStatService +public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualityService { private IDataSaubStatRepository dataSaubStatDrillingQualityRepository; private ITelemetryDataSaubService dataSaubService; diff --git a/AsbCloudInfrastructure/Services/DataSaubStatService.cs b/AsbCloudInfrastructure/Services/DataSaubStatService.cs index 84c51b56..db37758d 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatService.cs @@ -51,7 +51,7 @@ public class DataSaubStatService : IDataSaubStatService var idTelemetry = idTelemetries[i]; var lastDate = stats.FirstOrDefault(s => s.IdTelemetry == idTelemetry)?.DateEnd.ToUniversalTime() ?? DateTimeOffset.UnixEpoch; var statsCount = await CreateStatForTelemetryFromDate(idTelemetry, lastDate, token); - if(onProgressCallback != null) + if (onProgressCallback != null) onProgressCallback($"Calculate stat for telemetry: {idTelemetry}; from {lastDate}; results count: {statsCount};", 1d * i / idTelemetries.Length); } } diff --git a/AsbCloudInfrastructure/Startup.cs b/AsbCloudInfrastructure/Startup.cs index 83eba346..48ae8e26 100644 --- a/AsbCloudInfrastructure/Startup.cs +++ b/AsbCloudInfrastructure/Startup.cs @@ -33,6 +33,7 @@ public class Startup backgroundWorker.Add(TimeSpan.FromMinutes(30)); backgroundWorker.Add(TimeSpan.FromMinutes(0)); backgroundWorker.Add(TimeSpan.FromMinutes(0)); + backgroundWorker.Add(TimeSpan.FromMinutes(0)); backgroundWorker.Add(TimeSpan.FromMinutes(0)); backgroundWorker.Add(MakeMemoryMonitoringWork(), TimeSpan.FromMinutes(0)); From e2e861262809566f49d7a76b34050a6d01bc9054 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Tue, 8 Oct 2024 12:14:10 +0500 Subject: [PATCH 14/22] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20DataSaubStatDrillingQuality.=20=D0=9D=D0=B0=D1=87?= =?UTF-8?q?=D0=B0=D0=BB=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataSaubStatDtillingQualityServiceTest.cs | 269 ++++++++++++++++++ .../DataSaubStatServiceTest.cs | 2 +- 2 files changed, 270 insertions(+), 1 deletion(-) create mode 100644 AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs rename AsbCloudInfrastructure.Tests/Services/{ => DataSaubStat}/DataSaubStatServiceTest.cs (99%) diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs new file mode 100644 index 00000000..4a6b876b --- /dev/null +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs @@ -0,0 +1,269 @@ +using AsbCloudApp.Data; +using AsbCloudApp.Data.DetectedOperation; +using AsbCloudApp.Data.SAUB; +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; +using AsbCloudApp.Services; +using AsbCloudInfrastructure.Services; +using Mapster; +using NSubstitute; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace AsbCloudInfrastructure.Tests.Services; + +public class DataSaubStatDtillingQualityServiceTest +{ + private readonly int Gap = 5; + private readonly IDataSaubStatRepository dataSaubStatRepositoryMock = Substitute.For>(); + private readonly ITelemetryDataCache telemetryDataCacheMock = Substitute.For>(); + private readonly IDetectedOperationRepository detectedOperationRepositoryMock = Substitute.For(); + private readonly ITelemetryDataSaubService dataSaubServiceMock = Substitute.For(); + + private DataSaubStatDrillingQualityService dataSaubStatService; + + private int[] idTelemetries = [1]; + private IEnumerable dataSaubStatDrillingQualityDtos = new List() + { + new DataSaubStatDrillingQualityDto { + Id = 1, + DateEnd = DateTime.UtcNow, + DateStart = DateTime.UtcNow.AddHours(-1), + DepthEnd = 2, + DepthStart = 1, + IdFeedRegulator = 1, + IdTelemetry = 1 + }, + new DataSaubStatDrillingQualityDto { + Id = 2, + DateEnd = DateTime.UtcNow, + DateStart = DateTime.UtcNow.AddHours(-1), + DepthEnd = 3, + DepthStart = 2, + IdFeedRegulator = 2, + IdTelemetry = 2, + }, + new DataSaubStatDrillingQualityDto { + Id = 3, + DateEnd = DateTime.UtcNow, + DateStart = DateTime.UtcNow.AddHours(-1), + DepthEnd = 4, + DepthStart = 3, + IdFeedRegulator = 3, + IdTelemetry = 3, + }, + }; + + private List detectedOperationDtos = new List() { + new DetectedOperationDto { + Id = 1, + DateEnd = DateTimeOffset.UtcNow, + DateStart = DateTimeOffset.UtcNow.AddHours(-1), + DepthStart = 1, + DepthEnd = 2, + IdCategory = 5002, + IdTelemetry = 1, + Value = 1, + IdEditor = 1, + IdUserAtStart = 1 + } + }; + + private List telemetryDataSaubDtos = new List { + new TelemetryDataSaubDto() + { + IdTelemetry = 1, + DateTime = DateTime.UtcNow.AddMinutes(-30), + AxialLoad = 1, + AxialLoadLimitMax = 1, + AxialLoadSp = 1, + BitDepth = 1, + BlockPosition = 1, + BlockPositionMax = 1, + BlockPositionMin = 1, + BlockSpeed = 1, + BlockSpeedSp = 1, + BlockSpeedSpDevelop = 1, + BlockSpeedSpRotor = 1, + BlockSpeedSpSlide = 1, + Flow = 1, + FlowDeltaLimitMax = 1, + FlowIdle = 1, + HookWeight = 1, + HookWeightIdle = 1, + HookWeightLimitMax = 1, + HookWeightLimitMin = 1, + IdFeedRegulator = 1, + IdUser = 1, + Mode = 1, + Mse = 1, + MseState = 1, + Pressure = 1, + PressureDeltaLimitMax = 1, + PressureIdle = 1, + PressureSp = 1, + PressureSpDevelop = 1, + PressureSpRotor = 1, + PressureSpSlide = 1, + Pump0Flow = 1, + Pump1Flow = 1, + Pump2Flow = 1, + RotorSpeed = 1, + RotorTorque = 1, + RotorTorqueIdle = 1, + RotorTorqueSp = 1, + RotorTorqueLimitMax = 1, + WellDepth = 10, + } + }; + + public DataSaubStatDtillingQualityServiceTest() + { + telemetryDataCacheMock + .GetIds(Arg.Any()) + .Returns(idTelemetries); + + dataSaubStatRepositoryMock + .GetLastsAsync(Arg.Any(), Arg.Any()) + .Returns(dataSaubStatDrillingQualityDtos); + + var telemetrySaubDto = telemetryDataSaubDtos.FirstOrDefault(); + if (telemetrySaubDto != null) + { + var telemetrySaubDto1 = CreateTelemetryDataSaubItem(telemetrySaubDto, 1, 1); + telemetryDataSaubDtos.Add(telemetrySaubDto1); + + var telemetrySaubDto2 = telemetrySaubDto.Adapt(); + telemetrySaubDto2.WellDepth = 2; + telemetrySaubDto2.BitDepth = 2; + telemetrySaubDto2.IdFeedRegulator = 1; + telemetrySaubDto2.DateTime = telemetrySaubDto1.DateTime.AddMinutes(20); + telemetryDataSaubDtos.Add(telemetrySaubDto2); + + var telemetrySaubDto3 = telemetrySaubDto.Adapt(); + telemetrySaubDto3.WellDepth = 2; + telemetrySaubDto3.BitDepth = 2; + telemetrySaubDto3.IdFeedRegulator = 1; + telemetrySaubDto3.DateTime = telemetrySaubDto2.DateTime.AddMinutes(20); + telemetryDataSaubDtos.Add(telemetrySaubDto3); + + + } + + dataSaubServiceMock + .Get(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(telemetryDataSaubDtos); + + dataSaubStatService = new DataSaubStatDrillingQualityService( + dataSaubStatRepositoryMock, + telemetryDataCacheMock, + dataSaubServiceMock); + } + + private TelemetryDataSaubDto CreateTelemetryDataSaubItem( + TelemetryDataSaubDto telemetrySaubDto, + float wellDepth, + float bitDepth) + { + var telemetrySaubDto1 = telemetrySaubDto.Adapt(); + telemetrySaubDto1.WellDepth = wellDepth; + telemetrySaubDto1.BitDepth = bitDepth; + telemetrySaubDto1.IdFeedRegulator = 1; + telemetrySaubDto1.DateTime = DateTime.UtcNow.AddMinutes(20); + + return telemetrySaubDto1; + } + + [Fact] + public async Task Create_1DataSaubStatItems_ShouldReturn__Success() + { + var insertedDataSaubStatCount = 1; + + + + + dataSaubStatRepositoryMock + .InsertRangeAsync(Arg.Any>(), Arg.Any()) + .Returns(insertedDataSaubStatCount); + + Action action = (message, percent) => + { + //assert + Assert.NotNull(percent); + Assert.InRange(percent.Value, 0.0, 1.0); + }; + + //act + await dataSaubStatService.CreateStatAsync(Gap, action, CancellationToken.None); + + //assert + await dataSaubStatRepositoryMock.Received().InsertRangeAsync( + Arg.Is>(l => l.Count() == insertedDataSaubStatCount), + Arg.Any()); + } + + + + //[Fact] + //public async Task Create_2DataSaubStatItems_ShouldReturn__Success() + //{ + // var insertedDataSaubStatCount = 2; + + // var detectedOperationDto = detectedOperationDtos.FirstOrDefault(); + // if (detectedOperationDto != null) + // { + // var detectedOperationDto1 = detectedOperationDto.Adapt(); + // detectedOperationDto1.DateStart = DateTimeOffset.UtcNow.AddMinutes(1); + // detectedOperationDto1.DateEnd = DateTimeOffset.UtcNow.AddHours(1); + + // detectedOperationDtos.Add(detectedOperationDto1); + // } + + // var telemetryDataSaubDto = telemetryDataSaubDtos.LastOrDefault(); + // if (telemetryDataSaubDto != null) + // { + // var telemetryDataSaubDto1 = telemetryDataSaubDto.Adapt(); + // telemetryDataSaubDto1.DateTime = DateTime.UtcNow.AddMinutes(10); + // telemetryDataSaubDto1.WellDepth = telemetryDataSaubDto.WellDepth + 1; + + // var telemetryDataSaubDto2 = telemetryDataSaubDto.Adapt(); + // telemetryDataSaubDto2.DateTime = DateTime.UtcNow.AddMinutes(20); + // telemetryDataSaubDto2.WellDepth = telemetryDataSaubDto1.WellDepth + 1; + + // var telemetryDataSaubDto3 = telemetryDataSaubDto.Adapt(); + // telemetryDataSaubDto3.DateTime = DateTime.UtcNow.AddMinutes(30); + // telemetryDataSaubDto3.WellDepth = telemetryDataSaubDto2.WellDepth + 1; + + // telemetryDataSaubDtos.Add(telemetryDataSaubDto1); + // telemetryDataSaubDtos.Add(telemetryDataSaubDto2); + // telemetryDataSaubDtos.Add(telemetryDataSaubDto3); + // } + + // detectedOperationRepositoryMock + // .Get(Arg.Any(), Arg.Any()) + // .Returns(detectedOperationDtos); + + // dataSaubStatRepositoryMock + // .InsertRangeAsync(Arg.Any>(), Arg.Any()) + // .Returns(insertedDataSaubStatCount); + + // Action action = (message, percent) => + // { + // //assert + // Assert.NotNull(percent); + // Assert.InRange(percent.Value, 0.0, 1.0); + // }; + + // //act + // await dataSaubStatService.CreateStatAsync(Gap, action, CancellationToken.None); + + // //assert + // await dataSaubStatRepositoryMock.Received().InsertRangeAsync( + // Arg.Is>(l => l.Count() == insertedDataSaubStatCount), + // Arg.Any()); + //} +} \ No newline at end of file diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatServiceTest.cs similarity index 99% rename from AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs rename to AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatServiceTest.cs index 2c7cf7ce..3842026e 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatServiceTest.cs @@ -14,7 +14,7 @@ using System.Threading; using System.Threading.Tasks; using Xunit; -namespace AsbCloudInfrastructure.Tests.Services; +namespace AsbCloudInfrastructure.Tests.Services.DataSaubStat; public class DataSaubStatServiceTest { From 7872e068ba3d419cdbd52e5fb6308c15e06a0b5f Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Wed, 9 Oct 2024 10:07:50 +0500 Subject: [PATCH 15/22] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D1=82=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D1=8B=20(=D0=BF=D1=80=D0=BE=D0=B4=D0=BE=D0=BB?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5)=20+=20=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B1=D1=8D=D0=BA=D0=B0=20=D0=BF=D0=BE=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82=D0=B0=D0=BC=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataSaubStatDtillingQualityServiceTest.cs | 109 +++++++++++++----- .../DataSaubStatDrillingQualityService.cs | 12 +- 2 files changed, 88 insertions(+), 33 deletions(-) diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs index 4a6b876b..ed2b07d0 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs @@ -58,27 +58,13 @@ public class DataSaubStatDtillingQualityServiceTest }, }; - private List detectedOperationDtos = new List() { - new DetectedOperationDto { - Id = 1, - DateEnd = DateTimeOffset.UtcNow, - DateStart = DateTimeOffset.UtcNow.AddHours(-1), - DepthStart = 1, - DepthEnd = 2, - IdCategory = 5002, - IdTelemetry = 1, - Value = 1, - IdEditor = 1, - IdUserAtStart = 1 - } - }; private List telemetryDataSaubDtos = new List { new TelemetryDataSaubDto() { IdTelemetry = 1, DateTime = DateTime.UtcNow.AddMinutes(-30), - AxialLoad = 1, + AxialLoad = 800, AxialLoadLimitMax = 1, AxialLoadSp = 1, BitDepth = 1, @@ -117,7 +103,7 @@ public class DataSaubStatDtillingQualityServiceTest RotorTorqueIdle = 1, RotorTorqueSp = 1, RotorTorqueLimitMax = 1, - WellDepth = 10, + WellDepth = 800, } }; @@ -134,24 +120,81 @@ public class DataSaubStatDtillingQualityServiceTest var telemetrySaubDto = telemetryDataSaubDtos.FirstOrDefault(); if (telemetrySaubDto != null) { - var telemetrySaubDto1 = CreateTelemetryDataSaubItem(telemetrySaubDto, 1, 1); + //idFeedRegulator depthWell + //1 800 + //1 900 + //1 1000 + //1 900 + //1 1200 + //1 1300 + //1 1100 + //1 1500 + //2 1600 + // idFeedRegulator: + // depthWell = (1000 - 800) + (1300 - 900) + (1600 - 1100) = + var telemetrySaubDto1 = CreateTelemetryDataSaubItem( + telemetrySaubDto, + wellDepth: 900, + bitDepth: 900, + idFeedRegulator: 1, + dateTime: DateTime.UtcNow.AddMinutes(20)); telemetryDataSaubDtos.Add(telemetrySaubDto1); - var telemetrySaubDto2 = telemetrySaubDto.Adapt(); - telemetrySaubDto2.WellDepth = 2; - telemetrySaubDto2.BitDepth = 2; - telemetrySaubDto2.IdFeedRegulator = 1; - telemetrySaubDto2.DateTime = telemetrySaubDto1.DateTime.AddMinutes(20); + var telemetrySaubDto2 = CreateTelemetryDataSaubItem( + telemetrySaubDto, + wellDepth: 1000, + bitDepth: 1000, + idFeedRegulator: 1, + dateTime: DateTime.UtcNow.AddMinutes(20)); telemetryDataSaubDtos.Add(telemetrySaubDto2); - var telemetrySaubDto3 = telemetrySaubDto.Adapt(); - telemetrySaubDto3.WellDepth = 2; - telemetrySaubDto3.BitDepth = 2; - telemetrySaubDto3.IdFeedRegulator = 1; - telemetrySaubDto3.DateTime = telemetrySaubDto2.DateTime.AddMinutes(20); + var telemetrySaubDto3 = CreateTelemetryDataSaubItem( + telemetrySaubDto, + wellDepth: 900, + bitDepth: 900, + idFeedRegulator: 1, + dateTime: DateTime.UtcNow.AddMinutes(20)); telemetryDataSaubDtos.Add(telemetrySaubDto3); - + var telemetrySaubDto4 = CreateTelemetryDataSaubItem( + telemetrySaubDto, + wellDepth: 1200, + bitDepth: 1200, + idFeedRegulator: 1, + dateTime: DateTime.UtcNow.AddMinutes(20)); + telemetryDataSaubDtos.Add(telemetrySaubDto4); + + var telemetrySaubDto5 = CreateTelemetryDataSaubItem( + telemetrySaubDto, + wellDepth: 1300, + bitDepth: 1300, + idFeedRegulator: 1, + dateTime: DateTime.UtcNow.AddMinutes(20)); + telemetryDataSaubDtos.Add(telemetrySaubDto5); + + var telemetrySaubDto6 = CreateTelemetryDataSaubItem( + telemetrySaubDto, + wellDepth: 1100, + bitDepth: 1100, + idFeedRegulator: 1, + dateTime: DateTime.UtcNow.AddMinutes(20)); + telemetryDataSaubDtos.Add(telemetrySaubDto6); + + var telemetrySaubDto7 = CreateTelemetryDataSaubItem( + telemetrySaubDto, + wellDepth: 1500, + bitDepth: 1500, + idFeedRegulator: 1, + dateTime: DateTime.UtcNow.AddMinutes(20)); + telemetryDataSaubDtos.Add(telemetrySaubDto7); + + var telemetrySaubDto8 = CreateTelemetryDataSaubItem( + telemetrySaubDto, + wellDepth: 1600, + bitDepth: 1600, + idFeedRegulator: 2, + dateTime: DateTime.UtcNow.AddMinutes(20)); + telemetryDataSaubDtos.Add(telemetrySaubDto8); } dataSaubServiceMock @@ -167,13 +210,15 @@ public class DataSaubStatDtillingQualityServiceTest private TelemetryDataSaubDto CreateTelemetryDataSaubItem( TelemetryDataSaubDto telemetrySaubDto, float wellDepth, - float bitDepth) + float bitDepth, + short idFeedRegulator, + DateTime dateTime) { var telemetrySaubDto1 = telemetrySaubDto.Adapt(); telemetrySaubDto1.WellDepth = wellDepth; telemetrySaubDto1.BitDepth = bitDepth; - telemetrySaubDto1.IdFeedRegulator = 1; - telemetrySaubDto1.DateTime = DateTime.UtcNow.AddMinutes(20); + telemetrySaubDto1.IdFeedRegulator = idFeedRegulator; + telemetrySaubDto1.DateTime = dateTime; return telemetrySaubDto1; } @@ -181,7 +226,7 @@ public class DataSaubStatDtillingQualityServiceTest [Fact] public async Task Create_1DataSaubStatItems_ShouldReturn__Success() { - var insertedDataSaubStatCount = 1; + var insertedDataSaubStatCount = 2; diff --git a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs index b51c69d6..41c4adee 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs @@ -120,7 +120,17 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe if (indexStart < 0) break; - indexEnd = Array.FindIndex(dataSaub, indexStart, t => t.IdFeedRegulator != idFeedRegulator); + indexEnd = indexStart + 1; + for (var i = indexStart + 1; i < dataSaub.Count(); i++) + { + if (dataSaub[i].WellDepth >= dataSaub[i - 1].WellDepth) + indexEnd = i; + else if (dataSaub[i].IdFeedRegulator != idFeedRegulator) + break; + else + break; + + } if (indexEnd < 0) indexEnd = dataSaub.Length - 1; From 0ef3b5a30d646138bdd1043021337962235a03e1 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Wed, 9 Oct 2024 13:31:36 +0500 Subject: [PATCH 16/22] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D1=82=D0=B5?= =?UTF-8?q?=D1=81=D1=82=201=20=D0=B8=20=D1=80=D0=B5=D1=84=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3,=20=D0=BD=D1=83=D0=B6?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D0=B4=D0=BB=D1=8F=20=D0=B0=D0=B2=D1=82?= =?UTF-8?q?=D0=BE=D1=82=D0=B5=D1=81=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IDataSaubStatDrillingQualityService.cs | 16 +++- .../DataSaubStatDtillingQualityServiceTest.cs | 83 ++++++++----------- .../DataSaubStatDrillingQualityService.cs | 60 ++++++++------ 3 files changed, 81 insertions(+), 78 deletions(-) diff --git a/AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs b/AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs index 5db1ff71..8adbfc39 100644 --- a/AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs +++ b/AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs @@ -1,4 +1,6 @@ +using AsbCloudApp.Data; using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -10,7 +12,7 @@ namespace AsbCloudApp.Services; public interface IDataSaubStatDrillingQualityService { /// - /// Расчет статистики DataSaubStat + /// Расчет статистики DataSaubStatDrillingQuality и сохранение её в бд /// /// /// Количество дней за которые должны были приходить данные, чтобы телеметрия попала в обработку. @@ -20,4 +22,16 @@ public interface IDataSaubStatDrillingQualityService /// Task CreateStatAsync(int lastDaysFilter, Action onProgressCallback, CancellationToken token); + /// + /// Расчет статистики DataSaubStatDrillingQuality + /// + /// + /// + /// + /// + Task> CreateStatDrillingQualityForTelemetry( + int idTelemetry, + DateTimeOffset geDate, + CancellationToken token); + } diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs index ed2b07d0..17700f54 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs @@ -117,6 +117,31 @@ public class DataSaubStatDtillingQualityServiceTest .GetLastsAsync(Arg.Any(), Arg.Any()) .Returns(dataSaubStatDrillingQualityDtos); + dataSaubStatService = new DataSaubStatDrillingQualityService( + dataSaubStatRepositoryMock, + telemetryDataCacheMock, + dataSaubServiceMock); + } + + private TelemetryDataSaubDto CreateTelemetryDataSaubItem( + TelemetryDataSaubDto telemetrySaubDto, + float wellDepth, + float bitDepth, + short idFeedRegulator, + DateTime dateTime) + { + var telemetrySaubDto1 = telemetrySaubDto.Adapt(); + telemetrySaubDto1.WellDepth = wellDepth; + telemetrySaubDto1.BitDepth = bitDepth; + telemetrySaubDto1.IdFeedRegulator = idFeedRegulator; + telemetrySaubDto1.DateTime = dateTime; + + return telemetrySaubDto1; + } + + [Fact] + public async Task Create_1DataSaubStatItems_ShouldReturn__Success() + { var telemetrySaubDto = telemetryDataSaubDtos.FirstOrDefault(); if (telemetrySaubDto != null) { @@ -131,7 +156,8 @@ public class DataSaubStatDtillingQualityServiceTest //1 1500 //2 1600 // idFeedRegulator: - // depthWell = (1000 - 800) + (1300 - 900) + (1600 - 1100) = + // = 3 + // = (1000 - 800) + (1300 - 900) + (1600 - 1100) = 1100 var telemetrySaubDto1 = CreateTelemetryDataSaubItem( telemetrySaubDto, wellDepth: 900, @@ -141,10 +167,10 @@ public class DataSaubStatDtillingQualityServiceTest telemetryDataSaubDtos.Add(telemetrySaubDto1); var telemetrySaubDto2 = CreateTelemetryDataSaubItem( - telemetrySaubDto, - wellDepth: 1000, - bitDepth: 1000, - idFeedRegulator: 1, + telemetrySaubDto, + wellDepth: 1000, + bitDepth: 1000, + idFeedRegulator: 1, dateTime: DateTime.UtcNow.AddMinutes(20)); telemetryDataSaubDtos.Add(telemetrySaubDto2); @@ -201,54 +227,11 @@ public class DataSaubStatDtillingQualityServiceTest .Get(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) .Returns(telemetryDataSaubDtos); - dataSaubStatService = new DataSaubStatDrillingQualityService( - dataSaubStatRepositoryMock, - telemetryDataCacheMock, - dataSaubServiceMock); - } - - private TelemetryDataSaubDto CreateTelemetryDataSaubItem( - TelemetryDataSaubDto telemetrySaubDto, - float wellDepth, - float bitDepth, - short idFeedRegulator, - DateTime dateTime) - { - var telemetrySaubDto1 = telemetrySaubDto.Adapt(); - telemetrySaubDto1.WellDepth = wellDepth; - telemetrySaubDto1.BitDepth = bitDepth; - telemetrySaubDto1.IdFeedRegulator = idFeedRegulator; - telemetrySaubDto1.DateTime = dateTime; - - return telemetrySaubDto1; - } - - [Fact] - public async Task Create_1DataSaubStatItems_ShouldReturn__Success() - { - var insertedDataSaubStatCount = 2; - - - - - dataSaubStatRepositoryMock - .InsertRangeAsync(Arg.Any>(), Arg.Any()) - .Returns(insertedDataSaubStatCount); - - Action action = (message, percent) => - { - //assert - Assert.NotNull(percent); - Assert.InRange(percent.Value, 0.0, 1.0); - }; - //act - await dataSaubStatService.CreateStatAsync(Gap, action, CancellationToken.None); + var result = await dataSaubStatService.CreateStatDrillingQualityForTelemetry(1, DateTimeOffset.UnixEpoch, CancellationToken.None); //assert - await dataSaubStatRepositoryMock.Received().InsertRangeAsync( - Arg.Is>(l => l.Count() == insertedDataSaubStatCount), - Arg.Any()); + Assert.Equal(3, result.Count()); } diff --git a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs index 41c4adee..a058a9c4 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs @@ -70,38 +70,40 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe { var idTelemetry = idTelemetries[i]; var lastDate = stats.FirstOrDefault(s => s.IdTelemetry == idTelemetry)?.DateEnd.ToUniversalTime() ?? DateTimeOffset.UnixEpoch; - var statsCount = await CreateStatDrillingQualityForTelemetry(idTelemetry, lastDate, token); + var result = await CreateStatDrillingQualityForTelemetry(idTelemetry, lastDate, token); + + var statsCount = result.Count(); + if (result.Any()) + statsCount = await dataSaubStatDrillingQualityRepository.InsertRangeAsync(result, token); + if (onProgressCallback != null) onProgressCallback($"Calculate stat for telemetry: {idTelemetry}; from {lastDate}; results count: {statsCount};", 1d * i / idTelemetries.Length); } } - private async Task CreateStatDrillingQualityForTelemetry( + public async Task> CreateStatDrillingQualityForTelemetry( int idTelemetry, DateTimeOffset geDate, CancellationToken token) { var leDate = DateTimeOffset.UtcNow; + var result = new List(); var dataSaub = await dataSaubService.Get(idTelemetry, true, geDate, leDate, 100_000, token); if (!dataSaub.Any()) - return 0; + return result; if (dataSaub is not TelemetryDataSaubDto[] dataSaubArray) dataSaubArray = dataSaub.ToArray(); - - var result = new List(); + foreach (var item in QualitySettingsForFeedRegulators) { var data = CreateDataSaubStatDrillingQuality(item.Key, item.Value, dataSaubArray); result.AddRange(data); } - if (result.Any()) - return await dataSaubStatDrillingQualityRepository.InsertRangeAsync(result, token); - - return 0; + return result; } private static IEnumerable CreateDataSaubStatDrillingQuality( @@ -120,29 +122,16 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe if (indexStart < 0) break; - indexEnd = indexStart + 1; - for (var i = indexStart + 1; i < dataSaub.Count(); i++) - { - if (dataSaub[i].WellDepth >= dataSaub[i - 1].WellDepth) - indexEnd = i; - else if (dataSaub[i].IdFeedRegulator != idFeedRegulator) - break; - else - break; - - } - - if (indexEnd < 0) - indexEnd = dataSaub.Length - 1; - - if (indexEnd == indexStart) - continue; + indexEnd = FindIndexEnd(indexStart, idFeedRegulator, dataSaub); var length = indexEnd - indexStart + 1; + if (length <= 2) + continue; + var subset = dataSaub.AsSpan(indexStart, length); - if (length <= 2 || (subset[^1].WellDepth - subset[0].WellDepth) < 0.15) + if ((subset[^1].WellDepth - subset[0].WellDepth) < 0.15) continue; // мелкие выборки не учитываем. @@ -153,6 +142,23 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe return result; } + private static int FindIndexEnd(int indexStart, int idFeedRegulator, TelemetryDataSaubDto[] dataSaub) + { + var indexEnd = indexStart + 1; + for (var i = indexStart + 1; i < dataSaub.Count(); i++) + { + if (dataSaub[i].WellDepth >= dataSaub[i - 1].WellDepth) + { + indexEnd = i; + } + else if (dataSaub[i].IdFeedRegulator != idFeedRegulator) + break; + else + break; + } + return indexEnd; + } + private static DataSaubStatDrillingQualityDto CalcStatsDrillingQuality( int idFeedRegulator, Span dataSaub, From 00d489a849ae415281f32ea25cd1c2a81ecc249d Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Thu, 10 Oct 2024 15:29:27 +0500 Subject: [PATCH 17/22] CsvSerializer --- .../AsbCloudInfrastructure.Tests.csproj | 1 + .../DataSaubStatDtillingQualityServiceTest.cs | 210 +++++++++++------- .../DataSaubStat/TelemetryDataSaubMap.cs | 60 +++++ .../Services/DataSaubStat/test.csv | 12 + .../Services/SAUB/CsvSerializer.cs | 2 + 5 files changed, 205 insertions(+), 80 deletions(-) create mode 100644 AsbCloudInfrastructure.Tests/Services/DataSaubStat/TelemetryDataSaubMap.cs create mode 100644 AsbCloudInfrastructure.Tests/Services/DataSaubStat/test.csv diff --git a/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj b/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj index 9d052820..a9cf66be 100644 --- a/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj +++ b/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj @@ -17,6 +17,7 @@ + diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs index 17700f54..99818138 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs @@ -4,11 +4,17 @@ using AsbCloudApp.Data.SAUB; using AsbCloudApp.Repositories; using AsbCloudApp.Requests; using AsbCloudApp.Services; +using AsbCloudDb.Model; using AsbCloudInfrastructure.Services; +using AsbCloudInfrastructure.Services.SAUB; +using CsvHelper; using Mapster; using NSubstitute; using System; using System.Collections.Generic; +using System.Formats.Asn1; +using System.Globalization; +using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -18,6 +24,7 @@ namespace AsbCloudInfrastructure.Tests.Services; public class DataSaubStatDtillingQualityServiceTest { + private const string UsingTemplateFile = "AsbCloudInfrastructure/Tests/Services/DataSaubStat"; private readonly int Gap = 5; private readonly IDataSaubStatRepository dataSaubStatRepositoryMock = Substitute.For>(); private readonly ITelemetryDataCache telemetryDataCacheMock = Substitute.For>(); @@ -142,96 +149,132 @@ public class DataSaubStatDtillingQualityServiceTest [Fact] public async Task Create_1DataSaubStatItems_ShouldReturn__Success() { - var telemetrySaubDto = telemetryDataSaubDtos.FirstOrDefault(); - if (telemetrySaubDto != null) + var telemetryDataSaubDtos2 = new List(); + string fileName = @"C:\Users\admin\source\repos\AsbCloudServer\AsbCloudInfrastructure.Tests\Services\DataSaubStat\test.csv"; + using (var reader = new StreamReader(fileName)) + using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) { - //idFeedRegulator depthWell - //1 800 - //1 900 - //1 1000 - //1 900 - //1 1200 - //1 1300 - //1 1100 - //1 1500 - //2 1600 - // idFeedRegulator: - // = 3 - // = (1000 - 800) + (1300 - 900) + (1600 - 1100) = 1100 - var telemetrySaubDto1 = CreateTelemetryDataSaubItem( - telemetrySaubDto, - wellDepth: 900, - bitDepth: 900, - idFeedRegulator: 1, - dateTime: DateTime.UtcNow.AddMinutes(20)); - telemetryDataSaubDtos.Add(telemetrySaubDto1); + try + { + csv.Context.RegisterClassMap(); + var records = csv.GetRecords().ToList(); - var telemetrySaubDto2 = CreateTelemetryDataSaubItem( - telemetrySaubDto, - wellDepth: 1000, - bitDepth: 1000, - idFeedRegulator: 1, - dateTime: DateTime.UtcNow.AddMinutes(20)); - telemetryDataSaubDtos.Add(telemetrySaubDto2); - var telemetrySaubDto3 = CreateTelemetryDataSaubItem( - telemetrySaubDto, - wellDepth: 900, - bitDepth: 900, - idFeedRegulator: 1, - dateTime: DateTime.UtcNow.AddMinutes(20)); - telemetryDataSaubDtos.Add(telemetrySaubDto3); - var telemetrySaubDto4 = CreateTelemetryDataSaubItem( - telemetrySaubDto, - wellDepth: 1200, - bitDepth: 1200, - idFeedRegulator: 1, - dateTime: DateTime.UtcNow.AddMinutes(20)); - telemetryDataSaubDtos.Add(telemetrySaubDto4); + dataSaubServiceMock + .Get(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(records); - var telemetrySaubDto5 = CreateTelemetryDataSaubItem( - telemetrySaubDto, - wellDepth: 1300, - bitDepth: 1300, - idFeedRegulator: 1, - dateTime: DateTime.UtcNow.AddMinutes(20)); - telemetryDataSaubDtos.Add(telemetrySaubDto5); + //act + var result = await dataSaubStatService.CreateStatDrillingQualityForTelemetry(1, DateTimeOffset.UnixEpoch, CancellationToken.None); - var telemetrySaubDto6 = CreateTelemetryDataSaubItem( - telemetrySaubDto, - wellDepth: 1100, - bitDepth: 1100, - idFeedRegulator: 1, - dateTime: DateTime.UtcNow.AddMinutes(20)); - telemetryDataSaubDtos.Add(telemetrySaubDto6); - - var telemetrySaubDto7 = CreateTelemetryDataSaubItem( - telemetrySaubDto, - wellDepth: 1500, - bitDepth: 1500, - idFeedRegulator: 1, - dateTime: DateTime.UtcNow.AddMinutes(20)); - telemetryDataSaubDtos.Add(telemetrySaubDto7); - - var telemetrySaubDto8 = CreateTelemetryDataSaubItem( - telemetrySaubDto, - wellDepth: 1600, - bitDepth: 1600, - idFeedRegulator: 2, - dateTime: DateTime.UtcNow.AddMinutes(20)); - telemetryDataSaubDtos.Add(telemetrySaubDto8); + //assert + Assert.Equal(3, result.Count()); + } + catch (Exception ex) + { + ; + } } - dataSaubServiceMock - .Get(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(telemetryDataSaubDtos); + //var telemetrySaubDto = telemetryDataSaubDtos.FirstOrDefault(); + //if (telemetrySaubDto != null) + //{ + // //idFeedRegulator depthWell + // //1 800 + // //1 900 + // //1 1000 + // //1 900 + // //1 1200 + // //1 1300 + // //1 1100 + // //1 1500 + // //2 1600 + // // idFeedRegulator: + // // = 3 + // // = (1000 - 800) + (1300 - 900) + (1600 - 1100) = 1100 + // var telemetrySaubDto1 = CreateTelemetryDataSaubItem( + // telemetrySaubDto, + // wellDepth: 900, + // bitDepth: 900, + // idFeedRegulator: 1, + // dateTime: DateTime.UtcNow.AddMinutes(20)); + // telemetryDataSaubDtos.Add(telemetrySaubDto1); - //act - var result = await dataSaubStatService.CreateStatDrillingQualityForTelemetry(1, DateTimeOffset.UnixEpoch, CancellationToken.None); + // var telemetrySaubDto2 = CreateTelemetryDataSaubItem( + // telemetrySaubDto, + // wellDepth: 1000, + // bitDepth: 1000, + // idFeedRegulator: 1, + // dateTime: DateTime.UtcNow.AddMinutes(20)); + // telemetryDataSaubDtos.Add(telemetrySaubDto2); - //assert - Assert.Equal(3, result.Count()); + // var telemetrySaubDto3 = CreateTelemetryDataSaubItem( + // telemetrySaubDto, + // wellDepth: 900, + // bitDepth: 900, + // idFeedRegulator: 1, + // dateTime: DateTime.UtcNow.AddMinutes(20)); + // telemetryDataSaubDtos.Add(telemetrySaubDto3); + + // var telemetrySaubDto4 = CreateTelemetryDataSaubItem( + // telemetrySaubDto, + // wellDepth: 1200, + // bitDepth: 1200, + // idFeedRegulator: 1, + // dateTime: DateTime.UtcNow.AddMinutes(20)); + // telemetryDataSaubDtos.Add(telemetrySaubDto4); + + // var telemetrySaubDto5 = CreateTelemetryDataSaubItem( + // telemetrySaubDto, + // wellDepth: 1300, + // bitDepth: 1300, + // idFeedRegulator: 1, + // dateTime: DateTime.UtcNow.AddMinutes(20)); + // telemetryDataSaubDtos.Add(telemetrySaubDto5); + + // var telemetrySaubDto6 = CreateTelemetryDataSaubItem( + // telemetrySaubDto, + // wellDepth: 1100, + // bitDepth: 1100, + // idFeedRegulator: 1, + // dateTime: DateTime.UtcNow.AddMinutes(20)); + // telemetryDataSaubDtos.Add(telemetrySaubDto6); + + // var telemetrySaubDto7 = CreateTelemetryDataSaubItem( + // telemetrySaubDto, + // wellDepth: 1500, + // bitDepth: 1500, + // idFeedRegulator: 1, + // dateTime: DateTime.UtcNow.AddMinutes(20)); + // telemetryDataSaubDtos.Add(telemetrySaubDto7); + + // var telemetrySaubDto8 = CreateTelemetryDataSaubItem( + // telemetrySaubDto, + // wellDepth: 1600, + // bitDepth: 1600, + // idFeedRegulator: 2, + // dateTime: DateTime.UtcNow.AddMinutes(20)); + // telemetryDataSaubDtos.Add(telemetrySaubDto8); + //} + + + } + + private TelemetryDataSaubDto Convert(TelemetryDataSaub src, double timezoneOffset) + { + var mapper = MapsterForUnitTests.GetMapper(); + + var res = new TelemetryDataSaubDto(); + var dto = mapper.Map(src, res); + //var telemetryUser = telemetryUserService.GetOrDefault(src.IdTelemetry, src.IdUser ?? int.MinValue); + dto.User = "dfsdf"; + //telemetryUser?.MakeDisplayName(); + dto.DateTime = src.DateTime.ToRemoteDateTime(timezoneOffset); + dto.BitDepth = src.BitDepth <= src.WellDepth + ? src.BitDepth + : src.WellDepth; + return dto; } @@ -294,4 +337,11 @@ public class DataSaubStatDtillingQualityServiceTest // Arg.Is>(l => l.Count() == insertedDataSaubStatCount), // Arg.Any()); //} +} + +internal class TestDto +{ + public int Id { get; set; } + public string Name { get; set; } + public int Age { get; set; } } \ No newline at end of file diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/TelemetryDataSaubMap.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/TelemetryDataSaubMap.cs new file mode 100644 index 00000000..aa23cf94 --- /dev/null +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/TelemetryDataSaubMap.cs @@ -0,0 +1,60 @@ +using AsbCloudApp.Data.SAUB; +using CsvHelper.Configuration; +using AsbCloudInfrastructure.Services; +using CsvHelper.Configuration.Attributes; +using Mapster; +using Microsoft.EntityFrameworkCore; +using System; +using System.Text.Json.Serialization; + +namespace AsbCloudDb.Model +{ + public class TelemetryDataSaubMap : ClassMap + { + public TelemetryDataSaubMap() + { + Map(m => m.AxialLoad).Name("axial_load"); + Map(m => m.AxialLoadLimitMax).Name("axial_load_limit_max"); + Map(m => m.AxialLoadSp).Name("axial_load_sp"); + Map(m => m.BitDepth).Name("bit_depth"); + Map(m => m.BlockPosition).Name("block_position"); + Map(m => m.BlockPositionMax).Name("block_position_max"); + Map(m => m.BlockPositionMin).Name("block_position_min"); + Map(m => m.BlockSpeed).Name("block_speed"); + Map(m => m.BlockSpeedSp).Name("block_speed_sp"); + Map(m => m.BlockSpeedSpDevelop).Name("block_speed_sp_develop"); + Map(m => m.BlockSpeedSpRotor).Name("block_speed_sp_rotor"); + Map(m => m.BlockSpeedSpSlide).Name("block_speed_sp_slide"); + Map(m => m.DateTime).Name("date"); + Map(m => m.Flow).Name("flow"); + Map(m => m.FlowDeltaLimitMax).Name("flow_delta_limit_max"); + Map(m => m.FlowIdle).Name("flow_idle"); + Map(m => m.HookWeight).Name("hook_weight"); + Map(m => m.HookWeightIdle).Name("hook_weight_idle"); + Map(m => m.HookWeightLimitMax).Name("hook_weight_limit_max"); + Map(m => m.HookWeightLimitMin).Name("hook_weight_limit_min"); + Map(m => m.IdFeedRegulator).Name("id_feed_regulator"); + Map(m => m.IdTelemetry).Name("id_telemetry"); + Map(m => m.Mode).Name("mode"); + Map(m => m.Mse).Name("mse"); + Map(m => m.MseState).Name("mse_state"); + Map(m => m.Pressure).Name("pressure"); + Map(m => m.PressureDeltaLimitMax).Name("pressure_delta_limit_max"); + Map(m => m.PressureIdle).Name("pressure_idle"); + Map(m => m.PressureSp).Name("pressure_sp"); + Map(m => m.PressureSpDevelop).Name("pressure_sp_develop"); + Map(m => m.PressureSpRotor).Name("pressure_sp_rotor"); + Map(m => m.PressureSpSlide).Name("pressure_sp_slide"); + Map(m => m.Pump1Flow).Name("pump1_flow"); + Map(m => m.Pump0Flow).Name("pump0_flow"); + Map(m => m.Pump2Flow).Name("pump2_flow"); + Map(m => m.RotorSpeed).Name("rotor_speed"); + Map(m => m.RotorTorque).Name("rotor_torque"); + Map(m => m.RotorTorqueIdle).Name("rotor_torque_idle"); + Map(m => m.RotorTorqueLimitMax).Name("rotor_torque_limit_max"); + Map(m => m.RotorTorqueSp).Name("rotor_torque_sp"); + Map(m => m.WellDepth).Name("well_depth"); + + } + } +} diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test.csv b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test.csv new file mode 100644 index 00000000..2b765dd9 --- /dev/null +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test.csv @@ -0,0 +1,12 @@ +"id_telemetry","date","mode","id_user","well_depth","bit_depth","block_position","block_position_min","block_position_max","block_speed","block_speed_sp","block_speed_sp_rotor","block_speed_sp_slide","block_speed_sp_develop","pressure","pressure_idle","pressure_sp","pressure_sp_rotor","pressure_sp_slide","pressure_sp_develop","pressure_delta_limit_max","axial_load","axial_load_sp","axial_load_limit_max","hook_weight","hook_weight_idle","hook_weight_limit_min","hook_weight_limit_max","rotor_torque","rotor_torque_idle","rotor_torque_sp","rotor_torque_limit_max","rotor_speed","flow","flow_idle","flow_delta_limit_max","id_feed_regulator","mse_state","mse","pump0_flow","pump1_flow","pump2_flow" +419,2023-02-24 06:52:03.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.2787943,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.296837,25.0,0.0,0.0,0.9,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.62367916,,, +419,2023-02-24 06:52:27.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0.0,100.0,100.0,50.0,100.0,3.2657084,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.288881,25.0,0.0,0.0,0.7005794,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.58552027,,, +419,2023-02-24 06:52:01.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.281889,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.290037,25.0,0.0,0.0,1.1,0.0,24.0,28.0,20.0,0.0,0.0,3.0,1,0,0.6230831,,, +419,2023-02-24 06:52:02.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.2758698,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.298437,25.0,0.0,0.0,0.8,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.61103106,,, +419,2023-02-24 06:52:04.000 +0500,0,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.2403529,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.283327,25.0,0.0,0.0,0.99897236,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.5451977,,, +419,2023-02-24 06:52:28.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0.0,100.0,100.0,50.0,100.0,3.2521386,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.271387,25.0,0.0,0.0,0.9986298,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.5644083,,, +419,2023-02-24 06:52:29.000 +0500,0,1,46.0,46.0,18.559,0.0,0.0,0.0,100.0,100.0,50.0,100.0,3.2965276,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.279978,25.0,0.0,0.0,0.7880506,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.6650865,,, +419,2023-02-24 06:52:49.000 +0500,1,1,46.0,46.0,18.347,0.0,0.0,0.02323297,100.0,100.0,50.0,100.0,3.3215039,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.196453,25.0,0.0,0.0,0.8,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.7197559,,, +419,2023-02-24 06:52:50.000 +0500,1,1,46.0,46.0,18.347,0.0,0.0,0.008542753,100.0,100.0,50.0,100.0,3.2545505,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.18471,25.0,0.0,0.0,0.8,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.5640507,,, +419,2023-02-24 06:52:53.000 +0500,1,1,46.0,46.0,18.207,0.0,0.0,11.310025,100.0,100.0,50.0,100.0,3.271237,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.770308,25.0,0.0,0.0,0.99922925,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.60237646,,, +419,2023-02-24 15:29:12.000 +0500,1,1,251.28,251.28,11.062,0.5,0.0,52.383633,53.0,53.0,50.0,50.0,46.114864,32.0,68.0,68.0,50.0,47.0,45.0,0.5221672,8.0,11.0,28.4907,29.0,0.0,0.0,5.401707,0.0,24.0,28.0,19.8,0.0,0.0,3.0,1,0,26.786428,,, diff --git a/AsbCloudInfrastructure/Services/SAUB/CsvSerializer.cs b/AsbCloudInfrastructure/Services/SAUB/CsvSerializer.cs index cc92f6bc..b117aaed 100644 --- a/AsbCloudInfrastructure/Services/SAUB/CsvSerializer.cs +++ b/AsbCloudInfrastructure/Services/SAUB/CsvSerializer.cs @@ -49,6 +49,8 @@ public class CsvSerializer HandleRow(props.Select(p => CsvSerializer.Escape(Fromat(p.GetValue(item))))); } + + private string Fromat(object? obj) { if (obj is double objDouble) From ea0f8311ab59079a09fe8d8e71e4519d2ef0d3e0 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 14 Oct 2024 10:51:39 +0500 Subject: [PATCH 18/22] =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D1=82=D0=B5?= =?UTF-8?q?=D1=81=D1=82=20(=D0=BE=D0=BA=D0=BE=D0=BD=D1=87=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AsbCloudInfrastructure.Tests.csproj | 4 + .../DataSaubStatDrillingQualityDtoMap.cs | 16 + .../TelemetryDataSaubMap.cs | 8 +- .../DataSaubStatDtillingQualityServiceTest.cs | 332 +++--------------- .../DataSaubStat/{test.csv => test1.csv} | 0 .../Services/DataSaubStat/test1_result.csv | 2 + 6 files changed, 66 insertions(+), 296 deletions(-) create mode 100644 AsbCloudInfrastructure.Tests/MapData/DataSaubStatDrillingQualityDtoMap.cs rename AsbCloudInfrastructure.Tests/{Services/DataSaubStat => MapData}/TelemetryDataSaubMap.cs (92%) rename AsbCloudInfrastructure.Tests/Services/DataSaubStat/{test.csv => test1.csv} (100%) create mode 100644 AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1_result.csv diff --git a/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj b/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj index a9cf66be..3a1d909a 100644 --- a/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj +++ b/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj @@ -7,11 +7,15 @@ + + + + diff --git a/AsbCloudInfrastructure.Tests/MapData/DataSaubStatDrillingQualityDtoMap.cs b/AsbCloudInfrastructure.Tests/MapData/DataSaubStatDrillingQualityDtoMap.cs new file mode 100644 index 00000000..d6499973 --- /dev/null +++ b/AsbCloudInfrastructure.Tests/MapData/DataSaubStatDrillingQualityDtoMap.cs @@ -0,0 +1,16 @@ +using AsbCloudApp.Data; +using CsvHelper.Configuration; + +namespace AsbCloudInfrastructure.Tests.MapData +{ + public class DataSaubStatDrillingQualityDtoMap : ClassMap + { + public DataSaubStatDrillingQualityDtoMap() + { + Map(m => m.IdTelemetry).Name("id_telemetry"); + Map(m => m.DepthStart).Name("depth_start"); + Map(m => m.DepthEnd).Name("depth_end"); + Map(m => m.DepthDrillingQuality).Name("depth_drilling_quality"); + } + } +} diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/TelemetryDataSaubMap.cs b/AsbCloudInfrastructure.Tests/MapData/TelemetryDataSaubMap.cs similarity index 92% rename from AsbCloudInfrastructure.Tests/Services/DataSaubStat/TelemetryDataSaubMap.cs rename to AsbCloudInfrastructure.Tests/MapData/TelemetryDataSaubMap.cs index aa23cf94..9b679a55 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/TelemetryDataSaubMap.cs +++ b/AsbCloudInfrastructure.Tests/MapData/TelemetryDataSaubMap.cs @@ -1,13 +1,7 @@ using AsbCloudApp.Data.SAUB; using CsvHelper.Configuration; -using AsbCloudInfrastructure.Services; -using CsvHelper.Configuration.Attributes; -using Mapster; -using Microsoft.EntityFrameworkCore; -using System; -using System.Text.Json.Serialization; -namespace AsbCloudDb.Model +namespace AsbCloudInfrastructure.Tests.MapData { public class TelemetryDataSaubMap : ClassMap { diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs index 99818138..8e9485f5 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs @@ -1,21 +1,21 @@ using AsbCloudApp.Data; -using AsbCloudApp.Data.DetectedOperation; using AsbCloudApp.Data.SAUB; using AsbCloudApp.Repositories; using AsbCloudApp.Requests; using AsbCloudApp.Services; using AsbCloudDb.Model; using AsbCloudInfrastructure.Services; -using AsbCloudInfrastructure.Services.SAUB; +using AsbCloudInfrastructure.Tests.MapData; using CsvHelper; using Mapster; using NSubstitute; using System; using System.Collections.Generic; -using System.Formats.Asn1; using System.Globalization; using System.IO; using System.Linq; +using System.Net.NetworkInformation; +using System.Reflection; using System.Threading; using System.Threading.Tasks; using Xunit; @@ -25,323 +25,77 @@ namespace AsbCloudInfrastructure.Tests.Services; public class DataSaubStatDtillingQualityServiceTest { private const string UsingTemplateFile = "AsbCloudInfrastructure/Tests/Services/DataSaubStat"; - private readonly int Gap = 5; private readonly IDataSaubStatRepository dataSaubStatRepositoryMock = Substitute.For>(); private readonly ITelemetryDataCache telemetryDataCacheMock = Substitute.For>(); - private readonly IDetectedOperationRepository detectedOperationRepositoryMock = Substitute.For(); private readonly ITelemetryDataSaubService dataSaubServiceMock = Substitute.For(); private DataSaubStatDrillingQualityService dataSaubStatService; - private int[] idTelemetries = [1]; - private IEnumerable dataSaubStatDrillingQualityDtos = new List() - { - new DataSaubStatDrillingQualityDto { - Id = 1, - DateEnd = DateTime.UtcNow, - DateStart = DateTime.UtcNow.AddHours(-1), - DepthEnd = 2, - DepthStart = 1, - IdFeedRegulator = 1, - IdTelemetry = 1 - }, - new DataSaubStatDrillingQualityDto { - Id = 2, - DateEnd = DateTime.UtcNow, - DateStart = DateTime.UtcNow.AddHours(-1), - DepthEnd = 3, - DepthStart = 2, - IdFeedRegulator = 2, - IdTelemetry = 2, - }, - new DataSaubStatDrillingQualityDto { - Id = 3, - DateEnd = DateTime.UtcNow, - DateStart = DateTime.UtcNow.AddHours(-1), - DepthEnd = 4, - DepthStart = 3, - IdFeedRegulator = 3, - IdTelemetry = 3, - }, - }; - - - private List telemetryDataSaubDtos = new List { - new TelemetryDataSaubDto() - { - IdTelemetry = 1, - DateTime = DateTime.UtcNow.AddMinutes(-30), - AxialLoad = 800, - AxialLoadLimitMax = 1, - AxialLoadSp = 1, - BitDepth = 1, - BlockPosition = 1, - BlockPositionMax = 1, - BlockPositionMin = 1, - BlockSpeed = 1, - BlockSpeedSp = 1, - BlockSpeedSpDevelop = 1, - BlockSpeedSpRotor = 1, - BlockSpeedSpSlide = 1, - Flow = 1, - FlowDeltaLimitMax = 1, - FlowIdle = 1, - HookWeight = 1, - HookWeightIdle = 1, - HookWeightLimitMax = 1, - HookWeightLimitMin = 1, - IdFeedRegulator = 1, - IdUser = 1, - Mode = 1, - Mse = 1, - MseState = 1, - Pressure = 1, - PressureDeltaLimitMax = 1, - PressureIdle = 1, - PressureSp = 1, - PressureSpDevelop = 1, - PressureSpRotor = 1, - PressureSpSlide = 1, - Pump0Flow = 1, - Pump1Flow = 1, - Pump2Flow = 1, - RotorSpeed = 1, - RotorTorque = 1, - RotorTorqueIdle = 1, - RotorTorqueSp = 1, - RotorTorqueLimitMax = 1, - WellDepth = 800, - } - }; - public DataSaubStatDtillingQualityServiceTest() { - telemetryDataCacheMock - .GetIds(Arg.Any()) - .Returns(idTelemetries); - - dataSaubStatRepositoryMock - .GetLastsAsync(Arg.Any(), Arg.Any()) - .Returns(dataSaubStatDrillingQualityDtos); - dataSaubStatService = new DataSaubStatDrillingQualityService( dataSaubStatRepositoryMock, telemetryDataCacheMock, dataSaubServiceMock); } - private TelemetryDataSaubDto CreateTelemetryDataSaubItem( - TelemetryDataSaubDto telemetrySaubDto, - float wellDepth, - float bitDepth, - short idFeedRegulator, - DateTime dateTime) - { - var telemetrySaubDto1 = telemetrySaubDto.Adapt(); - telemetrySaubDto1.WellDepth = wellDepth; - telemetrySaubDto1.BitDepth = bitDepth; - telemetrySaubDto1.IdFeedRegulator = idFeedRegulator; - telemetrySaubDto1.DateTime = dateTime; - - return telemetrySaubDto1; - } [Fact] - public async Task Create_1DataSaubStatItems_ShouldReturn__Success() + public async Task Create_DataSaubStatDrillingQuality_From_CSVFile_Test1_ShouldReturn_Success() { - var telemetryDataSaubDtos2 = new List(); - string fileName = @"C:\Users\admin\source\repos\AsbCloudServer\AsbCloudInfrastructure.Tests\Services\DataSaubStat\test.csv"; - using (var reader = new StreamReader(fileName)) + var resourceName = Assembly.GetExecutingAssembly() + .GetManifestResourceNames() + .Where(r => r.Contains("DataSaubStat.test1.csv")) + .FirstOrDefault(); + + if (String.IsNullOrEmpty(resourceName)) + Assert.Fail("No mock data for test"); + + using var stream = Assembly.GetExecutingAssembly() + .GetManifestResourceStream(resourceName)!; + + var actual = Enumerable.Empty(); + + using (var reader = new StreamReader(stream)) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) { - try - { - csv.Context.RegisterClassMap(); - var records = csv.GetRecords().ToList(); + csv.Context.RegisterClassMap(); + var records = csv.GetRecords().ToList(); - - - dataSaubServiceMock + dataSaubServiceMock .Get(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) .Returns(records); - //act - var result = await dataSaubStatService.CreateStatDrillingQualityForTelemetry(1, DateTimeOffset.UnixEpoch, CancellationToken.None); - - //assert - Assert.Equal(3, result.Count()); - } - catch (Exception ex) - { - ; - } + //act + actual = await dataSaubStatService.CreateStatDrillingQualityForTelemetry(1, DateTimeOffset.UnixEpoch, CancellationToken.None); } - //var telemetrySaubDto = telemetryDataSaubDtos.FirstOrDefault(); - //if (telemetrySaubDto != null) - //{ - // //idFeedRegulator depthWell - // //1 800 - // //1 900 - // //1 1000 - // //1 900 - // //1 1200 - // //1 1300 - // //1 1100 - // //1 1500 - // //2 1600 - // // idFeedRegulator: - // // = 3 - // // = (1000 - 800) + (1300 - 900) + (1600 - 1100) = 1100 - // var telemetrySaubDto1 = CreateTelemetryDataSaubItem( - // telemetrySaubDto, - // wellDepth: 900, - // bitDepth: 900, - // idFeedRegulator: 1, - // dateTime: DateTime.UtcNow.AddMinutes(20)); - // telemetryDataSaubDtos.Add(telemetrySaubDto1); + resourceName = Assembly.GetExecutingAssembly() + .GetManifestResourceNames() + .Where(r => r.Contains("DataSaubStat.test1_result.csv")) + .FirstOrDefault(); - // var telemetrySaubDto2 = CreateTelemetryDataSaubItem( - // telemetrySaubDto, - // wellDepth: 1000, - // bitDepth: 1000, - // idFeedRegulator: 1, - // dateTime: DateTime.UtcNow.AddMinutes(20)); - // telemetryDataSaubDtos.Add(telemetrySaubDto2); + if (String.IsNullOrEmpty(resourceName)) + Assert.Fail("No mock data for test"); - // var telemetrySaubDto3 = CreateTelemetryDataSaubItem( - // telemetrySaubDto, - // wellDepth: 900, - // bitDepth: 900, - // idFeedRegulator: 1, - // dateTime: DateTime.UtcNow.AddMinutes(20)); - // telemetryDataSaubDtos.Add(telemetrySaubDto3); + using var stream2 = Assembly.GetExecutingAssembly() + .GetManifestResourceStream(resourceName)!; - // var telemetrySaubDto4 = CreateTelemetryDataSaubItem( - // telemetrySaubDto, - // wellDepth: 1200, - // bitDepth: 1200, - // idFeedRegulator: 1, - // dateTime: DateTime.UtcNow.AddMinutes(20)); - // telemetryDataSaubDtos.Add(telemetrySaubDto4); + using (var reader = new StreamReader(stream2)) + using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) + { + csv.Context.RegisterClassMap(); + var expected = csv.GetRecords().ToList(); - // var telemetrySaubDto5 = CreateTelemetryDataSaubItem( - // telemetrySaubDto, - // wellDepth: 1300, - // bitDepth: 1300, - // idFeedRegulator: 1, - // dateTime: DateTime.UtcNow.AddMinutes(20)); - // telemetryDataSaubDtos.Add(telemetrySaubDto5); + Assert.Equal(expected.Count(), actual.Count()); - // var telemetrySaubDto6 = CreateTelemetryDataSaubItem( - // telemetrySaubDto, - // wellDepth: 1100, - // bitDepth: 1100, - // idFeedRegulator: 1, - // dateTime: DateTime.UtcNow.AddMinutes(20)); - // telemetryDataSaubDtos.Add(telemetrySaubDto6); + var expectedItem = expected.FirstOrDefault()!; + var actualItem = actual.FirstOrDefault()!; - // var telemetrySaubDto7 = CreateTelemetryDataSaubItem( - // telemetrySaubDto, - // wellDepth: 1500, - // bitDepth: 1500, - // idFeedRegulator: 1, - // dateTime: DateTime.UtcNow.AddMinutes(20)); - // telemetryDataSaubDtos.Add(telemetrySaubDto7); - - // var telemetrySaubDto8 = CreateTelemetryDataSaubItem( - // telemetrySaubDto, - // wellDepth: 1600, - // bitDepth: 1600, - // idFeedRegulator: 2, - // dateTime: DateTime.UtcNow.AddMinutes(20)); - // telemetryDataSaubDtos.Add(telemetrySaubDto8); - //} - - + Assert.True(Math.Abs(expectedItem.DepthStart - actualItem.DepthStart) < 0.000001); + Assert.True(Math.Abs(expectedItem.DepthEnd - actualItem.DepthEnd) < 0.000001); + Assert.True(Math.Abs(expectedItem.DepthDrillingQuality - actualItem.DepthDrillingQuality) < 0.000001); + } } - - private TelemetryDataSaubDto Convert(TelemetryDataSaub src, double timezoneOffset) - { - var mapper = MapsterForUnitTests.GetMapper(); - - var res = new TelemetryDataSaubDto(); - var dto = mapper.Map(src, res); - //var telemetryUser = telemetryUserService.GetOrDefault(src.IdTelemetry, src.IdUser ?? int.MinValue); - dto.User = "dfsdf"; - //telemetryUser?.MakeDisplayName(); - dto.DateTime = src.DateTime.ToRemoteDateTime(timezoneOffset); - dto.BitDepth = src.BitDepth <= src.WellDepth - ? src.BitDepth - : src.WellDepth; - return dto; - } - - - - //[Fact] - //public async Task Create_2DataSaubStatItems_ShouldReturn__Success() - //{ - // var insertedDataSaubStatCount = 2; - - // var detectedOperationDto = detectedOperationDtos.FirstOrDefault(); - // if (detectedOperationDto != null) - // { - // var detectedOperationDto1 = detectedOperationDto.Adapt(); - // detectedOperationDto1.DateStart = DateTimeOffset.UtcNow.AddMinutes(1); - // detectedOperationDto1.DateEnd = DateTimeOffset.UtcNow.AddHours(1); - - // detectedOperationDtos.Add(detectedOperationDto1); - // } - - // var telemetryDataSaubDto = telemetryDataSaubDtos.LastOrDefault(); - // if (telemetryDataSaubDto != null) - // { - // var telemetryDataSaubDto1 = telemetryDataSaubDto.Adapt(); - // telemetryDataSaubDto1.DateTime = DateTime.UtcNow.AddMinutes(10); - // telemetryDataSaubDto1.WellDepth = telemetryDataSaubDto.WellDepth + 1; - - // var telemetryDataSaubDto2 = telemetryDataSaubDto.Adapt(); - // telemetryDataSaubDto2.DateTime = DateTime.UtcNow.AddMinutes(20); - // telemetryDataSaubDto2.WellDepth = telemetryDataSaubDto1.WellDepth + 1; - - // var telemetryDataSaubDto3 = telemetryDataSaubDto.Adapt(); - // telemetryDataSaubDto3.DateTime = DateTime.UtcNow.AddMinutes(30); - // telemetryDataSaubDto3.WellDepth = telemetryDataSaubDto2.WellDepth + 1; - - // telemetryDataSaubDtos.Add(telemetryDataSaubDto1); - // telemetryDataSaubDtos.Add(telemetryDataSaubDto2); - // telemetryDataSaubDtos.Add(telemetryDataSaubDto3); - // } - - // detectedOperationRepositoryMock - // .Get(Arg.Any(), Arg.Any()) - // .Returns(detectedOperationDtos); - - // dataSaubStatRepositoryMock - // .InsertRangeAsync(Arg.Any>(), Arg.Any()) - // .Returns(insertedDataSaubStatCount); - - // Action action = (message, percent) => - // { - // //assert - // Assert.NotNull(percent); - // Assert.InRange(percent.Value, 0.0, 1.0); - // }; - - // //act - // await dataSaubStatService.CreateStatAsync(Gap, action, CancellationToken.None); - - // //assert - // await dataSaubStatRepositoryMock.Received().InsertRangeAsync( - // Arg.Is>(l => l.Count() == insertedDataSaubStatCount), - // Arg.Any()); - //} } -internal class TestDto -{ - public int Id { get; set; } - public string Name { get; set; } - public int Age { get; set; } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test.csv b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1.csv similarity index 100% rename from AsbCloudInfrastructure.Tests/Services/DataSaubStat/test.csv rename to AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1.csv diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1_result.csv b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1_result.csv new file mode 100644 index 00000000..64c49983 --- /dev/null +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1_result.csv @@ -0,0 +1,2 @@ +"id_telemetry","depth_start","depth_end","depth_drilling_quality" +419,46,251.279998779297,0.0 From ea9800e561a604251db47156823cf33340ae39ae Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 14 Oct 2024 12:07:03 +0500 Subject: [PATCH 19/22] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B0=D0=B2=D1=82=D0=BE=D1=82=D0=B5=D1=81=D1=82=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82?= =?UTF-8?q?=D0=B0=D0=BC=20=D1=80=D0=B5=D0=B2=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataSaubStatDtillingQualityServiceTest.cs | 20 +++++++++---------- .../SAUB/TelemetryDataEditorService.cs | 2 ++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs index 8e9485f5..04fe2b83 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs @@ -1,20 +1,15 @@ using AsbCloudApp.Data; using AsbCloudApp.Data.SAUB; using AsbCloudApp.Repositories; -using AsbCloudApp.Requests; using AsbCloudApp.Services; -using AsbCloudDb.Model; using AsbCloudInfrastructure.Services; using AsbCloudInfrastructure.Tests.MapData; using CsvHelper; -using Mapster; using NSubstitute; using System; -using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; -using System.Net.NetworkInformation; using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -24,7 +19,6 @@ namespace AsbCloudInfrastructure.Tests.Services; public class DataSaubStatDtillingQualityServiceTest { - private const string UsingTemplateFile = "AsbCloudInfrastructure/Tests/Services/DataSaubStat"; private readonly IDataSaubStatRepository dataSaubStatRepositoryMock = Substitute.For>(); private readonly ITelemetryDataCache telemetryDataCacheMock = Substitute.For>(); private readonly ITelemetryDataSaubService dataSaubServiceMock = Substitute.For(); @@ -39,13 +33,16 @@ public class DataSaubStatDtillingQualityServiceTest dataSaubServiceMock); } - - [Fact] - public async Task Create_DataSaubStatDrillingQuality_From_CSVFile_Test1_ShouldReturn_Success() + [Theory] + [InlineData("DataSaubStat.test1.csv", "DataSaubStat.test1_result.csv")] + public async Task Create_DataSaubStatDrillingQuality_From_CSVFile_ShouldReturn_Success( + string pathMockData, + string pathResult + ) { var resourceName = Assembly.GetExecutingAssembly() .GetManifestResourceNames() - .Where(r => r.Contains("DataSaubStat.test1.csv")) + .Where(r => r.Contains(pathMockData)) .FirstOrDefault(); if (String.IsNullOrEmpty(resourceName)) @@ -72,7 +69,7 @@ public class DataSaubStatDtillingQualityServiceTest resourceName = Assembly.GetExecutingAssembly() .GetManifestResourceNames() - .Where(r => r.Contains("DataSaubStat.test1_result.csv")) + .Where(r => r.Contains(pathResult)) .FirstOrDefault(); if (String.IsNullOrEmpty(resourceName)) @@ -87,6 +84,7 @@ public class DataSaubStatDtillingQualityServiceTest csv.Context.RegisterClassMap(); var expected = csv.GetRecords().ToList(); + //assert Assert.Equal(expected.Count(), actual.Count()); var expectedItem = expected.FirstOrDefault()!; diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs index 27280426..7848e1ec 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataEditorService.cs @@ -37,6 +37,7 @@ public class TelemetryDataEditorService : ITelemetryDataEditorService ITelemetryDataSaubService dataSaubService, ITelemetryDataService dataSpinService, IDataSaubStatRepository dataSaubStatRepository, + IDataSaubStatRepository dataSaubStatDrillingQualityRepository, IMessageRepository messageRepository, IDrillTestRepository drillTestRepository, ILimitingParameterRepository limitingParameterRepository, @@ -55,6 +56,7 @@ public class TelemetryDataEditorService : ITelemetryDataEditorService dataSaubService, dataSpinService, dataSaubStatRepository, + dataSaubStatDrillingQualityRepository, messageRepository, drillTestRepository, limitingParameterRepository, From edb7d93a624477b32d50f044245eb0799eb1e4c3 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Wed, 16 Oct 2024 18:02:38 +0500 Subject: [PATCH 20/22] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=B0=D0=BD=D1=8B=20=D0=B0=D0=B2=D1=82=D0=BE=D1=82=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D1=8B=20+=20=D0=9C=D0=B5=D1=82=D0=BE=D0=B4,=20?= =?UTF-8?q?=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D0=B9=20=D0=BE=D1=82=D0=B4?= =?UTF-8?q?=D0=B0=D0=B5=D1=82=20=D0=BD=D0=B0=20=D1=84=D1=80=D0=BE=D0=BD?= =?UTF-8?q?=D1=82=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=BE=20=D0=BA?= =?UTF-8?q?=D0=B0=D1=87=D0=B5=D1=81=D1=82=D0=B2=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/IDataSaubStatRepository.cs | 6 +- .../Requests/DrillingQualityRequest.cs | 27 ++++++ .../IDataSaubStatDrillingQualityService.cs | 8 ++ .../AsbCloudInfrastructure.Tests.csproj | 8 ++ .../DataSaubStatDrillingQualityDtoMap.cs | 26 +++--- .../MapData/TelemetryDataSaubMap.cs | 87 +++++++++---------- .../DataSaubStatDtillingQualityServiceTest.cs | 47 +++++++--- .../Services/DataSaubStat/test1.csv | 33 ++++--- .../Services/DataSaubStat/test2.csv | 32 +++++++ .../Services/DataSaubStat/test2_result.csv | 8 ++ .../Services/DataSaubStat/test3.csv | 33 +++++++ .../Services/DataSaubStat/test3_result.csv | 10 +++ .../Repository/DataSaubStatRepository.cs | 17 +++- .../DataSaubStatDrillingQualityService.cs | 74 ++++++++++++---- .../Report/ProcessMapReportDrillingService.cs | 2 +- .../Controllers/ServiceOperationController.cs | 59 +++++++++++++ 16 files changed, 370 insertions(+), 107 deletions(-) create mode 100644 AsbCloudApp/Requests/DrillingQualityRequest.cs create mode 100644 AsbCloudInfrastructure.Tests/Services/DataSaubStat/test2.csv create mode 100644 AsbCloudInfrastructure.Tests/Services/DataSaubStat/test2_result.csv create mode 100644 AsbCloudInfrastructure.Tests/Services/DataSaubStat/test3.csv create mode 100644 AsbCloudInfrastructure.Tests/Services/DataSaubStat/test3_result.csv create mode 100644 AsbCloudWebApi/Controllers/ServiceOperationController.cs diff --git a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs index edda1fab..d3f6fab8 100644 --- a/AsbCloudApp/Repositories/IDataSaubStatRepository.cs +++ b/AsbCloudApp/Repositories/IDataSaubStatRepository.cs @@ -14,14 +14,14 @@ public interface IDataSaubStatRepository : ITelemetryDataEditorService where TDto : IDataSaubStatDto { /// - /// Получение записей по ключу телеметрии + /// Получение записей по ключам телеметрий /// - /// ключ телеметрии + /// ключи телеметрий /// начальная дата /// конечная дата /// /// - Task> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token); + Task> GetAsync(IEnumerable idsTelemetries, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token); /// /// Получение последних по дате окончания бурения записей в разрезе телеметрий diff --git a/AsbCloudApp/Requests/DrillingQualityRequest.cs b/AsbCloudApp/Requests/DrillingQualityRequest.cs new file mode 100644 index 00000000..8d8d17e8 --- /dev/null +++ b/AsbCloudApp/Requests/DrillingQualityRequest.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace AsbCloudApp.Requests; + +/// +/// Запрос на получение записей качества бурения +/// +public class DrillingQualityRequest +{ + /// + /// идентификаторы скважин + /// + [Required] + public IEnumerable IdsWell { get; set; } = null!; + + /// + /// Больше или равно дате + /// + public DateTimeOffset GeDate { get; set; } = DateTimeOffset.MinValue; + + /// + /// Меньше или равно дате + /// + public DateTimeOffset LeDate { get; set; } = DateTimeOffset.MaxValue; +} diff --git a/AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs b/AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs index 8adbfc39..cba74318 100644 --- a/AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs +++ b/AsbCloudApp/Services/DataSaubStat/IDataSaubStatDrillingQualityService.cs @@ -1,4 +1,5 @@ using AsbCloudApp.Data; +using AsbCloudApp.Requests; using System; using System.Collections.Generic; using System.Threading; @@ -34,4 +35,11 @@ public interface IDataSaubStatDrillingQualityService DateTimeOffset geDate, CancellationToken token); + /// + /// Получение записей DrillingQualityDto по параметрам + /// + /// параметры запроса + /// + /// + Task> GetStatAsync(DrillingQualityRequest request, CancellationToken token); } diff --git a/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj b/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj index 3a1d909a..ae3665cf 100644 --- a/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj +++ b/AsbCloudInfrastructure.Tests/AsbCloudInfrastructure.Tests.csproj @@ -9,6 +9,10 @@ + + + + @@ -16,6 +20,10 @@ + + + + diff --git a/AsbCloudInfrastructure.Tests/MapData/DataSaubStatDrillingQualityDtoMap.cs b/AsbCloudInfrastructure.Tests/MapData/DataSaubStatDrillingQualityDtoMap.cs index d6499973..990aa5d2 100644 --- a/AsbCloudInfrastructure.Tests/MapData/DataSaubStatDrillingQualityDtoMap.cs +++ b/AsbCloudInfrastructure.Tests/MapData/DataSaubStatDrillingQualityDtoMap.cs @@ -1,16 +1,22 @@ -using AsbCloudApp.Data; -using CsvHelper.Configuration; +using CsvHelper.Configuration.Attributes; namespace AsbCloudInfrastructure.Tests.MapData { - public class DataSaubStatDrillingQualityDtoMap : ClassMap + public class DataSaubStatDrillingQualityDtoMap { - public DataSaubStatDrillingQualityDtoMap() - { - Map(m => m.IdTelemetry).Name("id_telemetry"); - Map(m => m.DepthStart).Name("depth_start"); - Map(m => m.DepthEnd).Name("depth_end"); - Map(m => m.DepthDrillingQuality).Name("depth_drilling_quality"); - } + [Name("id_telemetry")] + public int IdTelemetry { get; set; } + + [Name("depth_start")] + public float DepthStart { get; set; } + + [Name("depth_end")] + public float DepthEnd { get; set; } + + [Name("depth_drilling_quality")] + public float DepthDrillingQuality { get; set; } + + [Name("id_feed_regulator")] + public short? IdFeedRegulator { get; set; } } } diff --git a/AsbCloudInfrastructure.Tests/MapData/TelemetryDataSaubMap.cs b/AsbCloudInfrastructure.Tests/MapData/TelemetryDataSaubMap.cs index 9b679a55..80d74b44 100644 --- a/AsbCloudInfrastructure.Tests/MapData/TelemetryDataSaubMap.cs +++ b/AsbCloudInfrastructure.Tests/MapData/TelemetryDataSaubMap.cs @@ -1,54 +1,47 @@ -using AsbCloudApp.Data.SAUB; -using CsvHelper.Configuration; +using CsvHelper.Configuration.Attributes; +using System; namespace AsbCloudInfrastructure.Tests.MapData { - public class TelemetryDataSaubMap : ClassMap + public class TelemetryDataSaubMap { - public TelemetryDataSaubMap() - { - Map(m => m.AxialLoad).Name("axial_load"); - Map(m => m.AxialLoadLimitMax).Name("axial_load_limit_max"); - Map(m => m.AxialLoadSp).Name("axial_load_sp"); - Map(m => m.BitDepth).Name("bit_depth"); - Map(m => m.BlockPosition).Name("block_position"); - Map(m => m.BlockPositionMax).Name("block_position_max"); - Map(m => m.BlockPositionMin).Name("block_position_min"); - Map(m => m.BlockSpeed).Name("block_speed"); - Map(m => m.BlockSpeedSp).Name("block_speed_sp"); - Map(m => m.BlockSpeedSpDevelop).Name("block_speed_sp_develop"); - Map(m => m.BlockSpeedSpRotor).Name("block_speed_sp_rotor"); - Map(m => m.BlockSpeedSpSlide).Name("block_speed_sp_slide"); - Map(m => m.DateTime).Name("date"); - Map(m => m.Flow).Name("flow"); - Map(m => m.FlowDeltaLimitMax).Name("flow_delta_limit_max"); - Map(m => m.FlowIdle).Name("flow_idle"); - Map(m => m.HookWeight).Name("hook_weight"); - Map(m => m.HookWeightIdle).Name("hook_weight_idle"); - Map(m => m.HookWeightLimitMax).Name("hook_weight_limit_max"); - Map(m => m.HookWeightLimitMin).Name("hook_weight_limit_min"); - Map(m => m.IdFeedRegulator).Name("id_feed_regulator"); - Map(m => m.IdTelemetry).Name("id_telemetry"); - Map(m => m.Mode).Name("mode"); - Map(m => m.Mse).Name("mse"); - Map(m => m.MseState).Name("mse_state"); - Map(m => m.Pressure).Name("pressure"); - Map(m => m.PressureDeltaLimitMax).Name("pressure_delta_limit_max"); - Map(m => m.PressureIdle).Name("pressure_idle"); - Map(m => m.PressureSp).Name("pressure_sp"); - Map(m => m.PressureSpDevelop).Name("pressure_sp_develop"); - Map(m => m.PressureSpRotor).Name("pressure_sp_rotor"); - Map(m => m.PressureSpSlide).Name("pressure_sp_slide"); - Map(m => m.Pump1Flow).Name("pump1_flow"); - Map(m => m.Pump0Flow).Name("pump0_flow"); - Map(m => m.Pump2Flow).Name("pump2_flow"); - Map(m => m.RotorSpeed).Name("rotor_speed"); - Map(m => m.RotorTorque).Name("rotor_torque"); - Map(m => m.RotorTorqueIdle).Name("rotor_torque_idle"); - Map(m => m.RotorTorqueLimitMax).Name("rotor_torque_limit_max"); - Map(m => m.RotorTorqueSp).Name("rotor_torque_sp"); - Map(m => m.WellDepth).Name("well_depth"); + [Name("id_telemetry")] + public int IdTelemetry { get; set; } - } + [Name("date")] + public DateTime DateTime { get; set; } + + [Name("well_depth")] + public float WellDepth { get; set; } + + [Name("bit_depth")] + public float BitDepth { get; set; } + + [Name("block_speed")] + public float? BlockSpeed { get; set; } + + [Name("block_speed_sp")] + public float? BlockSpeedSp { get; set; } + + [Name("pressure")] + public float Pressure { get; set; } + + [Name("pressure_sp")] + public float? PressureSp { get; set; } + + [Name("axial_load")] + public float AxialLoad { get; set; } + + [Name("axial_load_sp")] + public float? AxialLoadSp { get; set; } + + [Name("rotor_torque")] + public float RotorTorque { get; set; } + + [Name("rotor_torque_sp")] + public float? RotorTorqueSp { get; set; } + + [Name("id_feed_regulator")] + public short? IdFeedRegulator { get; set; } } } diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs index 04fe2b83..0ad9700c 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs @@ -5,6 +5,7 @@ using AsbCloudApp.Services; using AsbCloudInfrastructure.Services; using AsbCloudInfrastructure.Tests.MapData; using CsvHelper; +using Mapster; using NSubstitute; using System; using System.Globalization; @@ -22,6 +23,7 @@ public class DataSaubStatDtillingQualityServiceTest private readonly IDataSaubStatRepository dataSaubStatRepositoryMock = Substitute.For>(); private readonly ITelemetryDataCache telemetryDataCacheMock = Substitute.For>(); private readonly ITelemetryDataSaubService dataSaubServiceMock = Substitute.For(); + private readonly ITelemetryService telemetryServiceMock = Substitute.For(); private DataSaubStatDrillingQualityService dataSaubStatService; @@ -30,11 +32,14 @@ public class DataSaubStatDtillingQualityServiceTest dataSaubStatService = new DataSaubStatDrillingQualityService( dataSaubStatRepositoryMock, telemetryDataCacheMock, - dataSaubServiceMock); + dataSaubServiceMock, + telemetryServiceMock); } [Theory] - [InlineData("DataSaubStat.test1.csv", "DataSaubStat.test1_result.csv")] + [InlineData("DataSaubStat.test3.csv", "DataSaubStat.test3_result.csv")] + [InlineData("DataSaubStat.test2.csv", "DataSaubStat.test2_result.csv")] + //[InlineData("DataSaubStat.test1.csv", "DataSaubStat.test1_result.csv")] public async Task Create_DataSaubStatDrillingQuality_From_CSVFile_ShouldReturn_Success( string pathMockData, string pathResult @@ -51,20 +56,21 @@ public class DataSaubStatDtillingQualityServiceTest using var stream = Assembly.GetExecutingAssembly() .GetManifestResourceStream(resourceName)!; - var actual = Enumerable.Empty(); + var actualData = Enumerable.Empty(); using (var reader = new StreamReader(stream)) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) { - csv.Context.RegisterClassMap(); - var records = csv.GetRecords().ToList(); + var dataSaubMaps = csv.GetRecords().ToList(); + + var dtos = dataSaubMaps.Select(x => x.Adapt()).ToArray(); dataSaubServiceMock .Get(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(records); + .Returns(dtos); //act - actual = await dataSaubStatService.CreateStatDrillingQualityForTelemetry(1, DateTimeOffset.UnixEpoch, CancellationToken.None); + actualData = await dataSaubStatService.CreateStatDrillingQualityForTelemetry(1, DateTimeOffset.UnixEpoch, CancellationToken.None); } resourceName = Assembly.GetExecutingAssembly() @@ -81,18 +87,31 @@ public class DataSaubStatDtillingQualityServiceTest using (var reader = new StreamReader(stream2)) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) { - csv.Context.RegisterClassMap(); - var expected = csv.GetRecords().ToList(); + var dataSaubMaps = csv.GetRecords().ToList(); + var expectedData = dataSaubMaps.Select(x => x.Adapt()).ToArray(); //assert + var actual = actualData + .OrderBy(d => d.IdFeedRegulator) + .ToArray(); + + var expected = expectedData + .OrderBy(d => d.IdFeedRegulator) + .ToArray(); + Assert.Equal(expected.Count(), actual.Count()); - var expectedItem = expected.FirstOrDefault()!; - var actualItem = actual.FirstOrDefault()!; + for (var i = 0; i < actual.Count(); i++) + { + var expectedItem = expected[i]; + var actualItem = actual[i]; + + Assert.True(Math.Abs(expectedItem.DepthStart - actualItem.DepthStart) < 0.000001); + Assert.True(Math.Abs(expectedItem.DepthEnd - actualItem.DepthEnd) < 0.000001); + Assert.True(Math.Abs(expectedItem.DepthDrillingQuality - actualItem.DepthDrillingQuality) < 0.000001); + } + - Assert.True(Math.Abs(expectedItem.DepthStart - actualItem.DepthStart) < 0.000001); - Assert.True(Math.Abs(expectedItem.DepthEnd - actualItem.DepthEnd) < 0.000001); - Assert.True(Math.Abs(expectedItem.DepthDrillingQuality - actualItem.DepthDrillingQuality) < 0.000001); } } } diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1.csv b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1.csv index 2b765dd9..406f23f8 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1.csv +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1.csv @@ -1,12 +1,21 @@ -"id_telemetry","date","mode","id_user","well_depth","bit_depth","block_position","block_position_min","block_position_max","block_speed","block_speed_sp","block_speed_sp_rotor","block_speed_sp_slide","block_speed_sp_develop","pressure","pressure_idle","pressure_sp","pressure_sp_rotor","pressure_sp_slide","pressure_sp_develop","pressure_delta_limit_max","axial_load","axial_load_sp","axial_load_limit_max","hook_weight","hook_weight_idle","hook_weight_limit_min","hook_weight_limit_max","rotor_torque","rotor_torque_idle","rotor_torque_sp","rotor_torque_limit_max","rotor_speed","flow","flow_idle","flow_delta_limit_max","id_feed_regulator","mse_state","mse","pump0_flow","pump1_flow","pump2_flow" -419,2023-02-24 06:52:03.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.2787943,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.296837,25.0,0.0,0.0,0.9,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.62367916,,, -419,2023-02-24 06:52:27.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0.0,100.0,100.0,50.0,100.0,3.2657084,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.288881,25.0,0.0,0.0,0.7005794,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.58552027,,, -419,2023-02-24 06:52:01.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.281889,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.290037,25.0,0.0,0.0,1.1,0.0,24.0,28.0,20.0,0.0,0.0,3.0,1,0,0.6230831,,, -419,2023-02-24 06:52:02.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.2758698,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.298437,25.0,0.0,0.0,0.8,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.61103106,,, -419,2023-02-24 06:52:04.000 +0500,0,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.2403529,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.283327,25.0,0.0,0.0,0.99897236,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.5451977,,, -419,2023-02-24 06:52:28.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0.0,100.0,100.0,50.0,100.0,3.2521386,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.271387,25.0,0.0,0.0,0.9986298,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.5644083,,, -419,2023-02-24 06:52:29.000 +0500,0,1,46.0,46.0,18.559,0.0,0.0,0.0,100.0,100.0,50.0,100.0,3.2965276,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.279978,25.0,0.0,0.0,0.7880506,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.6650865,,, -419,2023-02-24 06:52:49.000 +0500,1,1,46.0,46.0,18.347,0.0,0.0,0.02323297,100.0,100.0,50.0,100.0,3.3215039,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.196453,25.0,0.0,0.0,0.8,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.7197559,,, -419,2023-02-24 06:52:50.000 +0500,1,1,46.0,46.0,18.347,0.0,0.0,0.008542753,100.0,100.0,50.0,100.0,3.2545505,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.18471,25.0,0.0,0.0,0.8,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.5640507,,, -419,2023-02-24 06:52:53.000 +0500,1,1,46.0,46.0,18.207,0.0,0.0,11.310025,100.0,100.0,50.0,100.0,3.271237,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.770308,25.0,0.0,0.0,0.99922925,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.60237646,,, -419,2023-02-24 15:29:12.000 +0500,1,1,251.28,251.28,11.062,0.5,0.0,52.383633,53.0,53.0,50.0,50.0,46.114864,32.0,68.0,68.0,50.0,47.0,45.0,0.5221672,8.0,11.0,28.4907,29.0,0.0,0.0,5.401707,0.0,24.0,28.0,19.8,0.0,0.0,3.0,1,0,26.786428,,, +"id_telemetry","date","well_depth","bit_depth","block_speed","block_speed_sp","pressure","pressure_sp","axial_load","axial_load_sp","rotor_torque","rotor_torque_sp","id_feed_regulator" +618,2023-02-24 06:52:03.000 +0500,303.545989990234,64.1760025024414,45.00,50.00,3.71015930175781,52.00,2.8034496307373,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,313.545989990234,63.5940017700195,46.00,50.00,3.69481015205383,52.00,2.04865455627441,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,323.545989990234,63.0130004882813,47.00,50.00,3.7329523563385,52.00,2.90703392028809,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,333.545989990234,62.4309997558594,48.00,50.00,3.70306921005249,52.00,2.17815017700195,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,343.545989990234,61.8499984741211,49.00,50.00,3.69618034362793,52.00,2.45234489440918,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,353.545989990234,61.2560005187988,50.00,50.00,3.72630000114441,52.00,3.2121467590332,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,363.545989990234,60.6679992675781,51.00,50.00,3.70950126647949,52.00,2.8408260345459,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,373.545989990234,60.0870018005371,52.00,50.00,3.73658561706543,52.00,1.16445922851563,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,383.545989990234,59.4939994812012,53.00,50.00,3.68171286582947,52.00,2.30134773254395,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,393.545989990234,58.9070014953613,54.00,50.00,3.72104644775391,52.00,1.91220664978027,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,403.545989990234,58.3199996948242,55.00,50.00,3.75041079521179,52.00,1.29618453979492,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,413.545989990234,57.7270011901856,56.00,50.00,3.71274995803833,52.00,2.0904655456543,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,423.545989990234,57.1389999389648,57.00,50.00,3.73990893363953,52.00,2.42434310913086,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,433.545989990234,56.5460014343262,58.00,50.00,3.7690634727478,52.00,2.07949066162109,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,443.545989990234,55.9589996337891,59.00,50.00,3.7951807975769,52.00,1.98602676391602,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,453.545989990234,55.3660011291504,60.00,50.00,3.84931874275208,52.00,2.41486930847168,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,463.545989990234,54.7719993591309,61.00,50.00,3.91031193733215,52.00,2.98539924621582,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,473.545989990234,54.1790008544922,62.00,50.00,3.95907807350159,52.00,2.65116500854492,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,483.545989990234,53.5919990539551,63.00,50.00,3.98743534088135,52.00,1.92432594299316,8.00,0.00,23.00,1 +618,2023-02-24 06:52:03.000 +0500,493.545989990234,53.0050010681152,64.00,50.00,4.02055215835571,52.00,2.56299781799316,8.00,0.00,23.00,1 diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test2.csv b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test2.csv new file mode 100644 index 00000000..cf5aa8b8 --- /dev/null +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test2.csv @@ -0,0 +1,32 @@ +"id_telemetry","date","well_depth","bit_depth","block_speed","block_speed_sp","pressure","pressure_sp","axial_load","axial_load_sp","rotor_torque","rotor_torque_sp","id_feed_regulator" +618,2023-02-24 06:52:03.000 +0500,205.00,204.00,100.00,80.00,80.00,105.00,0.00,10.00,10.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,205.00,204.99,90.00,80.00,70.00,105.00,0.00,10.00,10.00,13.00,0 +618,2023-02-24 06:52:03.000 +0500,205.00,205.00,80.00,80.00,150.00,105.00,3.00,10.00,10.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,207.00,207.00,70.00,80.00,57.00,105.00,4.00,10.00,10.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,210.00,210.00,78.00,80.00,62.00,105.00,8.00,10.00,10.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,210.00,209.00,82.00,80.00,93.00,105.00,0.00,10.00,10.00,13.00,0 +618,2023-02-24 06:52:03.000 +0500,210.00,209.77,81.00,80.00,32.00,105.00,0.30,10.00,10.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,210.00,210.00,90.00,80.00,66.00,70.00,7.00,10.00,11.00,13.00,2 +618,2023-02-24 06:52:03.000 +0500,213.00,213.00,90.00,80.00,33.00,70.00,6.00,10.00,12.00,13.00,2 +618,2023-02-24 06:52:03.000 +0500,216.00,216.00,30.00,80.00,74.00,70.00,5.00,10.00,12.00,13.00,2 +618,2023-02-24 06:52:03.000 +0500,219.00,219.00,5.00,80.00,35.00,70.00,7.00,10.00,12.50,13.00,4 +618,2023-02-24 06:52:03.000 +0500,222.00,222.00,90.00,80.00,99.00,70.00,2.00,10.00,13.60,13.00,4 +618,2023-02-24 06:52:03.000 +0500,222.00,221.00,33.00,80.00,20.00,70.00,0.00,10.00,13.00,13.00,4 +618,2023-02-24 06:52:03.000 +0500,222.00,222.00,100.00,100.00,96.00,70.00,4.00,10.00,12.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,225.00,225.00,106.00,100.00,78.00,70.00,5.00,10.00,11.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,228.00,228.00,102.00,100.00,77.00,70.00,6.00,10.00,12.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,231.00,231.00,98.00,100.00,85.00,70.00,8.00,12.00,11.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,234.00,234.00,200.00,100.00,32.00,70.00,5.00,12.00,10.00,15.00,0 +618,2023-02-24 06:52:03.000 +0500,237.00,237.00,200.00,100.00,88.00,70.00,9.00,12.00,10.00,15.00,0 +618,2023-02-24 06:52:03.000 +0500,240.00,240.00,94.00,100.00,63.00,70.00,6.00,12.00,11.00,15.00,1 +618,2023-02-24 06:52:03.000 +0500,240.00,233.00,96.00,100.00,66.00,70.00,0.00,12.00,10.00,15.00,1 +618,2023-02-24 06:52:03.000 +0500,240.00,240.00,82.00,80.00,92.00,105.00,0.50,12.00,11.00,15.00,1 +618,2023-02-24 06:52:03.000 +0500,243.00,243.00,12.00,80.00,100.00,105.00,11.50,12.00,12.00,15.00,3 +618,2023-02-24 06:52:03.000 +0500,246.00,246.00,15.00,80.00,92.00,105.00,11.00,12.00,11.00,15.00,3 +618,2023-02-24 06:52:03.000 +0500,249.00,249.00,36.00,80.00,90.00,105.00,12.00,12.00,14.00,15.00,3 +618,2023-02-24 06:52:03.000 +0500,252.00,252.00,55.00,80.00,60.00,105.00,12.50,12.00,13.00,15.00,3 +618,2023-02-24 06:52:03.000 +0500,255.00,255.00,78.00,80.00,90.00,105.00,12.00,12.00,14.00,15.00,3 +618,2023-02-24 06:52:03.000 +0500,258.00,258.00,33.00,80.00,80.00,105.00,10.00,12.00,14.70,15.00,4 +618,2023-02-24 06:52:03.000 +0500,261.00,261.00,54.00,80.00,70.00,105.00,10.00,12.00,18.00,15.00,4 +618,2023-02-24 06:52:03.000 +0500,262.00,262.00,55.00,80.00,90.00,105.00,10.00,12.00,13.00,15.00,0 +618,2023-02-24 06:52:03.000 +0500,262.00,261.00,57.00,80.00,90.00,105.00,0.00,12.00,10.00,15.00,0 diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test2_result.csv b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test2_result.csv new file mode 100644 index 00000000..7e1057af --- /dev/null +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test2_result.csv @@ -0,0 +1,8 @@ +"id_telemetry","depth_start","depth_end","id_feed_regulator","depth_drilling_quality" +618,205.00,210.00,1,2.00 +618,210.00,219.00,2,6.00 +618,219.00,222.00,4,3.00 +618,222.00,234.00,1,9.00 +618,240.00,243.00,1,3.00 +618,243.00,258.00,3,12.00 +618,258.00,262.00,4,3.00 diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test3.csv b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test3.csv new file mode 100644 index 00000000..83f053c2 --- /dev/null +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test3.csv @@ -0,0 +1,33 @@ +"id_telemetry","date","well_depth","bit_depth","block_speed","block_speed_sp","pressure","pressure_sp","axial_load","axial_load_sp","rotor_torque","rotor_torque_sp","id_feed_regulator" +618,2023-02-24 06:52:03.000 +0500,326.00,325.00,100.00,80.00,80.00,105.00,0.00,10.00,10.00,13.00,0 +618,2023-02-24 06:52:03.000 +0500,326.00,325.99,90.00,80.00,70.00,105.00,0.00,10.00,10.00,13.00,0 +618,2023-02-24 06:52:03.000 +0500,326.00,326.00,87.00,90.00,150.00,105.00,3.00,10.00,10.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,328.00,328.00,70.00,80.00,57.00,105.00,4.00,10.00,10.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,331.00,331.00,92.00,90.00,62.00,105.00,8.00,10.00,10.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,331.00,330.00,82.00,80.00,93.00,105.00,0.00,10.00,10.00,13.00,0 +618,2023-02-24 06:52:03.000 +0500,331.00,330.77,81.00,80.00,32.00,105.00,9.90,10.00,10.00,13.00,3 +618,2023-02-24 06:52:03.000 +0500,331.00,331.00,90.00,80.00,66.00,70.00,7.00,10.00,11.00,13.00,3 +618,2023-02-24 06:52:03.000 +0500,334.00,334.00,90.00,80.00,33.00,70.00,10.30,10.00,12.00,13.00,3 +618,2023-02-24 06:52:03.000 +0500,337.00,337.00,79.00,80.00,74.00,70.00,5.00,10.00,12.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,340.00,340.00,83.00,80.00,35.00,70.00,7.00,10.00,12.50,13.00,1 +618,2023-02-24 06:52:03.000 +0500,343.00,343.00,90.00,80.00,99.00,70.00,2.00,10.00,13.60,13.00,2 +618,2023-02-24 06:52:03.000 +0500,343.00,342.00,33.00,80.00,20.00,70.00,0.00,10.00,13.00,13.00,2 +618,2023-02-24 06:52:03.000 +0500,343.00,343.00,100.00,100.00,96.00,70.00,4.00,10.00,12.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,346.00,346.00,106.00,100.00,78.00,70.00,5.00,10.00,11.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,349.00,349.00,102.00,100.00,77.00,70.00,6.00,10.00,12.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,352.00,352.00,98.00,100.00,85.00,70.00,8.00,12.00,11.00,13.00,1 +618,2023-02-24 06:52:03.000 +0500,355.00,355.00,200.00,100.00,69.00,70.00,5.00,12.00,10.00,15.00,2 +618,2023-02-24 06:52:03.000 +0500,358.00,358.00,200.00,100.00,72.00,70.00,9.00,12.00,10.00,15.00,2 +618,2023-02-24 06:52:03.000 +0500,361.00,361.00,94.00,100.00,63.00,70.00,6.00,12.00,11.00,15.00,4 +618,2023-02-24 06:52:03.000 +0500,361.00,354.00,96.00,100.00,66.00,70.00,0.00,12.00,15.00,15.00,4 +618,2023-02-24 06:52:03.000 +0500,361.00,361.00,82.00,80.00,92.00,105.00,0.50,12.00,15.20,15.00,4 +618,2023-02-24 06:52:03.000 +0500,364.00,364.00,12.00,80.00,100.00,105.00,11.50,12.00,14.50,15.00,4 +618,2023-02-24 06:52:03.000 +0500,367.00,367.00,15.00,80.00,92.00,105.00,11.00,12.00,11.00,15.00,4 +618,2023-02-24 06:52:03.000 +0500,370.00,370.00,81.00,80.00,90.00,105.00,12.00,12.00,14.00,15.00,1 +618,2023-02-24 06:52:03.000 +0500,373.00,373.00,55.00,80.00,60.00,105.00,12.50,12.00,13.00,15.00,3 +618,2023-02-24 06:52:03.000 +0500,376.00,376.00,78.00,80.00,90.00,105.00,12.00,12.00,14.00,15.00,3 +618,2023-02-24 06:52:03.000 +0500,379.00,379.00,33.00,80.00,80.00,105.00,10.00,12.00,14.70,15.00,4 +618,2023-02-24 06:52:03.000 +0500,382.00,382.00,54.00,80.00,70.00,105.00,10.00,12.00,18.00,15.00,4 +618,2023-02-24 06:52:03.000 +0500,383.00,383.00,55.00,80.00,90.00,105.00,10.00,12.00,13.00,15.00,0 +618,2023-02-24 06:52:03.000 +0500,383.00,382.00,57.00,80.00,90.00,105.00,0.00,12.00,10.00,15.00,0 + diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test3_result.csv b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test3_result.csv new file mode 100644 index 00000000..3627439e --- /dev/null +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test3_result.csv @@ -0,0 +1,10 @@ +"id_telemetry","depth_start","depth_end","id_feed_regulator","depth_drilling_quality" +618,326.00,331.00,1,2.00 +618,331.00,337.00,3,3.00 +618,337.00,343.00,1,6.00 +618,343.00,355.00,1,9.00 +618,355.00,361.00,2,6.00 +618,361.00,370.00,4,6.00 +618,370.00,373.00,1,3.00 +618,373.00,379.00,3,6.00 +618,379.00,383.00,4,3.00 diff --git a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs index 3a6c19e0..065bbb3a 100644 --- a/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs +++ b/AsbCloudInfrastructure/Repository/DataSaubStatRepository.cs @@ -40,19 +40,28 @@ public class DataSaubStatRepository : IDataSaubStatRepository> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token) + public async Task> GetAsync(IEnumerable idsTelemetries, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token) { - var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours); + //todo + var timeSpanDict = new Dictionary(); + + idsTelemetries = idsTelemetries.Distinct(); + foreach (var idTelemetry in idsTelemetries) + { + var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours); + timeSpanDict.Add(idTelemetry, timeSpan); + } + var geDateUtc = geDate.ToUniversalTime(); var leDateUtc = leDate.ToUniversalTime(); var stats = await db.Set() - .Where(s => s.IdTelemetry == idTelemetry) + .Where(s => idsTelemetries.Contains(s.IdTelemetry)) .Where(s => s.DateStart >= geDateUtc) .Where(s => s.DateEnd <= leDateUtc) .ToArrayAsync(token); - var result = stats.Select(s => ConvertToDto(s, timeSpan)); + var result = stats.Select(s => ConvertToDto(s, timeSpanDict[s.IdTelemetry])); return result; } diff --git a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs index a058a9c4..f83932db 100644 --- a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs +++ b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs @@ -17,25 +17,33 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe private IDataSaubStatRepository dataSaubStatDrillingQualityRepository; private ITelemetryDataSaubService dataSaubService; private ITelemetryDataCache telemetryDataCache; + private ITelemetryService telemetryService; + + private static int IdFeedRegulatorRop = 1; + private static int IdFeedRegulatorPressureDelta = 2; + private static int IdFeedRegulatorAxialLoad = 3; + private static int IdFeedRegulatorTorque = 4; public Dictionary> QualitySettingsForFeedRegulators { get; } public DataSaubStatDrillingQualityService( IDataSaubStatRepository dataSaubStatDrillingQualityRepository, ITelemetryDataCache telemetryDataCache, - ITelemetryDataSaubService dataSaubService) + ITelemetryDataSaubService dataSaubService, + ITelemetryService telemetryService) { this.dataSaubStatDrillingQualityRepository = dataSaubStatDrillingQualityRepository; this.dataSaubService = dataSaubService; this.telemetryDataCache = telemetryDataCache; + this.telemetryService = telemetryService; Predicate hasQualityWithIdFeedRegulator1 = (TelemetryDataSaubDto spanItem) => (spanItem.BlockSpeed >= spanItem.BlockSpeedSp * 0.95 && spanItem.BlockSpeed <= spanItem.BlockSpeedSp * 1.05); Predicate hasQualityWithIdFeedRegulator2 = (TelemetryDataSaubDto spanItem) - => (spanItem.Pressure >= (spanItem.PressureSp - spanItem.PressureIdle) - 5 - && spanItem.Pressure <= (spanItem.PressureSp - spanItem.PressureIdle) + 5); + => (spanItem.Pressure >= (spanItem.PressureSp) - 5 + && spanItem.Pressure <= (spanItem.PressureSp) + 5); Predicate hasQualityWithIdFeedRegulator3 = (TelemetryDataSaubDto spanItem) => (spanItem.AxialLoad >= (spanItem.AxialLoadSp - 0.5) @@ -46,10 +54,10 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe && spanItem.RotorTorque <= (spanItem.RotorTorqueSp + 0.5)); QualitySettingsForFeedRegulators = new Dictionary>() { - { 1, hasQualityWithIdFeedRegulator1 }, - { 2, hasQualityWithIdFeedRegulator2 }, - { 3, hasQualityWithIdFeedRegulator3 }, - { 4, hasQualityWithIdFeedRegulator4 }, + { IdFeedRegulatorRop, hasQualityWithIdFeedRegulator1 }, + { IdFeedRegulatorPressureDelta, hasQualityWithIdFeedRegulator2 }, + { IdFeedRegulatorAxialLoad, hasQualityWithIdFeedRegulator3 }, + { IdFeedRegulatorTorque, hasQualityWithIdFeedRegulator4 }, }; } @@ -96,7 +104,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe if (dataSaub is not TelemetryDataSaubDto[] dataSaubArray) dataSaubArray = dataSaub.ToArray(); - + foreach (var item in QualitySettingsForFeedRegulators) { var data = CreateDataSaubStatDrillingQuality(item.Key, item.Value, dataSaubArray); @@ -125,16 +133,11 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe indexEnd = FindIndexEnd(indexStart, idFeedRegulator, dataSaub); var length = indexEnd - indexStart + 1; - - if (length <= 2) - continue; - var subset = dataSaub.AsSpan(indexStart, length); if ((subset[^1].WellDepth - subset[0].WellDepth) < 0.15) continue; // мелкие выборки не учитываем. - var stats = CalcStatsDrillingQuality(idFeedRegulator, subset, checkQuality); result.Add(stats); @@ -151,9 +154,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe { indexEnd = i; } - else if (dataSaub[i].IdFeedRegulator != idFeedRegulator) - break; - else + if (dataSaub[i].IdFeedRegulator != idFeedRegulator) break; } return indexEnd; @@ -185,4 +186,45 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe return result; } + + public async Task> GetStatAsync(DrillingQualityRequest request, CancellationToken token) + { + var telemetries = telemetryService.GetOrDefaultTelemetriesByIdsWells(request.IdsWell); + var idsTelemetriesWithIdWell = telemetries + .Where(t => t.IdWell.HasValue) + .ToDictionary(t => t.Id, t => t.IdWell!.Value); + + var dataSaubStatDrillingQuality = await dataSaubStatDrillingQualityRepository.GetAsync(idsTelemetriesWithIdWell.Keys, request.GeDate, request.LeDate, token); + + var dtosGroupedByIdTelemetries = dataSaubStatDrillingQuality + .GroupBy(s => new { s.IdTelemetry, s.IdFeedRegulator }) + .Select(stat => new + { + IdFeedRegulator = stat.Key.IdFeedRegulator, + IdTelemetry = stat.Key.IdTelemetry, + Kpd = (stat.Sum(s => s.DepthDrillingQuality) / stat.Sum(s => s.DepthEnd - s.DepthStart)) * 100, + }) + .GroupBy(stat => stat.IdTelemetry); + + var result = new List(); + foreach (var dtos in dtosGroupedByIdTelemetries) + { + var kpdValuesByIdFeedRegulator = dtos + .GroupBy(d => d.IdFeedRegulator) + .ToDictionary(d => d.Key, d => d.FirstOrDefault()!.Kpd); + + var item = new DrillingQualityDto() + { + IdWell = idsTelemetriesWithIdWell[dtos.Key], + KpdAxialLoad = kpdValuesByIdFeedRegulator.GetValueOrDefault(IdFeedRegulatorAxialLoad), + KpdPressureDelta = kpdValuesByIdFeedRegulator.GetValueOrDefault(IdFeedRegulatorPressureDelta), + KpdRop = kpdValuesByIdFeedRegulator.GetValueOrDefault(IdFeedRegulatorRop), + KpdTorque = kpdValuesByIdFeedRegulator.GetValueOrDefault(IdFeedRegulatorTorque) + }; + + result.Add(item); + } + + return result; + } } diff --git a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs index ec166d5d..8f05761f 100644 --- a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDrillingService.cs @@ -88,7 +88,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService var geDate = wellOperations.Min(p => p.DateStart); var leDate = wellOperations.Max(p => (p.DateStart.AddHours(p.DurationHours))); var dataSaubStats = - (await dataSaubStatRepository.GetAsync(well.IdTelemetry.Value, geDate, leDate, token)).ToArray(); + (await dataSaubStatRepository.GetAsync([well.IdTelemetry.Value], geDate, leDate, token)).ToArray(); if (!dataSaubStats.Any()) return Enumerable.Empty(); diff --git a/AsbCloudWebApi/Controllers/ServiceOperationController.cs b/AsbCloudWebApi/Controllers/ServiceOperationController.cs new file mode 100644 index 00000000..8221cd8f --- /dev/null +++ b/AsbCloudWebApi/Controllers/ServiceOperationController.cs @@ -0,0 +1,59 @@ +using AsbCloudApp.Data; +using AsbCloudApp.Services; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Services.WellReport; +using Microsoft.AspNetCore.Http; +using System; +using AsbCloudApp.Repositories; +using System.Linq; +using AsbCloudApp.Requests; +using AsbCloudInfrastructure.Services; + +namespace AsbCloudWebApi.Controllers; + +/// +/// +/// +[Route("api/[controller]")] +[ApiController] +//[Authorize] +public class ServiceOperationController : ControllerBase +{ + private readonly IWellService wellService; + private readonly IDataSaubStatRepository dataSaubStatRepository; + private readonly ITelemetryService telemetryService; + private readonly IDataSaubStatDrillingQualityService dataSaubStatDrillingQualityService; + + public ServiceOperationController( + IWellService wellService, + ITelemetryService telemetryService, + IDataSaubStatDrillingQualityService dataSaubStatDrillingQualityService, + IDataSaubStatRepository dataSaubStatRepository) + { + this.wellService = wellService; + this.dataSaubStatRepository = dataSaubStatRepository; + this.telemetryService = telemetryService; + this.dataSaubStatDrillingQualityService = dataSaubStatDrillingQualityService; + } + + /// + /// Возвращает данные для страницы "Качество" + /// + /// Параметры запроса + /// Токен отмены задачи + /// + [HttpGet("drillingQuality")] + [Permission] + [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] + public async Task GetDataSaubStatDrillingQualityAsync( + [FromQuery] DrillingQualityRequest request, CancellationToken token) + { + var result = await dataSaubStatDrillingQualityService.GetStatAsync(request, token); + return Ok(result); + } +} From f0f8044e77a9426ff1ebfddd36c350d08c9d3a5e Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Thu, 17 Oct 2024 15:42:01 +0500 Subject: [PATCH 21/22] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B0=D0=B2=D1=82=D0=BE=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0?= =?UTF-8?q?=D1=82=D0=B0=D0=BC=20=D1=80=D0=B5=D0=B2=D1=8C=D1=8E=20+=20?= =?UTF-8?q?=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D1=85?= =?UTF-8?q?=D0=B5=D0=BB=D0=BF=D0=B5=D1=80=20=D0=B4=D0=BB=D1=8F=20=D0=B8?= =?UTF-8?q?=D0=B7=D0=B2=D0=BB=D0=B5=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BC=D0=BE=D0=BA=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudInfrastructure.Tests/CsvMockHelper.cs | 46 ++++++++++ .../DataSaubStatDtillingQualityServiceTest.cs | 89 ++++++------------- .../Services/DataSaubStat/test1_result.csv | 4 +- 3 files changed, 75 insertions(+), 64 deletions(-) create mode 100644 AsbCloudInfrastructure.Tests/CsvMockHelper.cs diff --git a/AsbCloudInfrastructure.Tests/CsvMockHelper.cs b/AsbCloudInfrastructure.Tests/CsvMockHelper.cs new file mode 100644 index 00000000..2c9f2228 --- /dev/null +++ b/AsbCloudInfrastructure.Tests/CsvMockHelper.cs @@ -0,0 +1,46 @@ +using AsbCloudApp.Exceptions; +using CsvHelper; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Reflection; + +namespace AsbCloudInfrastructure.Tests; + +/// +/// Хелпер, который помогает получать мок-данные из csv файла +/// +public static class CsvMockHelper +{ + /// + /// метод получения данных из файла + /// + /// + /// путь до файла + /// + /// + public static IEnumerable Get(string path) + { + var resourceName = Assembly.GetExecutingAssembly() + .GetManifestResourceNames() + .Where(r => r.Contains(path)) + .FirstOrDefault(); + + if (String.IsNullOrEmpty(resourceName)) + throw new ArgumentInvalidException(nameof(path), "Файл с mock-данными не найден"); + + using var stream = Assembly.GetExecutingAssembly() + .GetManifestResourceStream(resourceName)!; + + using (var reader = new StreamReader(stream)) + { + using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) + { + var dataSaubMaps = csv.GetRecords().ToArray(); + return dataSaubMaps; + } + } + } +} diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs index 0ad9700c..0a3d4192 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/DataSaubStatDtillingQualityServiceTest.cs @@ -39,79 +39,44 @@ public class DataSaubStatDtillingQualityServiceTest [Theory] [InlineData("DataSaubStat.test3.csv", "DataSaubStat.test3_result.csv")] [InlineData("DataSaubStat.test2.csv", "DataSaubStat.test2_result.csv")] - //[InlineData("DataSaubStat.test1.csv", "DataSaubStat.test1_result.csv")] + [InlineData("DataSaubStat.test1.csv", "DataSaubStat.test1_result.csv")] public async Task Create_DataSaubStatDrillingQuality_From_CSVFile_ShouldReturn_Success( string pathMockData, string pathResult ) { - var resourceName = Assembly.GetExecutingAssembly() - .GetManifestResourceNames() - .Where(r => r.Contains(pathMockData)) - .FirstOrDefault(); + var mockData = CsvMockHelper.Get(pathMockData); + var dtoMockData = mockData.Select(x => x.Adapt()).ToArray(); - if (String.IsNullOrEmpty(resourceName)) - Assert.Fail("No mock data for test"); + dataSaubServiceMock + .Get(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) + .Returns(dtoMockData); - using var stream = Assembly.GetExecutingAssembly() - .GetManifestResourceStream(resourceName)!; + //act + var actualData = await dataSaubStatService.CreateStatDrillingQualityForTelemetry(1, DateTimeOffset.UnixEpoch, CancellationToken.None); - var actualData = Enumerable.Empty(); + var mockDataResult = CsvMockHelper.Get(pathResult); + var expectedData = mockDataResult.Select(x => x.Adapt()).ToArray(); - using (var reader = new StreamReader(stream)) - using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) + //assert + var actual = actualData + .OrderBy(d => d.IdFeedRegulator) + .ToArray(); + + var expected = expectedData + .OrderBy(d => d.IdFeedRegulator) + .ToArray(); + + Assert.Equal(expected.Count(), actual.Count()); + + for (var i = 0; i < actual.Count(); i++) { - var dataSaubMaps = csv.GetRecords().ToList(); - - var dtos = dataSaubMaps.Select(x => x.Adapt()).ToArray(); - - dataSaubServiceMock - .Get(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any()) - .Returns(dtos); - - //act - actualData = await dataSaubStatService.CreateStatDrillingQualityForTelemetry(1, DateTimeOffset.UnixEpoch, CancellationToken.None); - } - - resourceName = Assembly.GetExecutingAssembly() - .GetManifestResourceNames() - .Where(r => r.Contains(pathResult)) - .FirstOrDefault(); - - if (String.IsNullOrEmpty(resourceName)) - Assert.Fail("No mock data for test"); - - using var stream2 = Assembly.GetExecutingAssembly() - .GetManifestResourceStream(resourceName)!; - - using (var reader = new StreamReader(stream2)) - using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) - { - var dataSaubMaps = csv.GetRecords().ToList(); - var expectedData = dataSaubMaps.Select(x => x.Adapt()).ToArray(); - - //assert - var actual = actualData - .OrderBy(d => d.IdFeedRegulator) - .ToArray(); - - var expected = expectedData - .OrderBy(d => d.IdFeedRegulator) - .ToArray(); - - Assert.Equal(expected.Count(), actual.Count()); - - for (var i = 0; i < actual.Count(); i++) - { - var expectedItem = expected[i]; - var actualItem = actual[i]; - - Assert.True(Math.Abs(expectedItem.DepthStart - actualItem.DepthStart) < 0.000001); - Assert.True(Math.Abs(expectedItem.DepthEnd - actualItem.DepthEnd) < 0.000001); - Assert.True(Math.Abs(expectedItem.DepthDrillingQuality - actualItem.DepthDrillingQuality) < 0.000001); - } - + var expectedItem = expected[i]; + var actualItem = actual[i]; + Assert.True(Math.Abs(expectedItem.DepthStart - actualItem.DepthStart) < 0.000001); + Assert.True(Math.Abs(expectedItem.DepthEnd - actualItem.DepthEnd) < 0.000001); + Assert.True(Math.Abs(expectedItem.DepthDrillingQuality - actualItem.DepthDrillingQuality) < 0.000001); } } } diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1_result.csv b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1_result.csv index 64c49983..fe77a356 100644 --- a/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1_result.csv +++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStat/test1_result.csv @@ -1,2 +1,2 @@ -"id_telemetry","depth_start","depth_end","depth_drilling_quality" -419,46,251.279998779297,0.0 +"id_telemetry","depth_start","depth_end","id_feed_regulator","depth_drilling_quality" +618,303.545989990234,493.545989990234,1,50.00 From e5874a8cbab1deb99499f07daed5da737085f66a Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Thu, 17 Oct 2024 15:47:23 +0500 Subject: [PATCH 22/22] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D0=BB=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...roller.cs => DrillingQualityController.cs} | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) rename AsbCloudWebApi/Controllers/{ServiceOperationController.cs => DrillingQualityController.cs} (59%) diff --git a/AsbCloudWebApi/Controllers/ServiceOperationController.cs b/AsbCloudWebApi/Controllers/DrillingQualityController.cs similarity index 59% rename from AsbCloudWebApi/Controllers/ServiceOperationController.cs rename to AsbCloudWebApi/Controllers/DrillingQualityController.cs index 8221cd8f..9f4470f1 100644 --- a/AsbCloudWebApi/Controllers/ServiceOperationController.cs +++ b/AsbCloudWebApi/Controllers/DrillingQualityController.cs @@ -1,43 +1,27 @@ using AsbCloudApp.Data; +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; using AsbCloudApp.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Threading; using System.Threading.Tasks; -using AsbCloudApp.Services.WellReport; -using Microsoft.AspNetCore.Http; -using System; -using AsbCloudApp.Repositories; -using System.Linq; -using AsbCloudApp.Requests; -using AsbCloudInfrastructure.Services; namespace AsbCloudWebApi.Controllers; /// -/// +/// Контроллер для построения страницы "Качество" /// [Route("api/[controller]")] [ApiController] -//[Authorize] -public class ServiceOperationController : ControllerBase +[Authorize] +public class DrillingQualityController : ControllerBase { - private readonly IWellService wellService; - private readonly IDataSaubStatRepository dataSaubStatRepository; - private readonly ITelemetryService telemetryService; private readonly IDataSaubStatDrillingQualityService dataSaubStatDrillingQualityService; - public ServiceOperationController( - IWellService wellService, - ITelemetryService telemetryService, - IDataSaubStatDrillingQualityService dataSaubStatDrillingQualityService, - IDataSaubStatRepository dataSaubStatRepository) - { - this.wellService = wellService; - this.dataSaubStatRepository = dataSaubStatRepository; - this.telemetryService = telemetryService; + public DrillingQualityController(IDataSaubStatDrillingQualityService dataSaubStatDrillingQualityService) + { this.dataSaubStatDrillingQualityService = dataSaubStatDrillingQualityService; }