diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportDto.cs deleted file mode 100644 index ec87e260..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportDto.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections; -using System.Collections.Generic; - -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// DTO авто-сгенерированного суточного отчёта -/// -public class AutoGeneratedDailyReportDto : AutoGeneratedDailyReportInfoDto -{ - /// - /// Блок заголовка - /// - public HeadBlockDto Head { get; set; } = null!; - - /// - /// Блок подсистем - /// - public IEnumerable Subsystems { get; set; } = null!; - - /// - /// Блок ограничивающих параметров - /// - public IEnumerable LimitingParameters { get; set; } = null!; - - /// - /// Баланс времени - /// - public IEnumerable TimeBalance { get; set; } = null!; -} \ No newline at end of file diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportInfoDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportInfoDto.cs deleted file mode 100644 index 22e34cf2..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportInfoDto.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// Базовая информация о суточном отчёте -/// -public class AutoGeneratedDailyReportInfoDto : ReportInfoDto -{ - /// - /// Дата формирования отчёта - /// - public DateOnly ReportDate { get; set; } -} \ No newline at end of file diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/HeadBlockDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/HeadBlockDto.cs deleted file mode 100644 index 43ff5246..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/HeadBlockDto.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// Блок заголовка -/// -public class HeadBlockDto -{ - /// - /// Название скважины - /// - public string Well { get; set; } = null!; - - /// - /// Название куста - /// - public string Cluster { get; set; } = null!; - - /// - /// Заказчик - /// - public string Customer { get; set; } = null!; - - /// - /// Месторождение - /// - public string Deposit { get; set; } = null!; - - /// - /// Глубина забоя на дату начала интервала - /// - public double DepthFrom { get; set; } - - /// - /// Глубина забоя на дату окончания интервала - /// - public double DepthTo { get; set; } -} \ No newline at end of file diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/LimitingParameterRecordDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/LimitingParameterRecordDto.cs deleted file mode 100644 index e62b32d9..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/LimitingParameterRecordDto.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// Блок ограничивающих параметров -/// -public class LimitingParameterRecordDto -{ - /// - /// Время использования, мин - /// - public double Hours { get; set; } - - /// - /// Проходка, м - /// - public double Depth { get; set; } - - /// - /// Название ограничивающего параметра - /// - public string NameFeedRegulator { get; set; } = null!; - - /// - /// Процент по проходке, % - /// - public double PercentDepth { get; set; } -} \ No newline at end of file diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/SubsystemRecordDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/SubsystemRecordDto.cs deleted file mode 100644 index 34b2e4a7..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/SubsystemRecordDto.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// Блок подсистем -/// -public class SubsystemRecordDto -{ - /// - /// Название подсистемы - /// - public string Name { get; set; } = null!; - - /// - /// Использование, % - /// - public double KUsage { get; set; } - - /// - /// Время работы, ч - /// - public double UsedTimeHours { get; set; } - - /// - /// Проходка - /// - public double Depth { get; set; } -} \ No newline at end of file diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/TimeBalanceRecordDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/TimeBalanceRecordDto.cs deleted file mode 100644 index a6ac9845..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/TimeBalanceRecordDto.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// Баланс времени -/// -public class TimeBalanceRecordDto -{ - /// - /// Название операции - /// - public string Name { get; set; } = null!; - - /// - /// Продолжительность, часы - /// - public double DurationHours { get; set; } -} \ No newline at end of file diff --git a/AsbCloudApp/Data/BackgroundWorkDto.cs b/AsbCloudApp/Data/BackgroundWorkDto.cs index 3374148c..500f818a 100644 --- a/AsbCloudApp/Data/BackgroundWorkDto.cs +++ b/AsbCloudApp/Data/BackgroundWorkDto.cs @@ -180,12 +180,12 @@ namespace AsbCloudApp.Data /// protected void SetStatusComplete() { + CountComplete++; if (CurrentState is null) return; LastComplete = new(CurrentState); CurrentState = null; - CountComplete++; Trace.TraceInformation($"{WorkNameForTrace} state: completed"); } @@ -194,12 +194,12 @@ namespace AsbCloudApp.Data /// protected void SetLastError(string errorMessage) { + CountErrors++; if (CurrentState is null) return; LastError = new LastErrorInfo(CurrentState, errorMessage); CurrentState = null; - CountErrors++; Trace.TraceError($"{WorkNameForTrace} throw exception[{CountErrors}]: {errorMessage}"); } } diff --git a/AsbCloudApp/Data/DailyReport/BhaDto.cs b/AsbCloudApp/Data/DailyReport/BhaDto.cs deleted file mode 100644 index b39ba11c..00000000 --- a/AsbCloudApp/Data/DailyReport/BhaDto.cs +++ /dev/null @@ -1,64 +0,0 @@ -namespace AsbCloudApp.Data.DailyReport -{ - /// - /// блок КНБК - /// - public class BhaDto : ItemInfoDto - { - /// - /// КНБК описание - /// - public string BHADescription { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2195-2763м. Время начала - /// - public string ExtensionDrillingOneBegin{ get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2195-2763м. Время окончания - /// - public string ExtensionDrillingOneFinish { get; set; } = string.Empty; - - /// - /// Промывка. Время начала - /// - public string SluiceBegin { get; set; } = string.Empty; - - /// - /// Промывка. Время окончания - /// - public string SluiceFinish { get; set; } = string.Empty; - - /// - /// Подъем КНБК. Время начала - /// - public string ClimbBegin { get; set; } = string.Empty; - - /// - /// Подъем КНБК. Время окончания - /// - public string ClimbFinish { get; set; } = string.Empty; - - /// - /// Спуск КНБК. Время начала - /// - public string DescentBegin { get; set; } = string.Empty; - - /// - /// Спуск КНБК. Время окончания - /// - public string DescentFinish { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2763-2850м. Время начала - /// - public string ExtensionDrillingTwoBegin { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2763-2850м. Время окончания - /// - public string ExtensionDrillingTwoFinish { get; set; } = string.Empty; - } -} - diff --git a/AsbCloudApp/Data/DailyReport/Blocks/ProcessMapWellDrillingRecordDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/ProcessMapWellDrillingRecordDto.cs new file mode 100644 index 00000000..d51d4b5d --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/ProcessMapWellDrillingRecordDto.cs @@ -0,0 +1,27 @@ +namespace AsbCloudApp.Data.DailyReport.Blocks; + +/// +/// РТК +/// +public class ProcessMapWellDrillingRecordDto +{ + /// + /// Режим бурения + /// + public string DrillingMode { get; set; } = null!; + + /// + /// Мех. скорость + /// + public PlanFactDto Rop { get; set; } = new(); + + /// + /// Глубина ствола + /// + public double? WellBoreDepth { get; set; } + + /// + /// Часы бурения + /// + public double MechDrillingHours { get; set; } +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/ScheduleRecordDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/ScheduleRecordDto.cs new file mode 100644 index 00000000..91f11af4 --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/ScheduleRecordDto.cs @@ -0,0 +1,32 @@ +namespace AsbCloudApp.Data.DailyReport.Blocks; + +/// +/// Блок с графиком работы +/// +public class ScheduleRecordDto +{ + /// + /// Начало смены + /// + public TimeDto? ShiftStart { get; set; } + + /// + /// Конец смены + /// + public TimeDto? ShiftEnd { get; set; } + + /// + /// Имя бурильщика + /// + public string? Name { get; set; } + + /// + /// Фамилия бурильщика + /// + public string? Surname { get; set; } + + /// + /// Отчество бурильщика + /// + public string? Patronymic { get; set; } +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/Sign/SignBlockDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/Sign/SignBlockDto.cs new file mode 100644 index 00000000..d425f360 --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/Sign/SignBlockDto.cs @@ -0,0 +1,17 @@ +namespace AsbCloudApp.Data.DailyReport.Blocks.Sign; + +/// +/// Блок с подписями +/// +public class SignBlockDto : ItemInfoDto +{ + /// + /// Подпись мастера буровой + /// + public SignRecordDto? DrillingMaster { get; set; } + + /// + /// Подпись супервайзера + /// + public SignRecordDto? Supervisor { get; set; } +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/Sign/SignRecordDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/Sign/SignRecordDto.cs new file mode 100644 index 00000000..2196224e --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/Sign/SignRecordDto.cs @@ -0,0 +1,28 @@ +namespace AsbCloudApp.Data.DailyReport.Blocks.Sign; + +/// +/// Подпись +/// +public class SignRecordDto +{ + /// + /// Имя + /// + public string Name { get; set; } = null!; + + /// + /// Фамилия + /// + public string Surname { get; set; } = null!; + + /// + /// Отчество + /// + public string? Patronymic { get; set; } + + /// + public override string ToString() + { + return $"{Surname} {Name} {Patronymic}"; + } +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemBlockDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemBlockDto.cs new file mode 100644 index 00000000..605b8bdf --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemBlockDto.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using System.Linq; + +namespace AsbCloudApp.Data.DailyReport.Blocks.Subsystems; + +/// +/// Блок статистики работы подсистем +/// +public class SubsystemBlockDto : ItemInfoDto +{ + /// + /// Длина ствола скважины + /// + public double? Wellbore { get; set; } + + /// + /// Кол-во замеров за сутки + /// + public double? MeasurementsPerDay { get; set; } + + /// + /// Общая плановая мех. скорость + /// + public double? TotalRopPlan { get; set; } + + /// + /// Отклонение по ГГД, сут + /// + public double? TvgLagDays { get; set; } + + /// + /// Рекомендации специалиста + /// + public string? Comment { get; set; } + + /// + /// Подсистемы + /// + public IEnumerable Subsystems { get; set; } = Enumerable.Empty(); +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemParametersDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemParametersDto.cs new file mode 100644 index 00000000..e02d8714 --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemParametersDto.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations; + +namespace AsbCloudApp.Data.DailyReport.Blocks.Subsystems; + +/// +/// Параметры наработки подсистемы +/// +public class SubsystemParametersDto +{ + /// + /// Сумма изменения глубин при включенной подсистеме + /// + public double? SumDepthInterval { get; set; } + + /// + /// Наработка подсистемы + /// + public double? UsedTimeHours { get; set; } + + /// + /// Коэффициент использования + /// + [Range(0, 1)] + public double? KUsage { get; set; } +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemRecordDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemRecordDto.cs new file mode 100644 index 00000000..fab29d57 --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/Subsystems/SubsystemRecordDto.cs @@ -0,0 +1,22 @@ +namespace AsbCloudApp.Data.DailyReport.Blocks.Subsystems; + +/// +/// Модуль подсистемы +/// +public class SubsystemRecordDto +{ + /// + /// Название подсистемы + /// + public string Name { get; set; } = null!; + + /// + /// Использование подсистемы за сутки + /// + public SubsystemParametersDto? UsagePerDay { get; set; } + + /// + /// Использование подсистемы за скважину + /// + public SubsystemParametersDto? UsagePerWell { get; set; } +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/TimeBalance/TimeBalanceBlockDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/TimeBalance/TimeBalanceBlockDto.cs new file mode 100644 index 00000000..f58ed0ac --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/TimeBalance/TimeBalanceBlockDto.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; + +namespace AsbCloudApp.Data.DailyReport.Blocks.TimeBalance; + +/// +/// Блок с балансом времени +/// +public class TimeBalanceBlockDto : ItemInfoDto +{ + /// + /// Идентификатор секции + /// + [Range(1, int.MaxValue)] + public int IdSection { get; set; } + + /// + /// Название секции + /// + public string? SectionName { get; set; } + + /// + /// Проходка скважины + /// + public PlanFactDto WellDepth { get; set; } = new(); + + /// + /// Кол-во наращиваний за сутки + /// + public double? WellOperationSlipsTimeCount { get; set; } + + /// + /// Операции на скважине + /// + public IEnumerable WellOperations { get; set; } = Enumerable.Empty(); +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/TimeBalance/TimeBalanceRecordDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/TimeBalance/TimeBalanceRecordDto.cs new file mode 100644 index 00000000..5bdbec9a --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/TimeBalance/TimeBalanceRecordDto.cs @@ -0,0 +1,35 @@ +namespace AsbCloudApp.Data.DailyReport.Blocks.TimeBalance; + +/// +/// Операции проводимые на скважине +/// +public class TimeBalanceRecordDto +{ + /// + /// Мех. бурение - 1 + /// Снятие замера, ориентирование - 2 + /// Наращивание, выход на режим - 3 + /// Промывка, проработка - 4 + /// + public int IdWellOperation { get; set; } + + /// + /// Продолжительность операции, ч + /// + public PlanFactDto DurationHours { get; set; } = new(); + + /// + /// Отклонение за секцию + /// + public double? DrillingDeviationPerSection { get; set; } + + /// + /// Отклонение за сутки + /// + public double? DrillingDeviationPerDay { get; set; } + + /// + /// Причина отклонения + /// + public string? ReasonDeviation { get; set; } +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/TrajectoryBlockDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/TrajectoryBlockDto.cs new file mode 100644 index 00000000..39e49b54 --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/TrajectoryBlockDto.cs @@ -0,0 +1,27 @@ +namespace AsbCloudApp.Data.DailyReport.Blocks; + +/// +/// Блок с траекторией скважины +/// +public class TrajectoryBlockDto +{ + /// + /// Глубина по стволу + /// + public double? WellboreDepth { get; set; } + + /// + /// Глубина вертикальная + /// + public double? VerticalDepth { get; set; } + + /// + /// Угол зенитный + /// + public double? ZenithAngle { get; set; } + + /// + /// Азимут Географ. + /// + public double? AzimuthGeo { get; set; } +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/WellOperation/WellOperationBlockDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/WellOperation/WellOperationBlockDto.cs new file mode 100644 index 00000000..f12fd6f3 --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/WellOperation/WellOperationBlockDto.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; + +namespace AsbCloudApp.Data.DailyReport.Blocks.WellOperation; + +/// +/// Блок с операциями проводимыми на скважине +/// +public class WellOperationBlockDto +{ + /// + /// Продолжительность бурения за секцию + /// + public double SectionDrillingHours { get; set; } + + /// + /// Операции проводимые на скважине + /// + public IEnumerable WellOperations { get; set; } = Enumerable.Empty(); +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/Blocks/WellOperation/WellOperationRecordDto.cs b/AsbCloudApp/Data/DailyReport/Blocks/WellOperation/WellOperationRecordDto.cs new file mode 100644 index 00000000..1d627282 --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/Blocks/WellOperation/WellOperationRecordDto.cs @@ -0,0 +1,17 @@ +namespace AsbCloudApp.Data.DailyReport.Blocks.WellOperation; + +/// +/// Операция на скважине +/// +public class WellOperationRecordDto +{ + /// + /// Название категории + /// + public string? CategoryName { get; set; } + + /// + /// Продолжительность операции + /// + public double? DurationHours { get; set; } +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/DailyReportDto.cs b/AsbCloudApp/Data/DailyReport/DailyReportDto.cs index 3ba55718..0caeea30 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportDto.cs +++ b/AsbCloudApp/Data/DailyReport/DailyReportDto.cs @@ -1,45 +1,108 @@ using System; +using System.Collections.Generic; +using System.Linq; +using AsbCloudApp.Data.DailyReport.Blocks; +using AsbCloudApp.Data.DailyReport.Blocks.Sign; +using AsbCloudApp.Data.DailyReport.Blocks.Subsystems; +using AsbCloudApp.Data.DailyReport.Blocks.TimeBalance; +using AsbCloudApp.Data.DailyReport.Blocks.WellOperation; -namespace AsbCloudApp.Data.DailyReport +namespace AsbCloudApp.Data.DailyReport; + +/// +/// Суточный отчёт +/// +public class DailyReportDto : IId, + IWellRelated { - /// - /// Блоки для формирования суточного рапорта - /// - public class DailyReportDto - { - /// - /// дата отчёта - /// - public DateOnly StartDate { get; set; } + /// + public int Id { get; set; } - /// - /// блок заголовка - /// - public HeadDto Head { get; set; } = new(); + /// + public int IdWell { get; set; } - /// - /// блок КНБК - /// - public BhaDto Bha { get; set; } = new(); + /// + /// Название скважины + /// + public string WellCaption { get; set; } = null!; - /// - /// блок безметражные работы - /// - public NoDrillingDto NoDrilling { get; set; } = new(); + /// + /// Название типа скважины + /// + public string? WellType { get; set; } - /// - /// блок баланса времени - /// - public TimeBalanceDto TimeBalance { get; set; } = new(); + /// + /// Название куста + /// + public string? Cluster { get; set; } - /// - /// блок САУБ - /// - public SaubDto Saub { get; set; } = new(); + /// + /// Заказчик + /// + public string? Customer { get; set; } - /// - /// блок подписи - /// - public SignDto Sign { get; set; } = new(); - } -} + /// + /// Подрядчик + /// + public string? Contractor { get; set; } + + /// + /// Месторождение + /// + public string? Deposit { get; set; } + + /// + /// Глубина забоя на дату начала интервала + /// + public double? DepthStart { get; set; } + + /// + /// Глубина забоя на дату окончания интервала + /// + public double? DepthEnd { get; set; } + + /// + /// Дата формирования отчёта + /// + public DateTime Date { get; set; } + + /// + /// Дата последнего обновления + /// + public DateTime? DateLastUpdate { get; set; } + + /// + /// Блок фактической траектории + /// + public TrajectoryBlockDto TrajectoryBlock { get; set; } = null!; + + /// + /// Фактические операции + /// + public WellOperationBlockDto FactWellOperationBlock { get; set; } = null!; + + /// + /// Баланс времени + /// + public TimeBalanceBlockDto? TimeBalanceBlock { get; set; } + + /// + /// Наработка подсистем + /// + public SubsystemBlockDto? SubsystemBlock { get; set; } + + /// + /// Подпись + /// + public SignBlockDto? SignBlock { get; set; } + + /// + /// Блок расписания + /// + public IEnumerable ScheduleBlock { get; set; } = Enumerable.Empty(); + + /// + /// РТК + /// + public IEnumerable ProcessMapWellDrillingBlock { get; set; } = Enumerable.Empty(); +} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/HeadDto.cs b/AsbCloudApp/Data/DailyReport/HeadDto.cs deleted file mode 100644 index 173d4e63..00000000 --- a/AsbCloudApp/Data/DailyReport/HeadDto.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -namespace AsbCloudApp.Data.DailyReport -{ - /// - /// блок заголовка - /// - public class HeadDto : ItemInfoDto - { - /// - /// название скважины - /// - public string WellName { get; set; } = string.Empty; - - /// - /// название куста - /// - public string ClusterName { get; set; } = string.Empty; - - /// - /// заказчик - /// - public string Customer { get; set; } = string.Empty; - - /// - /// подрядчик - /// - public string Contractor { get; set; } = string.Empty; - - /// - /// дата рапорта - /// - public DateOnly ReportDate { get; set; } - - /// - /// глубина забоя на дату начала интервала - /// - public double? WellDepthIntervalStartDate { get; set; } - - /// - /// глубина забоя на дату окончания интервала - /// - public double? WellDepthIntervalFinishDate { get; set; } - - /// - /// Глубина забоя по стволу на окончание отчетного периода - /// - public double? BottomholeDepth { get; set; } - - /// - /// Глубина забоя по вертикали на дату окончания отчетного периода - /// - public double? VerticalDepth { get; set; } - - /// - /// Зенитный угол на дату окончания отчетного периода - /// - public double? ZenithAngle { get; set; } - - /// - /// Азимутальный угол на дату окончания отчетного периода - /// - public double? AzimuthAngle { get; set; } - - /// - /// ФИО бурильщиков - /// - public string FirstDriller { get; set; } = string.Empty; - - /// - /// ФИО бурильщиков - /// - public string SecondDriller { get; set; } = string.Empty; - - /// - /// Время работы АПД - /// - public double? WorkTimeSAUB { get; set; } - - /// - /// Время работы спин мастер - /// - public double? WorkTimeSpinMaster { get; set; } - - /// - /// Время работы torqueMaster - /// - public double? WorkTimeTorkMaster { get; set; } - - /// - /// количество метров пробуренных с включенным АПД - /// - public double? PenetrationSAUB { get; set; } - - /// - /// количество метров пробуренных с включенным Спин мастер - /// - public double? PenetrationSpinMaster { get; set; } - - /// - /// количество метров пробуренных с включенным torqueMaster - /// - public double? PenetrationTorkMaster { get; set; } - - /// - /// Количество запусков МСЕ - /// - public int CountLaunchesMSE { get; set; } - } -} - diff --git a/AsbCloudApp/Data/DailyReport/NoDrillingDto.cs b/AsbCloudApp/Data/DailyReport/NoDrillingDto.cs deleted file mode 100644 index ff08eb2f..00000000 --- a/AsbCloudApp/Data/DailyReport/NoDrillingDto.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace AsbCloudApp.Data.DailyReport -{ - /// - /// блок безметражные работы - /// - public class NoDrillingDto : ItemInfoDto - { - /// - /// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию - /// - public double? StandardTimeBarrelPreparation { get; set; } - - /// - /// Нормативное время на одну операцию по наращиванию - /// - public double? StandardTimeExtension { get; set; } - - /// - /// Фактическое время проработок при подготовке ствола скважины к наращиванию. - /// - public double? ActualTimeBarrelPreparation { get; set; } - - /// - /// Фактическое время наращиваний - /// - public double? ActualTimeExtension { get; set; } - } -} - diff --git a/AsbCloudApp/Data/DailyReport/SaubDto.cs b/AsbCloudApp/Data/DailyReport/SaubDto.cs deleted file mode 100644 index b59ef9ff..00000000 --- a/AsbCloudApp/Data/DailyReport/SaubDto.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System.Collections.Generic; - -namespace AsbCloudApp.Data.DailyReport -{ - /// - /// блок САУБ - /// - public class SaubDto : ItemInfoDto - { - /// - /// Режимы бурения в роторе - /// - public string RotorDrillingModes { get; set; } = string.Empty; - - /// - /// режимы бурения в слайде - /// - public string SlideDrillingModes { get; set; } = string.Empty; - - /// - /// Количество метров пробуренных в роторе за отчетный период - /// - public double? PenetrationInRotor { get; set; } - - /// - /// Количество часов бурения в роторе за отчетный период - /// - public double? NumberDrillingHours { get; set; } - - /// - /// средний диф перепад в роторе за отчетный период - /// - public double? AVGDiffDropRotor { get; set; } - - /// - /// количество метров пробуренных в слайде за отчетный период - /// - public double? PenetrationInSlide { get; set; } - - /// - /// время бурения в роторе за отчетный период - /// - public double? DrillingTimeInRotor { get; set; } - - /// - /// средний диф. перепад в слайде за отчетный период - /// - public double? AVGDiffPressureSlide { get; set; } - - /// - /// Плановая МСП за секцию - /// - public double? SectionROPPlan { get; set; } - - /// - /// Общее время бурения за секцию - /// - public double? SectionDrillingTimeTotal { get; set; } - - /// - /// Общая проходка за секцию - /// - public double? SectionPenetrationTotal { get; set; } - - /// - /// Количество наращиваний за отчетный период - /// - public int ExtensionsCount { get; set; } - - /// - /// Отклонение относительно ГГД - /// - public double? DeviationFromTVD { get; set; } - - /// - /// указываются все причины, которые влияют на снижение МСП. - /// - public string DeclinesReasonsROP { get; set; } = string.Empty; - - /// - /// Увеличение мех скорости за секцию % - /// - public string IncreaseSpeedSection { get; set; } = string.Empty; - - /// - /// Увеличение мех скорости за сутки % - /// - public string IncreaseSpeedDay { get; set; } = string.Empty; - - /// - /// Сокращение времени бурения за секцию, ч - /// - public string ReductionTimeDrilling { get; set; } = string.Empty; - - /// - /// Ротор/Слайд % - /// - public string RotorSlidePercent { get; set; } = string.Empty; - - /// - /// МСП - /// - public string MspSection { get; set; } = string.Empty; - - } -} - diff --git a/AsbCloudApp/Data/DailyReport/SignDto.cs b/AsbCloudApp/Data/DailyReport/SignDto.cs deleted file mode 100644 index f6726bb7..00000000 --- a/AsbCloudApp/Data/DailyReport/SignDto.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace AsbCloudApp.Data.DailyReport -{ - /// - /// блок подписи - /// - public class SignDto : ItemInfoDto - { - /// - /// ФИО Мастера буровой - /// - public string DrillingMaster { get; set; } = null!; - - /// - /// ФИО супервайзера - /// - public string Supervisor { get; set; } = null!; - } -} - diff --git a/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs b/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs deleted file mode 100644 index 855d5fd7..00000000 --- a/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; - -namespace AsbCloudApp.Data.DailyReport -{ - - /// - /// Блок баланса времени - /// - public class TimeBalanceDto : ItemInfoDto - { - /// - /// Статистика по операциям - /// - public Dictionary OperationsStat { get; set; } = new Dictionary(); - - } -} - diff --git a/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs b/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs index 49a96faf..aba5593f 100644 --- a/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs +++ b/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs @@ -7,92 +7,92 @@ namespace AsbCloudApp.Data.ProcessMaps.Report; /// public class ProcessMapReportWellDrillingDto { - /// - /// Идентификатор скважины - /// - public int IdWell { get; set; } + /// + /// Идентификатор скважины + /// + public int IdWell { get; set; } - /// - /// Id секции скважины - /// - public int IdWellSectionType { get; set; } + /// + /// Id секции скважины + /// + public int IdWellSectionType { get; set; } - /// - /// Название секции скважины - /// - public string WellSectionTypeName { get; set; } = null!; + /// + /// Название секции скважины + /// + public string WellSectionTypeName { get; set; } = null!; - /// - /// Глубина по стволу от, м - /// - /// на начало интервала - /// - /// - public double DepthStart { get; set; } + /// + /// Глубина по стволу от, м + /// + /// на начало интервала + /// + /// + public double DepthStart { get; set; } - /// - /// Глубина по стволу до, м - /// - /// на конец интервала - /// - /// - public double DepthEnd { get; set; } + /// + /// Глубина по стволу до, м + /// + /// на конец интервала + /// + /// + public double DepthEnd { get; set; } - /// - /// Дата/ время - /// - /// на начало интервала - /// - /// - public DateTime DateStart { get; set; } + /// + /// Дата/ время + /// + /// на начало интервала + /// + /// + public DateTime DateStart { get; set; } - /// - /// Время мех бурения, ч - /// - public double MechDrillingHours { get; set; } + /// + /// Время мех бурения, ч + /// + public double MechDrillingHours { get; set; } - /// - /// Режим бурения (Ротор/слайд/ручной) - /// - public string DrillingMode { get; set; } = null!; + /// + /// Режим бурения (Ротор/слайд/ручной) + /// + public string DrillingMode { get; set; } = null!; - /// - /// Проходка, м - /// - public double? DeltaDepth { get; set; } + /// + /// Проходка, м + /// + public double? DeltaDepth { get; set; } - /// - /// Перепад давления, атм - /// - public ProcessMapReportWellDrillingParamsDto PressureDiff { get; set; } = new(); + /// + /// Перепад давления, атм + /// + public ProcessMapReportWellDrillingParamsDto PressureDiff { get; set; } = new(); - /// - /// Нагрузка, т - /// - public ProcessMapReportWellDrillingParamsDto AxialLoad { get; set; } = new(); + /// + /// Нагрузка, т + /// + public ProcessMapReportWellDrillingParamsDto AxialLoad { get; set; } = new(); - /// - /// Момент на ВСП, кНхМ - /// - public ProcessMapReportWellDrillingParamsDto TopDriveTorque { get; set; } = new(); + /// + /// Момент на ВСП, кНхМ + /// + public ProcessMapReportWellDrillingParamsDto TopDriveTorque { get; set; } = new(); - /// - /// Ограничение скорости, м/ч - /// - public ProcessMapReportWellDrillingParamsDto SpeedLimit { get; set; } = new(); + /// + /// Ограничение скорости, м/ч + /// + public ProcessMapReportWellDrillingParamsDto SpeedLimit { get; set; } = new(); - /// - /// Процент использования системы АПД план, % - /// - public double UsagePlan { get; set; } + /// + /// Процент использования системы АПД план, % + /// + public double UsagePlan { get; set; } - /// - /// Процент использования системы АПД факт, % - /// - public double UsageFact { get; set; } + /// + /// Процент использования системы АПД факт, % + /// + public double UsageFact { get; set; } - /// - /// Фактическая механическая скорость, м/ч - /// - public double? Rop { get; set; } + /// + /// Механическая скорость, м/ч + /// + public PlanFactDto Rop { get; set; } } \ No newline at end of file diff --git a/AsbCloudApp/Repositories/IDailyReportRepository.cs b/AsbCloudApp/Repositories/IDailyReportRepository.cs new file mode 100644 index 00000000..6e59941d --- /dev/null +++ b/AsbCloudApp/Repositories/IDailyReportRepository.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.DailyReport; +using AsbCloudApp.Requests; +using AsbCloudApp.Services; + +namespace AsbCloudApp.Repositories; + +/// +/// Суточные отчёты +/// +public interface IDailyReportRepository : ICrudRepository +{ + /// + /// Получить список суточный отчёт по скважине + /// + /// + /// + /// + /// + Task> GetAsync(int idWell, FileReportRequest request, CancellationToken cancellationToken); + + /// + /// Получить суточный отчёт + /// + /// + /// + /// + /// + Task GetOrDefaultAsync(int idWell, DateTime date, CancellationToken cancellationToken); +} \ No newline at end of file diff --git a/AsbCloudApp/Repositories/ITrajectoryFactRepository.cs b/AsbCloudApp/Repositories/ITrajectoryFactRepository.cs index 95e991f5..79838333 100644 --- a/AsbCloudApp/Repositories/ITrajectoryFactRepository.cs +++ b/AsbCloudApp/Repositories/ITrajectoryFactRepository.cs @@ -1,16 +1,23 @@ -using AsbCloudApp.Data; -using AsbCloudApp.Data.WITS; -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using AsbCloudApp.Data; +using AsbCloudApp.Requests; namespace AsbCloudApp.Repositories { - /// - /// CRUD для работы с фактической траекторией из клиента - /// - /// - public interface ITrajectoryFactRepository : ITrajectoryRepository - { - } -} + /// + /// CRUD для работы с фактической траекторией из клиента + /// + /// + public interface ITrajectoryFactRepository : ITrajectoryRepository + { + /// + /// Получить траектории скважины + /// + /// + /// + /// + Task> GetAsync(TrajectoryGeoFactRequest request, CancellationToken token); + } +} \ No newline at end of file diff --git a/AsbCloudApp/Requests/TrajectoryFactRequest.cs b/AsbCloudApp/Requests/TrajectoryFactRequest.cs new file mode 100644 index 00000000..c0169fd5 --- /dev/null +++ b/AsbCloudApp/Requests/TrajectoryFactRequest.cs @@ -0,0 +1,24 @@ +using System; + +namespace AsbCloudApp.Requests; + +/// +/// Запрос для получения фактической траектории +/// +public class TrajectoryGeoFactRequest : RequestBase +{ + /// + /// Идентификатор скважины + /// + public int IdWell { get; set; } + + /// + /// Больше или равно дате + /// + public DateTime? GeDate { get; set; } + + /// + /// Меньше или равно дате + /// + public DateTime? LeDate { get; set; } +} \ No newline at end of file diff --git a/AsbCloudApp/Services/AutoGeneratedDailyReports/IAutoGeneratedDailyReportService.cs b/AsbCloudApp/Services/AutoGeneratedDailyReports/IAutoGeneratedDailyReportService.cs deleted file mode 100644 index 979f948c..00000000 --- a/AsbCloudApp/Services/AutoGeneratedDailyReports/IAutoGeneratedDailyReportService.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using AsbCloudApp.Data; -using AsbCloudApp.Data.AutogeneratedDailyReport; -using AsbCloudApp.Requests; - -namespace AsbCloudApp.Services.AutoGeneratedDailyReports; - -/// -/// Сервис для работы с авто-генерируемыми суточными отчётами -/// -public interface IAutoGeneratedDailyReportService -{ - /// - /// Список файлов суточных отчётов - /// - /// - /// - /// - /// - Task> GetListAsync(int idWell, - FileReportRequest request, - CancellationToken cancellationToken); - - /// - /// Генерация файла с отчётом - /// - /// - /// - /// - /// - Task<(string fileName, Stream stream)> GenerateAsync(int idWell, DateOnly reportDate, - CancellationToken cancellationToken); - - /// - /// Получение диапазона дат - /// - /// - /// - /// - Task GetDatesRangeAsync(int idWell, CancellationToken cancellationToken); -} \ No newline at end of file diff --git a/AsbCloudApp/Services/DailyReport/IDailyReportExportService.cs b/AsbCloudApp/Services/DailyReport/IDailyReportExportService.cs new file mode 100644 index 00000000..fb9a897a --- /dev/null +++ b/AsbCloudApp/Services/DailyReport/IDailyReportExportService.cs @@ -0,0 +1,21 @@ +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace AsbCloudApp.Services.DailyReport; + +/// +/// Сервис экспорта суточного отчёта +/// +public interface IDailyReportExportService +{ + /// + /// Экспортировать + /// + /// + /// + /// + /// + Task<(string FileName, Stream File)> ExportAsync(int idWell, DateTime dailyReportDateStart, CancellationToken cancellationToken); +} \ No newline at end of file diff --git a/AsbCloudApp/Services/DailyReport/IDailyReportService.cs b/AsbCloudApp/Services/DailyReport/IDailyReportService.cs new file mode 100644 index 00000000..44283a44 --- /dev/null +++ b/AsbCloudApp/Services/DailyReport/IDailyReportService.cs @@ -0,0 +1,53 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data; +using AsbCloudApp.Data.DailyReport; +using AsbCloudApp.Requests; + +namespace AsbCloudApp.Services.DailyReport; + +/// +/// Суточные отчёты +/// +public interface IDailyReportService +{ + /// + /// Обновить или создать суточный отчёт + /// + /// + /// + /// + /// + /// + /// + Task UpdateOrInsertAsync(int idWell, DateTime dateDailyReport, int idUser, TBlock editableBlock, + CancellationToken cancellationToken) + where TBlock : ItemInfoDto; + + /// + /// Получить сформированный суточный отчёт + /// + /// + /// + /// + /// + Task GetAsync(int idWell, DateTime dateDailyReport, CancellationToken cancellationToken); + + /// + /// Получить список суточных отчётов по скважине + /// + /// + /// + /// + /// + Task> GetAsync(int idWell, FileReportRequest request, CancellationToken cancellationToken); + + /// + /// Получить диапазон дат по которым возможно сформировать суточный отчёты + /// + /// + /// + /// + Task GetDatesRangeAsync(int idWell, CancellationToken cancellationToken); +} \ No newline at end of file diff --git a/AsbCloudApp/Services/IDailyReportService.cs b/AsbCloudApp/Services/IDailyReportService.cs deleted file mode 100644 index 66e7bd71..00000000 --- a/AsbCloudApp/Services/IDailyReportService.cs +++ /dev/null @@ -1,55 +0,0 @@ -using AsbCloudApp.Data; -using AsbCloudApp.Data.DailyReport; -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace AsbCloudApp.Services -{ - /// - /// Суточный рапорт (сводка) - /// - public interface IDailyReportService - { - /// - /// получить список сформированных рапортов по скважине за период времени - /// - /// - /// - /// - /// - /// - Task> GetListAsync(int idWell, DateOnly? begin, DateOnly? end, CancellationToken cancellationToken); - - /// - /// Добавить новый рапорт - /// - /// - /// - /// - /// - /// - Task AddAsync(int idWell, DateOnly startDate, int idUser, CancellationToken token); - - /// - /// Сформировать файл рапорта - /// - /// - /// - /// - /// - Task MakeReportAsync(int idWell, DateOnly date, CancellationToken token); - - /// - /// изменить блок данных для суточного рапорта - /// - /// - /// - /// - /// - /// - Task UpdateBlockAsync(int idWell, DateOnly startDate, ItemInfoDto dto, CancellationToken token); - } -} diff --git a/AsbCloudApp/Services/IScheduleService.cs b/AsbCloudApp/Services/IScheduleService.cs index 9a77b7b9..c4c0c1f5 100644 --- a/AsbCloudApp/Services/IScheduleService.cs +++ b/AsbCloudApp/Services/IScheduleService.cs @@ -1,5 +1,6 @@ using AsbCloudApp.Data; using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -10,6 +11,15 @@ namespace AsbCloudApp.Services /// public interface IScheduleRepository : IRepositoryWellRelated { + /// + /// Получить расписание смен + /// + /// + /// + /// + /// + Task> GetAsync(int idWell, DateTime workTime, CancellationToken token); + /// /// получить бурильщика по idWell и времени /// diff --git a/AsbCloudDb/Migrations/20231114051111_Update_DailyReport.Designer.cs b/AsbCloudDb/Migrations/20231114051111_Update_DailyReport.Designer.cs new file mode 100644 index 00000000..23c75c4b --- /dev/null +++ b/AsbCloudDb/Migrations/20231114051111_Update_DailyReport.Designer.cs @@ -0,0 +1,8916 @@ +// +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("20231114051111_Update_DailyReport")] + partial class Update_DailyReport + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("Russian_Russia.1251") + .HasAnnotation("ProductVersion", "6.0.24") + .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"); + + b.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") + .IsRequired() + .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") + .IsRequired() + .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"); + + b.HasComment("Контакты"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DailyReports.DailyReport", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Date") + .HasColumnType("timestamp with time zone") + .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"); + + b.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"); + + b.HasComment("Месторождение"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", 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("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина после завершения операции, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина на начало операции, м"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdReasonOfEnd") + .HasColumnType("integer") + .HasColumnName("id_reason_of_end") + .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"); + + b.HasComment("автоматически определенные операции по телеметрии"); + }); + + 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"); + + b.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"); + + b.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"); + + b.HasComment("Drill_test"); + }); + + 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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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 = 529, + Description = "Разрешение на получение отчетов drill test", + Name = "DrillTestReport.get" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", 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_planned_trajectory"); + + b.HasComment("Загрузка плановой траектории"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AxialLoadLimitMax") + .HasColumnType("double precision") + .HasColumnName("axial_load_limit_max") + .HasComment("Нагрузка, допустимый максимум"); + + b.Property("AxialLoadPlan") + .HasColumnType("double precision") + .HasColumnName("axial_load_plan") + .HasComment("Нагрузка, план"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("FlowLimitMax") + .HasColumnType("double precision") + .HasColumnName("flow_limit_max") + .HasComment("Расход, допустимый максимум"); + + b.Property("FlowPlan") + .HasColumnType("double precision") + .HasColumnName("flow_plan") + .HasComment("Расход, план"); + + b.Property("IdMode") + .HasColumnType("integer") + .HasColumnName("id_mode") + .HasComment("Id режима (1- ротор, 2 слайд)"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("LastUpdate") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_update") + .HasComment("Дата последнего изменения"); + + b.Property("PressureLimitMax") + .HasColumnType("double precision") + .HasColumnName("pressure_limit_max") + .HasComment("Перепад давления, допустимый максимум"); + + b.Property("PressurePlan") + .HasColumnType("double precision") + .HasColumnName("pressure_plan") + .HasComment("Перепад давления, план"); + + b.Property("RopPlan") + .HasColumnType("double precision") + .HasColumnName("rop_plan") + .HasComment("Плановая механическая скорость, м/ч"); + + b.Property("TopDriveSpeedLimitMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_limit_max") + .HasComment("Обороты на ВСП, допустимый максимум"); + + b.Property("TopDriveSpeedPlan") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_plan") + .HasComment("Обороты на ВСП, план"); + + b.Property("TopDriveTorqueLimitMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_limit_max") + .HasComment("Момент на ВСП, допустимый максимум"); + + b.Property("TopDriveTorquePlan") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_plan") + .HasComment("Момент на ВСП, план"); + + b.Property("UsageSaub") + .HasColumnType("double precision") + .HasColumnName("usage_saub") + .HasComment("Плановый процент использования АКБ"); + + b.Property("UsageSpin") + .HasColumnType("double precision") + .HasColumnName("usage_spin") + .HasComment("Плановый процент использования spin master"); + + b.HasKey("Id"); + + b.HasIndex("IdUser"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_well_drilling"); + + b.HasComment("РТК бурение скважины"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("LastUpdate") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_update") + .HasComment("Дата последнего изменения"); + + b.Property("Pressure") + .HasColumnType("double precision") + .HasColumnName("pressure") + .HasComment("Давление, атм"); + + b.Property("Repeats") + .HasColumnType("double precision") + .HasColumnName("repeats") + .HasComment("Количество повторений"); + + b.Property("SetpointDrag") + .HasColumnType("double precision") + .HasColumnName("setpoint_drag") + .HasComment("Уставка зятяжки, т"); + + b.Property("SetpointTight") + .HasColumnType("double precision") + .HasColumnName("setpoint_tight") + .HasComment("Уставка посадки, т"); + + b.Property("SpeedDownward") + .HasColumnType("double precision") + .HasColumnName("speed_downward") + .HasComment("Скорость спуска, м/ч"); + + b.Property("SpeedUpward") + .HasColumnType("double precision") + .HasColumnName("speed_upward") + .HasComment("Скорость подъёма, м/ч"); + + b.Property("SpinDownward") + .HasColumnType("double precision") + .HasColumnName("spin_downward") + .HasComment("Вращение при движении вниз, об/мин"); + + b.Property("SpinUpward") + .HasColumnType("double precision") + .HasColumnName("spin_upward") + .HasComment("Вращение при движении вверх, об/мин"); + + b.Property("Torque") + .HasColumnType("double precision") + .HasColumnName("torque") + .HasComment("Момент, кН*м"); + + b.HasKey("Id"); + + b.HasIndex("IdUser"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_well_ream"); + + b.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"); + + b.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"); + + b.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"); + + b.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 = 529 + }); + }); + + 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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.HasComment("Запросы на изменение уставок панели оператора"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.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"); + + b.HasComment("Описание подсистем"); + + b.HasData( + new + { + Id = 1, + Description = "Совместная работа режимов \"Бурение в роторе\" и \"Бурение в слайде\"", + Name = "АКБ" + }, + new + { + Id = 11, + Description = "Режим работы \"Бурение в роторе\"", + Name = "АПД ротор" + }, + new + { + Id = 12, + Description = "Режим работы \"Бурение в слайде\"", + Name = "АПД слайд" + }, + new + { + Id = 2, + Description = "Алгоритм поиска оптимальных параметров бурения САУБ", + Name = "MSE" + }, + new + { + Id = 65536, + Description = "Осцилляция", + Name = "Осцилляция" + }, + new + { + Id = 65537, + Description = "Демпфер", + Name = "Демпфер" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.SubsystemOperationTime", 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("DepthEnd") + .HasColumnType("real") + .HasColumnName("depth_end") + .HasComment("глубина забоя на момент выключения подсистемы"); + + b.Property("DepthStart") + .HasColumnType("real") + .HasColumnName("depth_start") + .HasComment("глубина забоя на момент включения подсистемы"); + + b.Property("IdSubsystem") + .HasColumnType("integer") + .HasColumnName("id_subsystem"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("ИД телеметрии по которой выдается информация"); + + b.HasKey("Id"); + + b.HasIndex("IdSubsystem"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_subsystem_operation_time"); + + b.HasComment("наработки подсистем"); + }); + + 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"); + + b.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"); + + b.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.ToView("mw_telemetry_datas_saub_stat"); + }); + + 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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.HasComment("настройки интерфейса пользователя"); + }); + + 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"); + + b.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"); + + b.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"); + + b.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"); + + b.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("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"); + + b.HasComment("Справочник операций на скважине"); + + b.HasData( + new + { + Id = 3000, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "БУРЕНИЕ" + }, + new + { + Id = 3001, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КРЕПЛЕНИЕ" + }, + new + { + Id = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГФР" + }, + new + { + Id = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные операции" + }, + new + { + Id = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Непроизводительное время (НПВ)" + }, + new + { + Id = 4000, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КНБК" + }, + new + { + Id = 4001, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "Механическое. бурение" + }, + new + { + Id = 4002, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Статический замер" + }, + new + { + Id = 4003, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Нормализация диаметра скважины" + }, + new + { + Id = 4004, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 4005, + IdParent = 3001, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4006, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск обсадной колонны" + }, + new + { + Id = 4007, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 4008, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы при креплении" + }, + new + { + Id = 4009, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка/разборка приборов ГИС" + }, + new + { + Id = 4010, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4011, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГИС" + }, + new + { + Id = 4012, + IdParent = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка, ОБР" + }, + new + { + Id = 4013, + IdParent = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы" + }, + new + { + Id = 4014, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт оборудования" + }, + new + { + Id = 4015, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Аварийные работы" + }, + new + { + Id = 4016, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Осложнение" + }, + new + { + Id = 4017, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Незаложенные в ГГД операции" + }, + new + { + Id = 5000, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка КНБК" + }, + new + { + Id = 5001, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка КНБК" + }, + new + { + Id = 5002, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение слайдом" + }, + new + { + Id = 5003, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение ротором" + }, + new + { + Id = 5004, + IdParent = 4002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Замер ЗТС (запись MWD)" + }, + new + { + Id = 5005, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка перед наращиванием" + }, + new + { + Id = 5006, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка во время бурения" + }, + new + { + Id = 5007, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка перед наращиванием" + }, + new + { + Id = 5008, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка во время бурения" + }, + new + { + Id = 5009, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка перед наращиванием" + }, + new + { + Id = 5010, + IdParent = 4004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 5011, + IdParent = 4004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Удержание в клиньях" + }, + new + { + Id = 5012, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем инструмента" + }, + new + { + Id = 5013, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем КНБК" + }, + new + { + Id = 5014, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента" + }, + new + { + Id = 5015, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КНБК" + }, + new + { + Id = 5016, + IdParent = 4006, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка при спуске ОК" + }, + new + { + Id = 5017, + IdParent = 4006, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск ОК" + }, + new + { + Id = 5018, + IdParent = 4007, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ОЗЦ" + }, + new + { + Id = 5019, + IdParent = 4007, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 5020, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка БИ" + }, + new + { + Id = 5021, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ОК" + }, + new + { + Id = 5022, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при спуске ОК" + }, + new + { + Id = 5023, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при цементировании" + }, + new + { + Id = 5024, + IdParent = 4009, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка комплекса приборов ГИС" + }, + new + { + Id = 5025, + IdParent = 4009, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка комплекса приборов ГИС" + }, + new + { + Id = 5026, + IdParent = 4010, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем приборов ГИС (на трубах)" + }, + new + { + Id = 5027, + IdParent = 4010, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск приборов ГИС (на трубах)" + }, + new + { + Id = 5028, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на жестком кабеле" + }, + new + { + Id = 5029, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на кабеле" + }, + new + { + Id = 5030, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на трубах" + }, + new + { + Id = 5031, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Закачка/прокачка пачки" + }, + new + { + Id = 5032, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка БР" + }, + new + { + Id = 5033, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование ТС при бурении" + }, + new + { + Id = 5034, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перезапись гаммы-каротажа" + }, + new + { + Id = 5035, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Приготовление БР" + }, + new + { + Id = 5036, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка" + }, + new + { + Id = 5037, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разбуривание тех.оснастки" + }, + new + { + Id = 5038, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента с проработкой" + }, + new + { + Id = 5039, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ВМР" + }, + new + { + Id = 5040, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Демонтаж ПВО" + }, + new + { + Id = 5041, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Долив затруба при подъёме" + }, + new + { + Id = 5042, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж ПВО" + }, + new + { + Id = 5043, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наработка жёлоба" + }, + new + { + Id = 5044, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обвязка устья с циркуляционной системой" + }, + new + { + Id = 5045, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Оборудование устья" + }, + new + { + Id = 5046, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ПВО" + }, + new + { + Id = 5047, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перемонтаж ПВО " + }, + new + { + Id = 5048, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перетяжка талевого каната" + }, + new + { + Id = 5049, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при сборке КНБК" + }, + new + { + Id = 5050, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Полная замена талевого каната" + }, + new + { + Id = 5051, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПР перед забуркой направления" + }, + new + { + Id = 5052, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Продувка манифольда" + }, + new + { + Id = 5053, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Срезка" + }, + new + { + Id = 5054, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тайм-дриллинг" + }, + new + { + Id = 5055, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тех.отстой" + }, + new + { + Id = 5056, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Учебная тревога \"Выброс\"" + }, + new + { + Id = 5057, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Чистка ЦСГО/емкостного блока" + }, + new + { + Id = 5058, + IdParent = 4014, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт бурового оборудования" + }, + new + { + Id = 5059, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ловильные работы" + }, + new + { + Id = 5060, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ожидание" + }, + new + { + Id = 5061, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Определение места прихвата и ЛМ" + }, + new + { + Id = 5062, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Работа яссом" + }, + new + { + Id = 5063, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Расхаживание" + }, + new + { + Id = 5064, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - колокол" + }, + new + { + Id = 5065, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - метчик" + }, + new + { + Id = 5066, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - овершот" + }, + new + { + Id = 5067, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - труболовка" + }, + new + { + Id = 5068, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (встряхивание)" + }, + new + { + Id = 5069, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (отстрел)" + }, + new + { + Id = 5070, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Установка ванн" + }, + new + { + Id = 5071, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Фрезеровка" + }, + new + { + Id = 5072, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Контролируемое ГНВП" + }, + new + { + Id = 5073, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Поглощение" + }, + new + { + Id = 5074, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сальникообразование" + }, + new + { + Id = 5075, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Утяжеление БР" + }, + new + { + Id = 5076, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "НПВ / прочее" + }, + new + { + Id = 5077, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка раствора (несоответствие параметров)" + }, + new + { + Id = 5078, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "подъем ОК" + }, + new + { + Id = 5079, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ревизия КНБК/инструмента/ЗТС" + }, + new + { + Id = 5082, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка устройства ориентирования КО" + }, + new + { + Id = 5083, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка принудительная" + }, + new + { + Id = 5084, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка подъем БИ, продувка" + }, + new + { + Id = 5085, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск бурильного инструмента со сборкой с мостков" + }, + new + { + Id = 5086, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем БИ с выбросом на мостки" + }, + new + { + Id = 5087, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск БИ со сборкой с мостков" + }, + new + { + Id = 5088, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка и спуск ТБТ" + }, + new + { + Id = 5089, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КО на транспотрной колонне" + }, + new + { + Id = 5090, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Отворот допускной трубы" + }, + new + { + Id = 5091, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески, опрессовка" + }, + new + { + Id = 5092, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж, опрессовка ФА" + }, + new + { + Id = 5093, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка хвостовика 114мм (согласно схеме)" + }, + new + { + Id = 5094, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР к спуску УЭЦН" + }, + new + { + Id = 5095, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески (потайной колонны, хвостовика)" + }, + new + { + Id = 5096, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонирование перед спуском" + }, + new + { + Id = 5097, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка - перевод скважины на новый раствор" + }, + new + { + Id = 5098, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка БИ с мостков на подсвечник" + }, + new + { + Id = 5099, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подготовка ствола скважины. Перезапись ГК в интервале установки КО." + }, + new + { + Id = 5100, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Смена рабочего переводника ВСП" + }, + new + { + Id = 5101, + IdParent = 4014, + 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"); + + b.HasComment("конструкция секции скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Пилотный ствол", + Order = 4f + }, + new + { + Id = 2, + Caption = "Направление", + Order = 0f + }, + new + { + Id = 3, + Caption = "Кондуктор", + Order = 1f + }, + new + { + Id = 4, + Caption = "Эксплуатационная колонна", + Order = 3f + }, + new + { + Id = 5, + Caption = "Транспортный ствол", + Order = 5f + }, + new + { + Id = 6, + Caption = "Хвостовик", + Order = 6f + }, + new + { + Id = 7, + Caption = "Пилотный ствол 2", + Order = 4.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 = 5.1f + }, + new + { + Id = 12, + Caption = "Хвостовик 2", + Order = 6.1f + }, + new + { + Id = 13, + Caption = "Пилотный ствол 3", + Order = 4.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 = 5.2f + }, + new + { + Id = 18, + Caption = "Хвостовик 3", + Order = 6.2f + }, + new + { + Id = 19, + Caption = "Пилотный ствол 4", + Order = 4.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 = 5.3f + }, + new + { + Id = 24, + Caption = "Хвостовик 4", + Order = 6.3f + }, + new + { + Id = 25, + Caption = "Пилотный ствол 5", + Order = 4.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 = 5.4f + }, + new + { + Id = 30, + Caption = "Хвостовик 5", + Order = 6.4f + }, + new + { + Id = 31, + Caption = "Техническая колонна", + 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.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"); + + b.HasComment("конструкция скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Наклонно-направленная" + }, + new + { + Id = 2, + Caption = "Горизонтальная" + }); + }); + + 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"); + }); + + 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.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.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.DrillTest", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + 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.PlannedTrajectory", 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.ProcessMaps.ProcessMapWellDrilling", 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.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", 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.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + 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.Subsystems.SubsystemOperationTime", b => + { + b.HasOne("AsbCloudDb.Model.Subsystems.Subsystem", "Subsystem") + .WithMany() + .HasForeignKey("IdSubsystem") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subsystem"); + + b.Navigation("Telemetry"); + }); + + 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.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.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/20231114051111_Update_DailyReport.cs b/AsbCloudDb/Migrations/20231114051111_Update_DailyReport.cs new file mode 100644 index 00000000..e4bac241 --- /dev/null +++ b/AsbCloudDb/Migrations/20231114051111_Update_DailyReport.cs @@ -0,0 +1,140 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace AsbCloudDb.Migrations +{ + public partial class Update_DailyReport : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql("Truncate table t_daily_report"); + + migrationBuilder.DropPrimaryKey( + name: "t_id_well_date_start_pk", + table: "t_daily_report"); + + migrationBuilder.DropColumn( + name: "start_date", + table: "t_daily_report"); + + migrationBuilder.DropColumn( + name: "info", + table: "t_daily_report"); + + migrationBuilder.AddColumn( + name: "Id", + table: "t_daily_report", + type: "integer", + nullable: false, + defaultValue: 0) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + migrationBuilder.AddColumn( + name: "date", + table: "t_daily_report", + type: "timestamp with time zone", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), + comment: "Дата формирования отчёта"); + + migrationBuilder.AddColumn( + name: "date_last_update", + table: "t_daily_report", + type: "timestamp with time zone", + nullable: true, + comment: "Дата последнего обновления"); + + migrationBuilder.AddColumn( + name: "sign_block", + table: "t_daily_report", + type: "jsonb", + nullable: true, + comment: "Подпись"); + + migrationBuilder.AddColumn( + name: "subsystem_block", + table: "t_daily_report", + type: "jsonb", + nullable: true, + comment: "Наработкой подсистем"); + + migrationBuilder.AddColumn( + name: "time_balance_block", + table: "t_daily_report", + type: "jsonb", + nullable: true, + comment: "Баланс времени"); + + migrationBuilder.AddPrimaryKey( + name: "PK_t_daily_report", + table: "t_daily_report", + column: "Id"); + + migrationBuilder.CreateIndex( + name: "IX_t_daily_report_id_well_date", + table: "t_daily_report", + columns: new[] { "id_well", "date" }, + unique: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql("Truncate table t_daily_report"); + + migrationBuilder.DropPrimaryKey( + name: "PK_t_daily_report", + table: "t_daily_report"); + + migrationBuilder.DropIndex( + name: "IX_t_daily_report_id_well_date", + table: "t_daily_report"); + + migrationBuilder.DropColumn( + name: "Id", + table: "t_daily_report"); + + migrationBuilder.DropColumn( + name: "date", + table: "t_daily_report"); + + migrationBuilder.DropColumn( + name: "date_last_update", + table: "t_daily_report"); + + migrationBuilder.DropColumn( + name: "sign_block", + table: "t_daily_report"); + + migrationBuilder.DropColumn( + name: "subsystem_block", + table: "t_daily_report"); + + migrationBuilder.DropColumn( + name: "time_balance_block", + table: "t_daily_report"); + + migrationBuilder.AddColumn( + name: "start_date", + table: "t_daily_report", + type: "date", + nullable: false, + defaultValue: new DateOnly(1, 1, 1), + comment: "Дата отчёта"); + + migrationBuilder.AddColumn( + name: "info", + table: "t_daily_report", + type: "jsonb", + nullable: true, + comment: "Список параметров для отчёта"); + + migrationBuilder.AddPrimaryKey( + name: "t_id_well_date_start_pk", + table: "t_daily_report", + columns: new[] { "id_well", "start_date" }); + } + } +} diff --git a/AsbCloudDb/Migrations/20231123085551_Add_New_WellOperationCategories.Designer.cs b/AsbCloudDb/Migrations/20231123085551_Add_New_WellOperationCategories.Designer.cs new file mode 100644 index 00000000..a74ef02e --- /dev/null +++ b/AsbCloudDb/Migrations/20231123085551_Add_New_WellOperationCategories.Designer.cs @@ -0,0 +1,8988 @@ +// +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("20231123085551_Add_New_WellOperationCategories")] + partial class Add_New_WellOperationCategories + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("Russian_Russia.1251") + .HasAnnotation("ProductVersion", "6.0.25") + .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"); + + b.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"); + + b.HasComment("Контакты"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("ID скважины"); + + b.Property("StartDate") + .HasColumnType("date") + .HasColumnName("start_date") + .HasComment("Дата отчёта"); + + b.Property("Info") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("info") + .HasComment("Список параметров для отчёта"); + + b.HasKey("IdWell", "StartDate") + .HasName("t_id_well_date_start_pk"); + + b.ToTable("t_daily_report"); + + b.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"); + + b.HasComment("Месторождение"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", 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("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина после завершения операции, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина на начало операции, м"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdReasonOfEnd") + .HasColumnType("integer") + .HasColumnName("id_reason_of_end") + .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"); + + b.HasComment("автоматически определенные операции по телеметрии"); + }); + + 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"); + + b.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"); + + b.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"); + + b.HasComment("Drill_test"); + }); + + 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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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 = 529, + Description = "Разрешение на получение отчетов drill test", + Name = "DrillTestReport.get" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", 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_planned_trajectory"); + + b.HasComment("Загрузка плановой траектории"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AxialLoadLimitMax") + .HasColumnType("double precision") + .HasColumnName("axial_load_limit_max") + .HasComment("Нагрузка, допустимый максимум"); + + b.Property("AxialLoadPlan") + .HasColumnType("double precision") + .HasColumnName("axial_load_plan") + .HasComment("Нагрузка, план"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("FlowLimitMax") + .HasColumnType("double precision") + .HasColumnName("flow_limit_max") + .HasComment("Расход, допустимый максимум"); + + b.Property("FlowPlan") + .HasColumnType("double precision") + .HasColumnName("flow_plan") + .HasComment("Расход, план"); + + b.Property("IdMode") + .HasColumnType("integer") + .HasColumnName("id_mode") + .HasComment("Id режима (1- ротор, 2 слайд)"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("LastUpdate") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_update") + .HasComment("Дата последнего изменения"); + + b.Property("PressureLimitMax") + .HasColumnType("double precision") + .HasColumnName("pressure_limit_max") + .HasComment("Перепад давления, допустимый максимум"); + + b.Property("PressurePlan") + .HasColumnType("double precision") + .HasColumnName("pressure_plan") + .HasComment("Перепад давления, план"); + + b.Property("RopPlan") + .HasColumnType("double precision") + .HasColumnName("rop_plan") + .HasComment("Плановая механическая скорость, м/ч"); + + b.Property("TopDriveSpeedLimitMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_limit_max") + .HasComment("Обороты на ВСП, допустимый максимум"); + + b.Property("TopDriveSpeedPlan") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_plan") + .HasComment("Обороты на ВСП, план"); + + b.Property("TopDriveTorqueLimitMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_limit_max") + .HasComment("Момент на ВСП, допустимый максимум"); + + b.Property("TopDriveTorquePlan") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_plan") + .HasComment("Момент на ВСП, план"); + + b.Property("UsageSaub") + .HasColumnType("double precision") + .HasColumnName("usage_saub") + .HasComment("Плановый процент использования АКБ"); + + b.Property("UsageSpin") + .HasColumnType("double precision") + .HasColumnName("usage_spin") + .HasComment("Плановый процент использования spin master"); + + b.HasKey("Id"); + + b.HasIndex("IdUser"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_well_drilling"); + + b.HasComment("РТК бурение скважины"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина по стволу до, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина по стволу от, м"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("LastUpdate") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_update") + .HasComment("Дата последнего изменения"); + + b.Property("Pressure") + .HasColumnType("double precision") + .HasColumnName("pressure") + .HasComment("Давление, атм"); + + b.Property("Repeats") + .HasColumnType("double precision") + .HasColumnName("repeats") + .HasComment("Количество повторений"); + + b.Property("SetpointDrag") + .HasColumnType("double precision") + .HasColumnName("setpoint_drag") + .HasComment("Уставка зятяжки, т"); + + b.Property("SetpointTight") + .HasColumnType("double precision") + .HasColumnName("setpoint_tight") + .HasComment("Уставка посадки, т"); + + b.Property("SpeedDownward") + .HasColumnType("double precision") + .HasColumnName("speed_downward") + .HasComment("Скорость спуска, м/ч"); + + b.Property("SpeedUpward") + .HasColumnType("double precision") + .HasColumnName("speed_upward") + .HasComment("Скорость подъёма, м/ч"); + + b.Property("SpinDownward") + .HasColumnType("double precision") + .HasColumnName("spin_downward") + .HasComment("Вращение при движении вниз, об/мин"); + + b.Property("SpinUpward") + .HasColumnType("double precision") + .HasColumnName("spin_upward") + .HasComment("Вращение при движении вверх, об/мин"); + + b.Property("Torque") + .HasColumnType("double precision") + .HasColumnName("torque") + .HasComment("Момент, кН*м"); + + b.HasKey("Id"); + + b.HasIndex("IdUser"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_well_ream"); + + b.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"); + + b.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"); + + b.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"); + + b.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 = 529 + }); + }); + + 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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.HasComment("Запросы на изменение уставок панели оператора"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.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"); + + b.HasComment("Описание подсистем"); + + b.HasData( + new + { + Id = 1, + Description = "Совместная работа режимов \"Бурение в роторе\" и \"Бурение в слайде\"", + Name = "АКБ" + }, + new + { + Id = 11, + Description = "Режим работы \"Бурение в роторе\"", + Name = "АПД ротор" + }, + new + { + Id = 12, + Description = "Режим работы \"Бурение в слайде\"", + Name = "АПД слайд" + }, + new + { + Id = 2, + Description = "Алгоритм поиска оптимальных параметров бурения САУБ", + Name = "MSE" + }, + new + { + Id = 65536, + Description = "Осцилляция", + Name = "Осцилляция" + }, + new + { + Id = 65537, + Description = "Демпфер", + Name = "Демпфер" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.SubsystemOperationTime", 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("DepthEnd") + .HasColumnType("real") + .HasColumnName("depth_end") + .HasComment("глубина забоя на момент выключения подсистемы"); + + b.Property("DepthStart") + .HasColumnType("real") + .HasColumnName("depth_start") + .HasComment("глубина забоя на момент включения подсистемы"); + + b.Property("IdSubsystem") + .HasColumnType("integer") + .HasColumnName("id_subsystem"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("ИД телеметрии по которой выдается информация"); + + b.HasKey("Id"); + + b.HasIndex("IdSubsystem"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_subsystem_operation_time"); + + b.HasComment("наработки подсистем"); + }); + + 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"); + + b.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"); + + b.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.ToView("mw_telemetry_datas_saub_stat"); + }); + + 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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.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"); + + b.HasComment("настройки интерфейса пользователя"); + }); + + 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"); + + b.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"); + + b.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"); + + b.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"); + + b.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("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"); + + b.HasComment("Справочник операций на скважине"); + + b.HasData( + new + { + Id = 3000, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "БУРЕНИЕ" + }, + new + { + Id = 3001, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КРЕПЛЕНИЕ" + }, + new + { + Id = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГФР" + }, + new + { + Id = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные операции" + }, + new + { + Id = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Непроизводительное время (НПВ)" + }, + new + { + Id = 4000, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КНБК" + }, + new + { + Id = 4001, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "Механическое. бурение" + }, + new + { + Id = 4002, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Статический замер" + }, + new + { + Id = 4003, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Нормализация диаметра скважины" + }, + new + { + Id = 4004, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 4005, + IdParent = 3001, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4006, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск обсадной колонны" + }, + new + { + Id = 4018, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Крепление" + }, + new + { + Id = 4007, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 4008, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы при креплении" + }, + new + { + Id = 4009, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка/разборка приборов ГИС" + }, + new + { + Id = 4010, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4011, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГИС" + }, + new + { + Id = 4012, + IdParent = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка, ОБР" + }, + new + { + Id = 4013, + IdParent = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы" + }, + new + { + Id = 4014, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт оборудования" + }, + new + { + Id = 4015, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Аварийные работы" + }, + new + { + Id = 4016, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Осложнение" + }, + new + { + Id = 4017, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Незаложенные в ГГД операции" + }, + new + { + Id = 5000, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка КНБК" + }, + new + { + Id = 5001, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка КНБК" + }, + new + { + Id = 5002, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение слайдом" + }, + new + { + Id = 5003, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение ротором" + }, + new + { + Id = 5004, + IdParent = 4002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Замер ЗТС (запись MWD)" + }, + new + { + Id = 5005, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка перед наращиванием" + }, + new + { + Id = 5006, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка во время бурения" + }, + new + { + Id = 5007, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка перед наращиванием" + }, + new + { + Id = 5008, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка во время бурения" + }, + new + { + Id = 5009, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка перед наращиванием" + }, + new + { + Id = 5010, + IdParent = 4004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 5011, + IdParent = 4004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Удержание в клиньях" + }, + new + { + Id = 5012, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем инструмента" + }, + new + { + Id = 5013, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем КНБК" + }, + new + { + Id = 5014, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента" + }, + new + { + Id = 5015, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КНБК" + }, + new + { + Id = 5016, + IdParent = 4006, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка при спуске ОК" + }, + new + { + Id = 5017, + IdParent = 4006, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск ОК" + }, + new + { + Id = 5018, + IdParent = 4007, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ОЗЦ" + }, + new + { + Id = 5019, + IdParent = 4007, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 5020, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка БИ" + }, + new + { + Id = 5021, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ОК" + }, + new + { + Id = 5022, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при спуске ОК" + }, + new + { + Id = 5023, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при цементировании" + }, + new + { + Id = 5024, + IdParent = 4009, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка комплекса приборов ГИС" + }, + new + { + Id = 5025, + IdParent = 4009, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка комплекса приборов ГИС" + }, + new + { + Id = 5026, + IdParent = 4010, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем приборов ГИС (на трубах)" + }, + new + { + Id = 5027, + IdParent = 4010, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск приборов ГИС (на трубах)" + }, + new + { + Id = 5028, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на жестком кабеле" + }, + new + { + Id = 5029, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на кабеле" + }, + new + { + Id = 5030, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на трубах" + }, + new + { + Id = 5031, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Закачка/прокачка пачки" + }, + new + { + Id = 5032, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка БР" + }, + new + { + Id = 5033, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование ТС при бурении" + }, + new + { + Id = 5034, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перезапись гаммы-каротажа" + }, + new + { + Id = 5035, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Приготовление БР" + }, + new + { + Id = 5036, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка" + }, + new + { + Id = 5037, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разбуривание тех.оснастки" + }, + new + { + Id = 5038, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента с проработкой" + }, + new + { + Id = 5039, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ВМР" + }, + new + { + Id = 5040, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Демонтаж ПВО" + }, + new + { + Id = 5041, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Долив затруба при подъёме" + }, + new + { + Id = 5042, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж ПВО" + }, + new + { + Id = 5043, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наработка жёлоба" + }, + new + { + Id = 5044, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обвязка устья с циркуляционной системой" + }, + new + { + Id = 5045, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Оборудование устья" + }, + new + { + Id = 5046, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ПВО" + }, + new + { + Id = 5047, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перемонтаж ПВО " + }, + new + { + Id = 5048, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перетяжка талевого каната" + }, + new + { + Id = 5049, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при сборке КНБК" + }, + new + { + Id = 5050, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Полная замена талевого каната" + }, + new + { + Id = 5051, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПР перед забуркой направления" + }, + new + { + Id = 5052, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Продувка манифольда" + }, + new + { + Id = 5053, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Срезка" + }, + new + { + Id = 5054, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тайм-дриллинг" + }, + new + { + Id = 5055, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тех.отстой" + }, + new + { + Id = 5056, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Учебная тревога \"Выброс\"" + }, + new + { + Id = 5057, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Чистка ЦСГО/емкостного блока" + }, + new + { + Id = 5058, + IdParent = 4014, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт бурового оборудования" + }, + new + { + Id = 5059, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ловильные работы" + }, + new + { + Id = 5060, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ожидание" + }, + new + { + Id = 5061, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Определение места прихвата и ЛМ" + }, + new + { + Id = 5062, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Работа яссом" + }, + new + { + Id = 5063, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Расхаживание" + }, + new + { + Id = 5064, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - колокол" + }, + new + { + Id = 5065, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - метчик" + }, + new + { + Id = 5066, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - овершот" + }, + new + { + Id = 5067, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - труболовка" + }, + new + { + Id = 5068, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (встряхивание)" + }, + new + { + Id = 5069, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (отстрел)" + }, + new + { + Id = 5070, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Установка ванн" + }, + new + { + Id = 5071, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Фрезеровка" + }, + new + { + Id = 5072, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Контролируемое ГНВП" + }, + new + { + Id = 5073, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Поглощение" + }, + new + { + Id = 5074, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сальникообразование" + }, + new + { + Id = 5075, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Утяжеление БР" + }, + new + { + Id = 5076, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "НПВ / прочее" + }, + new + { + Id = 5077, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка раствора (несоответствие параметров)" + }, + new + { + Id = 5078, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "подъем ОК" + }, + new + { + Id = 5079, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ревизия КНБК/инструмента/ЗТС" + }, + new + { + Id = 5082, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка устройства ориентирования КО" + }, + new + { + Id = 5083, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка принудительная" + }, + new + { + Id = 5084, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка подъем БИ, продувка" + }, + new + { + Id = 5085, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск бурильного инструмента со сборкой с мостков" + }, + new + { + Id = 5086, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем БИ с выбросом на мостки" + }, + new + { + Id = 5087, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск БИ со сборкой с мостков" + }, + new + { + Id = 5088, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка и спуск ТБТ" + }, + new + { + Id = 5089, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КО на транспотрной колонне" + }, + new + { + Id = 5090, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Отворот допускной трубы" + }, + new + { + Id = 5091, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески, опрессовка" + }, + new + { + Id = 5092, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж, опрессовка ФА" + }, + new + { + Id = 5093, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка хвостовика 114мм (согласно схеме)" + }, + new + { + Id = 5094, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР к спуску УЭЦН" + }, + new + { + Id = 5095, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески (потайной колонны, хвостовика)" + }, + new + { + Id = 5096, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонирование перед спуском" + }, + new + { + Id = 5097, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка - перевод скважины на новый раствор" + }, + new + { + Id = 5098, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка БИ с мостков на подсвечник" + }, + new + { + Id = 5099, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подготовка ствола скважины. Перезапись ГК в интервале установки КО." + }, + new + { + Id = 5100, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Смена рабочего переводника ВСП" + }, + new + { + Id = 5101, + IdParent = 4014, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт" + }, + new + { + Id = 5102, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск пакера" + }, + new + { + Id = 5103, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Запись гамма-каратожа" + }, + new + { + Id = 5104, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонирование спуск БИ" + }, + new + { + Id = 5105, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка клин-отклонителя" + }, + new + { + Id = 5106, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование и посадка клина-отклонителя" + }, + new + { + Id = 5107, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Протяжка подъемного патрубка подвески" + }, + new + { + Id = 5108, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем клина-отклонителя" + }, + new + { + Id = 5109, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Стыковка стингера с хвостовиком основного ствола" + }, + new + { + Id = 5110, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование и установка стыковочного узла хвостовика" + }, + new + { + Id = 5111, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение с отбором керна" + }, + new + { + Id = 5112, + IdParent = 4018, + 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"); + + b.HasComment("конструкция секции скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Пилотный ствол", + Order = 4f + }, + new + { + Id = 2, + Caption = "Направление", + Order = 0f + }, + new + { + Id = 3, + Caption = "Кондуктор", + Order = 1f + }, + new + { + Id = 4, + Caption = "Эксплуатационная колонна", + Order = 3f + }, + new + { + Id = 5, + Caption = "Транспортный ствол", + Order = 5f + }, + new + { + Id = 6, + Caption = "Хвостовик", + Order = 6f + }, + new + { + Id = 7, + Caption = "Пилотный ствол 2", + Order = 4.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 = 5.1f + }, + new + { + Id = 12, + Caption = "Хвостовик 2", + Order = 6.1f + }, + new + { + Id = 13, + Caption = "Пилотный ствол 3", + Order = 4.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 = 5.2f + }, + new + { + Id = 18, + Caption = "Хвостовик 3", + Order = 6.2f + }, + new + { + Id = 19, + Caption = "Пилотный ствол 4", + Order = 4.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 = 5.3f + }, + new + { + Id = 24, + Caption = "Хвостовик 4", + Order = 6.3f + }, + new + { + Id = 25, + Caption = "Пилотный ствол 5", + Order = 4.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 = 5.4f + }, + new + { + Id = 30, + Caption = "Хвостовик 5", + Order = 6.4f + }, + new + { + Id = 31, + Caption = "Техническая колонна", + 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.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"); + + b.HasComment("конструкция скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Наклонно-направленная" + }, + new + { + Id = 2, + Caption = "Горизонтальная" + }); + }); + + 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"); + }); + + 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.DailyReport.DailyReport", b => + { + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Well"); + }); + + 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.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.DrillTest", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + 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.PlannedTrajectory", 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.ProcessMaps.ProcessMapWellDrilling", 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.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", 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.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + 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.Subsystems.SubsystemOperationTime", b => + { + b.HasOne("AsbCloudDb.Model.Subsystems.Subsystem", "Subsystem") + .WithMany() + .HasForeignKey("IdSubsystem") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subsystem"); + + b.Navigation("Telemetry"); + }); + + 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.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.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/20231123085551_Add_New_WellOperationCategories.cs b/AsbCloudDb/Migrations/20231123085551_Add_New_WellOperationCategories.cs new file mode 100644 index 00000000..2d6bebc5 --- /dev/null +++ b/AsbCloudDb/Migrations/20231123085551_Add_New_WellOperationCategories.cs @@ -0,0 +1,94 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AsbCloudDb.Migrations +{ + public partial class Add_New_WellOperationCategories : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "t_well_operation_category", + columns: new[] { "id", "id_parent", "key_value_name", "key_value_units", "name" }, + values: new object[,] + { + { 4018, 3002, "dT", "мин", "Крепление" }, + { 5102, 4018, "dT", "мин", "Спуск пакера" }, + { 5103, 4011, "dT", "мин", "Запись гамма-каратожа" }, + { 5104, 4013, "dT", "мин", "Шаблонирование спуск БИ" }, + { 5105, 4018, "dT", "мин", "Сборка клин-отклонителя" }, + { 5106, 4018, "dT", "мин", "Ориентирование и посадка клина-отклонителя" }, + { 5107, 4018, "dT", "мин", "Протяжка подъемного патрубка подвески" }, + { 5108, 4018, "dT", "мин", "Подъем клина-отклонителя" }, + { 5109, 4018, "dT", "мин", "Стыковка стингера с хвостовиком основного ствола" }, + { 5110, 4018, "dT", "мин", "Ориентирование и установка стыковочного узла хвостовика" }, + { 5111, 4001, "МСП", "м/ч", "Бурение с отбором керна" }, + { 5112, 4018, "dT", "мин", "Работа пакером в обсадной колонне" } + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 4018); + + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 5102); + + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 5103); + + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 5104); + + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 5105); + + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 5106); + + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 5107); + + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 5108); + + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 5109); + + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 5110); + + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 5111); + + migrationBuilder.DeleteData( + table: "t_well_operation_category", + keyColumn: "id", + keyValue: 5112); + } + } +} diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index d430d37f..f11bc399 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -262,26 +262,48 @@ namespace AsbCloudDb.Migrations b.HasComment("Контакты"); }); - modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b => + modelBuilder.Entity("AsbCloudDb.Model.DailyReports.DailyReport", b => { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Date") + .HasColumnType("timestamp with time zone") + .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("StartDate") - .HasColumnType("date") - .HasColumnName("start_date") - .HasComment("Дата отчёта"); - - b.Property("Info") - .IsRequired() + b.Property("SignBlock") .HasColumnType("jsonb") - .HasColumnName("info") - .HasComment("Список параметров для отчёта"); + .HasColumnName("sign_block") + .HasComment("Подпись"); - b.HasKey("IdWell", "StartDate") - .HasName("t_id_well_date_start_pk"); + 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"); @@ -2413,6 +2435,12 @@ namespace AsbCloudDb.Migrations Id = 528, Description = "Разрешение на удаление контакта", Name = "WellContact.delete" + }, + new + { + Id = 529, + Description = "Разрешение на получение отчетов drill test", + Name = "DrillTestReport.get" }); }); @@ -4079,6 +4107,11 @@ namespace AsbCloudDb.Migrations { IdUserRole = 1, IdPermission = 528 + }, + new + { + IdUserRole = 1, + IdPermission = 529 }); }); @@ -5986,6 +6019,14 @@ namespace AsbCloudDb.Migrations Name = "Спуск обсадной колонны" }, new + { + Id = 4018, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Крепление" + }, + new { Id = 4007, IdParent = 3002, @@ -6872,6 +6913,94 @@ namespace AsbCloudDb.Migrations KeyValueName = "dT", KeyValueUnits = "мин", Name = "Ремонт" + }, + new + { + Id = 5102, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск пакера" + }, + new + { + Id = 5103, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Запись гамма-каратожа" + }, + new + { + Id = 5104, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонирование спуск БИ" + }, + new + { + Id = 5105, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка клин-отклонителя" + }, + new + { + Id = 5106, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование и посадка клина-отклонителя" + }, + new + { + Id = 5107, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Протяжка подъемного патрубка подвески" + }, + new + { + Id = 5108, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем клина-отклонителя" + }, + new + { + Id = 5109, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Стыковка стингера с хвостовиком основного ствола" + }, + new + { + Id = 5110, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование и установка стыковочного узла хвостовика" + }, + new + { + Id = 5111, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение с отбором керна" + }, + new + { + Id = 5112, + IdParent = 4018, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Работа пакером в обсадной колонне" }); }); @@ -7905,7 +8034,7 @@ namespace AsbCloudDb.Migrations b.Navigation("Well"); }); - modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b => + modelBuilder.Entity("AsbCloudDb.Model.DailyReports.DailyReport", b => { b.HasOne("AsbCloudDb.Model.Well", "Well") .WithMany() diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index b26c7a25..0016e981 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -3,6 +3,7 @@ using AsbCloudDb.Model.Subsystems; using Microsoft.EntityFrameworkCore; using System.Threading; using System.Threading.Tasks; +using AsbCloudDb.Model.DailyReports; using AsbCloudDb.Model.Manuals; using AsbCloudDb.Model.ProcessMaps; @@ -13,7 +14,7 @@ namespace AsbCloudDb.Model public virtual DbSet Clusters => Set(); public virtual DbSet Companies => Set(); public virtual DbSet CompaniesTypes => Set(); - public virtual DbSet DailyReports => Set (); + public virtual DbSet DailyReports => Set (); public virtual DbSet Deposits => Set(); public virtual DbSet DetectedOperations => Set(); public virtual DbSet PlannedTrajectories => Set(); @@ -331,11 +332,18 @@ namespace AsbCloudDb.Model .IsRequired(); }); - modelBuilder.Entity(entity => + modelBuilder.Entity(entity => { - entity.HasKey(e => new { e.IdWell, e.StartDate }) - .HasName("t_id_well_date_start_pk"); - entity.Property(e => e.Info) + entity.HasIndex(e => new { e.IdWell, e.Date }) + .IsUnique(); + + entity.Property(e => e.SubsystemBlock) + .HasJsonConversion(); + + entity.Property(e => e.SignBlock) + .HasJsonConversion(); + + entity.Property(e => e.TimeBalanceBlock) .HasJsonConversion(); }); diff --git a/AsbCloudDb/Model/DailyReport/Bha.cs b/AsbCloudDb/Model/DailyReport/Bha.cs deleted file mode 100644 index b1765c19..00000000 --- a/AsbCloudDb/Model/DailyReport/Bha.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace AsbCloudDb.Model.DailyReport -{ - public class Bha : ItemInfo - { - /// - /// КНБК описание - /// - public string BHADescription { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2195-2763м. Время начала - /// - public string ExtensionDrillingOneBegin { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2195-2763м. Время окончания - /// - public string ExtensionDrillingOneFinish { get; set; } = string.Empty; - - /// - /// Промывка. Время начала - /// - public string SluiceBegin { get; set; } = string.Empty; - - /// - /// Промывка. Время окончания - /// - public string SluiceFinish { get; set; } = string.Empty; - - /// - /// Подьем КНБК. Время начала - /// - public string ClimbBegin { get; set; } = string.Empty; - - /// - /// Подьем КНБК. Время окончания - /// - public string ClimbFinish { get; set; } = string.Empty; - - /// - /// Спуск КНБК. Время начала - /// - public string DescentBegin { get; set; } = string.Empty; - - /// - /// Спуск КНБК. Время окончания - /// - public string DescentFinish { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2763-2850м. Время начала - /// - public string ExtensionDrillingTwoBegin { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2763-2850м. Время окончания - /// - public string ExtensionDrillingTwoFinish { get; set; } = string.Empty; - - } -} diff --git a/AsbCloudDb/Model/DailyReport/DailyReport.cs b/AsbCloudDb/Model/DailyReport/DailyReport.cs deleted file mode 100644 index f620221f..00000000 --- a/AsbCloudDb/Model/DailyReport/DailyReport.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; -using System.ComponentModel.DataAnnotations.Schema; - -namespace AsbCloudDb.Model.DailyReport -{ - [Table("t_daily_report"), Comment("Ежедневные отчёты")] - public class DailyReport - { - [Column("id_well"), Comment("ID скважины")] - public int IdWell { get; set; } - - [Column("start_date", TypeName = "date"), Comment("Дата отчёта")] - public DateOnly StartDate { get; set; } - - [Column("info", TypeName = "jsonb"), Comment("Список параметров для отчёта")] - public DailyReportInfo Info { get; set; } = null!; - - [ForeignKey(nameof(IdWell))] - public virtual Well Well { get; set; } = null!; - } -} \ No newline at end of file diff --git a/AsbCloudDb/Model/DailyReport/DailyReportInfo.cs b/AsbCloudDb/Model/DailyReport/DailyReportInfo.cs deleted file mode 100644 index d5a7bfd6..00000000 --- a/AsbCloudDb/Model/DailyReport/DailyReportInfo.cs +++ /dev/null @@ -1,13 +0,0 @@ -using AsbCloudDb.Model.DailyReport; - -namespace AsbCloudDb.Model -{ - public class DailyReportInfo - { - public Head Head { get; set; } = null!; - public Bha Bha { get; set; } = new(); - public NoDrilling NoDrilling { get; set; } = new(); - public Saub Saub { get; set; } = new(); - public Sign Sign { get; set; } = new(); - } -} diff --git a/AsbCloudDb/Model/DailyReport/Head.cs b/AsbCloudDb/Model/DailyReport/Head.cs deleted file mode 100644 index fc5542e8..00000000 --- a/AsbCloudDb/Model/DailyReport/Head.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace AsbCloudDb.Model.DailyReport -{ - public class Head : ItemInfo - { - /// - /// название скважины - /// - public string WellName { get; set; } = string.Empty; - - /// - /// название куста - /// - public string ClusterName { get; set; } = string.Empty; - - /// - /// заказчик - /// - public string Customer { get; set; } = string.Empty; - - /// - /// подрядчик - /// - public string Contractor { get; set; } = string.Empty; - - /// - /// дата рапорта - /// - [JsonConverter(typeof(DateOnlyJsonConverter))] - public DateOnly ReportDate { get; set; } - - /// - /// глубина забоя на дату начала интервала - /// - public double? WellDepthIntervalStartDate { get; set; } - - /// - /// глубина забоя на дату окончания интервала - /// - public double? WellDepthIntervalFinishDate { get; set; } - - /// - /// Глубина забоя по стволу на окончание отчетного периода - /// - public double? BottomholeDepth { get; set; } - - /// - /// Глубина забоя по вертикали на дату окончания отчетного периода - /// - public double? VerticalDepth { get; set; } - - /// - /// Зенитный угол на дату окончания отчетного периода - /// - public double? ZenithAngle { get; set; } - - /// - /// Азимутальный угол на дату окончания отчетного периода - /// - public double? AzimuthAngle { get; set; } - - /// - /// ФИО бурильщиков - /// - public string FirstDriller { get; set; } = string.Empty; - - /// - /// ФИО бурильщиков - /// - public string SecondDriller { get; set; } = string.Empty; - - /// - /// Время работы АПД - /// - public double? WorkTimeSAUB { get; set; } - - /// - /// Время работы спин мастер - /// - public double? WorkTimeSpinMaster { get; set; } - - /// - /// Время работы torqueMaster - /// - public double? WorkTimeTorkMaster { get; set; } - - /// - /// количество метров пробуренных с включенным АПД - /// - public double? PenetrationSAUB { get; set; } - - /// - /// количество метров пробуренных с включенным Спин мастер - /// - public double? PenetrationSpinMaster { get; set; } - - /// - /// количество метров пробуренных с включенным torqueMaster - /// - public double? PenetrationTorkMaster { get; set; } - - /// - /// Количество запусков МСЕ - /// - public int CountLaunchesMSE { get; set; } - } -} - diff --git a/AsbCloudDb/Model/DailyReport/NoDrilling.cs b/AsbCloudDb/Model/DailyReport/NoDrilling.cs deleted file mode 100644 index c1a3b604..00000000 --- a/AsbCloudDb/Model/DailyReport/NoDrilling.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace AsbCloudDb.Model.DailyReport -{ - public class NoDrilling : ItemInfo - { - /// - /// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию - /// - public double? StandardTimeBarrelPreparation { get; set; } - - /// - /// Нормативное время на одну операцию по наращиванию - /// - public double? StandardTimeExtension { get; set; } - - /// - /// Фактическое время проработок при подготовке ствола скважины к наращиванию. - /// - public double? ActualTimeBarrelPreparation { get; set; } - - /// - /// Фактическое время наращиваний - /// - public double? ActualTimeExtension { get; set; } - } -} - diff --git a/AsbCloudDb/Model/DailyReport/Saub.cs b/AsbCloudDb/Model/DailyReport/Saub.cs deleted file mode 100644 index 43202677..00000000 --- a/AsbCloudDb/Model/DailyReport/Saub.cs +++ /dev/null @@ -1,101 +0,0 @@ -namespace AsbCloudDb.Model.DailyReport -{ - public class Saub : ItemInfo - { - /// - /// Режимы бурения в роторе - /// - public string? RotorDrillingModes { get; set; } - - /// - /// режимы бурения в слайде - /// - public string? SlideDrillingModes { get; set; } - - /// - /// Количество метров пробуренных в роторе за отчетный период - /// - public double? PenetrationInRotor { get; set; } - - /// - /// Количество часов бурения в роторе за отчетный период - /// - public double? NumberDrillingHours { get; set; } - - /// - /// средний диф перепад в роторе за отчетный период - /// - public double? AVGDiffDropRotor { get; set; } - - /// - /// количество метров пробуренных в слайде за отчетный период - /// - public double? PenetrationInSlide { get; set; } - - /// - /// время бурения в роторе за отчетный период - /// - public double? DrillingTimeInRotor { get; set; } - - /// - /// средний диф. перепад в слайде за отчетный период - /// - public double? AVGDiffPressureSlide { get; set; } - - /// - /// Плановая МСП за секцию - /// - public double? SectionROPPlan { get; set; } - - /// - /// Общее время бурения за секцию - /// - public double? SectionDrillingTimeTotal { get; set; } - - /// - /// Общая проходка за секцию - /// - public double? SectionPenetrationTotal { get; set; } - - /// - /// Количество наращиваний за отчетный период - /// - public int ExtensionsCount { get; set; } - - /// - /// Отклонение относительно ГГД - /// - public double? DeviationFromTVD { get; set; } - - /// - /// указываются все причины, которые влияют на снижение МСП. - /// - public string DeclinesReasonsROP { get; set; } = string.Empty; - - /// - /// Увеличение мех скорости за секцию % - /// - public string IncreaseSpeedSection { get; set; } = string.Empty; - - /// - /// Увеличение мех скорости за сутки % - /// - public string IncreaseSpeedDay { get; set; } = string.Empty; - - /// - /// Сокращение времени бурения за секцию, ч - /// - public string ReductionTimeDrilling { get; set; } = string.Empty; - - /// - /// Ротор/Слайд % - /// - public string RotorSlidePercent { get; set; } = string.Empty; - - /// - /// МСП - /// - public string MspSection { get; set; } = string.Empty; - } -} - diff --git a/AsbCloudDb/Model/DailyReport/Sign.cs b/AsbCloudDb/Model/DailyReport/Sign.cs deleted file mode 100644 index 1b443348..00000000 --- a/AsbCloudDb/Model/DailyReport/Sign.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace AsbCloudDb.Model.DailyReport -{ - public class Sign : ItemInfo - { - /// - /// ФИО Мастера буровой - /// - public string DrillingMaster { get; set; } = string.Empty; - - /// - /// ФИО супервайзера - /// - public string Supervisor { get; set; } = string.Empty; - } -} - diff --git a/AsbCloudDb/Model/DailyReports/Blocks/Sign/SignBlock.cs b/AsbCloudDb/Model/DailyReports/Blocks/Sign/SignBlock.cs new file mode 100644 index 00000000..2e394f79 --- /dev/null +++ b/AsbCloudDb/Model/DailyReports/Blocks/Sign/SignBlock.cs @@ -0,0 +1,8 @@ +namespace AsbCloudDb.Model.DailyReports.Blocks.Sign; + +public class SignBlock : ItemInfo +{ + public SignRecord? DrillingMaster { get; set; } + + public SignRecord? Supervisor { get; set; } +} \ No newline at end of file diff --git a/AsbCloudDb/Model/DailyReports/Blocks/Sign/SignRecord.cs b/AsbCloudDb/Model/DailyReports/Blocks/Sign/SignRecord.cs new file mode 100644 index 00000000..9ea1119e --- /dev/null +++ b/AsbCloudDb/Model/DailyReports/Blocks/Sign/SignRecord.cs @@ -0,0 +1,10 @@ +namespace AsbCloudDb.Model.DailyReports.Blocks.Sign; + +public class SignRecord +{ + public string Name { get; set; } = null!; + + public string Surname { get; set; } = null!; + + public string? Patronymic { get; set; } +} \ No newline at end of file diff --git a/AsbCloudDb/Model/DailyReports/Blocks/Subsystem/SubsystemBlock.cs b/AsbCloudDb/Model/DailyReports/Blocks/Subsystem/SubsystemBlock.cs new file mode 100644 index 00000000..67223138 --- /dev/null +++ b/AsbCloudDb/Model/DailyReports/Blocks/Subsystem/SubsystemBlock.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; + +namespace AsbCloudDb.Model.DailyReports.Blocks.Subsystem; + +public class SubsystemBlock : ItemInfo +{ + public double? Wellbore { get; set; } + + public double? MeasurementsPerDay { get; set; } + + public double? TvgLagDays { get; set; } + + public double? TotalRopPlan { get; set; } + + public string? Comment { get; set; } + + public IEnumerable? Subsystems { get; set; } +} \ No newline at end of file diff --git a/AsbCloudDb/Model/DailyReports/Blocks/Subsystem/SubsystemParameters.cs b/AsbCloudDb/Model/DailyReports/Blocks/Subsystem/SubsystemParameters.cs new file mode 100644 index 00000000..839e181c --- /dev/null +++ b/AsbCloudDb/Model/DailyReports/Blocks/Subsystem/SubsystemParameters.cs @@ -0,0 +1,10 @@ +namespace AsbCloudDb.Model.DailyReports.Blocks.Subsystem; + +public class SubsystemParameters +{ + public double? SumDepthInterval { get; set; } + + public double? UsedTimeHours { get; set; } + + public double? KUsage { get; set; } +} \ No newline at end of file diff --git a/AsbCloudDb/Model/DailyReports/Blocks/Subsystem/SubsystemRecord.cs b/AsbCloudDb/Model/DailyReports/Blocks/Subsystem/SubsystemRecord.cs new file mode 100644 index 00000000..86b376b6 --- /dev/null +++ b/AsbCloudDb/Model/DailyReports/Blocks/Subsystem/SubsystemRecord.cs @@ -0,0 +1,10 @@ +namespace AsbCloudDb.Model.DailyReports.Blocks.Subsystem; + +public class SubsystemRecord +{ + public string Name { get; set; } = null!; + + public SubsystemParameters? UsagePerDay { get; set; } + + public SubsystemParameters? UsagePerWell { get; set; } +} \ No newline at end of file diff --git a/AsbCloudDb/Model/DailyReports/Blocks/TimeBalance/TimeBalanceBlock.cs b/AsbCloudDb/Model/DailyReports/Blocks/TimeBalance/TimeBalanceBlock.cs new file mode 100644 index 00000000..6af3a946 --- /dev/null +++ b/AsbCloudDb/Model/DailyReports/Blocks/TimeBalance/TimeBalanceBlock.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; + +namespace AsbCloudDb.Model.DailyReports.Blocks.TimeBalance; + +public class TimeBalanceBlock : ItemInfo +{ + public int IdSection { get; set; } + + public string? SectionName { get; set; } + + public double? WellDepthPlan { get; set; } + + public double WellDepthFact { get; set; } + + public double? WellOperationSlipsTimeCount { get; set; } + + public IEnumerable? WellOperations { get; set; } +} \ No newline at end of file diff --git a/AsbCloudDb/Model/DailyReports/Blocks/TimeBalance/TimeBalanceRecord.cs b/AsbCloudDb/Model/DailyReports/Blocks/TimeBalance/TimeBalanceRecord.cs new file mode 100644 index 00000000..5c08ab8c --- /dev/null +++ b/AsbCloudDb/Model/DailyReports/Blocks/TimeBalance/TimeBalanceRecord.cs @@ -0,0 +1,16 @@ +namespace AsbCloudDb.Model.DailyReports.Blocks.TimeBalance; + +public class TimeBalanceRecord +{ + public int IdWellOperation { get; set; } + + public double? DurationHoursPlan { get; set; } + + public double? DurationHoursFact { get; set; } + + public double? DrillingDeviationPerSection { get; set; } + + public double? DrillingDeviationPerDay { get; set; } + + public string? ReasonDeviation { get; set; } +} \ No newline at end of file diff --git a/AsbCloudDb/Model/DailyReports/DailyReport.cs b/AsbCloudDb/Model/DailyReports/DailyReport.cs new file mode 100644 index 00000000..1906d9ab --- /dev/null +++ b/AsbCloudDb/Model/DailyReports/DailyReport.cs @@ -0,0 +1,37 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using AsbCloudDb.Model.DailyReports.Blocks.Sign; +using AsbCloudDb.Model.DailyReports.Blocks.Subsystem; +using AsbCloudDb.Model.DailyReports.Blocks.TimeBalance; +using Microsoft.EntityFrameworkCore; + +namespace AsbCloudDb.Model.DailyReports; + +[Table("t_daily_report"), Comment("Ежедневные отчёты")] +public class DailyReport : IId +{ + [Key] + public int Id { get; set; } + + [Column("id_well"), Comment("ID скважины")] + public int IdWell { get; set; } + + [Column("date_last_update", TypeName = "timestamp with time zone"), Comment("Дата последнего обновления")] + public DateTime? DateLastUpdate { get; set; } + + [Column("date", TypeName = "timestamp with time zone"), Comment("Дата формирования отчёта")] + public DateTime Date { get; set; } + + [Column("sign_block", TypeName = "jsonb"), Comment("Подпись")] + public SignBlock? SignBlock { get; set; } + + [Column("time_balance_block", TypeName = "jsonb"), Comment("Баланс времени")] + public TimeBalanceBlock? TimeBalanceBlock { get; set; } + + [Column("subsystem_block", TypeName = "jsonb"), Comment("Наработкой подсистем")] + public SubsystemBlock? SubsystemBlock { get; set; } + + [ForeignKey(nameof(IdWell))] + public virtual Well Well { get; set; } = null!; +} \ No newline at end of file diff --git a/AsbCloudDb/Model/DefaultData/WellOperationCategories.xlsx b/AsbCloudDb/Model/DefaultData/WellOperationCategories.xlsx new file mode 100644 index 00000000..1f41a051 Binary files /dev/null and b/AsbCloudDb/Model/DefaultData/WellOperationCategories.xlsx differ diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs index 74e61356..6d5098c8 100644 --- a/AsbCloudDb/Model/IAsbCloudDbContext.cs +++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs @@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using System; using System.Threading; using System.Threading.Tasks; +using AsbCloudDb.Model.DailyReports; using AsbCloudDb.Model.Manuals; using AsbCloudDb.Model.ProcessMaps; @@ -17,7 +18,7 @@ namespace AsbCloudDb.Model DbSet Clusters { get; } DbSet Companies { get; } DbSet CompaniesTypes { get; } - DbSet DailyReports { get; } + DbSet DailyReports { get; } DbSet Deposits { get; } DbSet DetectedOperations { get; } DbSet PlannedTrajectories { get; } diff --git a/AsbCloudDb/Model/DailyReport/ItemInfo.cs b/AsbCloudDb/Model/ItemInfo.cs similarity index 100% rename from AsbCloudDb/Model/DailyReport/ItemInfo.cs rename to AsbCloudDb/Model/ItemInfo.cs diff --git a/AsbCloudDb/Model/WellOperationCategory.cs b/AsbCloudDb/Model/WellOperationCategory.cs index 8829011e..28acc79e 100644 --- a/AsbCloudDb/Model/WellOperationCategory.cs +++ b/AsbCloudDb/Model/WellOperationCategory.cs @@ -253,6 +253,7 @@ namespace AsbCloudDb.Model new () {Id = IdBuilding, IdParent = 3000, Name = "Наращивание", KeyValueName = "dT", KeyValueUnits = "мин" }, new () {Id = IdSPO , IdParent = 3001, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" }, new () {Id = IdCasingRunning, IdParent = 3002, Name = "Спуск обсадной колонны", KeyValueName = "dT", KeyValueUnits = "мин" }, + new () {Id = 4018, IdParent = 3002, Name = "Крепление", KeyValueName = "dT", KeyValueUnits = "мин"}, new () {Id = IdCementing, IdParent = 3002, Name = "Цементирование", KeyValueName = "dT", KeyValueUnits = "мин" }, new () {Id = IdAuxiliaryWorkFastening, IdParent = 3002, Name = "Вспомогательные работы при креплении", KeyValueName = "dT", KeyValueUnits = "мин" }, new () {Id = IdAssemblyOrDisassemblyGIS, IdParent = 3003, Name = "Сборка/разборка приборов ГИС", KeyValueName = "dT", KeyValueUnits = "мин" }, @@ -370,6 +371,17 @@ namespace AsbCloudDb.Model new () {Id = 5099, IdParent = 4013, Name = "Подготовка ствола скважины. Перезапись ГК в интервале установки КО.", KeyValueName = "dT", KeyValueUnits = "мин" }, new () {Id = 5100, IdParent = 4013, Name = "Смена рабочего переводника ВСП", KeyValueName = "dT", KeyValueUnits = "мин" }, new () {Id = 5101, IdParent = 4014, Name = "Ремонт", KeyValueName = "dT", KeyValueUnits = "мин" }, + new () {Id = 5102, IdParent = 4018, Name = "Спуск пакера", KeyValueName = "dT", KeyValueUnits = "мин"}, + new () {Id = 5103, IdParent = 4011, Name = "Запись гамма-каратожа", KeyValueName = "dT", KeyValueUnits = "мин"}, + new () {Id = 5104, IdParent = 4013, Name = "Шаблонирование спуск БИ", KeyValueName = "dT", KeyValueUnits = "мин"}, + new () {Id = 5105, IdParent = 4018, Name = "Сборка клин-отклонителя", KeyValueName = "dT", KeyValueUnits = "мин"}, + new () {Id = 5106, IdParent = 4018, Name = "Ориентирование и посадка клина-отклонителя", KeyValueName = "dT", KeyValueUnits = "мин"}, + new () {Id = 5107, IdParent = 4018, Name = "Протяжка подъемного патрубка подвески", KeyValueName = "dT", KeyValueUnits = "мин"}, + new () {Id = 5108, IdParent = 4018, Name = "Подъем клина-отклонителя", KeyValueName = "dT", KeyValueUnits = "мин"}, + new () {Id = 5109, IdParent = 4018, Name = "Стыковка стингера с хвостовиком основного ствола", KeyValueName = "dT", KeyValueUnits = "мин"}, + new () {Id = 5110, IdParent = 4018, Name = "Ориентирование и установка стыковочного узла хвостовика", KeyValueName = "dT", KeyValueUnits = "мин"}, + new () {Id = 5111, IdParent = 4001, Name = "Бурение с отбором керна", KeyValueName = "МСП", KeyValueUnits = "м/ч"}, + new () {Id = 5112, IdParent = 4018, Name = "Работа пакером в обсадной колонне", KeyValueName = "dT", KeyValueUnits = "мин"} }; #endregion diff --git a/AsbCloudDb/Setup db replication.md b/AsbCloudDb/Setup db replication.md index f4a529af..91c64792 100644 --- a/AsbCloudDb/Setup db replication.md +++ b/AsbCloudDb/Setup db replication.md @@ -15,7 +15,7 @@ sudo nano postgresql.conf 2. В postgres.conf найти запись listen_addresses и добавить туда ip standby-сервера - > listen_addresses = '*, ' + > listen_addresses = 'localhost, ' 3. Открыть клиент для работы с postgres @@ -52,7 +52,7 @@ sudo nano pg_hba.conf ``` ## 3. Настройка replica-сервера - 1. Остановить сервер + 1. Остановить сервер ``` sudo systemctl stop postgresql ``` @@ -75,7 +75,7 @@ sudo nano pg_hba.conf 5. Используя утилиту basebackup создать базовую резервную копию с правами владения postgres (либо любого пользователя с соответствующими разрешениями). ``` - pg_basebackup -h -D /var/lib/postgresql/14/main/ -U replicator -P -v -R -X stream -C -S slaveslot1 + pg_basebackup -h -D /var/lib/postgresql/15/main/ -U replicator -P -v -R -X stream -C -S slaveslot1 где: /var/lib/postgresql/15/main/ - каталог replica-сервера ``` @@ -133,12 +133,12 @@ sudo -u postgres psql 1. Установить на primary-сервер pgpool2 и postgresql-14-pgpool2 ``` -apt-get -y install pgpool2 postgresql-15-pgpool2 +apt -y install pgpool2 postgresql-15-pgpool2 ``` 2. Установить на standby-сервер только postgresql-14-pgpool2 ``` -apt-get -y install postgresql-15-pgpool2 +apt -y install postgresql-15-pgpool2 ``` ### Далее все настройки выполнить на primary-сервере 3. Зайти на редактирование в конфигурационный файл pgpool2 @@ -154,11 +154,12 @@ apt-get -y install postgresql-15-pgpool2 backend_hostname0 = '' backend_port0 = '<порт primary-сервера>' backend_weight0 = 0 - backend_data_directory0 = '/var/lib/postgresql/14/main' + backend_data_directory0 = '/var/lib/postgresql/15/main' ___ backend_hostname1 = '' - backend_port1 = '<порт primary-сервера>' + backend_port1 = '<порт replica-сервера>' backend_weight1 = 1 + ___ enable_pool_hba = on log_statement = on diff --git a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj index d731d329..1b3f5f92 100644 --- a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj +++ b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj @@ -35,7 +35,6 @@ - @@ -62,10 +61,6 @@ - - - - CommonLibs\AsbWitsInfo.dll diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index e5095db4..62e05164 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -1,6 +1,5 @@ using System; using AsbCloudApp.Data; -using AsbCloudApp.Data.AutogeneratedDailyReport; using AsbCloudApp.Data.DrillTestReport; using AsbCloudApp.Data.Manuals; using AsbCloudApp.Data.ProcessMaps; @@ -9,7 +8,6 @@ using AsbCloudApp.Data.Subsystems; using AsbCloudApp.Data.WellOperationImport.Options; using AsbCloudApp.Repositories; using AsbCloudApp.Services; -using AsbCloudApp.Services.AutoGeneratedDailyReports; using AsbCloudApp.Services.Notifications; using AsbCloudApp.Services.ProcessMaps; using AsbCloudApp.Services.ProcessMaps.WellDrilling; @@ -22,7 +20,6 @@ using AsbCloudDb.Model.Subsystems; using AsbCloudInfrastructure.Background; using AsbCloudInfrastructure.Repository; using AsbCloudInfrastructure.Services; -using AsbCloudInfrastructure.Services.AutoGeneratedDailyReports; using AsbCloudInfrastructure.Services.DailyReport; using AsbCloudInfrastructure.Services.DetectOperations; using AsbCloudInfrastructure.Services.DrillingProgram; @@ -40,21 +37,15 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using AsbCloudApp.Data.DailyReport.Blocks.TimeBalance; +using AsbCloudApp.Services.DailyReport; +using AsbCloudDb.Model.DailyReports.Blocks.TimeBalance; namespace AsbCloudInfrastructure { public static class DependencyInjection { - public static IAsbCloudDbContext MakeContext(string connectionString) - { - var options = new DbContextOptionsBuilder() - .UseNpgsql(connectionString) - .Options; - var context = new AsbCloudDbContext(options); - return context; - } - public static void MapsterSetup() { TypeAdapterConfig.GlobalSettings.Default.Config @@ -145,6 +136,22 @@ namespace AsbCloudInfrastructure .Map(dest => dest.TopDriveSpeedLimitMax, src => src.TopDriveSpeed.LimitMax) .Map(dest => dest.TopDriveTorquePlan, src => src.TopDriveTorque.Plan) .Map(dest => dest.TopDriveTorqueLimitMax, src => src.TopDriveTorque.LimitMax); + + + TypeAdapterConfig.GlobalSettings.Default.Config + .ForType() + .Map(dest => dest.DurationHours, src => new PlanFactDto() + { + Plan = src.DurationHoursPlan, + Fact = src.DurationHoursFact + }); + + TypeAdapterConfig.GlobalSettings.Default.Config + .ForType() + .Map(dest => dest.WellDepth, src => new PlanFactDto() + { + Plan = src.WellDepthPlan + }); } public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration) @@ -278,9 +285,7 @@ namespace AsbCloudInfrastructure services.AddTransient, WitsRecordRepository>(); services.AddTransient, WitsRecordRepository>(); services.AddTransient, WitsRecordRepository>(); - - services.AddTransient(); - services.AddTransient, AutoGeneratedDailyReportMakerService>(); + services.AddTransient(); services.AddTransient, DrillTestReportMakerService>(); @@ -299,21 +304,11 @@ namespace AsbCloudInfrastructure services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + return services; - } - - public static IServiceCollection AddTransientLazy(this IServiceCollection services) - where TService : class - where TImplementation : class, TService - => services.AddTransient() - .AddTransient(provider => new Lazy(provider.GetRequiredService)); - - public static IServiceCollection AddTransientLazy(this IServiceCollection services, Func implementationFactory) - where TService : class - where TImplementation : class, TService - => services.AddTransient(implementationFactory) - .AddTransient(provider => new Lazy(() => implementationFactory(provider))); - + } } - } diff --git a/AsbCloudInfrastructure/Repository/DailyReportRepository.cs b/AsbCloudInfrastructure/Repository/DailyReportRepository.cs new file mode 100644 index 00000000..fff15138 --- /dev/null +++ b/AsbCloudInfrastructure/Repository/DailyReportRepository.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.DailyReport; +using AsbCloudApp.Data.DailyReport.Blocks.Sign; +using AsbCloudApp.Data.DailyReport.Blocks.Subsystems; +using AsbCloudApp.Data.DailyReport.Blocks.TimeBalance; +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; +using AsbCloudDb; +using AsbCloudDb.Model; +using AsbCloudDb.Model.DailyReports; +using Mapster; +using Microsoft.EntityFrameworkCore; + +namespace AsbCloudInfrastructure.Repository; + +public class DailyReportRepository : CrudRepositoryBase, + IDailyReportRepository +{ + public DailyReportRepository(IAsbCloudDbContext dbContext) + : base(dbContext) + { + } + + public async Task> GetAsync(int idWell, FileReportRequest request, CancellationToken cancellationToken) + { + var skip = request.Skip ?? 0; + var take = request.Take ?? 10; + + var query = GetQuery().Where(d => d.IdWell == idWell); + + if (request.GeDate.HasValue) + { + var geDate = request.GeDate.Value.ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc); + query = query.Where(d => d.Date >= geDate); + } + + if (request.LeDate.HasValue) + { + var leDate = request.LeDate.Value.ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc); + query = query.Where(d => d.Date <= leDate); + } + + if (request.SortFields?.Any() == true) + { + query = query.SortBy(request.SortFields); + } + else + { + query = query.OrderBy(d => d.Date); + } + + var entities = await query + .Skip(skip) + .Take(take) + .AsNoTracking() + .ToArrayAsync(cancellationToken); + + var dtos = entities.Select(Convert); + + return dtos; + } + + public async Task GetOrDefaultAsync(int idWell, DateTime date, CancellationToken cancellationToken) + { + var entity = await GetQuery() + .AsNoTracking() + .SingleOrDefaultAsync(d => d.IdWell == idWell && d.Date == date, cancellationToken); + + return entity is null ? null : Convert(entity); + } + + protected override DailyReportDto Convert(DailyReport src) + { + var dto = new DailyReportDto + { + Id = src.Id, + IdWell = src.IdWell, + DateLastUpdate = src.DateLastUpdate, + Date = src.Date, + SignBlock = src.SignBlock?.Adapt(), + TimeBalanceBlock = src.TimeBalanceBlock?.Adapt(), + SubsystemBlock = src.SubsystemBlock?.Adapt() + }; + + return dto; + } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Repository/ScheduleRepository.cs b/AsbCloudInfrastructure/Repository/ScheduleRepository.cs index 8cbb62f5..92676cd4 100644 --- a/AsbCloudInfrastructure/Repository/ScheduleRepository.cs +++ b/AsbCloudInfrastructure/Repository/ScheduleRepository.cs @@ -1,17 +1,19 @@ using AsbCloudApp.Data; 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; +using Mapster; namespace AsbCloudInfrastructure.Repository { - public class ScheduleRepository : CrudWellRelatedRepositoryBase, IScheduleRepository + public class ScheduleRepository : CrudWellRelatedRepositoryBase, + IScheduleRepository { private readonly IWellService wellService; @@ -21,31 +23,47 @@ namespace AsbCloudInfrastructure.Repository this.wellService = wellService; } + public async Task> GetAsync(int idWell, DateTime workTime, CancellationToken token) + { + var entities = await BuildQuery(idWell, workTime) + .AsNoTracking() + .ToArrayAsync(token); + + return entities.Select(Convert); + } + public async Task GetOrDefaultDrillerAsync(int idWell, DateTime workTime, CancellationToken token) { - var hoursOffset = wellService.GetTimezone(idWell).Hours; - var date = workTime.ToUtcDateTimeOffset(hoursOffset); - - var entities = await GetQuery() - .Where(s => s.IdWell == idWell - && s.DrillStart <= date - && s.DrillEnd >= date) - .ToListAsync(token); + var entities = await BuildQuery(idWell, workTime) + .AsNoTracking() + .ToArrayAsync(token); if (!entities.Any()) return null; - - var remoteDate = date.ToRemoteDateTime(hoursOffset); + + var hoursOffset = wellService.GetTimezone(idWell).Hours; + var remoteDate = workTime.ToUtcDateTimeOffset(hoursOffset).ToRemoteDateTime(hoursOffset); var time = new TimeOnly(remoteDate.Hour, remoteDate.Minute, remoteDate.Second); - + var entity = entities.FirstOrDefault(s => s.ShiftStart > s.ShiftEnd ^ (time >= s.ShiftStart && time < s.ShiftEnd) ); - + return entity?.Driller.Adapt(); } + private IQueryable BuildQuery(int idWell, DateTime workTime) + { + var hoursOffset = wellService.GetTimezone(idWell).Hours; + + var workTimeDateTime = workTime.ToUtcDateTimeOffset(hoursOffset); + + return GetQuery().Where(s => s.IdWell == idWell + && s.DrillStart <= workTimeDateTime + && s.DrillEnd >= workTimeDateTime); + } + protected override Schedule Convert(ScheduleDto dto) { var hoursOffset = wellService.GetTimezone(dto.IdWell).Hours; diff --git a/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs b/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs index 5eb7b57d..1c29d780 100644 --- a/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs +++ b/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs @@ -1,53 +1,65 @@ using AsbCloudApp.Data; -using AsbCloudApp.Repositories; -using AsbCloudApp.Services; -using AsbCloudDb.Model; -using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using AsbCloudApp.Exceptions; +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; +using AsbCloudDb.Model; +using AsbCloudDb.Model.WITS; +using Microsoft.EntityFrameworkCore; -namespace AsbCloudInfrastructure.Repository +namespace AsbCloudInfrastructure.Repository; + +public class TrajectoryFactRepository : ITrajectoryFactRepository { - internal class TrajectoryFactRepository : ITrajectoryFactRepository - { - private readonly IAsbCloudDbContext db; - private readonly IWellService wellService; - public TrajectoryFactRepository(IAsbCloudDbContext db, IWellService wellService) - { - this.db = db; - this.wellService = wellService; - } - - public async Task> GetAsync(int idWell, CancellationToken token) - { - var well = await wellService.GetOrDefaultAsync(idWell, - token); - - if (well is null) - return Enumerable.Empty(); + private readonly IAsbCloudDbContext dbContext; - var entities = await db.Record7 - .AsNoTracking() - .Where(x => x.IdTelemetry == well.IdTelemetry) - .Where(coord => coord.Deptsvym != null && coord.Svyinc != null && coord.Svyazc != null) - .OrderBy(e => e.Deptsvym) - .ToArrayAsync(token); + public TrajectoryFactRepository(IAsbCloudDbContext dbContext) + { + this.dbContext = dbContext; + } - var result = entities - .Select(coord => new TrajectoryGeoFactDto - { - IdWell = idWell, - AzimuthMagnetic = coord.Svymtf, - VerticalDepth = coord.Deptsvyv, - WellboreDepth = coord.Deptsvym!.Value, - ZenithAngle = coord.Svyinc!.Value, - AzimuthGeo = coord.Svyazc!.Value - }) - .ToArray(); + public async Task> GetAsync(TrajectoryGeoFactRequest request, CancellationToken token) => + (await BuildQuery(request) + .Where(coord => coord.Deptsvym.HasValue && + coord.Svyinc.HasValue && + coord.Svyazc.HasValue) + .AsNoTracking() + .ToArrayAsync(token)) + .Select(r => new TrajectoryGeoFactDto + { + IdWell = request.IdWell, + AzimuthMagnetic = r.Svymtf, + VerticalDepth = r.Deptsvyv, + WellboreDepth = r.Deptsvym!.Value, + ZenithAngle = r.Svyinc!.Value, + AzimuthGeo = r.Svyazc!.Value + }); - return result; - } - } -} + public Task> GetAsync(int idWell, CancellationToken token) => + GetAsync(new TrajectoryGeoFactRequest + { + IdWell = idWell + }, token); + + private IQueryable BuildQuery(TrajectoryGeoFactRequest request) + { + var well = dbContext.Wells.SingleOrDefault(w => w.Id == request.IdWell); + + if (well is null) + throw new ArgumentInvalidException($"Скважина с Id: {request.IdWell} не найдена", nameof(request.IdWell)); + + var query = dbContext.Record7.Where(r => r.IdTelemetry == well.IdTelemetry) + .Where(x => x.IdTelemetry == well.IdTelemetry); + + if (request.GeDate.HasValue) + query = query.Where(r => r.DateTime >= request.GeDate.Value); + + if (request.LeDate.HasValue) + query = query.Where(r => r.DateTime <= request.LeDate.Value); + + return query.OrderBy(e => e.Deptsvym); + } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportMakerService.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportMakerService.cs deleted file mode 100644 index cfc95753..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportMakerService.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Threading; -using System.Threading.Tasks; -using AsbCloudApp.Data.AutogeneratedDailyReport; -using AsbCloudApp.Services; -using AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks; -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports; - -public class AutoGeneratedDailyReportMakerService : IReportMakerService -{ - private readonly string templateName = "AutogeneratedDailyReportTemplate.xlsx"; - - private readonly IEnumerable blockWriters = new List() - { - new HeadExcelBlockWriter(), - new SubsystemExcelBlockWriter(), - new LimitingParameterExcelBlockWriter(), - new TimeBalanceExcelBlockWriter() - }; - - public async Task MakeReportAsync(AutoGeneratedDailyReportDto report, CancellationToken cancellationToken) - { - using var excelTemplateStream = await Assembly - .GetExecutingAssembly() - .GetTemplateCopyStreamAsync(templateName, cancellationToken); - - using var workbook = new XLWorkbook(excelTemplateStream, XLEventTracking.Disabled); - - AddToWorkbook(workbook, report); - - MemoryStream memoryStream = new MemoryStream(); - workbook.SaveAs(memoryStream, new SaveOptions { }); - memoryStream.Seek(0, SeekOrigin.Begin); - - return memoryStream; - } - - private void AddToWorkbook(XLWorkbook workbook, AutoGeneratedDailyReportDto report) - { - const string sheetName = "Рапорт"; - - var sheet = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetName) - ?? throw new FileFormatException($"Книга excel не содержит листа {sheetName}."); - - foreach (var blockBuilder in blockWriters) - { - blockBuilder.Write(sheet, report); - } - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs deleted file mode 100644 index 1ada2676..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs +++ /dev/null @@ -1,262 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using AsbCloudApp.Data; -using AsbCloudApp.Data.AutogeneratedDailyReport; -using AsbCloudApp.Data.Subsystems; -using AsbCloudApp.Exceptions; -using AsbCloudApp.Repositories; -using AsbCloudApp.Requests; -using AsbCloudApp.Services; -using AsbCloudApp.Services.AutoGeneratedDailyReports; -using AsbCloudApp.Services.Subsystems; -using AsbCloudDb.Model; - -namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports; - -public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService -{ - private const string fileNameTemplate = "Суточный_отчёт_по_скважине_{0}_куст_{1}_от_{2}.xlsx"; - - private readonly IWellService wellService; - private readonly IWellOperationRepository wellOperationRepository; - private readonly ISubsystemOperationTimeService subsystemOperationTimeService; - private readonly ICrudRepository subsystemRepository; - private readonly ILimitingParameterService limitingParameterService; - private readonly IReportMakerService autoGeneratedDailyReportMakerService; - - public AutoGeneratedDailyReportService(IWellService wellService, - IWellOperationRepository wellOperationRepository, - ISubsystemOperationTimeService subsystemOperationTimeService, - ICrudRepository subsystemRepository, - ILimitingParameterService limitingParameterService, - IReportMakerService autoGeneratedDailyReportMakerService) - { - this.wellOperationRepository = wellOperationRepository; - this.wellService = wellService; - this.subsystemOperationTimeService = subsystemOperationTimeService; - this.subsystemRepository = subsystemRepository; - this.limitingParameterService = limitingParameterService; - this.autoGeneratedDailyReportMakerService = autoGeneratedDailyReportMakerService; - } - - public async Task> GetListAsync(int idWell, - FileReportRequest request, - CancellationToken cancellationToken) - { - var result = new PaginationContainer - { - Skip = request.Skip ?? 0, - Take = request.Take ?? 10, - Items = Enumerable.Empty() - }; - - var reports = new List(); - - var well = await wellService.GetOrDefaultAsync(idWell, cancellationToken) - ?? throw new ArgumentInvalidException(nameof(idWell), "Скважина не найдена"); - - if (!well.IdTelemetry.HasValue) - throw new ArgumentInvalidException(nameof(idWell), "Телеметрия для скважины отсутствует"); - - var datesRange = await GetDatesRangeAsync(idWell, cancellationToken); - - if (datesRange is null) - return result; - - if (request.GeDate.HasValue) - { - var startDate = new DateTime(request.GeDate.Value.Year, request.GeDate.Value.Month, - request.GeDate.Value.Day); - - if(startDate.Date >= datesRange.From.Date) - datesRange.From = startDate; - } - - if (request.LeDate.HasValue) - { - var finishDate = new DateTime(request.LeDate.Value.Year, request.LeDate.Value.Month, - request.LeDate.Value.Day); - - if (finishDate.Date <= datesRange.To.Date) - datesRange.To = finishDate; - } - - if (datesRange.From.AddDays(result.Skip) <= datesRange.To) - result.Count = (int)(Math.Ceiling((datesRange.To - DateTime.UnixEpoch).TotalDays) - Math.Floor((datesRange.From - DateTime.UnixEpoch).TotalDays)); - - for (int day = result.Skip; (day - result.Skip) < result.Take && (datesRange.From.AddDays(day)) <= datesRange.To; day++) - { - var reportDate = DateOnly.FromDateTime(datesRange.From.AddDays(day)); - - reports.Add(new AutoGeneratedDailyReportInfoDto - { - FileName = string.Format(fileNameTemplate, well.Caption, well.Cluster, reportDate), - ReportDate = reportDate, - FileSize = GetFileSize(reportDate, idWell), - }); - } - - result.Items = reports; - - return result; - } - - public async Task<(string fileName, Stream stream)> GenerateAsync(int idWell, DateOnly reportDate, - CancellationToken cancellationToken) - { - var startDate = new DateTime(reportDate.Year, reportDate.Month, reportDate.Day); - var finishDate = startDate.AddDays(1); - - var well = await wellService.GetOrDefaultAsync(idWell, cancellationToken) - ?? throw new ArgumentInvalidException(nameof(idWell), "Скважина не найдена"); - - if (!well.IdTelemetry.HasValue) - throw new ArgumentInvalidException(nameof(idWell), "Телеметрия для скважины отсутствует"); - - var factOperations = await GetFactOperationsAsync(well.Id, startDate, finishDate, - cancellationToken); - - var report = new AutoGeneratedDailyReportDto - { - FileName = string.Format(fileNameTemplate, well.Caption, well.Cluster, reportDate), - FileSize = GetFileSize(reportDate, idWell), - ReportDate = reportDate, - Head = CreateHeadBlock(well, factOperations), - Subsystems = (await CreateSubsystemBlockAsync(idWell, startDate, finishDate, cancellationToken)).ToArray(), - LimitingParameters = (await CreateLimitingParameterBlockAsync(idWell, startDate, finishDate, cancellationToken)).ToArray(), - TimeBalance = factOperations.GroupBy(w => w.CategoryName).Select(x => new TimeBalanceRecordDto - { - Name = x.Key ?? "Название операции отсутствует", - DurationHours = x.Sum(o => o.DurationHours) - }).ToArray(), - }; - - var stream = await autoGeneratedDailyReportMakerService.MakeReportAsync(report, cancellationToken); - - return (report.FileName, stream); - } - - public async Task GetDatesRangeAsync(int idWell, CancellationToken cancellationToken) - { - var factOperations = await GetFactOperationsAsync(idWell, null, null, - cancellationToken); - - if (!factOperations.Any()) - return null; - - return new DatesRangeDto - { - From = factOperations.Min(o => o.DateStart).Date, - To = factOperations.Max(o => o.DateStart).Date - }; - } - - private HeadBlockDto CreateHeadBlock(WellDto well, IEnumerable factOperations) - { - var customer = well.Companies.FirstOrDefault(company => company.IdCompanyType == 1); - var sortedFactOperations = factOperations.OrderBy(o => o.DateStart); - - return new HeadBlockDto - { - Customer = customer?.Caption ?? string.Empty, - Deposit = well.Deposit ?? string.Empty, - Cluster = well.Cluster ?? string.Empty, - Well = well.Caption, - DepthFrom = sortedFactOperations.FirstOrDefault()?.DepthStart ?? 0.00, - DepthTo = sortedFactOperations.LastOrDefault()?.DepthEnd ?? 0.00 - }; - } - - private async Task> CreateSubsystemBlockAsync(int idWell, DateTime startDate, - DateTime finishDate, - CancellationToken cancellationToken) - { - var subsystems = await subsystemRepository.GetAllAsync(cancellationToken); - var subsystemStats = await GetSubsystemStatsAsync(idWell, startDate, finishDate, - cancellationToken); - - return subsystems.Select(subsystem => - { - var subsytemStat = subsystemStats?.FirstOrDefault(s => s.IdSubsystem == subsystem.Id); - - return new SubsystemRecordDto - { - Name = subsystem.Name, - KUsage = subsytemStat?.KUsage ?? 0.00, - UsedTimeHours = subsytemStat?.UsedTimeHours ?? 0.00, - Depth = subsytemStat?.SumDepthInterval ?? 0.00, - }; - }); - } - - private async Task> CreateLimitingParameterBlockAsync(int idWell, - DateTime startDate, DateTime finishDate, CancellationToken cancellationToken) - { - var limitingParameterStats = (await GetLimitingParameterStatsAsync(idWell, - startDate, finishDate, cancellationToken)).ToArray(); - - var sumDepths = limitingParameterStats.Sum(x => x.Depth); - - return limitingParameterStats.Select(l => new LimitingParameterRecordDto - { - NameFeedRegulator = l.NameFeedRegulator, - Hours = l.TotalMinutes, - PercentDepth = sumDepths != 0 ? l.Depth / sumDepths : 0, - Depth = l.Depth, - }); - } - - private async Task> GetFactOperationsAsync(int idWell, DateTime? startDate, - DateTime? finishDate, CancellationToken cancellationToken) - { - var request = new WellOperationRequest - { - IdWell = idWell, - OperationType = WellOperation.IdOperationTypeFact, - GeDate = startDate, - LtDate = finishDate, - SortFields = new[] { "DateStart asc" }, - }; - - return (await wellOperationRepository.GetAsync(request, cancellationToken)) - .OrderBy(w => w.DateStart); - } - - private Task> GetSubsystemStatsAsync(int idWell, DateTime startDate, - DateTime finishDate, CancellationToken cancellationToken) - { - var request = new SubsystemOperationTimeRequest - { - IdWell = idWell, - GtDate = startDate, - LtDate = finishDate, - }; - - return subsystemOperationTimeService.GetStatAsync(request, cancellationToken); - } - - private Task> GetLimitingParameterStatsAsync(int idWell, - DateTime startDate, DateTime finishDate, CancellationToken cancellationToken) - { - var request = new LimitingParameterRequest - { - IdWell = idWell, - GtDate = startDate, - LtDate = finishDate, - }; - - return limitingParameterService.GetStatAsync(request, cancellationToken); - } - - private int GetFileSize(DateOnly reportDate, int idWell) - { - const int fileSizeTemplate = 10240; - long ticks = 1L * reportDate.Year * reportDate.Month * reportDate.Day * idWell; - int remainder = (int)(ticks % (fileSizeTemplate / 10)); - return fileSizeTemplate + remainder; - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/HeadExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/HeadExcelBlockWriter.cs deleted file mode 100644 index dad6bf35..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/HeadExcelBlockWriter.cs +++ /dev/null @@ -1,34 +0,0 @@ -using AsbCloudApp.Data.AutogeneratedDailyReport; -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks; - -public class HeadExcelBlockWriter : IExcelBlockWriter -{ - private static readonly (int, int) customerCell = (2, 2); - private static readonly (int, int) depositCell = (4, 2); - private static readonly (int, int) clusterCell = (5, 2); - private static readonly (int, int) wellCell = (6, 2); - - private const int dateRow = 9; - private const int dateFromColumn = 2; - private const int dateFromToColumn = 3; - - private const int depthRow = 10; - private const int depthFromColumn = 2; - private const int depthToColumn = 3; - - public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report) - { - sheet.Cell(customerCell.Item1, customerCell.Item2).Value = report.Head.Customer; - sheet.Cell(depositCell.Item1, depositCell.Item2).Value = report.Head.Deposit; - sheet.Cell(clusterCell.Item1, clusterCell.Item2).Value = report.Head.Cluster; - sheet.Cell(wellCell.Item1, wellCell.Item2).Value = report.Head.Well; - - sheet.Cell(dateRow, dateFromColumn).Value = report.ReportDate; - sheet.Cell(dateRow, dateFromToColumn).Value = report.ReportDate.AddDays(1); - - sheet.Cell(depthRow, depthFromColumn).Value = report.Head.DepthFrom; - sheet.Cell(depthRow, depthToColumn).Value = report.Head.DepthTo; - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/IExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/IExcelBlockWriter.cs deleted file mode 100644 index 0f83fe05..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/IExcelBlockWriter.cs +++ /dev/null @@ -1,9 +0,0 @@ -using AsbCloudApp.Data.AutogeneratedDailyReport; -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks; - -public interface IExcelBlockWriter -{ - void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report); -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/LimitingParameterExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/LimitingParameterExcelBlockWriter.cs deleted file mode 100644 index 30cf36f0..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/LimitingParameterExcelBlockWriter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Linq; -using AsbCloudApp.Data.AutogeneratedDailyReport; -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks; - -public class LimitingParameterExcelBlockWriter : IExcelBlockWriter -{ - private const int rowHeaderBlock = 20; - - private const int columnNameFeedRegulator = 1; - private const int columnDepth = 2; - private const int columnTotalHours = 3; - private const int columnPercentDepth = 4; - - public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report) - { - var i = 1; - foreach (var limitingParameter in report.LimitingParameters) - { - var row = sheet.Row( i++ + rowHeaderBlock); - row.Cell(columnNameFeedRegulator).Value = limitingParameter.NameFeedRegulator; - row.Cell(columnDepth).Value = limitingParameter.Depth; - row.Cell(columnTotalHours).Value = limitingParameter.Hours; - row.Cell(columnPercentDepth).Value = limitingParameter.PercentDepth; - } - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/SubsystemExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/SubsystemExcelBlockWriter.cs deleted file mode 100644 index a1b25c88..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/SubsystemExcelBlockWriter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Linq; -using AsbCloudApp.Data.AutogeneratedDailyReport; -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks; - -public class SubsystemExcelBlockWriter : IExcelBlockWriter -{ - private const int rowHeaderBlock = 13; - - private const int columnName = 1; - private const int columnKUsage = 2; - private const int columnDepth = 3; - private const int columnUsedTimeHours = 4; - - public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report) - { - var i = 1; - foreach( var subsystem in report.Subsystems ) - { - var row = sheet.Row(i++ + rowHeaderBlock); - row.Cell(columnName).Value = subsystem.Name; - row.Cell(columnKUsage).Value = subsystem.KUsage; - row.Cell(columnDepth).Value = subsystem.Depth; - row.Cell(columnUsedTimeHours).Value = subsystem.UsedTimeHours; - } - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/TimeBalanceExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/TimeBalanceExcelBlockWriter.cs deleted file mode 100644 index 51e4643e..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/TimeBalanceExcelBlockWriter.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Linq; -using AsbCloudApp.Data.AutogeneratedDailyReport; -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks; - -public class TimeBalanceExcelBlockWriter : IExcelBlockWriter -{ - private const int rowHeaderBlock = 27; - - private const int columnName = 1; - private const int columnDurationHours = 2; - - public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report) - { - var i = 1; - foreach(var timeBalance in report.TimeBalance) - { - var row = sheet.Row(i++ + rowHeaderBlock); - row.Cell(columnName).Value = timeBalance.Name; - row.Cell(columnDurationHours).Value = timeBalance.DurationHours; - AddBorderToCell(row.Cell(columnName)); - AddBorderToCell(row.Cell(columnDurationHours)); - } - } - - private static void AddBorderToCell(IXLCell cell) - { - cell.Style.Border.TopBorder = XLBorderStyleValues.Thin; - cell.Style.Border.BottomBorder = XLBorderStyleValues.Thin; - cell.Style.Border.LeftBorder = XLBorderStyleValues.Thin; - cell.Style.Border.RightBorder = XLBorderStyleValues.Thin; - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportTemplate.xlsx b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportTemplate.xlsx deleted file mode 100644 index 0a887a4e..00000000 Binary files a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportTemplate.xlsx and /dev/null differ diff --git a/AsbCloudInfrastructure/Services/DailyReport/BlockAbstract.cs b/AsbCloudInfrastructure/Services/DailyReport/BlockAbstract.cs deleted file mode 100644 index 92286ee6..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/BlockAbstract.cs +++ /dev/null @@ -1,13 +0,0 @@ -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.DailyReport -{ - - abstract class BlockAbstract - { - public abstract CellAddress AddressBlockBegin { get; } - public abstract CellAddress AddressBlockEnd { get; } - public abstract void Draw(IXLWorksheet sheet); - } - -} diff --git a/AsbCloudInfrastructure/Services/DailyReport/CellAddress.cs b/AsbCloudInfrastructure/Services/DailyReport/CellAddress.cs deleted file mode 100644 index 10329a4c..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/CellAddress.cs +++ /dev/null @@ -1,174 +0,0 @@ -using ClosedXML.Excel; -using System; -using System.Diagnostics.CodeAnalysis; -using System.Text; - -namespace AsbCloudInfrastructure.Services.DailyReport -{ - - internal class CellAddress: IXLAddress - { - const int excelLettersCount = 'Z' - 'A' + 1; - public int RowNumber { get; set; } - public int ColumnNumber { get; set; } - - public string ColumnLetter - { - get { return CalcColumnLetter(); } - } - - public bool FixedColumn { get; set; } - - public bool FixedRow { get; set; } - - public string UniqueId => ToString(XLReferenceStyle.A1, true); - - public IXLWorksheet? Worksheet { get; set; } - - public CellAddress(IXLWorksheet? worksheet, int row, int colunm) - { - Worksheet = worksheet; - RowNumber = row; - ColumnNumber = colunm; - } - - public static CellAddress operator + (CellAddress a, CellAddress b) - => new CellAddress(a.Worksheet, a.RowNumber + b.RowNumber, a.ColumnNumber + b.ColumnNumber); - public static CellAddress operator +(CellAddress a, (int row, int column) b) - => new CellAddress(a.Worksheet, a.RowNumber + b.row, a.ColumnNumber + b.column); - public static CellAddress operator - (CellAddress a, CellAddress b) - => new CellAddress(a.Worksheet, a.RowNumber - b.RowNumber, a.ColumnNumber - b.ColumnNumber); - public static bool operator == (CellAddress a, CellAddress b) - => a.RowNumber == b.RowNumber && a.ColumnNumber == b.ColumnNumber; - public static bool operator !=(CellAddress a, CellAddress b) - => !(a == b); - - private string CalcColumnLetter() - { - string letter = ""; - var columnNumber = ColumnNumber; - while (columnNumber > 0) - { - int modulo = (columnNumber - 1) % excelLettersCount; - letter = Convert.ToChar('A' + modulo) + letter; - columnNumber = (columnNumber - modulo) / excelLettersCount; - } - - return letter; - } - - public CellAddress Copy() - => new CellAddress(Worksheet, RowNumber, ColumnNumber) - { - FixedColumn = this.FixedColumn, - FixedRow = this.FixedRow, - }; - - public override string ToString() - => ToString(XLReferenceStyle.A1); - - public string ToString(XLReferenceStyle referenceStyle) - => ToString(referenceStyle, false); - - public string ToString(XLReferenceStyle referenceStyle, bool includeSheet) - { - if (referenceStyle == XLReferenceStyle.R1C1) - throw new NotImplementedException("R1C1 - style doesn't implemented"); - - var sb = new StringBuilder(); - if (includeSheet && Worksheet is not null) - sb.Append('$') - .Append(Worksheet.Name) - .Append('.'); - - if (FixedColumn) - sb.Append('$'); - - sb.Append(ColumnLetter); - - if (FixedRow) - sb.Append('$'); - - sb.Append(RowNumber); - - return sb.ToString(); - } - - public string ToStringFixed() - => ToStringFixed(XLReferenceStyle.A1); - - public string ToStringFixed(XLReferenceStyle referenceStyle) - => ToStringFixed(referenceStyle, false); - - public string ToStringFixed(XLReferenceStyle referenceStyle, bool includeSheet) - { - if (referenceStyle == XLReferenceStyle.R1C1) - throw new NotImplementedException("R1C1 - style doesn't implemented"); - - var sb = new StringBuilder(); - if (includeSheet && Worksheet is not null) - sb.Append('$') - .Append(Worksheet.Name) - .Append('.'); - - sb.Append('$'); - sb.Append(ColumnLetter); - sb.Append('$'); - sb.Append(RowNumber); - - return sb.ToString(); - } - - public string ToStringRelative() - => ToStringRelative(false); - - public string ToStringRelative(bool includeSheet) - { - var sb = new StringBuilder(); - if (includeSheet && Worksheet is not null) - sb.Append('$') - .Append(Worksheet.Name) - .Append('.'); - - sb.Append(ColumnLetter); - sb.Append(RowNumber); - - return sb.ToString(); - } - - public bool Equals(IXLAddress? x, IXLAddress? y) - => x?.ColumnNumber == y?.ColumnNumber && - x?.RowNumber == y?.RowNumber && - x?.FixedColumn == y?.FixedColumn && - x?.FixedRow == y?.FixedRow && - x?.Worksheet == y?.Worksheet; - - public override int GetHashCode() - => base.GetHashCode(); - - public int GetHashCode([DisallowNull] IXLAddress obj) - => obj.GetHashCode(); - - public bool Equals(IXLAddress? other) - => Equals(this, other); - - public override bool Equals(object? obj) - { - if (ReferenceEquals(this, obj)) - { - return true; - } - - if (obj is null) - { - return false; - } - - if (obj is CellAddress address) - return this == address; - - return false; - } - } - -} diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/BhaBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/BhaBlock.cs deleted file mode 100644 index 9c3d1cdc..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/BhaBlock.cs +++ /dev/null @@ -1,118 +0,0 @@ -using AsbCloudApp.Data.DailyReport; -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks -{ - - class BhaBlock : BlockAbstract - { - private readonly BhaDto blockDto; - - public CellAddress AddressBhaDescription { get; } - public CellAddress AddressOperationTitle { get; } - public CellAddress AddressDurationTitle { get; } - public CellAddress AddressTotalTitle { get; } - public CellAddress[] AddressOperationData { get; } - public CellAddress[] AddressDurationDataStart { get; } - public CellAddress[] AddressDurationDataFinish { get; } - public CellAddress[] AddressTotaData { get; } - public override CellAddress AddressBlockBegin { get; } - public override CellAddress AddressBlockEnd { get; } - - public BhaBlock(CellAddress addressBlockBegin, BhaDto blockDto) - { - this.blockDto = blockDto; - AddressBlockBegin = addressBlockBegin.Copy(); - AddressBhaDescription = addressBlockBegin + (1,0); - AddressOperationTitle = addressBlockBegin + (3, 0); - AddressDurationTitle = addressBlockBegin + (3, 5); - AddressTotalTitle = addressBlockBegin + (3, 7); - AddressOperationData = new CellAddress[5]; - AddressOperationData[0] = addressBlockBegin + (4, 0); - AddressOperationData[1] = addressBlockBegin + (5, 0); - AddressOperationData[2] = addressBlockBegin + (6, 0); - AddressOperationData[3] = addressBlockBegin + (7, 0); - AddressOperationData[4] = addressBlockBegin + (8, 0); - AddressDurationDataStart = new CellAddress[5]; - AddressDurationDataStart[0] = addressBlockBegin + (4, 5); - AddressDurationDataStart[1] = addressBlockBegin + (5, 5); - AddressDurationDataStart[2] = addressBlockBegin + (6, 5); - AddressDurationDataStart[3] = addressBlockBegin + (7, 5); - AddressDurationDataStart[4] = addressBlockBegin + (8, 5); - AddressDurationDataFinish = new CellAddress[5]; - AddressDurationDataFinish[0] = addressBlockBegin + (4, 6); - AddressDurationDataFinish[1] = addressBlockBegin + (5, 6); - AddressDurationDataFinish[2] = addressBlockBegin + (6, 6); - AddressDurationDataFinish[3] = addressBlockBegin + (7, 6); - AddressDurationDataFinish[4] = addressBlockBegin + (8, 6); - AddressTotaData = new CellAddress[5]; - AddressTotaData[0] = addressBlockBegin + (4, 7); - AddressTotaData[1] = addressBlockBegin + (5, 7); - AddressTotaData[2] = addressBlockBegin + (6, 7); - AddressTotaData[3] = addressBlockBegin + (7, 7); - AddressTotaData[4] = addressBlockBegin + (8, 7); - AddressBlockEnd = AddressTotaData[4]; - } - - private string FormulaBhaBlock(CellAddress beginTime, CellAddress endTime) - { - return string.Format("IF({0}>0,({0}-{1})*24, \"\")", endTime.ToString(), beginTime.ToString()); - } - - public override void Draw(IXLWorksheet sheet) - { - sheet._Range(AddressBhaDescription, AddressBhaDescription + (0, 7)) - ._SetValue($"{blockDto.BHADescription}"); - sheet._Range(AddressOperationTitle, AddressOperationTitle + (0, 4)) - ._SetValue("Выполняемые операции в отчетный период, комментарии:"); - sheet._Range(AddressDurationTitle, AddressDurationTitle + (0, 1)) - ._SetValue("Продолжительность, ч. "); - sheet.Cell(AddressTotalTitle) - ._SetValue("Итого"); - sheet._Range(AddressOperationData[0], AddressOperationData[0] + (0, 4)) - ._SetValue("Бурение с наращиваниями в инт. 2195-2763м."); - sheet.Cell(AddressDurationDataStart[0]) - ._SetValue($"{blockDto.ExtensionDrillingOneBegin}"); - sheet.Cell(AddressDurationDataFinish[0]) - ._SetValue($"{blockDto.ExtensionDrillingOneFinish}"); - sheet.Cell(AddressTotaData[0]) - .SetFormulaA1($"{FormulaBhaBlock(AddressDurationDataStart[0], AddressDurationDataFinish[0])}").Style.SetAllBorders(); - sheet._Range(AddressOperationData[1], AddressOperationData[1] + (0, 4)) - ._SetValue("Промывка."); - sheet.Cell(AddressDurationDataStart[1]) - ._SetValue($"{blockDto.SluiceBegin}"); - sheet.Cell(AddressDurationDataFinish[1]) - ._SetValue($"{blockDto.SluiceFinish}"); - sheet.Cell(AddressTotaData[1]) - .SetFormulaA1($"{FormulaBhaBlock(AddressDurationDataStart[1], AddressDurationDataFinish[1])}").Style.SetAllBorders(); - sheet._Range(AddressOperationData[2], AddressOperationData[2] + (0, 4)) - ._SetValue("Подъем КНБК в инт. 2763-2442м."); - sheet.Cell(AddressDurationDataStart[2]) - ._SetValue($"{blockDto.ClimbBegin}"); - sheet.Cell(AddressDurationDataFinish[2]) - ._SetValue($"{blockDto.ClimbFinish}"); - sheet.Cell(AddressTotaData[2]) - .SetFormulaA1($"{FormulaBhaBlock(AddressDurationDataStart[2], AddressDurationDataFinish[2])}").Style.SetAllBorders(); - sheet._Range(AddressOperationData[3], AddressOperationData[3] + (0, 4)) - ._SetValue("Спуск КНБК в инт. 2442-2763м."); - sheet.Cell(AddressDurationDataStart[3]) - ._SetValue($"{blockDto.DescentBegin}"); - sheet.Cell(AddressDurationDataFinish[3]) - ._SetValue($"{blockDto.DescentFinish}"); - sheet.Cell(AddressTotaData[3]) - .SetFormulaA1($"{FormulaBhaBlock(AddressDurationDataStart[3], AddressDurationDataFinish[3])}").Style.SetAllBorders(); - sheet._Range(AddressOperationData[4], AddressOperationData[4] + (0, 4)) - ._SetValue("Бурение с наращиваниями в инт. 2763-2850м."); - sheet.Cell(AddressDurationDataStart[4]) - ._SetValue($"{blockDto.ExtensionDrillingTwoBegin}"); - sheet.Cell(AddressDurationDataFinish[4]) - ._SetValue($"{blockDto.ExtensionDrillingTwoFinish}"); - sheet.Cell(AddressTotaData[4]) - .SetFormulaA1($"{FormulaBhaBlock(AddressDurationDataStart[4], AddressDurationDataFinish[4])}").Style.SetAllBorders(); - } - } - -} - - - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs deleted file mode 100644 index 18ee9fbc..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs +++ /dev/null @@ -1,119 +0,0 @@ -using AsbCloudApp.Data.DailyReport; -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks -{ - - internal class DimensionlessBlock : BlockAbstract - { - private readonly NoDrillingDto blockDto; - - public SaubBlock SaubBlock { get; set; } = null!; - - public CellAddress AddressDimensionTitle { get; } - public CellAddress AddressPreparationTitle { get; } - public CellAddress AddressExtensionTitle { get; } - public CellAddress AddressPreparationDescription { get; } - public CellAddress AddressExtensionDescription { get; } - public CellAddress[] AddressPreparationHead { get; } - public CellAddress[] AddressPreparationValue { get; } - public CellAddress[] AddressExtensionHead { get; } - public CellAddress[] AddressExtensionValue { get; } - public CellAddress AddressBlockFormula { get; } = null!; - public override CellAddress AddressBlockBegin { get; } - public override CellAddress AddressBlockEnd { get; } - public DimensionlessBlock(CellAddress addressBlockBegin, NoDrillingDto blockDto) - { - AddressBlockBegin = addressBlockBegin.Copy(); - this.blockDto = blockDto; - - AddressDimensionTitle = addressBlockBegin + (2, 3); - AddressPreparationTitle = addressBlockBegin + (3, 1); - AddressExtensionTitle = addressBlockBegin + (3, 4); - AddressPreparationHead = new CellAddress[4]; - AddressPreparationHead[0] = addressBlockBegin + (4, 1); - AddressPreparationHead[1] = addressBlockBegin + (5, 1); - AddressPreparationHead[2] = addressBlockBegin + (6, 1); - AddressPreparationHead[3] = addressBlockBegin + (7, 1); - AddressPreparationValue = new CellAddress[4]; - AddressPreparationValue[0] = addressBlockBegin + (4, 3); - AddressPreparationValue[1] = addressBlockBegin + (5, 3); - AddressPreparationValue[2] = addressBlockBegin + (6, 3); - AddressPreparationValue[3] = addressBlockBegin + (7, 3); - AddressPreparationDescription = addressBlockBegin + (8, 1); - AddressExtensionHead = new CellAddress[4]; - AddressExtensionHead[0] = addressBlockBegin + (4, 4); - AddressExtensionHead[1] = addressBlockBegin + (5, 4); - AddressExtensionHead[2] = addressBlockBegin + (6, 4); - AddressExtensionHead[3] = addressBlockBegin + (7, 4); - AddressExtensionValue = new CellAddress[4]; - AddressExtensionValue[0] = addressBlockBegin + (4, 6); - AddressExtensionValue[1] = addressBlockBegin + (5, 6); - AddressExtensionValue[2] = addressBlockBegin + (6, 6); - AddressExtensionValue[3] = addressBlockBegin + (7, 6); - AddressExtensionDescription = addressBlockBegin + (8, 4); - AddressBlockEnd = addressBlockBegin + (9,0); - } - - private string FormulaBlockPlan(CellAddress cellTarget) - { - return $"={cellTarget}/60*{SaubBlock.AddressExtensionsCountValue}"; - } - - private string FormulaBlockExcess(CellAddress cellFact, CellAddress cellPlan) - { - return string.Format("={0}-{1}", cellFact.ToString(), cellPlan.ToString()); - } - - public override void Draw(IXLWorksheet sheet) - { - sheet.Range(AddressDimensionTitle.RowNumber, AddressDimensionTitle.ColumnNumber, - AddressDimensionTitle.RowNumber, AddressDimensionTitle.ColumnNumber + 1) - .Merge() - .Style.Alignment.SetWrapText(true); - sheet.Cell(AddressDimensionTitle.RowNumber, AddressDimensionTitle.ColumnNumber)._ValueNoBorder("БЕЗМЕТРАЖНЫЕ РАБОТЫ",true); - sheet._Range(AddressPreparationTitle, AddressPreparationTitle + (0, 2)) - ._SetValue("Подготовка ствола скв. к наращиванию"); - sheet._Range(AddressExtensionTitle, AddressExtensionTitle + (0, 2)) - ._SetValue("Наращивание"); - sheet._Range(AddressPreparationHead[0], AddressPreparationHead[0] + (0, 1)) - ._SetValue("Норматив на одну операцию, (мин):"); - sheet.Cell(AddressPreparationValue[0]) - ._SetValue($"{blockDto.StandardTimeBarrelPreparation}"); - sheet._Range(AddressPreparationHead[1], AddressPreparationHead[1] + (0, 1)) - ._SetValue("Проработка при бур, план (ч):"); - sheet.Cell(AddressPreparationValue[1]) - .SetFormulaA1($"{FormulaBlockPlan(AddressPreparationValue[0])}").Style.SetAllBorders(); - sheet._Range(AddressPreparationHead[2], AddressPreparationHead[2] + (0, 1)) - ._SetValue("Проработка при бур, факт (ч):"); - sheet.Cell(AddressPreparationValue[2]) - ._SetValue($"{blockDto.ActualTimeBarrelPreparation}"); - sheet._Range(AddressPreparationHead[3], AddressPreparationHead[3] + (0, 1)) - ._SetValue("Превышение плановых норм, (ч):"); - sheet.Cell(AddressPreparationValue[3]) - .SetFormulaA1($"{FormulaBlockExcess(AddressPreparationValue[2], AddressPreparationValue[1])}").Style.SetAllBorders(); - sheet._Range(AddressExtensionHead[0], AddressExtensionHead[0] + (0, 1)) - ._SetValue("Норматив на одну операцию, (мин):"); - sheet.Cell(AddressExtensionValue[0]) - ._SetValue($"{blockDto.StandardTimeExtension}"); - sheet._Range(AddressExtensionHead[1], AddressExtensionHead[1] + (0, 1)) - ._SetValue("Наращивание, план (ч):"); - sheet.Cell(AddressExtensionValue[1]) - .SetFormulaA1($"{FormulaBlockPlan(AddressExtensionValue[0])}").Style.SetAllBorders(); - sheet._Range(AddressExtensionHead[2], AddressExtensionHead[2] + (0, 1)) - ._SetValue("Наращивание, факт (ч):"); - sheet.Cell(AddressExtensionValue[2]) - ._SetValue($"{blockDto.ActualTimeExtension}"); - sheet._Range(AddressExtensionHead[3], AddressExtensionHead[3] + (0, 1)) - ._SetValue("Превышение плановых норм, (ч):"); - sheet.Cell(AddressExtensionValue[3]) - .SetFormulaA1($"{FormulaBlockExcess(AddressExtensionValue[2], AddressExtensionValue[1])}").Style.SetAllBorders(); - sheet._Range(AddressPreparationDescription, AddressPreparationDescription + (1, 2)) - ._SetValue("Подготовка ствола скв. к наращиванию"); - sheet._Range(AddressExtensionDescription, AddressExtensionDescription + (1, 2)) - ._SetValue("Наращивание"); - } - } - -} - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs deleted file mode 100644 index b7ae4dfe..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs +++ /dev/null @@ -1,181 +0,0 @@ -using AsbCloudApp.Data.DailyReport; -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks -{ - - class HeadBlock : BlockAbstract - { - private readonly HeadDto blockDto; - - public CellAddress AddressTitle { get; } - public CellAddress AddressCustomer { get; } - public CellAddress AddressDriller { get; } - public CellAddress AddressPeriod { get; } - public CellAddress AddressSlaughter { get; } - public CellAddress AddressTrajectoryTableTitle { get; } - public CellAddress AddressDrillerOneTitle { get; } - public CellAddress AddressDrillerOne { get; } - public CellAddress AddressDrillerTwoTitle { get; } - public CellAddress AddressDrillerTwo { get; } - public CellAddress AddressWorkSaubTitle { get; } - public CellAddress AddressWatchTitle { get; } - public CellAddress AddressMetreTitle { get; } - public CellAddress[] AddressWorkSaubData { get; } - public CellAddress[] AddressWatchData { get; } - public CellAddress[] AddressMetreData { get; } - public CellAddress[] AddressPeriodTableHeadArray { get; } - public CellAddress[] AddressPeriodTableDataArray { get; } - public CellAddress[] AddressTrajectoryTableHeadArray { get; } - public CellAddress[] AddressTrajectoryTableDataArray { get; } - public override CellAddress AddressBlockBegin { get; } - public override CellAddress AddressBlockEnd { get; } - public HeadBlock(CellAddress addressBlockBegin, HeadDto blockDto) - { - AddressBlockBegin = addressBlockBegin.Copy(); - this.blockDto = blockDto; - AddressTitle = addressBlockBegin + (0, 0); - AddressCustomer = addressBlockBegin + (1, 0); - AddressDriller = addressBlockBegin + (2, 0); - AddressPeriod = addressBlockBegin + (4, 0); - AddressSlaughter = addressBlockBegin + (4, 4); - AddressPeriodTableHeadArray = new CellAddress[4]; - AddressPeriodTableHeadArray[0]= addressBlockBegin + (5, 0); - AddressPeriodTableHeadArray[1] = addressBlockBegin + (5, 2); - AddressPeriodTableHeadArray[2] = addressBlockBegin + (5, 4); - AddressPeriodTableHeadArray[3] = addressBlockBegin + (5, 6); - AddressPeriodTableDataArray = new CellAddress[4]; - AddressPeriodTableDataArray[0] = addressBlockBegin + (6, 0); - AddressPeriodTableDataArray[1] = addressBlockBegin + (6, 2); - AddressPeriodTableDataArray[2] = addressBlockBegin + (6, 4); - AddressPeriodTableDataArray[3] = addressBlockBegin + (6, 6); - AddressTrajectoryTableTitle = addressBlockBegin + (8,0); - AddressTrajectoryTableHeadArray = new CellAddress[4]; - AddressTrajectoryTableHeadArray[0] = addressBlockBegin + (9, 0); - AddressTrajectoryTableHeadArray[1] = addressBlockBegin + (9, 2); - AddressTrajectoryTableHeadArray[2] = addressBlockBegin + (9, 4); - AddressTrajectoryTableHeadArray[3] = addressBlockBegin + (9, 6); - AddressTrajectoryTableDataArray = new CellAddress[4]; - AddressTrajectoryTableDataArray[0] = addressBlockBegin + (10, 0); - AddressTrajectoryTableDataArray[1] = addressBlockBegin + (10, 2); - AddressTrajectoryTableDataArray[2] = addressBlockBegin + (10, 4); - AddressTrajectoryTableDataArray[3] = addressBlockBegin + (10, 6); - AddressDrillerOneTitle = addressBlockBegin + (12, 0); - AddressDrillerOne = addressBlockBegin + (12, 2); - AddressDrillerTwoTitle = addressBlockBegin + (13, 0); - AddressDrillerTwo = addressBlockBegin + (13, 2); - AddressWorkSaubTitle = addressBlockBegin + (15, 0); - AddressWatchTitle = addressBlockBegin + (15, 3); - AddressMetreTitle = addressBlockBegin + (15, 4); - AddressWorkSaubData = new CellAddress[4]; - AddressWorkSaubData[0] = addressBlockBegin + (16, 0); - AddressWorkSaubData[1] = addressBlockBegin + (17, 0); - AddressWorkSaubData[2] = addressBlockBegin + (18, 0); - AddressWorkSaubData[3] = addressBlockBegin + (19, 0); - AddressWatchData = new CellAddress[4]; - AddressWatchData[0] = addressBlockBegin + (16, 3); - AddressWatchData[1] = addressBlockBegin + (17, 3); - AddressWatchData[2] = addressBlockBegin + (18, 3); - AddressWatchData[3] = addressBlockBegin + (19, 3); - AddressMetreData = new CellAddress[4]; - AddressMetreData[0] = addressBlockBegin + (16, 4); - AddressMetreData[1] = addressBlockBegin + (17, 4); - AddressMetreData[2] = addressBlockBegin + (18, 4); - AddressBlockEnd = AddressWatchData[3]+(0,1); - } - - public override void Draw(IXLWorksheet sheet) - { - sheet._Range(AddressTitle, AddressTitle + (0, 7)) - ._SetValue($"Суточная сводка бурения скважины: {blockDto.WellName}, куст: {blockDto.ClusterName}") - - .Style.SetH1(); - - sheet._Range(AddressCustomer, AddressCustomer + (0, 7)) - ._SetValue($"Заказчик: {blockDto.Customer}") - .Style.SetH1(); - sheet._Range(AddressDriller, AddressDriller + (0, 7)) - ._SetValue($"Подрядчик: {blockDto.Contractor}") - .Style.SetH1(); - sheet._Range(AddressPeriod, AddressPeriod + (0, 3)) - ._SetValue("Отчетный период"); - sheet._Range(AddressSlaughter, AddressSlaughter + (0, 3)) - ._SetValue("Забой за отчетный период, м"); - sheet._Range(AddressPeriodTableHeadArray[0], AddressPeriodTableHeadArray[0] + (0, 1)) - ._SetValue("От (дата, время)"); - sheet._Range(AddressPeriodTableHeadArray[1], AddressPeriodTableHeadArray[1] + (0, 1)) - ._SetValue("До (дата, время)"); - sheet._Range(AddressPeriodTableHeadArray[2], AddressPeriodTableHeadArray[2] + (0, 1)) - ._SetValue("От"); - sheet._Range(AddressPeriodTableHeadArray[3], AddressPeriodTableHeadArray[3] + (0, 1)) - ._SetValue("До"); - sheet._Range(AddressPeriodTableDataArray[0], AddressPeriodTableDataArray[0] + (0, 1)) - ._SetValue($"{blockDto.ReportDate}"); - sheet._Range(AddressPeriodTableDataArray[1], AddressPeriodTableDataArray[1] + (0, 1))._SetValue(""); - sheet.Cell(AddressPeriodTableDataArray[1]) - .SetFormulaA1(string.Format("{0}-1", AddressPeriodTableDataArray[0].ToString())) - .Style.DateFormat.Format= "DD.MM.YYYY HH:MM:SS"; - sheet._Range(AddressPeriodTableDataArray[2], AddressPeriodTableDataArray[2] + (0, 1)) - ._SetValue($"{blockDto.WellDepthIntervalStartDate}"); - sheet._Range(AddressPeriodTableDataArray[3], AddressPeriodTableDataArray[3] + (0, 1)) - ._SetValue($"{blockDto.WellDepthIntervalFinishDate}"); - sheet._Range(AddressTrajectoryTableTitle, AddressTrajectoryTableTitle + (0, 7)) - ._SetValue("Данные по траектории скважины на конец суток"); - sheet._Range(AddressTrajectoryTableHeadArray[0], AddressTrajectoryTableHeadArray[0] + (0, 1)) - ._SetValue("Глубина по стволу"); - sheet._Range(AddressTrajectoryTableHeadArray[1], AddressTrajectoryTableHeadArray[1] + (0, 1)) - ._SetValue("Глубина по вертикали"); - sheet._Range(AddressTrajectoryTableHeadArray[2], AddressTrajectoryTableHeadArray[2] + (0, 1)) - ._SetValue("Зенитный угол"); - sheet._Range(AddressTrajectoryTableHeadArray[3], AddressTrajectoryTableHeadArray[3] + (0, 1)) - ._SetValue("Азимут"); - sheet._Range(AddressTrajectoryTableDataArray[0], AddressTrajectoryTableDataArray[0] + (0, 1)) - ._SetValue($"{blockDto.BottomholeDepth}"); - sheet._Range(AddressTrajectoryTableDataArray[1], AddressTrajectoryTableDataArray[1] + (0, 1)) - ._SetValue($"{blockDto.VerticalDepth}"); - sheet._Range(AddressTrajectoryTableDataArray[2], AddressTrajectoryTableDataArray[2] + (0, 1)) - ._SetValue($"{blockDto.ZenithAngle}"); - sheet._Range(AddressTrajectoryTableDataArray[3], AddressTrajectoryTableDataArray[3] + (0, 1)) - ._SetValue($"{blockDto.AzimuthAngle}"); - sheet._Range(AddressDrillerOneTitle, AddressDrillerOneTitle + (0, 1)) - ._SetValue("Бурильщик 1 смена"); - sheet._Range(AddressDrillerOne, AddressDrillerOne + (0, 1)) - ._SetValue($"{blockDto.FirstDriller}"); - sheet._Range(AddressDrillerTwoTitle, AddressDrillerTwoTitle + (0, 1)) - ._SetValue("Бурильщик 2 смена"); - sheet._Range(AddressDrillerTwo, AddressDrillerTwo + (0, 1)) - ._SetValue($"{blockDto.SecondDriller}"); - sheet._Range(AddressWorkSaubTitle, AddressWorkSaubTitle + (0, 2)) - ._SetValue("Работа модулей САУБ:"); - sheet.Cell(AddressWatchTitle) - ._SetValue("Часов:"); - sheet.Cell(AddressMetreTitle) - ._SetValue("Метров:"); - sheet._Range(AddressWorkSaubData[0], AddressWorkSaubData[0] + (0, 2)) - ._SetValue("АПД (автоматическая подача долота), ч/м:"); - sheet.Cell(AddressWatchData[0]) - ._SetValue($"{blockDto.WorkTimeSAUB}"); - sheet.Cell(AddressMetreData[0]) - ._SetValue($"{blockDto.PenetrationSAUB}"); - sheet._Range(AddressWorkSaubData[1], AddressWorkSaubData[1] + (0, 2)) - ._SetValue("Спин Мастер (осцилляция),ч/м:"); - sheet.Cell(AddressWatchData[1]) - ._SetValue($"{blockDto.WorkTimeSpinMaster}"); - sheet.Cell(AddressMetreData[1]) - ._SetValue($"{blockDto.PenetrationSpinMaster}"); - sheet._Range(AddressWorkSaubData[2], AddressWorkSaubData[2] + (0, 2)) - ._SetValue("Торк Мастер (демпфирование), ч/:"); - sheet.Cell(AddressWatchData[2]) - ._SetValue($"{blockDto.WorkTimeTorkMaster}"); - sheet.Cell(AddressMetreData[2]) - ._SetValue($"{blockDto.PenetrationTorkMaster}"); - sheet._Range(AddressWorkSaubData[3], AddressWorkSaubData[3] + (0, 2)) - ._SetValue("МСЕ, колличество запусков, раз:"); - sheet._Range(AddressWatchData[3], AddressWatchData[3] + (0, 1)) - ._SetValue($"{blockDto.CountLaunchesMSE}"); - } - } - -} - - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs deleted file mode 100644 index f6f4791f..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs +++ /dev/null @@ -1,230 +0,0 @@ -using AsbCloudApp.Data.DailyReport; -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks -{ - - internal class SaubBlock : BlockAbstract - { - private readonly SaubDto blockDto; - private readonly HeadBlock headBlock; - public CellAddress AddressRotorDrilling { get; } - public CellAddress AddressSlideDrilling { get; } - public CellAddress AddressDrillingTableTitle { get; } - public CellAddress[] AddressDrillingTableHead { get; } - public CellAddress[] AddressDrillingTableData { get; } - public CellAddress AddressSlideTableTitle { get; } - public CellAddress[] AddressSlideTableHead { get; } - public CellAddress[] AddressSlideTableData { get; } - public CellAddress AddressTotalTableMechanicalSpeed { get; } - public CellAddress AddressTotalTableTitle { get; } - public CellAddress[] AddressTotalTableHead { get; } - public CellAddress[] AddressTotalTableData { get; } - public CellAddress IncreaseSpeedSection { get; } - public CellAddress IncreaseSpeedDay { get; } - public CellAddress ReductionTimeDrilling { get; } - public CellAddress RotorSlidePercent { get; } - public CellAddress MspSection { get; } - public CellAddress SectionDrillingTimeTotal { get; } - public CellAddress SectionPenetrationTotal { get; } - public CellAddress AddressExtensionsCount { get; } - public CellAddress DeviationFromTVD { get; } - public CellAddress DeclinesReasonsROP { get; } - public CellAddress IncreaseSpeedSectionValue { get; } - public CellAddress IncreaseSpeedDayValue { get; } - public CellAddress ReductionTimeDrillingValue { get; } - public CellAddress RotorSlidePercentValue { get; } - public CellAddress MspSectionValue { get; } - public CellAddress SectionDrillingTimeTotalValue { get; } - public CellAddress SectionPenetrationTotalValue { get; } - public CellAddress AddressExtensionsCountValue { get; } - public CellAddress DeviationFromTVDValue { get; } - public override CellAddress AddressBlockBegin { get; } - public override CellAddress AddressBlockEnd { get; } - - public SaubBlock(CellAddress addressBlockBegin, SaubDto blockDto, HeadBlock headBlock) - { - this.headBlock = headBlock; - AddressBlockBegin = addressBlockBegin.Copy(); - this.blockDto = blockDto; - AddressRotorDrilling = addressBlockBegin + (1, 0); - AddressSlideDrilling = addressBlockBegin + (2, 0); - AddressDrillingTableTitle = addressBlockBegin + (4, 0); - AddressDrillingTableHead = new CellAddress[4]; - AddressDrillingTableHead[0] = addressBlockBegin + (5, 0); - AddressDrillingTableHead[1] = addressBlockBegin + (5, 2); - AddressDrillingTableHead[2] = addressBlockBegin + (5, 4); - AddressDrillingTableHead[3] = addressBlockBegin + (5, 6); - AddressDrillingTableData = new CellAddress[4]; - AddressDrillingTableData[0] = addressBlockBegin + (6, 0); - AddressDrillingTableData[1] = addressBlockBegin + (6, 2); - AddressDrillingTableData[2] = addressBlockBegin + (6, 4); - AddressDrillingTableData[3] = addressBlockBegin + (6, 6); - AddressSlideTableTitle = addressBlockBegin + (8, 0); - AddressSlideTableHead = new CellAddress[4]; - AddressSlideTableHead[0] = addressBlockBegin + (9, 0); - AddressSlideTableHead[1] = addressBlockBegin + (9, 2); - AddressSlideTableHead[2] = addressBlockBegin + (9, 4); - AddressSlideTableHead[3] = addressBlockBegin + (9, 6); - AddressSlideTableData = new CellAddress[4]; - AddressSlideTableData[0] = addressBlockBegin + (10, 0); - AddressSlideTableData[1] = addressBlockBegin + (10, 2); - AddressSlideTableData[2] = addressBlockBegin + (10, 4); - AddressSlideTableData[3] = addressBlockBegin + (10, 6); - AddressTotalTableTitle = addressBlockBegin + (12, 0); - AddressTotalTableMechanicalSpeed = addressBlockBegin + (12, 6); - AddressTotalTableHead = new CellAddress[4]; - AddressTotalTableHead[0] = addressBlockBegin + (13, 0); - AddressTotalTableHead[1] = addressBlockBegin + (13, 2); - AddressTotalTableHead[2] = addressBlockBegin + (13, 4); - AddressTotalTableData = new CellAddress[4]; - AddressTotalTableData[0] = addressBlockBegin + (14, 0); - AddressTotalTableData[1] = addressBlockBegin + (14, 2); - AddressTotalTableData[2] = addressBlockBegin + (14, 4); - AddressTotalTableData[3] = addressBlockBegin + (14, 6); - IncreaseSpeedSection = addressBlockBegin + (16, 0); - IncreaseSpeedSectionValue = addressBlockBegin + (16, 4); - IncreaseSpeedDay = addressBlockBegin + (17, 0); - IncreaseSpeedDayValue = addressBlockBegin + (17, 4); - ReductionTimeDrilling = addressBlockBegin + (18, 0); - ReductionTimeDrillingValue = addressBlockBegin + (18, 4); - RotorSlidePercent = addressBlockBegin + (19, 0); - RotorSlidePercentValue = addressBlockBegin + (19, 4); - MspSection = addressBlockBegin + (20, 0); - MspSectionValue = addressBlockBegin + (20, 4); - SectionDrillingTimeTotal = addressBlockBegin + (21, 0); - SectionDrillingTimeTotalValue = addressBlockBegin + (21, 4); - SectionPenetrationTotal = addressBlockBegin + (22, 0); - SectionPenetrationTotalValue = addressBlockBegin + (22, 4); - AddressExtensionsCount = addressBlockBegin + (23, 0); - AddressExtensionsCountValue = addressBlockBegin + (23, 4); - DeviationFromTVD = addressBlockBegin + (24, 0); - DeviationFromTVDValue = addressBlockBegin + (24, 4); - DeclinesReasonsROP = addressBlockBegin + (25, 0); - AddressBlockEnd = DeclinesReasonsROP + (1,7) ; - } - - private string FormulaMechanicalSpeed(CellAddress cellSinking, CellAddress cellWatch ) - { - return string.Format("=IF({0}>0,{1}/{2},0)", cellWatch.ToString(), cellSinking.ToString(), cellWatch.ToString()); - } - - private string FormulaSinking(CellAddress sinkingDrilling, CellAddress sinkingSlide, CellAddress slaughterEnd, CellAddress slaughterBegin) - { - return string.Format("=IF(({0}+{1})<>({2}-{3}),\"ОШИБКА\",({0}+{1}))", sinkingSlide.ToString(), sinkingDrilling.ToString(), - slaughterEnd.ToString(), slaughterBegin.ToString()); - } - private string FormulaWatch(CellAddress cellSinkingDrill, CellAddress cellSinkingSlide) - { - return string.Format("={0}+{1}", - cellSinkingDrill.ToString(), cellSinkingSlide.ToString()); - } - - public override void Draw(IXLWorksheet sheet) - { - sheet._Range(AddressRotorDrilling, AddressRotorDrilling + (0, 7)) - ._SetValue($"Бурение в роторе : {blockDto.RotorDrillingModes}"); - sheet._Range(AddressSlideDrilling, AddressSlideDrilling + (0, 7)) - ._SetValue($"Бурение в слайде : {blockDto.SlideDrillingModes}"); - sheet._Range(AddressDrillingTableTitle, AddressDrillingTableTitle + (0, 7)) - ._SetValue("Бурение в роторе(за отчетный период) с использование САУБ - 1"); - sheet._Range(AddressDrillingTableHead[0], AddressDrillingTableHead[0] + (0, 1)) - ._SetValue("Проходка"); - sheet._Range(AddressDrillingTableHead[1], AddressDrillingTableHead[1] + (0, 1)) - ._SetValue("Часы бурения"); - sheet._Range(AddressDrillingTableHead[2], AddressDrillingTableHead[2] + (0, 1)) - ._SetValue("Мех. скорость"); - sheet._Range(AddressDrillingTableHead[3], AddressDrillingTableHead[3] + (0, 1)) - ._SetValue("Среднее диф. Давление"); - sheet._Range(AddressDrillingTableData[0], AddressDrillingTableData[0] + (0, 1)) - ._SetValue($"{blockDto.PenetrationInRotor}"); - sheet._Range(AddressDrillingTableData[1], AddressDrillingTableData[1] + (0, 1)) - ._SetValue($"{blockDto.NumberDrillingHours}"); - sheet._Range(AddressDrillingTableData[2], AddressDrillingTableData[2] + (0, 1))._SetValue(""); - sheet.Cell(AddressDrillingTableData[2]) - .SetFormulaA1(FormulaMechanicalSpeed(AddressDrillingTableData[0], AddressDrillingTableData[1])).Style.SetAllBorders(); - sheet._Range(AddressDrillingTableData[3], AddressDrillingTableData[3] + (0, 1)) - ._SetValue($"{blockDto.AVGDiffDropRotor}"); - sheet._Range(AddressSlideTableTitle, AddressSlideTableTitle + (0, 7)) - ._SetValue("Бурение в слайде (за отчетный период) с использование САУБ-1"); - sheet._Range(AddressSlideTableHead[0], AddressSlideTableHead[0] + (0, 1)) - ._SetValue("Проходка"); - sheet._Range(AddressSlideTableHead[1], AddressSlideTableHead[1] + (0, 1)) - ._SetValue("Часы бурения"); - sheet._Range(AddressSlideTableHead[2], AddressSlideTableHead[2] + (0, 1)) - ._SetValue("Мех. скорость"); - sheet._Range(AddressSlideTableHead[3], AddressSlideTableHead[3] + (0, 1)) - ._SetValue("Среднее диф. Давление"); - sheet._Range(AddressSlideTableData[0], AddressSlideTableData[0] + (0, 1)) - ._SetValue($"{blockDto.PenetrationInSlide}"); - sheet._Range(AddressSlideTableData[1], AddressSlideTableData[1] + (0, 1)) - ._SetValue($"{blockDto.DrillingTimeInRotor}"); - sheet._Range(AddressSlideTableData[2], AddressSlideTableData[2] + (0, 1))._SetValue(""); - sheet.Cell(AddressSlideTableData[2]) - .SetFormulaA1(FormulaMechanicalSpeed(AddressSlideTableData[0], AddressSlideTableData[1])).Style.SetAllBorders(); - sheet._Range(AddressSlideTableData[3], AddressSlideTableData[3] + (0, 1)) - ._SetValue($"{blockDto.AVGDiffPressureSlide}"); - sheet._Range(AddressTotalTableTitle, AddressTotalTableTitle + (0, 5)) - ._SetValue("Итого за отчетный период, использование САУБ-1"); - sheet._Range(AddressTotalTableMechanicalSpeed, AddressTotalTableMechanicalSpeed + (1, 1)) - ._SetValue("Плановая мех скорость"); - sheet._Range(AddressTotalTableHead[0], AddressTotalTableHead[0] + (0, 1)) - ._SetValue("Проходка"); - sheet._Range(AddressTotalTableHead[1], AddressTotalTableHead[1] + (0, 1)) - ._SetValue("Часы бурения"); - sheet._Range(AddressTotalTableHead[2], AddressTotalTableHead[2] + (0, 1)) - ._SetValue("Мех. скорость"); - - sheet._Range(AddressTotalTableData[0], AddressTotalTableData[0] + (0, 1))._SetValue(""); - sheet.Cell(AddressTotalTableData[0]) - .SetFormulaA1(FormulaSinking(AddressDrillingTableData[0], AddressSlideTableData[0], headBlock.AddressPeriodTableDataArray[3], headBlock.AddressPeriodTableDataArray[2])); - sheet._Range(AddressTotalTableData[1], AddressTotalTableData[1] + (0, 1))._SetValue(""); - sheet.Cell(AddressTotalTableData[1]) - .SetFormulaA1(FormulaWatch(AddressDrillingTableData[1], AddressSlideTableData[1])); - sheet._Range(AddressTotalTableData[2], AddressTotalTableData[2] + (0, 1)) - ._SetValue(""); - sheet._Range(AddressTotalTableData[3], AddressTotalTableData[3] + (0, 1)) - ._SetValue($"{blockDto.SectionROPPlan}"); - sheet._Range(IncreaseSpeedSection, IncreaseSpeedSection + (0, 3)) - ._SetValue("Увеличение мех скорости за секцию %"); - sheet._Range(IncreaseSpeedSectionValue, IncreaseSpeedSectionValue + (0, 3)) - ._SetValue($"{blockDto.IncreaseSpeedSection}"); - sheet._Range(IncreaseSpeedDay, IncreaseSpeedDay + (0, 3)) - ._SetValue("Увеличение мех скорости за сутки %"); - sheet._Range(IncreaseSpeedDayValue, IncreaseSpeedDayValue + (0, 3)) - ._SetValue($"{blockDto.IncreaseSpeedDay}"); - sheet._Range(ReductionTimeDrilling, ReductionTimeDrilling + (0, 3)) - ._SetValue("Сокращение времени бурения за секцию, ч"); - sheet._Range(ReductionTimeDrillingValue, ReductionTimeDrillingValue + (0, 3)) - ._SetValue($"{blockDto.ReductionTimeDrilling}"); - sheet._Range(RotorSlidePercent, RotorSlidePercent + (0, 3)) - ._SetValue("Ротор / слайд, %"); - sheet._Range(RotorSlidePercentValue, RotorSlidePercentValue + (0, 3)) - ._SetValue($"{blockDto.RotorSlidePercent}"); - sheet._Range(MspSection, MspSection + (0, 3)) - ._SetValue("МСП за секцию м/ч."); - sheet._Range(MspSectionValue, MspSectionValue + (0, 3)) - ._SetValue($"{blockDto.MspSection}"); - sheet._Range(SectionDrillingTimeTotal, SectionDrillingTimeTotal + (0, 3)) - ._SetValue("Время бурения за секцию"); - sheet._Range(SectionDrillingTimeTotalValue, SectionDrillingTimeTotalValue + (0, 3)) - ._SetValue($"{blockDto.SectionDrillingTimeTotal}"); - sheet._Range(SectionPenetrationTotal, SectionPenetrationTotal + (0, 3)) - ._SetValue("Проходка за секцию"); - sheet._Range(SectionPenetrationTotalValue, SectionPenetrationTotalValue + (0, 3)) - ._SetValue($"{blockDto.SectionPenetrationTotal}"); - sheet._Range(AddressExtensionsCount, AddressExtensionsCount + (0, 3)) - ._SetValue("Кол- во наращиваний"); - sheet._Range(AddressExtensionsCountValue, AddressExtensionsCountValue + (0, 3)) - ._SetValue($"{blockDto.ExtensionsCount}"); - sheet._Range(DeviationFromTVD, DeviationFromTVD + (0, 3)) - ._SetValue("Отклонение от ГГД +/-, сут"); - sheet._Range(DeviationFromTVDValue, DeviationFromTVDValue + (0, 3)) - ._SetValue($"{blockDto.DeviationFromTVD}"); - sheet._Range(DeclinesReasonsROP, DeclinesReasonsROP + (1, 7)) - ._SetValue($"Примечание: {blockDto.DeclinesReasonsROP}"); - } - } - -} - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs deleted file mode 100644 index b7e5eb60..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs +++ /dev/null @@ -1,51 +0,0 @@ -using AsbCloudApp.Data.DailyReport; -using ClosedXML.Excel; - -namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks -{ - - internal class SignBlock : BlockAbstract - { - private readonly SignDto blockDto; - public CellAddress AddressDrillMasterHead { get; } - public CellAddress AddressDrillMaster { get; } - public CellAddress AddressSupervisorHead { get; } - public CellAddress AddressSupervisor { get; } - public override CellAddress AddressBlockBegin { get; } - public override CellAddress AddressBlockEnd { get; } - - public SignBlock(CellAddress addressBlockBegin, SignDto blockDto) - { - AddressBlockBegin = addressBlockBegin.Copy(); - this.blockDto = blockDto; - AddressDrillMasterHead = addressBlockBegin + (3, 0); - AddressDrillMaster = AddressDrillMasterHead + (0, 5); - AddressSupervisorHead = AddressDrillMasterHead + (2, 0); - AddressSupervisor = AddressSupervisorHead + (0, 5); - AddressBlockEnd = AddressSupervisor + (0,1); - } - - public override void Draw(IXLWorksheet sheet) - { - sheet.Range(AddressDrillMasterHead.RowNumber, AddressDrillMasterHead.ColumnNumber - , AddressDrillMasterHead.RowNumber, AddressDrillMasterHead.ColumnNumber + 2) - .Merge() - .SetValue("Мастер буровой "); - sheet.Range(AddressDrillMaster.RowNumber, AddressDrillMaster.ColumnNumber - , AddressDrillMaster.RowNumber, AddressDrillMaster.ColumnNumber + 2) - .Merge() - .SetValue($"{blockDto.DrillingMaster}"); - sheet.Range(AddressSupervisorHead.RowNumber, AddressSupervisorHead.ColumnNumber - , AddressSupervisorHead.RowNumber, AddressSupervisorHead.ColumnNumber + 2) - .Merge() - .SetValue("Супервайзер "); - sheet.Range(AddressSupervisor.RowNumber, AddressSupervisor.ColumnNumber - , AddressSupervisor.RowNumber, AddressSupervisor.ColumnNumber + 2) - .Merge() - .SetValue($"{blockDto.Supervisor}"); - } - } - -} - - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs deleted file mode 100644 index 9fe13a72..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs +++ /dev/null @@ -1,93 +0,0 @@ -using AsbCloudApp.Data; -using AsbCloudApp.Data.DailyReport; -using ClosedXML.Excel; -using System; -using System.Collections.Generic; -using System.Linq; - - -namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks -{ - /// - /// Построение баланса времени - /// - class TimeBalanceBlock : BlockAbstract - { - /// - /// Начальная ячейка - /// - public override CellAddress AddressBlockBegin { get; } - - /// - /// Конечная ячейка - /// - public override CellAddress AddressBlockEnd { get; } - - /// - /// Ячейка с заголовком - /// - private CellAddress Title { get { return AddressBlockBegin + (1, 3); } } - - /// - /// Статистика по операциям - /// - private Dictionary OperationsStatistics { get; } - - /// - /// Категории операций - /// - private IEnumerable OperationCategories { get; } - - /// - /// количество столбцов в таблице - /// - private const int countColumns = 3; - - /// - /// количество категорий операций - /// - private int OperationCategoriesCount { get { return OperationCategories.Count(); } } - - - public TimeBalanceBlock(CellAddress addressBlockBegin, TimeBalanceDto blockDto, IEnumerable operationCategories) - { - AddressBlockBegin = addressBlockBegin.Copy(); - - OperationsStatistics = blockDto.OperationsStat; - OperationCategories = operationCategories; - - var rowsCount = (int)Math.Ceiling( 1d * OperationCategoriesCount / countColumns); - var colsCount = (1 + 1) * countColumns; - AddressBlockEnd = Title + (rowsCount, colsCount); - } - - public override void Draw(IXLWorksheet sheet) - { - sheet.Range(Title.RowNumber, Title.ColumnNumber, Title.RowNumber, Title.ColumnNumber + 1) - .Merge() - .SetValue("БАЛАНС ВРЕМЕНИ"); - - var i = 0; - - foreach (var operationCategory in OperationCategories) - { - var row = 2 + (int)Math.Floor(1d * i / countColumns); - var col = 1 + 2 *(i % countColumns); - i++; - - sheet.Cell(AddressBlockBegin + (row, col)) - ._SetValue(operationCategory.Name, true); - sheet.Cell(AddressBlockBegin + (row, col + 1)) - ._SetValue(GetValue(operationCategory.Id), true); - } - } - - private string GetValue(int categoryId) - { - if (OperationsStatistics.TryGetValue(categoryId, out double duration)) - return $"{duration}"; - return "0"; - } - } -} - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportExportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportExportService.cs new file mode 100644 index 00000000..7c1cb1bb --- /dev/null +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportExportService.cs @@ -0,0 +1,253 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.DailyReport; +using AsbCloudApp.Data.DailyReport.Blocks; +using AsbCloudApp.Data.DailyReport.Blocks.Sign; +using AsbCloudApp.Data.DailyReport.Blocks.Subsystems; +using AsbCloudApp.Data.DailyReport.Blocks.TimeBalance; +using AsbCloudApp.Data.DailyReport.Blocks.WellOperation; +using AsbCloudApp.Services.DailyReport; +using ClosedXML.Excel; + +namespace AsbCloudInfrastructure.Services.DailyReport; + +public class DailyReportExportService : IDailyReportExportService +{ + private const int rowStartScheduleBlock = 20; + private const int rowStartSubsystemBlock = 26; + private const int rowStartFactWellOperationBlock = 39; + private const int rowStartTimeBalanceBlock = 62; + private const int rowStartProcessMapWellDrillingBlock = 68; + + private const int columnTimeBalanceDurationPlan = 3; + private const int columnTimeBalanceDurationFact = 6; + private const int columnTimeBalanceReasonDeviation = 8; + private const int columnTimeBalanceDrillingDeviationPerSection = 10; + private const int columnTimeBalanceDrillingDeviationPerDay = 11; + + private const int columnSheduleDriller = 3; + private const int columnSheduleShiftStart = 7; + private const int columnSheduleShiftEnd = 8; + + private const int columnSubsystemName = 2; + private const int columnUseSubsystemPerDayUsedTimeHours = 3; + private const int columnUseSubsystemPerDaySumDepthInterval = 4; + private const int columnUseSubsystemPerDayKUsage = 5; + + private const int columnUseSubsystemPerWellUsedTimeHours = 6; + private const int columnUseSubsystemPerWellSumDepthInterval = 7; + private const int columnUseSubsystemPerWellKUsage = 8; + + private const int columnProcessMapWellDrillingBlockDrillingMode = 2; + private const int columnProcessMapWellDrillingBlockWellBoreDepth = 3; + private const int columnProcessMapWellDrillingBlockMechDrillingHours = 4; + private const int columnProcessMapWellDrillingBlockRopPlan = 5; + private const int columnProcessMapWellDrillingBlockRopFact = 6; + + private const int columnWellOperationCategory = 2; + private const int columnWellOperationDurationHours = 4; + + private const string cellCustomer = "C2"; + private const string cellContractor = "C3"; + private const string cellDeposit = "C5"; + private const string cellCluster = "C6"; + private const string cellWellCaption = "C7"; + private const string cellWellType = "C8"; + private const string cellDate = "C12"; + private const string cellDepthStart = "C13"; + private const string cellDepthEnd = "D13"; + + private const string cellTrajectoryBlockWellboreDepth = "B17"; + private const string cellTrajectoryBlockVerticalDepth = "C17"; + private const string cellTrajectoryBlockZenithAngle = "D17"; + private const string cellTrajectoryBlockAzimuthGeo = "E17"; + + private const string cellTimeBalanceBlockSection = "C60"; + private const string cellTimeBalanceBlockWellDepthPlan = "C61"; + private const string cellSectionDrillingHours = "F77"; + private const string cellTimeBalanceBlockWellDepthFact = "F78"; + private const string cellTimeBalanceBlockWellOperationSlipsTimeCount = "F79"; + + private const string cellSubsystemComment = "D35"; + private const string cellSubsystemTvgLagDays = "F80"; + private const string cellSubsystemMeasurementsPerDay = "F81"; + private const string cellSubsystemWellbore = "C9"; + private const string cellSubsystemTotalRopPlan = "E70"; + + private const string cellSignDrillingMaster = "C85"; + private const string cellSignSupervisor = "C86"; + + private readonly IDailyReportService dailyReportService; + + public DailyReportExportService(IDailyReportService dailyReportService) + { + this.dailyReportService = dailyReportService; + } + + public async Task<(string FileName, Stream File)> ExportAsync(int idWell, DateTime dailyReportDateStart, CancellationToken cancellationToken) + { + var dailyReport = await dailyReportService.GetAsync(idWell, dailyReportDateStart, cancellationToken); + + var stream = await GenerateFileAsync(dailyReport, cancellationToken); + + var fileName = $"Суточный_рапорт_по_скважине_{dailyReport.WellCaption}_куст_{dailyReport.Cluster}_от_{dailyReport.Date:yy-MM-dd}.xlsx"; + + return (fileName, stream); + } + + private static async Task GenerateFileAsync(DailyReportDto dailyReport, CancellationToken cancellationToken) + { + using var excelTemplateStream = await Assembly + .GetExecutingAssembly() + .GetTemplateCopyStreamAsync("DailyReportTemplate.xlsx", cancellationToken); + + using var workbook = new XLWorkbook(excelTemplateStream, XLEventTracking.Disabled); + + AddDailyReportToWorkBook(workbook, dailyReport); + + var memoryStream = new MemoryStream(); + workbook.SaveAs(memoryStream, new SaveOptions { }); + memoryStream.Seek(0, SeekOrigin.Begin); + return memoryStream; + } + + private static void AddDailyReportToWorkBook(IXLWorkbook workbook, DailyReportDto dailyReport) + { + const string sheetName = "Суточный отчёт"; + + var sheet = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetName) + ?? throw new FileFormatException($"Книга excel не содержит листа {sheetName}."); + + sheet.Cell(cellCustomer).Value = dailyReport.Customer; + sheet.Cell(cellContractor).Value = dailyReport.Contractor; + sheet.Cell(cellDeposit).Value = dailyReport.Deposit; + sheet.Cell(cellCluster).Value = dailyReport.Cluster; + sheet.Cell(cellWellCaption).Value = dailyReport.WellCaption; + sheet.Cell(cellWellType).Value = dailyReport.WellType; + sheet.Cell(cellDate).Value = dailyReport.Date; + sheet.Cell(cellDepthStart).Value = dailyReport.DepthStart; + sheet.Cell(cellDepthEnd).Value = dailyReport.DepthEnd; + + if (dailyReport.TimeBalanceBlock is not null) + AddTimeBalanceBlockToSheet(sheet, dailyReport.TimeBalanceBlock); + + if (dailyReport.SubsystemBlock is not null) + AddSubsystemBlockToSheet(sheet, dailyReport.SubsystemBlock); + + if (dailyReport.SignBlock is not null) + AddSignBlockToSheet(sheet, dailyReport.SignBlock); + + AddTrajectoryBlockToSheet(sheet, dailyReport.TrajectoryBlock); + AddScheduleBlockToSheet(sheet, dailyReport.ScheduleBlock); + AddProcessMapWellDrillingBlockToSheet(sheet, dailyReport.ProcessMapWellDrillingBlock); + AddFactWellOperationBlockToSheet(sheet, dailyReport.FactWellOperationBlock); + } + + private static void AddTrajectoryBlockToSheet(IXLWorksheet sheet, TrajectoryBlockDto trajectoryBlock) + { + sheet.Cell(cellTrajectoryBlockWellboreDepth).Value = trajectoryBlock.WellboreDepth; + sheet.Cell(cellTrajectoryBlockVerticalDepth).Value = trajectoryBlock.VerticalDepth; + sheet.Cell(cellTrajectoryBlockZenithAngle).Value = trajectoryBlock.ZenithAngle; + sheet.Cell(cellTrajectoryBlockAzimuthGeo).Value = trajectoryBlock.AzimuthGeo; + } + + private static void AddTimeBalanceBlockToSheet(IXLWorksheet sheet, TimeBalanceBlockDto timeBalanceBlock) + { + var rowCurrent = rowStartTimeBalanceBlock; + + foreach (var wellOperation in timeBalanceBlock.WellOperations.OrderBy(w => w.IdWellOperation)) + { + sheet.Cell(rowCurrent, columnTimeBalanceDurationPlan).Value = wellOperation.DurationHours.Plan; + sheet.Cell(rowCurrent, columnTimeBalanceDurationFact).Value = wellOperation.DurationHours.Fact; + sheet.Cell(rowCurrent, columnTimeBalanceReasonDeviation).Value = wellOperation.ReasonDeviation; + sheet.Cell(rowCurrent, columnTimeBalanceDrillingDeviationPerSection).Value = wellOperation.DrillingDeviationPerSection; + sheet.Cell(rowCurrent, columnTimeBalanceDrillingDeviationPerDay).Value = wellOperation.DrillingDeviationPerDay; + + rowCurrent++; + } + + sheet.Cell(cellTimeBalanceBlockSection).Value = timeBalanceBlock.SectionName; + sheet.Cell(cellTimeBalanceBlockWellDepthPlan).Value = timeBalanceBlock.WellDepth.Plan; + sheet.Cell(cellTimeBalanceBlockWellDepthFact).Value = timeBalanceBlock.WellDepth.Fact; + sheet.Cell(cellTimeBalanceBlockWellOperationSlipsTimeCount).Value = timeBalanceBlock.WellOperationSlipsTimeCount; + } + + private static void AddSubsystemBlockToSheet(IXLWorksheet sheet, SubsystemBlockDto subsystemBlock) + { + var rowСurrent = rowStartSubsystemBlock; + + foreach (var subsystem in subsystemBlock.Subsystems) + { + sheet.Cell(rowСurrent, columnSubsystemName).Value = subsystem.Name; + + sheet.Cell(rowСurrent, columnUseSubsystemPerDayUsedTimeHours).Value = subsystem.UsagePerDay?.UsedTimeHours; + sheet.Cell(rowСurrent, columnUseSubsystemPerDaySumDepthInterval).Value = subsystem.UsagePerDay?.SumDepthInterval; + sheet.Cell(rowСurrent, columnUseSubsystemPerDayKUsage).Value = subsystem.UsagePerDay?.KUsage; + + sheet.Cell(rowСurrent, columnUseSubsystemPerWellUsedTimeHours).Value = subsystem.UsagePerWell?.UsedTimeHours; + sheet.Cell(rowСurrent, columnUseSubsystemPerWellSumDepthInterval).Value = subsystem.UsagePerWell?.SumDepthInterval; + sheet.Cell(rowСurrent, columnUseSubsystemPerWellKUsage).Value = subsystem.UsagePerWell?.KUsage; + + rowСurrent++; + } + + sheet.Cell(cellSubsystemComment).Value = subsystemBlock.Comment; + sheet.Cell(cellSubsystemTvgLagDays).Value = subsystemBlock.TvgLagDays; + sheet.Cell(cellSubsystemMeasurementsPerDay).Value = subsystemBlock.MeasurementsPerDay; + sheet.Cell(cellSubsystemWellbore).Value = subsystemBlock.Wellbore; + sheet.Cell(cellSubsystemTotalRopPlan).Value = subsystemBlock.TotalRopPlan; + } + + private static void AddScheduleBlockToSheet(IXLWorksheet sheet, IEnumerable scheduleBlock) + { + var rowCurrent = rowStartScheduleBlock; + + foreach (var schedule in scheduleBlock.OrderBy(s => s.ShiftStart)) + { + sheet.Cell(rowCurrent, columnSheduleDriller).Value = $"{schedule.Surname} {schedule.Name} {schedule.Patronymic}"; + sheet.Cell(rowCurrent, columnSheduleShiftStart).Value = schedule.ShiftStart; + sheet.Cell(rowCurrent, columnSheduleShiftEnd).Value = schedule.ShiftEnd; + + rowCurrent++; + } + } + + private static void AddProcessMapWellDrillingBlockToSheet(IXLWorksheet sheet, + IEnumerable processMapWellDrillingBlock) + { + var rowCurrent = rowStartProcessMapWellDrillingBlock; + + foreach (var processMapWellDrilling in processMapWellDrillingBlock.OrderBy(p => p.DrillingMode)) + { + sheet.Cell(rowCurrent, columnProcessMapWellDrillingBlockDrillingMode).Value = processMapWellDrilling.DrillingMode; + sheet.Cell(rowCurrent, columnProcessMapWellDrillingBlockWellBoreDepth).Value = processMapWellDrilling.WellBoreDepth; + sheet.Cell(rowCurrent, columnProcessMapWellDrillingBlockMechDrillingHours).Value = processMapWellDrilling.MechDrillingHours; + sheet.Cell(rowCurrent, columnProcessMapWellDrillingBlockRopPlan).Value = processMapWellDrilling.Rop.Plan; + sheet.Cell(rowCurrent, columnProcessMapWellDrillingBlockRopFact).Value = processMapWellDrilling.Rop.Fact; + + rowCurrent++; + } + } + + private static void AddFactWellOperationBlockToSheet(IXLWorksheet sheet, WellOperationBlockDto factWellOperationBlock) + { + sheet.Cell(cellSectionDrillingHours).Value = factWellOperationBlock.SectionDrillingHours; + + foreach (var factOperation in factWellOperationBlock.WellOperations.OrderBy(w => w.CategoryName)) + { + sheet.Cell(rowStartFactWellOperationBlock, columnWellOperationCategory).Value = factOperation.CategoryName; + sheet.Cell(rowStartFactWellOperationBlock, columnWellOperationDurationHours).Value = factOperation.DurationHours; + } + } + + private static void AddSignBlockToSheet(IXLWorksheet sheet, SignBlockDto signBlock) + { + sheet.Cell(cellSignDrillingMaster).Value = signBlock.DrillingMaster?.ToString(); + sheet.Cell(cellSignSupervisor).Value = signBlock.Supervisor?.ToString(); + } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs deleted file mode 100644 index 56b68c30..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs +++ /dev/null @@ -1,61 +0,0 @@ -using AsbCloudApp.Data; -using AsbCloudApp.Data.DailyReport; -using AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks; -using ClosedXML.Excel; -using System.Collections.Generic; -using System.IO; -namespace AsbCloudInfrastructure.Services.DailyReport -{ - - public class DailyReportMakerExcel - { - private IEnumerable OperationCategories = null!; - - public Stream MakeReportFromBlocks(DailyReportDto dto, IEnumerable operationCategories) - { - OperationCategories = operationCategories; - - using var workbook = new XLWorkbook(); - FillExampleBlocks(workbook, dto); - MemoryStream memoryStream = new MemoryStream(); - workbook.SaveAs(memoryStream, new SaveOptions { }); - memoryStream.Seek(0, SeekOrigin.Begin); - return memoryStream; - } - - private void FillExampleBlocks(XLWorkbook workbook, DailyReportDto dto) - { - var sheet = workbook.Worksheets.Add(dto.Head.ReportDate.ToString("dd.MM.yyyy")); - var addressStart = new CellAddress(sheet, 2, 2); - var blockHeader = new HeadBlock(addressStart, dto.Head); - addressStart = blockHeader.AddressBlockEnd + (1, 0); - addressStart.ColumnNumber = 2; - var blockBha = new BhaBlock(addressStart, dto.Bha); - addressStart = blockBha.AddressBlockEnd + (1, 0); - addressStart.ColumnNumber = 2; - var timeBalance = new TimeBalanceBlock(addressStart, dto.TimeBalance, OperationCategories); - addressStart = timeBalance.AddressBlockEnd + (1, 0); - addressStart.ColumnNumber = 2; - var blockDimensionless = new DimensionlessBlock(addressStart, dto.NoDrilling); - addressStart = blockDimensionless.AddressBlockEnd + (1, 0); - addressStart.ColumnNumber = 2; - var blockSaub = new SaubBlock(addressStart, dto.Saub, blockHeader); - addressStart = blockSaub.AddressBlockEnd + (1, 0); - blockDimensionless.SaubBlock = blockSaub; - addressStart.ColumnNumber = 2; - var blockSign = new SignBlock(addressStart, dto.Sign); - addressStart = blockSign.AddressBlockEnd + (1, 0); - addressStart.ColumnNumber = 2; - blockHeader.Draw(sheet); - blockBha.Draw(sheet); - timeBalance.Draw(sheet); - blockDimensionless.Draw(sheet); - blockSaub.Draw(sheet); - blockSign.Draw(sheet); - //sheet.Columns().AdjustToContents(); // Adjust column width - sheet.Rows().AdjustToContents(); - } - } - -} - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs index abb88b14..f58f0a96 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs @@ -1,241 +1,377 @@ -using AsbCloudApp.Data; -using AsbCloudApp.Data.DailyReport; -using AsbCloudApp.Data.User; +using AsbCloudApp.Data.DailyReport; using AsbCloudApp.Exceptions; using AsbCloudApp.Repositories; -using AsbCloudApp.Requests; using AsbCloudApp.Services; -using AsbCloudDb.Model; -using AsbCloudDb.Model.DailyReport; -using Mapster; -using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using AsbCloudApp.Data; +using AsbCloudApp.Data.DailyReport.Blocks; +using AsbCloudApp.Data.DailyReport.Blocks.Sign; +using AsbCloudApp.Data.DailyReport.Blocks.Subsystems; +using AsbCloudApp.Data.DailyReport.Blocks.TimeBalance; +using AsbCloudApp.Data.DailyReport.Blocks.WellOperation; +using AsbCloudApp.Requests; +using AsbCloudApp.Services.DailyReport; +using AsbCloudApp.Services.ProcessMaps.WellDrilling; +using AsbCloudApp.Services.Subsystems; +using AsbCloudDb.Model; +using Mapster; -namespace AsbCloudInfrastructure.Services.DailyReport +namespace AsbCloudInfrastructure.Services.DailyReport; + +public class DailyReportService : IDailyReportService { + private readonly IWellService wellService; + private readonly ITrajectoryFactRepository trajectoryFactRepository; + private readonly IDailyReportRepository dailyReportRepository; + private readonly IScheduleRepository scheduleRepository; + private readonly IWellOperationRepository wellOperationRepository; + private readonly ISubsystemOperationTimeService subsystemOperationTimeService; + private readonly IProcessMapReportWellDrillingService processMapReportWellDrillingService; + private readonly IDetectedOperationService detectedOperationService; - public class DailyReportService : IDailyReportService - { - private readonly IAsbCloudDbContext db; - private readonly IUserRepository userRepository; - private readonly IWellOperationRepository wellOperationRepository; - private readonly IWellService wellService; - private readonly DailyReportMakerExcel dailyReportMaker = new DailyReportMakerExcel(); + public DailyReportService(IWellService wellService, + ITrajectoryFactRepository trajectoryFactRepository, + IDailyReportRepository dailyReportRepository, + IScheduleRepository scheduleRepository, + IWellOperationRepository wellOperationRepository, + ISubsystemOperationTimeService subsystemOperationTimeService, + IProcessMapReportWellDrillingService processMapReportWellDrillingService, + IDetectedOperationService detectedOperationService) + { + this.wellService = wellService; + this.trajectoryFactRepository = trajectoryFactRepository; + this.dailyReportRepository = dailyReportRepository; + this.scheduleRepository = scheduleRepository; + this.wellOperationRepository = wellOperationRepository; + this.subsystemOperationTimeService = subsystemOperationTimeService; + this.processMapReportWellDrillingService = processMapReportWellDrillingService; + this.detectedOperationService = detectedOperationService; + } - public DailyReportService( - IAsbCloudDbContext db, - IWellService wellService, - IUserRepository userRepository, - IWellOperationRepository wellOperationRepository) - { - this.db = db; - this.wellService = wellService; - this.userRepository = userRepository; - this.wellOperationRepository = wellOperationRepository; + public async Task UpdateOrInsertAsync(int idWell, DateTime dateDailyReport, int idUser, TBlock editableBlock, + CancellationToken cancellationToken) + where TBlock : ItemInfoDto + { + if (!await IsDateDailyReportInRangeAsync(idWell, dateDailyReport, cancellationToken)) + throw new ArgumentInvalidException(nameof(dateDailyReport), "Невозможно обновить суточный отчёт"); + + var dailyReport = await dailyReportRepository.GetOrDefaultAsync(idWell, dateDailyReport, cancellationToken) ?? + new DailyReportDto + { + IdWell = idWell, + Date = dateDailyReport + }; - } + switch (editableBlock) + { + case SubsystemBlockDto subsystemBlock: + dailyReport.SubsystemBlock = subsystemBlock; + break; + case TimeBalanceBlockDto timeBalanceBlock: + dailyReport.TimeBalanceBlock = timeBalanceBlock; + break; + case SignBlockDto signBlock: + dailyReport.SignBlock = signBlock; + break; + default: + throw new InvalidOperationException("Unexpected type of editableBlock"); + } - public async Task> GetListAsync(int idWell, DateOnly? begin, DateOnly? end, CancellationToken token) - { - var well = wellService.GetOrDefault(idWell) - ?? throw new ArgumentInvalidException(nameof(idWell), "idWell doesn`t exist"); + editableBlock.IdUser = idUser; + editableBlock.LastUpdateDate = DateTime.UtcNow; - var query = db.DailyReports.Where(r => r.IdWell == idWell); + dailyReport.DateLastUpdate = DateTime.UtcNow; - if (begin is not null) - { - query = query.Where(d => d.StartDate >= begin); - } + if (dailyReport.Id == 0) + return await dailyReportRepository.InsertAsync(dailyReport, cancellationToken); + + return await dailyReportRepository.UpdateAsync(dailyReport, cancellationToken); + } - if (end is not null) - { - query = query.Where(d => d.StartDate <= end); - } + public async Task GetAsync(int idWell, DateTime dateDailyReport, CancellationToken cancellationToken) + { + var well = await wellService.GetOrDefaultAsync(idWell, cancellationToken); - var entities = await query.OrderByDescending(e => e.StartDate) - .AsNoTracking() - .ToArrayAsync(token) - .ConfigureAwait(false); + if (well is null) + throw new ArgumentNullException(nameof(idWell), $"Скважина с Id: {idWell} не найдена"); + + if (!await IsDateDailyReportInRangeAsync(idWell, dateDailyReport, cancellationToken)) + throw new ArgumentInvalidException(nameof(dateDailyReport), "Невозможно получить суточный отчёт"); + - var factOperationsForDtos = await GetFactOperationsForDailyReportAsync(idWell, token); - var userDtos = await userRepository.GetAllAsync(token); + var dailyReport = await dailyReportRepository.GetOrDefaultAsync(idWell, dateDailyReport, cancellationToken) ?? new DailyReportDto + { + Date = dateDailyReport.Date, + IdWell = well.Id + }; - var dtos = entities.Select(entity => Convert(entity, factOperationsForDtos, userDtos)); - return dtos; - } + var factWellOperations = (await GetFactWellOperationsAsync(idWell, dailyReport.Date, cancellationToken)) + .OrderBy(o => o.DateStart) + .ThenBy(o => o.DepthStart); - /// - /// Получение фактических операций для суточного рапорта - /// - /// - /// - /// - private async Task> GetFactOperationsForDailyReportAsync(int idWell, CancellationToken token) - { - var request = new WellOperationRequest() - { - IdWell = idWell, - OperationType = WellOperation.IdOperationTypeFact, - }; + dailyReport.WellCaption = well.Caption; + dailyReport.WellType = well.WellType; + dailyReport.Cluster = well.Cluster; + dailyReport.Deposit = well.Deposit; + dailyReport.Customer = well.Companies.FirstOrDefault(c => c.IdCompanyType == 1)?.Caption; + dailyReport.Contractor = well.Companies.FirstOrDefault(c => c.IdCompanyType == 2)?.Caption; + dailyReport.DepthStart = factWellOperations.FirstOrDefault()?.DepthStart; + dailyReport.DepthEnd = factWellOperations.LastOrDefault()?.DepthEnd; - var factOperations = await wellOperationRepository.GetAsync(request, token); - return factOperations; - } + await UpdateTimeBalanceBlockAsync(dailyReport, factWellOperations, cancellationToken); + await UpdateSubsystemBlockAsync(dailyReport, cancellationToken); + + await AddTrajectoryBlockAsync(dailyReport, cancellationToken); + await AddScheduleBlockAsync(dailyReport, cancellationToken); + await AddProcessMapWellDrillingBlockAsync(dailyReport, cancellationToken); - public async Task AddAsync(int idWell, DateOnly startDate, int idUser, CancellationToken token) - { - var well = wellService.GetOrDefault(idWell) - ?? throw new ArgumentInvalidException(nameof(idWell), "idWell doesn`t exist"); + AddFactWellOperationBlock(dailyReport, factWellOperations); - var hasEntity = await db.DailyReports - .AnyAsync(r => r.IdWell == idWell && r.StartDate == startDate, token); - if (hasEntity) - throw new ArgumentInvalidException(nameof(startDate), $"daily report on {startDate} already exists"); + return dailyReport; + } - var entity = new AsbCloudDb.Model.DailyReport.DailyReport - { - IdWell = idWell, - StartDate = startDate, - Info = new DailyReportInfo() - { - Head = CreateHeadDailyReportBlock(well, startDate, idUser) - } - }; - db.DailyReports.Add(entity); - var result = await db.SaveChangesAsync(token); - return result; - } + public async Task> GetAsync(int idWell, FileReportRequest request, + CancellationToken cancellationToken) + { + var result = new PaginationContainer + { + Skip = request.Skip ?? 0, + Take = request.Take ?? 10, + Items = Enumerable.Empty() + }; - public async Task UpdateBlockAsync(int idWell, DateOnly startDate, ItemInfoDto dto, CancellationToken token) - { - var well = wellService.GetOrDefault(idWell) - ?? throw new ArgumentInvalidException(nameof(idWell), "idWell doesn`t exist"); + var datesRange = await GetDatesRangeAsync(idWell, cancellationToken); - var entity = await db.DailyReports.FirstOrDefaultAsync(r => r.IdWell == idWell && r.StartDate == startDate, token) - ?? throw new ArgumentInvalidException(nameof(startDate), "Daily report doesn`t exist"); + if (datesRange is null) + return result; - dto.LastUpdateDate = DateTimeOffset.Now; - if (dto is HeadDto headDto) - entity.Info.Head = headDto.Adapt(); - if (dto is BhaDto bhaDto) - entity.Info.Bha = bhaDto.Adapt(); - if (dto is NoDrillingDto noDrillingDto) - entity.Info.NoDrilling = noDrillingDto.Adapt(); - if (dto is SaubDto saubDto) - entity.Info.Saub = saubDto.Adapt(); - if (dto is SignDto signDto) - entity.Info.Sign = signDto.Adapt(); + var dailyReports = new List(); - db.DailyReports.Update(entity); - var result = await db.SaveChangesAsync(token); - return result; - } + var existingDailyReports = await dailyReportRepository.GetAsync(idWell, request, cancellationToken); + var factWellOperations = await GetFactWellOperationsAsync(idWell, null, cancellationToken); - public async Task MakeReportAsync(int idWell, DateOnly date, CancellationToken token) - { - var stageIds = WellOperationCategory.WorkStages.Select(w => w.Id).ToArray(); - var wellOperationCategories = wellOperationRepository.GetCategories(true) - .Where(o => o.IdParent is not null) - .Where(o => stageIds.Contains(o.IdParent!.Value)); + if (request.GeDate.HasValue) + { + var startDate = new DateTime(request.GeDate.Value.Year, request.GeDate.Value.Month, + request.GeDate.Value.Day); - var dailyReportDto = await GetOrDefaultAsync(idWell, date, token); - if (dailyReportDto is null) - return null; + if (startDate.Date >= datesRange.From.Date) + datesRange.From = startDate; + } - var memoryStream = dailyReportMaker.MakeReportFromBlocks(dailyReportDto, wellOperationCategories); + if (request.LeDate.HasValue) + { + var finishDate = new DateTime(request.LeDate.Value.Year, request.LeDate.Value.Month, + request.LeDate.Value.Day); - return memoryStream; - } + if (finishDate.Date <= datesRange.To.Date) + datesRange.To = finishDate; + } - private async Task GetOrDefaultAsync(int idWell, DateOnly date, CancellationToken token) - { - var entity = await db.DailyReports - .FirstOrDefaultAsync(r => r.IdWell == idWell && r.StartDate == date, token) - ?? throw new ArgumentInvalidException(nameof(date), "Daily report doesn`t exist"); + if (datesRange.From.AddDays(result.Skip) <= datesRange.To) + result.Count = (int)(Math.Ceiling((datesRange.To - DateTime.UnixEpoch).TotalDays) - + Math.Floor((datesRange.From - DateTime.UnixEpoch).TotalDays)); - var factOperationsForDtos = await GetFactOperationsForDailyReportAsync(idWell, token); - var userDtos = await userRepository.GetAllAsync(token); - var dto = Convert(entity, factOperationsForDtos, userDtos); - return dto; - } - /// - /// конвертация данных из модели базы данных в dto - /// - /// модель базы данных - /// список фактичских операций для формирования суточного рапорта - /// список пользователей для нахождения последнего изменившего запись - /// - private DailyReportDto Convert( - AsbCloudDb.Model.DailyReport.DailyReport entity, - IEnumerable factOperationsForDtos, - IEnumerable users) - { - var dto = entity.Info.Adapt(); - dto.StartDate = entity.StartDate; + if (request.SortFields?.Contains("DateStart desc") == true) + { + for (var day = result.Skip; day - result.Skip < result.Take && datesRange.To.AddDays(-day) >= datesRange.From; day++) + { + var dateDailyReport = datesRange.To.AddDays(-day).Date; - var dailyFactOperations = factOperationsForDtos - .Where(o => DateOnly.FromDateTime(o.DateStart) == dto.StartDate) - .Where(o => o.IdParentCategory is not null); + AddDailyReport(dateDailyReport); + } + } + else + { + for (var day = result.Skip; day - result.Skip < result.Take && datesRange.From.AddDays(day) <= datesRange.To; day++) + { + var dateDailyReport = datesRange.From.AddDays(day).Date; - var lastDailyFactOperation = dailyFactOperations - .OrderByDescending(o => o.LastUpdateDate) - .FirstOrDefault(); - dto.TimeBalance.IdUser = lastDailyFactOperation?.IdUser; - dto.TimeBalance.LastUpdateDate = lastDailyFactOperation?.LastUpdateDate; - dto.TimeBalance.OperationsStat = dailyFactOperations - .GroupBy(o => o.IdParentCategory!.Value) - .ToDictionary(g => g.Key, g => g.Sum(o => o.DurationHours)); + AddDailyReport(dateDailyReport); + } + } - var blocks = new ItemInfoDto[] { - dto.Head, - dto.Bha, - dto.NoDrilling, - dto.TimeBalance, - dto.Saub, - dto.Sign - }; + result.Items = dailyReports; - foreach (var block in blocks) - { - if (block.IdUser is not null) - { - block.UserName = users.FirstOrDefault(u => u.Id == block.IdUser.Value)?.MakeDisplayName() - ?? $"userId:{block.IdUser.Value}"; - } - } + return result; - return dto; - } + void AddDailyReport(DateTime date) + { + var dailyReport = existingDailyReports.FirstOrDefault(d => d.IdWell == idWell && d.Date == date) + ?? new DailyReportDto + { + Date = date, + IdWell = idWell + }; - /// - /// Создание блока "Заголовок" по умолчанию - /// - /// - /// - /// - /// - private Head CreateHeadDailyReportBlock(WellDto well, DateOnly startDate, int idUser) - { - var customer = well.Companies.FirstOrDefault(company => company.IdCompanyType == 1); - var contractor = well.Companies.FirstOrDefault(company => company.IdCompanyType == 2); + AddFactWellOperationBlock(dailyReport, factWellOperations.Where(o => o.DateStart >= date && o.DateStart <= date.AddDays(1))); + + dailyReports.Add(dailyReport); + } + } - return new Head() - { - ReportDate = startDate, - WellName = well.Caption, - ClusterName = well?.Cluster ?? string.Empty, - Customer = customer?.Caption ?? string.Empty, - Contractor = contractor?.Caption ?? string.Empty, - IdUser = idUser, - LastUpdateDate = DateTimeOffset.Now, - }; - } - } + public async Task GetDatesRangeAsync(int idWell, CancellationToken cancellationToken) + { + var factOperations = await GetFactWellOperationsAsync(idWell, null, cancellationToken); -} + if (!factOperations.Any()) + return null; + + var minDateStart = factOperations.Min(o => o.DateStart).Date; + var maxDateStart = factOperations.Max(o => o.DateStart).Date; + + return new DatesRangeDto + { + From = minDateStart.AddDays(1) <= DateTime.UtcNow ? minDateStart : DateTime.UtcNow.Date.AddDays(-1), + To = maxDateStart.AddDays(1) <= DateTime.UtcNow ? maxDateStart : DateTime.UtcNow.Date.AddDays(-1) + }; + } + + private async Task UpdateTimeBalanceBlockAsync(DailyReportDto dailyReport, IEnumerable factWellOperations, + CancellationToken cancellationToken) + { + const int idWellOperationSlipsTime = 5011; + + if (dailyReport.TimeBalanceBlock is not null) + { + dailyReport.TimeBalanceBlock.SectionName = wellOperationRepository.GetSectionTypes() + .FirstOrDefault(s => s.Id == dailyReport.TimeBalanceBlock.IdSection)?.Caption; + + dailyReport.TimeBalanceBlock.WellOperationSlipsTimeCount = (await detectedOperationService.GetAsync( + new DetectedOperationRequest + { + IdsCategories = new[] { idWellOperationSlipsTime }, + IdWell = dailyReport.IdWell, + GtDate = dailyReport.Date, + LtDate = dailyReport.Date.AddHours(24) + }, cancellationToken))?.Stats.Sum(s => s.Count); + + dailyReport.TimeBalanceBlock.WellDepth.Fact = factWellOperations + .Where(o => o.IdWellSectionType == dailyReport.TimeBalanceBlock.IdSection) + .Sum(o => o.DepthEnd - o.DepthStart); + } + } + + private async Task AddTrajectoryBlockAsync(DailyReportDto dailyReport, CancellationToken cancellationToken) + { + var trajectory = (await trajectoryFactRepository.GetAsync(new TrajectoryGeoFactRequest + { + IdWell = dailyReport.IdWell, + GeDate = dailyReport.Date, + LeDate = dailyReport.Date.AddHours(24) + }, cancellationToken)).MaxBy(t => t.WellboreDepth); + + dailyReport.TrajectoryBlock = new TrajectoryBlockDto + { + WellboreDepth = trajectory?.WellboreDepth, + VerticalDepth = trajectory?.VerticalDepth, + ZenithAngle = trajectory?.ZenithAngle, + AzimuthGeo = trajectory?.AzimuthGeo + }; + } + + private async Task AddScheduleBlockAsync(DailyReportDto dailyReport, CancellationToken cancellationToken) => + dailyReport.ScheduleBlock = (await scheduleRepository.GetAsync(dailyReport.IdWell, dailyReport.Date, cancellationToken)) + .Select(s => new ScheduleRecordDto + { + ShiftStart = s.ShiftStart, + ShiftEnd = s.ShiftEnd, + Name = s.Driller?.Name, + Surname = s.Driller?.Surname, + Patronymic = s.Driller?.Patronymic + }); + + private async Task UpdateSubsystemBlockAsync(DailyReportDto dailyReport, CancellationToken cancellationToken) + { + dailyReport.SubsystemBlock ??= new SubsystemBlockDto(); + + dailyReport.SubsystemBlock.Subsystems = await GetSubsystemsAsync(); + + async Task> GetSubsystemsAsync() + { + var subsystemOperationTimesPerWell = await subsystemOperationTimeService.GetStatAsync(new SubsystemOperationTimeRequest + { + IdWell = dailyReport.IdWell + }, cancellationToken); + + var subsystemOperationTimesPerDay = await subsystemOperationTimeService.GetStatAsync(new SubsystemOperationTimeRequest + { + IdWell = dailyReport.IdWell, + GtDate = dailyReport.Date, + LtDate = dailyReport.Date.AddHours(24) + }, cancellationToken); + + var subsystems = subsystemOperationTimesPerWell + .Select(subsystemOperationTime => new SubsystemRecordDto + { + Name = subsystemOperationTime.SubsystemName, + UsagePerDay = subsystemOperationTimesPerDay.FirstOrDefault(s => s.IdSubsystem == subsystemOperationTime.IdSubsystem)?.Adapt(), + UsagePerWell = subsystemOperationTime.Adapt() + }).ToList(); + + if (dailyReport.SubsystemBlock?.Subsystems != null && dailyReport.SubsystemBlock.Subsystems.Any()) + subsystems.AddRange(dailyReport.SubsystemBlock.Subsystems); + + return subsystems.OrderBy(s => s.Name); + } + } + + private async Task AddProcessMapWellDrillingBlockAsync(DailyReportDto dailyReport, CancellationToken cancellationToken) + { + dailyReport.ProcessMapWellDrillingBlock = (await processMapReportWellDrillingService.GetAsync(dailyReport.IdWell, + cancellationToken)).Where(p => p.DateStart >= dailyReport.Date && + p.DateStart <= dailyReport.Date.AddHours(24)) + .GroupBy(p => p.DrillingMode) + .Select(g => new ProcessMapWellDrillingRecordDto + { + DrillingMode = g.Key, + WellBoreDepth = g.Sum(p => p.DeltaDepth), + Rop = new PlanFactDto + { + Plan = g.Sum(p => p.Rop.Plan), + Fact = g.Sum(p => p.Rop.Fact) + }, + MechDrillingHours = g.Sum(p => p.MechDrillingHours) + }); + } + + private static void AddFactWellOperationBlock(DailyReportDto dailyReport, IEnumerable factWellOperations) + { + const int idWellOperationCategoryDrilling = 4001; + + dailyReport.FactWellOperationBlock = new WellOperationBlockDto + { + WellOperations = factWellOperations.GroupBy(o => o.IdParentCategory) + .Select(g => new WellOperationRecordDto + { + CategoryName = g.First().CategoryName, + DurationHours = g.Sum(o => o.DurationHours) + }), + + SectionDrillingHours = factWellOperations + .Where(o => o.IdParentCategory is idWellOperationCategoryDrilling) + .Sum(o => o.DurationHours) + }; + } + + private Task> GetFactWellOperationsAsync(int idWell, DateTime? dateDailyReport, CancellationToken cancellationToken) => + wellOperationRepository.GetAsync(new WellOperationRequest + { + IdWell = idWell, + OperationType = WellOperation.IdOperationTypeFact, + GeDate = dateDailyReport, + LtDate = dateDailyReport?.AddHours(24) + }, cancellationToken); + + private async Task IsDateDailyReportInRangeAsync(int idWell, DateTime dateDailyReport, CancellationToken cancellationToken) + { + var datesRange = await GetDatesRangeAsync(idWell, cancellationToken); + + return dateDailyReport >= datesRange?.From && dateDailyReport <= datesRange.To; + } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportTemplate.xlsx b/AsbCloudInfrastructure/Services/DailyReport/DailyReportTemplate.xlsx index 640f481b..38d1bdba 100644 Binary files a/AsbCloudInfrastructure/Services/DailyReport/DailyReportTemplate.xlsx and b/AsbCloudInfrastructure/Services/DailyReport/DailyReportTemplate.xlsx differ diff --git a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingExportService.cs b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingExportService.cs index 246d03e6..e89d64ad 100644 --- a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingExportService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingExportService.cs @@ -149,7 +149,7 @@ public class ProcessMapReportWellDrillingExportService : IProcessMapReportWellDr .SetVal(modeData.UsageFact); sheet.Cell(row, columnRop) - .SetVal(modeData.Rop); + .SetVal(modeData.Rop.Fact); return row + 1; } diff --git a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingService.cs b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingService.cs index a1fe7960..0561e9ee 100644 --- a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportWellDrillingService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using AsbCloudApp.Data; using AsbCloudApp.Data.ProcessMaps; using AsbCloudApp.Data.ProcessMaps.Report; using AsbCloudApp.Data.SAUB; @@ -188,7 +189,12 @@ public class ProcessMapReportWellDrillingService : IProcessMapReportWellDrilling TopDriveTorque = telemetryStat.RotorTorque.MakeParams(processMapByMode?.TopDriveTorque.Plan), SpeedLimit = telemetryStat.BlockSpeed.MakeParams(processMapByMode?.RopPlan), - Rop = telemetryStat.Rop, + Rop = new PlanFactDto + { + Plan = processMapByMode?.RopPlan, + Fact = telemetryStat.Rop + }, + UsagePlan = processMapByMode?.UsageSaub ?? telemetryStat.UsagePredictPlan, UsageFact = telemetryStat.UsageSaub, }; diff --git a/AsbCloudInfrastructure/Services/WellOperationImport/Files/Dictionaries/Operations.txt b/AsbCloudInfrastructure/Services/WellOperationImport/Files/Dictionaries/Operations.txt index 7bad4814..68bc28c7 100644 --- a/AsbCloudInfrastructure/Services/WellOperationImport/Files/Dictionaries/Operations.txt +++ b/AsbCloudInfrastructure/Services/WellOperationImport/Files/Dictionaries/Operations.txt @@ -187,4 +187,15 @@ Cборка хвостовика=Сборка хвостовика 114мм (со Выброс СБТ 127 (2100м), оставляется СБТ-127 (700 м) на след скв. ЗБР, чистка емкостей, вывоз БР.=Подъем БИ с выбросом на мостки Монтаж ПВО повторный (смена плашек ПВО). ЗБР, чистка емкостей, вывоз БР=Монтаж ПВО Опрессовка ПВО (200 атм), глухие=Опрессовка ПВО -Сборка ТБТ на 2 этапе (кол-во по согласованию с ЦУСС). Подъем/спуск БИ со сборкой ТБТ 102 мм. Опрессовка БИ (1.5 ч)=Сборка и спуск ТБТ \ No newline at end of file +Сборка ТБТ на 2 этапе (кол-во по согласованию с ЦУСС). Подъем/спуск БИ со сборкой ТБТ 102 мм. Опрессовка БИ (1.5 ч)=Сборка и спуск ТБТ +Спуск пакера=Спуск пакера +Запись гамма-каратожа=Запись гамма-каратожа +Шаблонирование спуск БИ=Шаблонирование спуск БИ +Сборка клин-отклонителя=Сборка клин-отклонителя +Ориентирование и посадка клина-отклонителя=Ориентирование и посадка клина-отклонителя +Протяжка подъемного патрубка подвески=Протяжка подъемного патрубка подвески +Подъем клина-отклонителя=Подъем клина-отклонителя +Стыковка стингера с хвостовиком основного ствола=Стыковка стингера с хвостовиком основного ствола +Ориентирование и установка стыковочного узла хвостовика=Ориентирование и установка стыковочного узла хвостовика +Бурение с отбором керна=Бурение с отбором керна +Работа пакером в обсадной колонне=Работа пакером в обсадной колонне \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/WellOperationImport/Files/WellOperationImportTemplate.xlsx b/AsbCloudInfrastructure/Services/WellOperationImport/Files/WellOperationImportTemplate.xlsx index 686f6f86..48e19c6c 100644 Binary files a/AsbCloudInfrastructure/Services/WellOperationImport/Files/WellOperationImportTemplate.xlsx and b/AsbCloudInfrastructure/Services/WellOperationImport/Files/WellOperationImportTemplate.xlsx differ diff --git a/AsbCloudInfrastructure/XLExtentions.cs b/AsbCloudInfrastructure/XLExtentions.cs index ca083b6a..3a583bf9 100644 --- a/AsbCloudInfrastructure/XLExtentions.cs +++ b/AsbCloudInfrastructure/XLExtentions.cs @@ -186,17 +186,6 @@ internal static class XLExtentions return style; } - /// - /// Костыль исправляющий проблему в библиотеке IXLRange Range(this IXLWorksheet, IXLAddress, IXLAddress) с кастингом IXLAddress к XLAddress. - /// - /// - /// - /// - /// - internal static IXLRange _Range(this IXLWorksheet sheet, CellAddress begin, CellAddress end) - => sheet.Range(begin.RowNumber, begin.ColumnNumber, end.RowNumber, end.ColumnNumber); - - internal static T? GetCellValue(this IXLCell cell) { try diff --git a/AsbCloudWebApi.Tests/UnitTests/Services/DailyReportServiceTest.cs b/AsbCloudWebApi.Tests/UnitTests/Services/DailyReportServiceTest.cs new file mode 100644 index 00000000..a5818058 --- /dev/null +++ b/AsbCloudWebApi.Tests/UnitTests/Services/DailyReportServiceTest.cs @@ -0,0 +1,556 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data; +using AsbCloudApp.Data.DailyReport; +using AsbCloudApp.Data.DailyReport.Blocks.Sign; +using AsbCloudApp.Data.DailyReport.Blocks.Subsystems; +using AsbCloudApp.Data.DailyReport.Blocks.TimeBalance; +using AsbCloudApp.Data.DetectedOperation; +using AsbCloudApp.Data.ProcessMaps.Report; +using AsbCloudApp.Data.Subsystems; +using AsbCloudApp.Exceptions; +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; +using AsbCloudApp.Services; +using AsbCloudApp.Services.ProcessMaps.WellDrilling; +using AsbCloudApp.Services.Subsystems; +using AsbCloudInfrastructure.Services.DailyReport; +using NSubstitute; +using Xunit; + +namespace AsbCloudWebApi.Tests.UnitTests.Services; + +public class DailyReportServiceTest +{ + private const int idDailyReport = 1; + private const int idUser = 3; + private const int idWell = 2; + + private readonly DateTime dateDailyReport = new DateOnly(2023, 10, 26).ToDateTime(TimeOnly.MinValue); + + private readonly SubsystemBlockDto fakeSubsystemBlock = new() + { + IdUser = idUser, + Wellbore = 999, + MeasurementsPerDay = 999, + TotalRopPlan = 999, + Comment = "Увеличить обороты", + Subsystems = new[] + { + new SubsystemRecordDto + { + Name = "АвтоСПО", + UsagePerDay = new SubsystemParametersDto + { + UsedTimeHours = 24, + SumDepthInterval = 1500, + KUsage = 15 + }, + UsagePerWell = new SubsystemParametersDto + { + UsedTimeHours = 500, + SumDepthInterval = 3000, + KUsage = 100 + } + } + } + }; + + private readonly SignBlockDto fakeSignBlock = new() + { + IdUser = idUser, + DrillingMaster = new SignRecordDto + { + Name = "Иван", + Patronymic = "Иванович", + Surname = "Иванов" + }, + Supervisor = new SignRecordDto() + { + Name = "Илья", + Patronymic = "Ильич", + Surname = "Бурилов" + } + }; + + private readonly TimeBalanceBlockDto fakeTimeBalanceBlock = new() + { + IdUser = idUser, + IdSection = 1, + WellDepth = new PlanFactDto + { + Plan = 2000 + }, + WellOperations = new[] + { + new TimeBalanceRecordDto + { + IdWellOperation = 1, + DurationHours = new PlanFactDto + { + Fact = 100, + Plan = 150, + }, + DrillingDeviationPerSection = 90, + DrillingDeviationPerDay = 100, + ReasonDeviation = "Отклонение" + } + } + }; + + private readonly DetectedOperationListDto fakeWellOperationSlipsTime = new() + { + Stats = new[] + { + new DetectedOperationDrillersStatDto + { + Count = 40 + } + } + }; + + private readonly ProcessMapReportWellDrillingDto fakeProcessMapReportWellDrilling = new() + { + DrillingMode = "Ротор", + DateStart = new DateTime(2023, 10, 26), + DeltaDepth = 500, + Rop = new PlanFactDto + { + Plan = 300, + Fact = 500 + }, + MechDrillingHours = 100 + }; + + private readonly WellSectionTypeDto fakeSectionType = new() + { + Id = 1, + Caption = "Пилотный ствол", + }; + + private readonly TrajectoryGeoFactDto fakeLastFactTrajectory = new() + { + WellboreDepth = 100, + VerticalDepth = 150, + ZenithAngle = 3, + AzimuthGeo = 5 + }; + + private readonly CompanyDto fakeCustomer = new() + { + Caption = "Тестовый заказчик", + IdCompanyType = 1 + }; + + private readonly CompanyDto fakeContractor = new() + { + Caption = "Тестовый подрядчик", + IdCompanyType = 2 + }; + + private readonly WellOperationDto fakeFirstFactWellOperation = new() + { + IdWell = idWell, + IdParentCategory = 4001, + IdWellSectionType = 1, + CategoryName = "Механическое. бурение", + DateStart = new DateTime(2023, 10, 26), + DepthStart = 80, + DepthEnd = 150, + DurationHours = 8, + }; + + private readonly WellOperationDto fakeLastFactWellOperation = new() + { + IdWell = idWell, + CategoryName = "Механическое. бурение", + IdWellSectionType = 1, + IdParentCategory = 4001, + DateStart = new DateTime(2023, 10, 26), + DepthStart = 150, + DepthEnd = 200, + DurationHours = 8, + }; + + private readonly ScheduleDto fakeShedule = new() + { + IdWell = idWell, + ShiftStart = new TimeDto(1), + ShiftEnd = new TimeDto(5), + DrillStart = new DateTime(2023, 01, 26), + DrillEnd = new DateTime(2023, 12, 26), + Driller = new() + { + Name = "Иван", + Surname = "Иванов", + Patronymic = "Бурила" + } + }; + + private readonly SubsystemStatDto fakeStatSubsystemOperationTime = new() + { + SubsystemName = "АПД", + SumDepthInterval = 250, + UsedTimeHours = 200, + KUsage = 30 + }; + + private readonly IWellService wellServiceMock = Substitute.For(); + private readonly ITrajectoryFactRepository trajectoryFactRepositoryMock = Substitute.For(); + private readonly IDailyReportRepository dailyReportRepositoryMock = Substitute.For(); + private readonly IScheduleRepository scheduleRepositoryMock = Substitute.For(); + private readonly IWellOperationRepository wellOperationRepositoryMock = Substitute.For(); + private readonly ISubsystemOperationTimeService subsystemOperationTimeServiceMock = Substitute.For(); + private readonly IProcessMapReportWellDrillingService processMapReportWellDrillingServiceMock = Substitute.For(); + private readonly IDetectedOperationService detectedOperationServiceMock = Substitute.For(); + + private readonly DailyReportService dailyReportService; + + private readonly DailyReportDto fakeDailyReport; + private readonly WellDto fakeWell; + + public DailyReportServiceTest() + { + fakeDailyReport = new DailyReportDto + { + Id = idDailyReport, + IdWell = idWell, + Date = dateDailyReport, + DateLastUpdate = null + }; + + fakeWell = new WellDto + { + Id = idWell, + Caption = "Тестовое название", + WellType = "Горизонтальная", + Cluster = "Тестовый куст", + Deposit = "Тестовое месторождение", + Companies = new[] { fakeCustomer, fakeContractor } + }; + + dailyReportService = new DailyReportService(wellServiceMock, + trajectoryFactRepositoryMock, + dailyReportRepositoryMock, + scheduleRepositoryMock, + wellOperationRepositoryMock, + subsystemOperationTimeServiceMock, + processMapReportWellDrillingServiceMock, + detectedOperationServiceMock); + + dailyReportRepositoryMock.InsertAsync(Arg.Any(), Arg.Any()) + .ReturnsForAnyArgs(idDailyReport); + + dailyReportRepositoryMock.GetOrDefaultAsync(Arg.Any(), Arg.Any(), Arg.Any()) + .ReturnsForAnyArgs(fakeDailyReport); + + dailyReportRepositoryMock.UpdateAsync(Arg.Any(), Arg.Any()) + .ReturnsForAnyArgs(idDailyReport); + + wellServiceMock.GetOrDefaultAsync(Arg.Any(), Arg.Any()) + .ReturnsForAnyArgs(fakeWell); + + trajectoryFactRepositoryMock.GetAsync(Arg.Any(), Arg.Any()) + .ReturnsForAnyArgs(new[] { fakeLastFactTrajectory }); + + wellOperationRepositoryMock.GetAsync(Arg.Any(), Arg.Any()) + .ReturnsForAnyArgs(new[] { fakeFirstFactWellOperation, fakeLastFactWellOperation }); + + wellOperationRepositoryMock.GetSectionTypes() + .ReturnsForAnyArgs(new[] { fakeSectionType }); + + detectedOperationServiceMock.GetAsync(Arg.Any(), Arg.Any()) + .ReturnsForAnyArgs(fakeWellOperationSlipsTime); + + subsystemOperationTimeServiceMock.GetStatAsync(Arg.Any(), Arg.Any()) + .ReturnsForAnyArgs(new[] { fakeStatSubsystemOperationTime }); + + scheduleRepositoryMock.GetAsync(idWell, dateDailyReport, Arg.Any()) + .ReturnsForAnyArgs(new[] { fakeShedule }); + + processMapReportWellDrillingServiceMock.GetAsync(idWell, Arg.Any()) + .ReturnsForAnyArgs(new[] { fakeProcessMapReportWellDrilling }); + } + + [Fact] + public async Task UpdateOrInsertAsync_ShouldReturn_UpdatedSubsystemBlock() + { + //act + var result = await dailyReportService.UpdateOrInsertAsync(idWell, dateDailyReport, idUser, fakeSubsystemBlock, CancellationToken.None); + + //assert + Assert.NotNull(fakeSubsystemBlock.LastUpdateDate); + Assert.NotNull(fakeDailyReport.DateLastUpdate); + Assert.Equal(fakeSubsystemBlock.IdUser, idUser); + Assert.Equal(fakeDailyReport.SubsystemBlock, fakeSubsystemBlock); + Assert.Equal(idDailyReport, result); + } + + [Theory] + [InlineData("2090.01.01")] + [InlineData("2000.01.01")] + public async Task UpdateOrInsertAsync_ShouldReturn_UnableToUpdateDailyReport(DateTime dateDaileReport) + { + //act + var result = await Assert.ThrowsAsync(() => dailyReportService.UpdateOrInsertAsync( + idWell, + dateDaileReport, + idUser, + fakeSignBlock, + CancellationToken.None)); + + //assert + Assert.Contains("Невозможно обновить суточный отчёт", result.Message); + } + + [Fact] + public async Task UpdateOrInsertAsync_ShouldReturn_UpdatedSignBlock() + { + //act + var result = await dailyReportService.UpdateOrInsertAsync(idWell, dateDailyReport, idUser, fakeSignBlock, CancellationToken.None); + + //assert + Assert.NotNull(fakeSignBlock.LastUpdateDate); + Assert.NotNull(fakeDailyReport.DateLastUpdate); + Assert.Equal(fakeSignBlock.IdUser, idUser); + Assert.Equal(fakeDailyReport.SignBlock, fakeSignBlock); + Assert.Equal(idDailyReport, result); + } + + [Fact] + public async Task UpdateOrInsertAsync_ShouldReturn_UpdatedTimeBalanceBlock() + { + //act + var result = await dailyReportService.UpdateOrInsertAsync(idWell, dateDailyReport, idUser, fakeTimeBalanceBlock, + CancellationToken.None); + + //assert + Assert.NotNull(fakeTimeBalanceBlock.LastUpdateDate); + Assert.NotNull(fakeDailyReport.DateLastUpdate); + Assert.Equal(fakeTimeBalanceBlock.IdUser, idUser); + Assert.Equal(fakeDailyReport.TimeBalanceBlock, fakeTimeBalanceBlock); + Assert.Equal(idDailyReport, result); + } + + [Theory] + [InlineData("2090.01.01")] + [InlineData("2000.01.01")] + public async Task GetAsync_ShouldReturn_UnableToGetDailyReport(DateTime dateDaileReport) + { + //act + var result = await Assert.ThrowsAsync(() => dailyReportService.GetAsync(idWell, + dateDaileReport, + CancellationToken.None)); + + //assert + Assert.Contains("Невозможно получить суточный отчёт", result.Message); + } + + [Fact] + public async Task GetAsync_ShouldReturn_AddedWellInfo() + { + //act + var result = await dailyReportService.GetAsync(idWell, dateDailyReport, CancellationToken.None); + + //assert + Assert.Equal(result.IdWell, fakeWell.Id); + Assert.Equal(result.WellCaption, fakeWell.Caption); + Assert.Equal(result.WellType, fakeWell.WellType); + Assert.Equal(result.Cluster, fakeWell.Cluster); + Assert.Equal(result.Deposit, fakeWell.Deposit); + Assert.Equal(result.Customer, fakeCustomer.Caption); + Assert.Equal(result.Contractor, fakeContractor.Caption); + Assert.Equal(result.DepthStart, fakeFirstFactWellOperation.DepthStart); + Assert.Equal(result.DepthEnd, fakeLastFactWellOperation.DepthEnd); + } + + [Fact] + public async Task GetAsync_ShouldReturn_AddedTrajectoryBlock() + { + //act + var result = await dailyReportService.GetAsync(idWell, dateDailyReport, CancellationToken.None); + + //assert + Assert.Equal(fakeLastFactTrajectory.WellboreDepth, result.TrajectoryBlock.WellboreDepth); + Assert.Equal(fakeLastFactTrajectory.VerticalDepth, result.TrajectoryBlock.VerticalDepth); + Assert.Equal(fakeLastFactTrajectory.ZenithAngle, result.TrajectoryBlock.ZenithAngle); + Assert.Equal(fakeLastFactTrajectory.AzimuthGeo, result.TrajectoryBlock.AzimuthGeo); + } + + [Fact] + public async Task GetAsync_ShouldReturn_AddedFactWellOperationBlock() + { + //act + var result = await dailyReportService.GetAsync(idWell, dateDailyReport, CancellationToken.None); + + //assert + Assert.Equal(16, result.FactWellOperationBlock.SectionDrillingHours); + Assert.Single(result.FactWellOperationBlock.WellOperations); + + var wellOperation = result.FactWellOperationBlock.WellOperations.Single(); + + Assert.Equal("Механическое. бурение", wellOperation.CategoryName); + Assert.Equal(16, wellOperation.DurationHours); + } + + [Fact] + public async Task GetAsync_ShouldReturn_AddedScheduleBlock() + { + //act + var result = await dailyReportService.GetAsync(idWell, dateDailyReport, CancellationToken.None); + + //assert + Assert.Single(result.ScheduleBlock); + + var sheduleRecord = result.ScheduleBlock.Single(); + + Assert.Equal(fakeShedule.ShiftStart, sheduleRecord.ShiftStart); + Assert.Equal(fakeShedule.ShiftEnd, sheduleRecord.ShiftEnd); + Assert.Equal(fakeShedule.Driller?.Name, sheduleRecord.Name); + Assert.Equal(fakeShedule.Driller?.Surname, sheduleRecord.Surname); + Assert.Equal(fakeShedule.Driller?.Patronymic, sheduleRecord.Patronymic); + } + + [Fact] + public async Task GetAsync_ShouldReturn_UpdatedTimeBalanceBlock() + { + //arrange + fakeDailyReport.TimeBalanceBlock = fakeTimeBalanceBlock; + + //act + var result = await dailyReportService.GetAsync(idWell, dateDailyReport, CancellationToken.None); + + //assert + Assert.NotNull(result.TimeBalanceBlock); + Assert.Equal(fakeSectionType.Id, result.TimeBalanceBlock.IdSection); + Assert.Equal(fakeSectionType.Caption, result.TimeBalanceBlock.SectionName); + Assert.Equal(2000, result.TimeBalanceBlock?.WellDepth.Plan); + Assert.Equal(120, result.TimeBalanceBlock?.WellDepth.Fact); + Assert.Equal(40, result.TimeBalanceBlock?.WellOperationSlipsTimeCount); + } + + [Fact] + public async Task GetAsync_ShouldReturn_AddedProcessMapWellDrillingBlock() + { + //act + var result = await dailyReportService.GetAsync(idWell, dateDailyReport, CancellationToken.None); + + //assert + Assert.Single(result.ProcessMapWellDrillingBlock); + + var processMapWellDrillingRecord = result.ProcessMapWellDrillingBlock.Single(); + + Assert.Equal(fakeProcessMapReportWellDrilling.DrillingMode, processMapWellDrillingRecord.DrillingMode); + Assert.Equal(fakeProcessMapReportWellDrilling.Rop.Plan, processMapWellDrillingRecord.Rop.Plan); + Assert.Equal(fakeProcessMapReportWellDrilling.Rop.Fact, processMapWellDrillingRecord.Rop.Fact); + Assert.Equal(fakeProcessMapReportWellDrilling.DeltaDepth, processMapWellDrillingRecord.WellBoreDepth); + Assert.Equal(fakeProcessMapReportWellDrilling.MechDrillingHours, processMapWellDrillingRecord.MechDrillingHours); + } + + [Fact] + public async Task GetAsync_ShouldReturn_UpdatedSubsystemBlock() + { + //arrange + fakeDailyReport.SubsystemBlock = fakeSubsystemBlock; + + //act + var result = await dailyReportService.GetAsync(idDailyReport, dateDailyReport, CancellationToken.None); + + //assert + Assert.NotNull(result.SubsystemBlock); + Assert.Equal(2, result.SubsystemBlock?.Subsystems.Count()); + + var subsystemRecord0 = result.SubsystemBlock?.Subsystems.ElementAt(0); + + Assert.Equal("АвтоСПО", subsystemRecord0?.Name); + Assert.Equal(24, subsystemRecord0?.UsagePerDay?.UsedTimeHours); + Assert.Equal(1500, subsystemRecord0?.UsagePerDay?.SumDepthInterval); + Assert.Equal(15, subsystemRecord0?.UsagePerDay?.KUsage); + + Assert.Equal(500, subsystemRecord0?.UsagePerWell?.UsedTimeHours); + Assert.Equal(3000, subsystemRecord0?.UsagePerWell?.SumDepthInterval); + Assert.Equal(100, subsystemRecord0?.UsagePerWell?.KUsage); + + var subsystemRecord1 = result.SubsystemBlock?.Subsystems.ElementAt(1); + + Assert.Equal("АПД", subsystemRecord1?.Name); + Assert.Equal(200, subsystemRecord1?.UsagePerDay?.UsedTimeHours); + Assert.Equal(250, subsystemRecord1?.UsagePerDay?.SumDepthInterval); + Assert.Equal(30, subsystemRecord1?.UsagePerDay?.KUsage); + + Assert.Equal(200, subsystemRecord1?.UsagePerWell?.UsedTimeHours); + Assert.Equal(250, subsystemRecord1?.UsagePerWell?.SumDepthInterval); + Assert.Equal(30, subsystemRecord1?.UsagePerWell?.KUsage); + } + + [Fact] + public async Task GetAsync_ShouldReturn_FictiveDailyReport() + { + //act + var result = await dailyReportService.GetAsync(idWell, new FileReportRequest(), CancellationToken.None); + + //assert + Assert.True((fakeLastFactWellOperation.DateStart - fakeFirstFactWellOperation.DateStart).Days == result.Count); + } + + [Theory] + [MemberData(nameof(FactWellOperationDates))] + public async Task GetDatesRangeAsync_ShouldReturn_DateRangeByFactWellOperations(IEnumerable factWellOperationDates) + { + //arrange + wellOperationRepositoryMock.GetAsync(Arg.Any(), CancellationToken.None) + .ReturnsForAnyArgs(factWellOperationDates.Select(dateStart => new WellOperationDto { DateStart = dateStart })); + + //act + var result = await dailyReportService.GetDatesRangeAsync(idWell, CancellationToken.None); + + //assert + Assert.NotNull(result); + Assert.True(result.From <= result.To); + Assert.True(result.To < DateTime.UtcNow.Date); + } + + public static IEnumerable FactWellOperationDates() + { + yield return new object[] + { + new[] + { + new DateTime(2023, 11, 1), + new DateTime(2023, 11, 9), + DateTime.UtcNow + } + }; + + yield return new object[] + { + new[] + { + new DateTime(2023, 11, 1), + new DateTime(2023, 11, 1) + } + }; + + yield return new object[] + { + new[] + { + DateTime.UtcNow, + DateTime.UtcNow + } + }; + + yield return new object[] + { + new[] + { + new DateTime(2023, 11, 1), + new DateTime(2023, 11, 9), + new DateTime(2023, 11, 11) + } + }; + } +} \ No newline at end of file diff --git a/AsbCloudWebApi/AsbCloudWebApi.csproj b/AsbCloudWebApi/AsbCloudWebApi.csproj index 0d8f4806..8c9b17b8 100644 --- a/AsbCloudWebApi/AsbCloudWebApi.csproj +++ b/AsbCloudWebApi/AsbCloudWebApi.csproj @@ -25,9 +25,6 @@ - - PreserveNewest - PreserveNewest diff --git a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs deleted file mode 100644 index a392bf51..00000000 --- a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.Net; -using System.Threading; -using System.Threading.Tasks; -using AsbCloudApp.Data; -using AsbCloudApp.Data.AutogeneratedDailyReport; -using AsbCloudApp.Requests; -using AsbCloudApp.Services; -using AsbCloudApp.Services.AutoGeneratedDailyReports; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; - -namespace AsbCloudWebApi.Controllers; - -/// -/// Контроллер для авто-генерируемых суточных отчётов -/// -[ApiController] -[Route("api/well/{idWell}/[controller]")] -[Authorize] -public class AutoGeneratedDailyReportController : ControllerBase -{ - private readonly IAutoGeneratedDailyReportService autoGeneratedDailyReportService; - private readonly IWellService wellService; - - public AutoGeneratedDailyReportController( - IAutoGeneratedDailyReportService autoGeneratedDailyReportService, - IWellService wellService) - { - this.autoGeneratedDailyReportService = autoGeneratedDailyReportService; - this.wellService = wellService; - } - - /// - /// Формирование отчёта - /// - /// Id скважины - /// Дата отчёта - /// - /// - [HttpGet] - [ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK, "application/octet-stream")] - [ProducesResponseType(StatusCodes.Status204NoContent)] - public async Task GenerateReportAsync([FromRoute] int idWell, - [Required] DateOnly reportDate, - CancellationToken cancellationToken) - { - if (!await CanUserAccessToWellAsync(idWell, cancellationToken)) - return Forbid(); - - var reportFile = await autoGeneratedDailyReportService.GenerateAsync(idWell, - reportDate, - cancellationToken); - - return File(reportFile.stream, "application/octet-stream", reportFile.fileName); - } - - /// - /// Список файлов суточных отчётов - /// - /// Id скважины - /// Параметры запроса - /// - /// - [HttpGet("all")] - [ProducesResponseType(typeof(PaginationContainer), (int)HttpStatusCode.OK)] - public async Task GetListAsync([FromRoute][Required] int idWell, - [FromQuery] FileReportRequest request, - CancellationToken cancellationToken) - { - if (!await CanUserAccessToWellAsync(idWell, cancellationToken)) - return Forbid(); - - var reports = await autoGeneratedDailyReportService.GetListAsync(idWell, - request, - cancellationToken); - - return Ok(reports); - } - - /// - /// Диапазон дат для формирования суточных отчётов - /// - /// - /// - /// - [HttpGet("datesRange")] - [ProducesResponseType(typeof(DatesRangeDto), (int)HttpStatusCode.OK)] - public async Task GetDatesRangeAsync(int idWell, CancellationToken cancellationToken) - { - if (!await CanUserAccessToWellAsync(idWell, cancellationToken)) - return Forbid(); - - return Ok(await autoGeneratedDailyReportService.GetDatesRangeAsync(idWell, cancellationToken)); - } - - private async Task CanUserAccessToWellAsync(int idWell, CancellationToken cancellationToken) - { - int? idCompany = User.GetCompanyId(); - return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany, - idWell, cancellationToken).ConfigureAwait(false); - } -} \ No newline at end of file diff --git a/AsbCloudWebApi/Controllers/DailyReportController.cs b/AsbCloudWebApi/Controllers/DailyReportController.cs index dc740619..93d2fbe3 100644 --- a/AsbCloudWebApi/Controllers/DailyReportController.cs +++ b/AsbCloudWebApi/Controllers/DailyReportController.cs @@ -1,196 +1,203 @@ -using AsbCloudApp.Data; -using AsbCloudApp.Data.DailyReport; -using AsbCloudApp.Exceptions; -using AsbCloudApp.Services; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; +using System; +using System.Linq; +using System.Net; using System.Threading; using System.Threading.Tasks; +using AsbCloudApp.Data; +using AsbCloudApp.Data.DailyReport; +using AsbCloudApp.Data.DailyReport.Blocks.Sign; +using AsbCloudApp.Data.DailyReport.Blocks.Subsystems; +using AsbCloudApp.Data.DailyReport.Blocks.TimeBalance; +using AsbCloudApp.Exceptions; +using AsbCloudApp.Repositories; +using AsbCloudApp.Requests; +using AsbCloudApp.Services; +using AsbCloudApp.Services.DailyReport; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; -namespace AsbCloudWebApi.Controllers +namespace AsbCloudWebApi.Controllers; + +/// +/// Суточный отчёт +/// +[ApiController] +[Route("api/well/{idWell:int}/[controller]")] +[Authorize] +public class DailyReportController : ControllerBase { + private readonly IWellOperationRepository wellOperationRepository; + private readonly IDailyReportService dailyReportService; + private readonly IDailyReportExportService dailyReportExportService; + private readonly IWellService wellService; - /// - /// Суточный рапорт - /// - [Route("api/well/{idWell}/[controller]")] - [ApiController] - [Authorize] - public class DailyReportController : ControllerBase - { - private readonly IDailyReportService dailyReportService; - private readonly IWellService wellService; + public DailyReportController(IWellOperationRepository wellOperationRepository, + IDailyReportService dailyReportService, + IDailyReportExportService dailyReportExportService, + IWellService wellService) + { + this.wellOperationRepository = wellOperationRepository; + this.dailyReportService = dailyReportService; + this.dailyReportExportService = dailyReportExportService; + this.wellService = wellService; + } - public DailyReportController( - IDailyReportService dailyReportService, - IWellService wellService) - { - this.dailyReportService = dailyReportService; - this.wellService = wellService; - } + private int IdUser + { + get + { + var idUser = User.GetUserId(); - /// - /// Список наборов данных для формирования рапорта - /// - /// - /// - /// - /// - /// - [HttpGet] - [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] - public async Task GetListAsync(int idWell, DateOnly? begin, DateOnly? end, CancellationToken token) - { - var result = await dailyReportService.GetListAsync(idWell, begin, end, token); - return Ok(result); - } + if (!idUser.HasValue) + throw new ForbidException("Неизвестный пользователь"); - /// - /// Создание суточного рапорта - /// - /// - /// - /// - /// - [HttpPost] - [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] - public async Task AddAsync(int idWell, [Required] DateOnly startDate, CancellationToken token) - { - if (!await UserHasAccesToWellAsync(idWell, token)) - return Forbid(); + return idUser.Value; + } + } - var idUser = User.GetUserId()!.Value; + /// + /// Обновить подпись + /// + /// Id скважины + /// Дата суточного отчёта + /// Обновляемый блок + /// + /// + [HttpPut("sign")] + [Permission] + [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public Task UpdateSignBlockAsync(int idWell, DateOnly dateDailyReport, SignBlockDto signBlock, + CancellationToken cancellationToken) => + UpdateOrInsertAsync(idWell, dateDailyReport, signBlock, cancellationToken); - var result = await dailyReportService.AddAsync(idWell, startDate, idUser, token); - return Ok(result); - } + /// + /// Обновить наработку подсистем + /// + /// Id скважины + /// Дата суточного отчёта + /// Обновляемый блок + /// + /// + [HttpPut("subsystem")] + [Permission] + [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public Task UpdateSubsystemBlockAsync(int idWell, DateOnly dateDailyReport, SubsystemBlockDto subsystemBlock, + CancellationToken cancellationToken) + { + var validSubsystemNames = new[] { "АвтоСПО", "Автопроработка" }; - /// - /// Сохранение изменений набора данных для формирования рапорта (заголовок) - /// - /// - /// Дата без учета времени - /// - /// - /// - [HttpPut("{date}/head")] - [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] - public Task UpdateHeadAsync(int idWell, [Required] DateOnly date, [Required] HeadDto dto, CancellationToken token) - => UpdateReportBlockAsync(idWell, date, dto, token); + if (subsystemBlock.Subsystems.Any(m => !validSubsystemNames.Contains(m.Name))) + throw new ArgumentInvalidException($"Возможно добавить подсистемы с именами {string.Join(", ", validSubsystemNames)}", + nameof(subsystemBlock.Subsystems)); - /// - /// Сохранение изменений набора данных для формирования рапорта (блок КНБК) - /// - /// - /// Дата без учета времени - /// - /// - /// - [HttpPut("{date}/bha")] - [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] - public Task UpdateBhaAsync(int idWell, [Required] DateOnly date, [Required] BhaDto dto, CancellationToken token) - => UpdateReportBlockAsync(idWell, date, dto, token); + return UpdateOrInsertAsync(idWell, dateDailyReport, subsystemBlock, cancellationToken); + } - /// - /// Сохранение изменений набора данных для формирования рапорта (безметражные работы) - /// - /// - /// Дата без учета времени - /// - /// - /// - [HttpPut("{date}/noDrilling")] - [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] - public Task UpdateNoDrillingAsync(int idWell, [Required] DateOnly date, [Required] NoDrillingDto dto, CancellationToken token) - => UpdateReportBlockAsync(idWell, date, dto, token); + /// + /// Обновить баланс времени + /// + /// Id скважины + /// Дата суточного отчёта + /// Обновляемый блок + /// + /// + [HttpPut("timeBalance")] + [Permission] + [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public Task UpdateTimeBalanceBlockAsync(int idWell, DateOnly dateDailyReport, TimeBalanceBlockDto timeBalanceBlock, + CancellationToken cancellationToken) + { + var validWellOperationsIds = new[] { 1, 2, 3, 4 }; - /// - /// Сохранение изменений набора данных для формирования рапорта (САУБ) - /// - /// - /// Дата без учета времени - /// - /// - /// - [HttpPut("{date}/saub")] - [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] - public Task UpdateSaubAsync(int idWell, [Required] DateOnly date, [Required] SaubDto dto, CancellationToken token) - => UpdateReportBlockAsync(idWell, date, dto, token); + if (timeBalanceBlock.WellOperations.Any(o => !validWellOperationsIds.Contains(o.IdWellOperation))) + throw new ArgumentInvalidException($"Возможно добавить операции только с Id: {string.Join(", ", validWellOperationsIds)}", + nameof(timeBalanceBlock.WellOperations)); - /// - /// Сохранение изменений набора данных для формирования рапорта (подпись) - /// - /// - /// Дата без учета времени - /// - /// - /// - [HttpPut("{date}/sign")] - [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] - public Task UpdateSignAsync(int idWell, [Required] DateOnly date, [Required] SignDto dto, CancellationToken token) - => UpdateReportBlockAsync(idWell, date, dto, token); + var wellSections = wellOperationRepository.GetSectionTypes(); - /// - /// Обновление блока суточного рапорта - /// - /// ключ скважины - /// дата суточного рапорта - /// - /// - /// - private async Task UpdateReportBlockAsync(int idWell, DateOnly date, ItemInfoDto dto, CancellationToken token) - { - if (!await UserHasAccesToWellAsync(idWell, token)) - return Forbid(); + if (wellSections.All(s => s.Id != timeBalanceBlock.IdSection)) + throw new ArgumentInvalidException($"Секция с Id: {timeBalanceBlock.IdSection} не найдена", nameof(timeBalanceBlock.IdSection)); - dto.IdUser = User.GetUserId(); - dto.LastUpdateDate = DateTimeOffset.Now; + return UpdateOrInsertAsync(idWell, dateDailyReport, timeBalanceBlock, cancellationToken); + } - var result = await dailyReportService.UpdateBlockAsync(idWell, date, dto, token); - return Ok(result); - } + /// + /// Получить список суточных отчётов по скважине + /// + /// Идентификатор скважины + /// Параметры запроса + /// + /// + [HttpGet] + [ProducesResponseType(typeof(PaginationContainer), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task GetAsync(int idWell, [FromQuery] FileReportRequest request, CancellationToken cancellationToken) + { + await AssertUserAccessToWell(idWell, cancellationToken); - /// - /// Сформировать и скачать рапорт в формате excel - /// - /// - /// - /// - /// - [HttpGet("{date}/excel")] - [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)] - [ProducesResponseType(StatusCodes.Status204NoContent)] - public async Task DownloadAsync(int idWell, DateOnly date, CancellationToken token) - { - if (!await UserHasAccesToWellAsync(idWell, token)) - return Forbid(); + var dailyReports = await dailyReportService.GetAsync(idWell, request, cancellationToken); - var well = await wellService.GetOrDefaultAsync(idWell, token); - if (well is null) - return this.ValidationBadRequest(nameof(idWell), $"Скважина c id:{idWell} не найдена"); + return Ok(dailyReports); + } + + /// + /// Получить диапазон дат по которым возможно сформировать суточный отчёты + /// + /// Id скважины + /// + /// + [HttpGet("datesRange")] + [ProducesResponseType(typeof(DatesRangeDto), (int)HttpStatusCode.OK)] + public async Task GetDatesRangeAsync(int idWell, CancellationToken cancellationToken) + { + await AssertUserAccessToWell(idWell, cancellationToken); - var stream = await dailyReportService.MakeReportAsync(idWell, date, token); - if (stream is null) - return NoContent(); - - var fileName = $"Суточный рапорт по скважине {well.Caption} куст {well.Cluster}.xlsx"; - return File(stream, "application/octet-stream", fileName); + var datesRanges = await dailyReportService.GetDatesRangeAsync(idWell, cancellationToken); - } + return Ok(datesRanges); + } + + /// + /// Экспорт суточного рапорта + /// + /// Id скважины + /// Дата формирования суточного отчёта + /// + /// + [HttpGet("{dateDailyReport}")] + [ProducesResponseType(typeof(PhysicalFileResult), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)] + public async Task ExportAsync(int idWell, DateOnly dateDailyReport, CancellationToken cancellationToken) + { + await AssertUserAccessToWell(idWell, cancellationToken); - protected async Task UserHasAccesToWellAsync(int idWell, CancellationToken token) - { - var idCompany = User.GetCompanyId(); - if (idCompany is not null && - await wellService.IsCompanyInvolvedInWellAsync((int)idCompany, idWell, token) - .ConfigureAwait(false)) - return true; - return false; - } - } + var dailyReport = await dailyReportExportService.ExportAsync(idWell, + dateDailyReport.ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc), cancellationToken); -} + return File(dailyReport.File, "application/octet-stream", dailyReport.FileName); + } + + private async Task UpdateOrInsertAsync(int idWell, DateOnly dateDailyReport, TBlock block, + CancellationToken cancellationToken) + where TBlock : ItemInfoDto + { + await AssertUserAccessToWell(idWell, cancellationToken); + + var id = await dailyReportService.UpdateOrInsertAsync(idWell, dateDailyReport.ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc), IdUser, + block, cancellationToken); + + return Ok(id); + } + + private async Task AssertUserAccessToWell(int idWell, CancellationToken cancellationToken) + { + var idCompany = User.GetCompanyId(); + + if (!idCompany.HasValue || !await wellService.IsCompanyInvolvedInWellAsync(idCompany.Value, idWell, cancellationToken)) + throw new ForbidException("Нет доступа к скважине"); + } +} \ No newline at end of file diff --git a/AsbCloudWebApi/Startup.cs b/AsbCloudWebApi/Startup.cs index c7138dba..c39dc43e 100644 --- a/AsbCloudWebApi/Startup.cs +++ b/AsbCloudWebApi/Startup.cs @@ -132,17 +132,6 @@ namespace AsbCloudWebApi app.UseDeveloperExceptionPage(); } - app.UseDefaultFiles(); - app.UseStaticFiles( - new StaticFileOptions - { - OnPrepareResponse = ctx => - { - ctx.Context.Response.Headers.CacheControl = "public,max-age=2592000"; - ctx.Context.Response.Headers.Expires = System.DateTime.UtcNow.AddDays(10).ToString("R", System.Globalization.CultureInfo.InvariantCulture); - } - } - ); app.UseCors("ClientPermission"); app.UseRouting(); diff --git a/AsbCloudWebApi/wwwroot/index.html b/AsbCloudWebApi/wwwroot/index.html deleted file mode 100644 index 4a8d1fca..00000000 --- a/AsbCloudWebApi/wwwroot/index.html +++ /dev/null @@ -1 +0,0 @@ -DDrill
\ No newline at end of file