diff --git a/AsbCloudApp/Data/WellOperationDto.cs b/AsbCloudApp/Data/WellOperationDto.cs index 7cca980a..35fa5007 100644 --- a/AsbCloudApp/Data/WellOperationDto.cs +++ b/AsbCloudApp/Data/WellOperationDto.cs @@ -23,12 +23,29 @@ namespace AsbCloudApp.Data /// public int IdType { get; set; } - public double WellDepth { get; set; } + /// + /// Глубина на начало операции, м + /// + public double DepthStart { get; set; } - public DateTime StartDate { get; set; } + /// + /// Глубина после завершения операции, м + /// + public double DepthEnd { get; set; } + /// + /// Дата начала операции + /// + public DateTime DateStart { get; set; } + + /// + /// Продолжительность, часы + /// public double DurationHours { get; set; } + /// + /// Полезный комментарий + /// public string Comment { get; set; } } } diff --git a/AsbCloudDb/Migrations/20211007052829_Rename_WellOperation_WellDepth_to_WellDepthEnd.Designer.cs b/AsbCloudDb/Migrations/20211007052829_Rename_WellOperation_WellDepth_to_WellDepthEnd.Designer.cs new file mode 100644 index 00000000..8ebe7869 --- /dev/null +++ b/AsbCloudDb/Migrations/20211007052829_Rename_WellOperation_WellDepth_to_WellDepthEnd.Designer.cs @@ -0,0 +1,2377 @@ +// +using System; +using System.Collections.Generic; +using AsbCloudDb.Model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace AsbCloudDb.Migrations +{ + [DbContext(typeof(AsbCloudDbContext))] + [Migration("20211007052829_Rename_WellOperation_WellDepth_to_WellDepthEnd")] + partial class Rename_WellOperation_WellDepth_to_WellDepthEnd + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasPostgresExtension("adminpack") + .HasAnnotation("Relational:Collation", "Russian_Russia.1251") + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.10") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .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.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") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .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") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.HasKey("Id"); + + b.ToTable("t_company_type"); + + b.HasData( + new + { + Id = 1, + Caption = "Недрапользователь" + }, + new + { + Id = 2, + Caption = "Буровой подрядчик" + }, + new + { + Id = 3, + Caption = "Сервис автоматизации бурения" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .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.HasKey("Id"); + + b.ToTable("t_deposit"); + + b + .HasComment("Месторождение"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Name") + .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 = "fluidPlanLastData" + }, + new + { + Id = 9, + Name = "Последний замер бурового раствора ФАКТ", + ShortName = "fluidFactLastData" + }, + new + { + Id = 10, + Name = "Последние данные Шламограммы", + ShortName = "mudLastData" + }, + new + { + Id = 11, + Name = "Последние данные ННБ", + ShortName = "nnbLastData" + }, + new + { + Id = 12, + Name = "Рапорт", + ShortName = "report" + }, + new + { + Id = 13, + Name = "Программа бурения, части", + ShortName = "ПБч" + }, + new + { + Id = 14, + Name = "Программа бурения", + ShortName = "ПБ" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + 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") + .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.Measure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property>("Data") + .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 without 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") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Name") + .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.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.ReportProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + 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.Telemetry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Info") + .HasColumnType("jsonb") + .HasColumnName("info") + .HasComment("Информация с панели о скважине"); + + b.Property("RemoteUid") + .HasColumnType("text") + .HasColumnName("remote_uid") + .HasComment("Идентификатор передающего устройства. Может повторяться в списке, так как комплекты оборудования переезжают от скв. к скв."); + + b.HasKey("Id"); + + b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index"); + + b.ToTable("t_telemetry"); + + b + .HasComment("таблица привязки телеметрии от комплектов к конкретной скважине."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryAnalysis", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DurationSec") + .HasColumnType("integer") + .HasColumnName("duration_sec") + .HasComment("Кол-во секунд после предыдущей операции"); + + b.Property("IdOperation") + .HasColumnType("integer") + .HasColumnName("id_operation"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IsBitPositionDecreasing") + .HasColumnType("boolean") + .HasColumnName("is_bit_position_decreasing") + .HasComment("Долото поднимается"); + + b.Property("IsBitPositionIncreasing") + .HasColumnType("boolean") + .HasColumnName("is_bit_position_increasing") + .HasComment("Долото спускается"); + + b.Property("IsBitPositionLt20") + .HasColumnType("boolean") + .HasColumnName("is_bit_posision_lt_20") + .HasComment("Положение долота меньше 20м"); + + b.Property("IsBlockPositionDecreasing") + .HasColumnType("boolean") + .HasColumnName("is_block_posision_decresing") + .HasComment("Талевый блок поднимается"); + + b.Property("IsBlockPositionIncreasing") + .HasColumnType("boolean") + .HasColumnName("is_block_posision_incresing") + .HasComment("Талевый блок спускается"); + + b.Property("IsHookWeightLt3") + .HasColumnType("boolean") + .HasColumnName("is_hook_weight_lt_3") + .HasComment("Вес на крюке менее 3т"); + + b.Property("IsHookWeightNotChanges") + .HasColumnType("boolean") + .HasColumnName("is_hook_weight_not_changes") + .HasComment("Вес на крюке не меняется"); + + b.Property("IsPressureGt20") + .HasColumnType("boolean") + .HasColumnName("is_pressure_gt_20") + .HasComment("Давоение более 20"); + + b.Property("IsPressureLt20") + .HasColumnType("boolean") + .HasColumnName("is_pressure_lt_20") + .HasComment("Давление менее 20"); + + b.Property("IsRotorSpeedGt5") + .HasColumnType("boolean") + .HasColumnName("is_rotor_speed_gt_3") + .HasComment("Обороты ротора выше 3"); + + b.Property("IsRotorSpeedLt5") + .HasColumnType("boolean") + .HasColumnName("is_rotor_speed_lt_3") + .HasComment("Обороты ротора ниже 3"); + + b.Property("IsWellDepthDecreasing") + .HasColumnType("boolean") + .HasColumnName("is_well_depth_decreasing") + .HasComment("Глубина забоя не увеличивается"); + + b.Property("IsWellDepthIncreasing") + .HasColumnType("boolean") + .HasColumnName("is_well_depth_increasing") + .HasComment("Глубина забоя увеличивается"); + + b.Property("OperationEndDepth") + .HasColumnType("double precision") + .HasColumnName("operation_end_depth") + .HasComment("Глубина, на которой закончилась операция"); + + b.Property("OperationStartDepth") + .HasColumnType("double precision") + .HasColumnName("operation_start_depth") + .HasComment("Глубина, на которой началась операция"); + + b.Property("UnixDate") + .HasColumnType("bigint") + .HasColumnName("unix_date") + .HasComment("Unix timestamp для Linq запросов с вычислением дат"); + + b.HasKey("Id"); + + b.HasIndex("IdOperation"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_telemetry_analysis"); + + b + .HasComment("События на скважине"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AxialLoad") + .HasColumnType("double precision") + .HasColumnName("axial_load") + .HasComment("Осевая нагрузка"); + + b.Property("AxialLoadLimitMax") + .HasColumnType("double precision") + .HasColumnName("axial_load_limit_max") + .HasComment("Осевая нагрузка. Аварийная макс."); + + b.Property("AxialLoadSp") + .HasColumnType("double precision") + .HasColumnName("axial_load_sp") + .HasComment("Осевая нагрузка. Задание"); + + b.Property("BitDepth") + .HasColumnType("double precision") + .HasColumnName("bit_depth") + .HasComment("Положение инструмента"); + + b.Property("BlockPosition") + .HasColumnType("double precision") + .HasColumnName("block_position") + .HasComment("Высота талевого блока"); + + b.Property("BlockPositionMax") + .HasColumnType("double precision") + .HasColumnName("block_position_max") + .HasComment("Талевый блок. Макс положение"); + + b.Property("BlockPositionMin") + .HasColumnType("double precision") + .HasColumnName("block_position_min") + .HasComment("Талевый блок. Мин положение"); + + b.Property("BlockSpeed") + .HasColumnType("double precision") + .HasColumnName("block_speed") + .HasComment("Скорость талевого блока"); + + b.Property("BlockSpeedSp") + .HasColumnType("double precision") + .HasColumnName("block_speed_sp") + .HasComment("Скорости талевого блока. Задание"); + + b.Property("BlockSpeedSpDevelop") + .HasColumnType("double precision") + .HasColumnName("block_speed_sp_develop") + .HasComment("Талевый блок. Задание скорости для проработки"); + + b.Property("BlockSpeedSpRotor") + .HasColumnType("double precision") + .HasColumnName("block_speed_sp_rotor") + .HasComment("Талевый блок. Задание скорости для роторного бурения"); + + b.Property("BlockSpeedSpSlide") + .HasColumnType("double precision") + .HasColumnName("block_speed_sp_slide") + .HasComment("Талевый блок. Задание скорости для режима слайда"); + + b.Property("Date") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("Flow") + .HasColumnType("double precision") + .HasColumnName("flow") + .HasComment("Расход"); + + b.Property("FlowDeltaLimitMax") + .HasColumnType("double precision") + .HasColumnName("flow_delta_limit_max") + .HasComment("Расход. Аварийный макс."); + + b.Property("FlowIdle") + .HasColumnType("double precision") + .HasColumnName("flow_idle") + .HasComment("Расход. Холостой ход"); + + b.Property("HookWeight") + .HasColumnType("double precision") + .HasColumnName("hook_weight") + .HasComment("Вес на крюке"); + + b.Property("HookWeightIdle") + .HasColumnType("double precision") + .HasColumnName("hook_weight_idle") + .HasComment("Вес на крюке. Холостой ход"); + + b.Property("HookWeightLimitMax") + .HasColumnType("double precision") + .HasColumnName("hook_weight_limit_max") + .HasComment("Вес на крюке. Затяжка"); + + b.Property("HookWeightLimitMin") + .HasColumnType("double precision") + .HasColumnName("hook_weight_limit_min") + .HasComment("Вес на крюке. Посадка"); + + b.Property("IdFeedRegulator") + .HasColumnType("double precision") + .HasColumnName("id_feed_regulator") + .HasComment("Текущий критерий бурения"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Пользователь САУБ"); + + b.Property("Mode") + .HasColumnType("integer") + .HasColumnName("mode") + .HasComment("Режим САУБ"); + + b.Property("MseState") + .HasColumnType("double precision") + .HasColumnName("mse_state") + .HasComment("Текущее состояние работы MSE"); + + b.Property("Pressure") + .HasColumnType("double precision") + .HasColumnName("pressure") + .HasComment("Давление"); + + b.Property("PressureDeltaLimitMax") + .HasColumnType("double precision") + .HasColumnName("pressure_delta_limit_max") + .HasComment("Давление дифф. Аварийное макс."); + + b.Property("PressureIdle") + .HasColumnType("double precision") + .HasColumnName("pressure_idle") + .HasComment("Давление. Холостой ход"); + + b.Property("PressureSp") + .HasColumnType("double precision") + .HasColumnName("pressure_sp") + .HasComment("Давление. Задание"); + + b.Property("PressureSpDevelop") + .HasColumnType("double precision") + .HasColumnName("pressure_sp_develop") + .HasComment("Давление. Задание для проработки"); + + b.Property("PressureSpRotor") + .HasColumnType("double precision") + .HasColumnName("pressure_sp_rotor") + .HasComment("Давление. Задание для роторного бурения"); + + b.Property("PressureSpSlide") + .HasColumnType("double precision") + .HasColumnName("pressure_sp_slide") + .HasComment("Давление. Задание для режима слайда"); + + b.Property("RotorSpeed") + .HasColumnType("double precision") + .HasColumnName("rotor_speed") + .HasComment("Обороты ротора"); + + b.Property("RotorTorque") + .HasColumnType("double precision") + .HasColumnName("rotor_torque") + .HasComment("Момент на роторе"); + + b.Property("RotorTorqueIdle") + .HasColumnType("double precision") + .HasColumnName("rotor_torque_idle") + .HasComment("Момент на роторе. Холостой ход"); + + b.Property("RotorTorqueLimitMax") + .HasColumnType("double precision") + .HasColumnName("rotor_torque_limit_max") + .HasComment("Момент на роторе. Аварийный макс."); + + b.Property("RotorTorqueSp") + .HasColumnType("double precision") + .HasColumnName("rotor_torque_sp") + .HasComment("Момент на роторе. Задание"); + + b.Property("WellDepth") + .HasColumnType("double precision") + .HasColumnName("well_depth") + .HasComment("Глубина забоя"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_telemetry_data_saub"); + + b + .HasComment("набор основных данных по SAUB"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BreakAngleK") + .HasColumnType("double precision") + .HasColumnName("break_angle_k") + .HasComment("Коэффициент для расчёта за какой угол нужно тормозить"); + + b.Property("BreakAngleLeft") + .HasColumnType("double precision") + .HasColumnName("break_angle_left") + .HasComment("Угол торможения влево при работе по моменту"); + + b.Property("Date") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("EncoderResolution") + .HasColumnType("double precision") + .HasColumnName("encoder_resolution ") + .HasComment(" Разрешение энкодера"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("Mode") + .HasColumnType("integer") + .HasColumnName("mode") + .HasComment("Выбранный режим управления"); + + b.Property("PidMuxTorqueLeftLimit") + .HasColumnType("double precision") + .HasColumnName("pid_mux_torque_left_limit") + .HasComment(" Момент при котором определяется ехать назад по моменту или по скорости"); + + b.Property("PositionRight") + .HasColumnType("double precision") + .HasColumnName("position_right") + .HasComment("Крайний правый угол осциляции"); + + b.Property("PositionZero") + .HasColumnType("double precision") + .HasColumnName("position_zero") + .HasComment("Нулевая позиция осциляции"); + + b.Property("Ratio") + .HasColumnType("double precision") + .HasColumnName("ratio") + .HasComment(" Коэффициент редукции редектора"); + + b.Property("ReverseKTorque") + .HasColumnType("double precision") + .HasColumnName("reverse_k_torque") + .HasComment("Коэффициент на который умножается момент, для того чтобы система поняла что мы движемся в обратную сторону"); + + b.Property("ReverseSpeedSpZeroTime") + .HasColumnType("integer") + .HasColumnName("reverse_speed_sp_zero_time") + .HasComment("Время выдачи сигнала нулевой скорости на при смене направления"); + + b.Property("RevolsLeftLimit") + .HasColumnType("double precision") + .HasColumnName("revols_left_limit") + .HasComment("Ограничение числа оборотов влево"); + + b.Property("RevolsLeftTotal") + .HasColumnType("double precision") + .HasColumnName("revols_left_total") + .HasComment("Суммарное количество оборотов влево"); + + b.Property("RevolsRightLimit") + .HasColumnType("double precision") + .HasColumnName("revols_right_limit") + .HasComment("Ограничение числа оборотов вправо"); + + b.Property("RevolsRightTotal") + .HasColumnType("double precision") + .HasColumnName("revols_right_total") + .HasComment("Суммарное количество оборотов вправо"); + + b.Property("RotorTorqueAvg") + .HasColumnType("double precision") + .HasColumnName("rotor_torque_avg") + .HasComment(" Момент в роторе средний"); + + b.Property("SpeedLeftSp") + .HasColumnType("double precision") + .HasColumnName("speed_left_sp") + .HasComment("Заданная скорость вращения влево"); + + b.Property("SpeedRightSp") + .HasColumnType("double precision") + .HasColumnName("speed_right_sp") + .HasComment("Заданная скорость вращения вправо"); + + b.Property("State") + .HasColumnType("integer") + .HasColumnName("state") + .HasComment("Переменная этапа"); + + b.Property("TopDriveSpeed") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed") + .HasComment("Скорость СВП"); + + b.Property("TopDriveSpeedErr") + .HasColumnType("integer") + .HasColumnName("top_drive_speed_err"); + + b.Property("TopDriveSpeedMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_max") + .HasComment("верхний предел"); + + b.Property("TopDriveSpeedMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_min") + .HasComment("нижний предел"); + + b.Property("TopDriveSpeedOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_offset") + .HasComment("смещение"); + + b.Property("TopDriveSpeedSpFrom") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_from") + .HasComment("Заданная скорость c СВП"); + + b.Property("TopDriveSpeedSpFromErr") + .HasColumnType("integer") + .HasColumnName("top_drive_speed_sp_from_err"); + + b.Property("TopDriveSpeedSpFromMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_from_max"); + + b.Property("TopDriveSpeedSpFromMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_from_min"); + + b.Property("TopDriveSpeedSpFromOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_from_offset"); + + b.Property("TopDriveSpeedSpTo") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_to") + .HasComment("Задание скорости на СВП"); + + b.Property("TopDriveSpeedSpToErr") + .HasColumnType("integer") + .HasColumnName("top_drive_speed_sp_to_err"); + + b.Property("TopDriveSpeedSpToMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_to_max"); + + b.Property("TopDriveSpeedSpToMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_to_min"); + + b.Property("TopDriveSpeedSpToOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_to_offset"); + + b.Property("TopDriveTorque") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque") + .HasComment("Момент СВП"); + + b.Property("TopDriveTorqueErr") + .HasColumnType("integer") + .HasColumnName("top_drive_torque_err"); + + b.Property("TopDriveTorqueMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_max"); + + b.Property("TopDriveTorqueMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_min"); + + b.Property("TopDriveTorqueOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_offset"); + + b.Property("TopDriveTorqueSpFrom") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_from") + .HasComment("Заданный момент c СВП"); + + b.Property("TopDriveTorqueSpFromErr") + .HasColumnType("integer") + .HasColumnName("top_drive_torque_sp_from_err"); + + b.Property("TopDriveTorqueSpFromMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_from_max"); + + b.Property("TopDriveTorqueSpFromMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_from_min"); + + b.Property("TopDriveTorqueSpFromOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_from_offset"); + + b.Property("TopDriveTorqueSpTo") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_to") + .HasComment("Задание момента на СВП"); + + b.Property("TopDriveTorqueSpToErr") + .HasColumnType("integer") + .HasColumnName("top_drive_torque_sp_to_err"); + + b.Property("TopDriveTorqueSpToMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_to_max"); + + b.Property("TopDriveTorqueSpToMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_to_min"); + + b.Property("TopDriveTorqueSpToOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_to_offset"); + + b.Property("TorqueLeftLimit") + .HasColumnType("double precision") + .HasColumnName("torque_left_limit") + .HasComment("Ограничение крутящего момента влево"); + + b.Property("TorqueRampTime") + .HasColumnType("double precision") + .HasColumnName("torque_ramp_time") + .HasComment("Время нарастания момента"); + + b.Property("TorqueRightLimit") + .HasColumnType("double precision") + .HasColumnName("torque_right_limit") + .HasComment("Ограничение крутящего момента вправо"); + + b.Property("TorqueStarting") + .HasColumnType("double precision") + .HasColumnName("torque_starting") + .HasComment(" Страгивающий момент"); + + b.Property("TurnLeftOnceByAngle") + .HasColumnType("double precision") + .HasColumnName("turn_left_once_by_angle") + .HasComment("Доворот по градусам единожды влево"); + + b.Property("TurnLeftOnceByRevols") + .HasColumnType("double precision") + .HasColumnName("turn_left_once_by_revols") + .HasComment("Доворот по оборотам единожды влево"); + + b.Property("TurnLeftOnceByTorque") + .HasColumnType("double precision") + .HasColumnName("turn_left_once_by_torque") + .HasComment("Доворот по моменту единожды влево"); + + b.Property("TurnRightOnceByAngle") + .HasColumnType("double precision") + .HasColumnName("turn_right_once_by_angle") + .HasComment("Доворот по градусам единожды вправо"); + + b.Property("TurnRightOnceByRevols") + .HasColumnType("double precision") + .HasColumnName("turn_right_once_by_revols") + .HasComment("Доворот по оборотам единожды вправо"); + + b.Property("TurnRightOnceByTorque") + .HasColumnType("double precision") + .HasColumnName("turn_right_once_by_torque") + .HasComment("Доворот по моменту единожды вправо"); + + b.Property("UnlockBySectorOut") + .HasColumnType("double precision") + .HasColumnName("unlock_by_sector_out") + .HasComment(" Градус отклонения от сектора для автоматического сброса блокировки"); + + b.Property("Ver") + .HasColumnType("double precision") + .HasColumnName("ver") + .HasComment("Версия ПО ПЛК"); + + b.Property("W2800") + .HasColumnType("integer") + .HasColumnName("w2800") + .HasComment("Установка нуля энкодера"); + + b.Property("W2808") + .HasColumnType("integer") + .HasColumnName("w2808") + .HasComment("Неисправность энкодера"); + + b.Property("W2810") + .HasColumnType("integer") + .HasColumnName("w2810") + .HasComment(" автоматический сброс блокировки"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + 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") + .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") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + 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("Date") + .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") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname"); + + b.HasKey("IdTelemetry", "IdUser"); + + b.ToTable("t_telemetry_user"); + + b + .HasComment("Пользователи панели САУБ. Для сообщений."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Email") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("email") + .HasComment("должность"); + + b.Property("IdCompany") + .HasColumnType("integer") + .HasColumnName("id_company"); + + b.Property("IdRole") + .HasColumnType("integer") + .HasColumnName("id_role"); + + b.Property("Level") + .HasColumnType("integer") + .HasColumnName("level"); + + b.Property("Login") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("login"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("имя"); + + b.Property("PasswordHash") + .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("State") + .HasColumnType("smallint") + .HasColumnName("state") + .HasComment("состояние:\n100 - удален"); + + b.Property("Surname") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname") + .HasComment("фамилия"); + + b.HasKey("Id"); + + b.HasIndex("IdCompany"); + + b.HasIndex("IdRole"); + + b.HasIndex("Login") + .IsUnique(); + + b.ToTable("t_user"); + + b + .HasComment("Пользователи облака"); + + b.HasData( + new + { + Id = 1, + IdCompany = 1, + IdRole = 1, + Level = 2147483647, + Login = "dev", + Name = "Разработчик", + PasswordHash = "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_user_role"); + + b + .HasComment("Роли пользователей в системе"); + + b.HasData( + new + { + Id = 1, + Caption = "Администратор" + }, + new + { + Id = 2, + Caption = "Пользователь" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IdCluster") + .HasColumnType("integer") + .HasColumnName("id_cluster"); + + 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.HasKey("Id"); + + b.HasIndex("IdCluster"); + + b.HasIndex("IdTelemetry") + .IsUnique(); + + b.HasIndex("IdWellType"); + + b.ToTable("t_well"); + + b + .HasComment("скважины"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CategoryInfo") + .HasColumnType("text") + .HasColumnName("category_info") + .HasComment("Доп. информация к выбраной категории"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DateStart") + .HasColumnType("timestamp without time zone") + .HasColumnName("date_start") + .HasComment("Дата начала операции"); + + b.Property("DurationHours") + .HasColumnType("double precision") + .HasColumnName("duration_hours") + .HasComment("Продолжительность в часах"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("id_type") + .HasComment("0 = План или 1 = Факт"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_well_section_type") + .HasComment("Id тип секции скважины"); + + b.Property("WellDepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина, на которой производилась операция"); + + b.HasKey("Id"); + + b.HasIndex("DateStart"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.HasIndex("WellDepthEnd"); + + b.ToTable("t_well_operation"); + + b + .HasComment("Данные по операциям на скважине"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Code") + .HasColumnType("integer") + .HasColumnName("code") + .HasComment("Код операции"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории операции"); + + b.HasKey("Id"); + + b.ToTable("t_well_operation_category"); + + b + .HasComment("Справочник операций на скважине"); + + b.HasData( + new + { + Id = 1, + Code = 0, + Name = "Невозможно определить операцию" + }, + new + { + Id = 2, + Code = 0, + Name = "Роторное бурение" + }, + new + { + Id = 3, + Code = 0, + Name = "Слайдирование" + }, + new + { + Id = 4, + Code = 0, + Name = "Подъем с проработкой" + }, + new + { + Id = 5, + Code = 0, + Name = "Спуск с проработкой" + }, + new + { + Id = 6, + Code = 0, + Name = "Подъем с промывкой" + }, + new + { + Id = 7, + Code = 0, + Name = "Спуск с промывкой" + }, + new + { + Id = 8, + Code = 0, + Name = "Спуск в скважину" + }, + new + { + Id = 9, + Code = 0, + Name = "Спуск с вращением" + }, + new + { + Id = 10, + Code = 0, + Name = "Подъем из скважины" + }, + new + { + Id = 11, + Code = 0, + Name = "Подъем с вращением" + }, + new + { + Id = 12, + Code = 0, + Name = "Промывка в покое" + }, + new + { + Id = 13, + Code = 0, + Name = "Промывка с вращением" + }, + new + { + Id = 14, + Code = 0, + Name = "Удержание в клиньях" + }, + new + { + Id = 15, + Code = 0, + Name = "Неподвижное состояние" + }, + new + { + Id = 16, + Code = 0, + Name = "Вращение без циркуляции" + }, + new + { + Id = 17, + Code = 0, + Name = "На поверхности" + }, + new + { + Id = 1001, + Code = 0, + Name = "Бурение в интервале" + }, + new + { + Id = 1002, + Code = 0, + Name = "ГИС" + }, + new + { + Id = 1003, + Code = 0, + Name = "ГФР" + }, + new + { + Id = 1004, + Code = 0, + Name = "Монтаж ПВО" + }, + new + { + Id = 1005, + Code = 0, + Name = "Демонтаж ПВО" + }, + new + { + Id = 1006, + Code = 0, + Name = "Установка ФА" + }, + new + { + Id = 1007, + Code = 0, + Name = "Оборудование устья" + }, + new + { + Id = 1008, + Code = 0, + Name = "ОЗЦ" + }, + new + { + Id = 1009, + Code = 0, + Name = "Оборудование устья" + }, + new + { + Id = 1010, + Code = 0, + Name = "ОЗЦ" + }, + new + { + Id = 1011, + Code = 0, + Name = "Начало цикла строительства скважины" + }, + new + { + Id = 1012, + Code = 0, + Name = "Окончание цикла строительства скважины" + }, + new + { + Id = 1013, + Code = 0, + Name = "Опрессовка ПВО" + }, + new + { + Id = 1014, + Code = 0, + Name = "Опресовка Ц.К." + }, + new + { + Id = 1015, + Code = 0, + Name = "Опрессовка ВЗД" + }, + new + { + Id = 1016, + Code = 0, + Name = "Перевод скв на другой тип промывочной жидкости" + }, + new + { + Id = 1017, + Code = 0, + Name = "Перезапись каротажа" + }, + new + { + Id = 1018, + Code = 0, + Name = "Перетяжка талевого каната" + }, + new + { + Id = 1019, + Code = 0, + Name = "Наращивание, промывка" + }, + new + { + Id = 1020, + Code = 0, + Name = "Подъем инструмента" + }, + new + { + Id = 1021, + Code = 0, + Name = "Подъем инструмента с промывкой" + }, + new + { + Id = 1022, + Code = 0, + Name = "Обратная проработка" + }, + new + { + Id = 1023, + Code = 0, + Name = "Сборка инструмента" + }, + new + { + Id = 1024, + Code = 0, + Name = "Подготовительные работы" + }, + new + { + Id = 1025, + Code = 0, + Name = "Сборка КНБК" + }, + new + { + Id = 1026, + Code = 0, + Name = "Разборка КНБК" + }, + new + { + Id = 1027, + Code = 0, + Name = "Промывка" + }, + new + { + Id = 1028, + Code = 0, + Name = "Промежуточная промывка" + }, + new + { + Id = 1029, + Code = 0, + Name = "Прокачка пачек" + }, + new + { + Id = 1030, + Code = 0, + Name = "Разбуривание тех.оснастки" + }, + new + { + Id = 1031, + Code = 0, + Name = "Ремонт" + }, + new + { + Id = 1032, + Code = 0, + Name = "Спуск инструмента" + }, + new + { + Id = 1033, + Code = 0, + Name = "Спуск инструмента с промывкой" + }, + new + { + Id = 1034, + Code = 0, + Name = "Прямая проработка" + }, + new + { + Id = 1035, + Code = 0, + Name = "Принудительная проработка" + }, + new + { + Id = 1036, + Code = 0, + Name = "Спуск обсадной колонны" + }, + new + { + Id = 1037, + Code = 0, + Name = "Тех СПО-подъем" + }, + new + { + Id = 1038, + Code = 0, + Name = "Тех СПО-спуск" + }, + new + { + Id = 1039, + Code = 0, + Name = "Техническое обслуживание" + }, + new + { + Id = 1040, + Code = 0, + Name = "Цементаж" + }, + new + { + Id = 1041, + Code = 0, + Name = "Шаблонировка ствола" + }, + new + { + Id = 1042, + Code = 0, + Name = "Геологическое осложнение" + }, + new + { + Id = 1043, + Code = 0, + Name = "НПВ" + }, + new + { + Id = 1044, + Code = 0, + Name = "ВМР" + }, + new + { + Id = 1045, + Code = 0, + Name = "Прочее" + }, + new + { + Id = 1046, + Code = 0, + Name = "Спуск КНБК" + }, + new + { + Id = 1047, + Code = 0, + Name = "Подъем КНБК" + }, + new + { + Id = 1048, + Code = 0, + Name = "Спуск ОК" + }, + new + { + Id = 1050, + Code = 0, + Name = "Промывка при спуске ОК" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_well_section_type"); + + b + .HasComment("конструкция секции скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Пилотный ствол" + }, + new + { + Id = 2, + Caption = "Направление" + }, + new + { + Id = 3, + Caption = "Кондуктор" + }, + new + { + Id = 4, + Caption = "Эксплуатационная колонна" + }, + new + { + Id = 5, + Caption = "Транспортный ствол" + }, + new + { + Id = 6, + Caption = "Хвостовик" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .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.Cluster", b => + { + b.HasOne("AsbCloudDb.Model.Deposit", "Deposit") + .WithMany("Clusters") + .HasForeignKey("IdDeposit") + .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.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.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.RelationCompanyWell", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdCompany") + .HasConstraintName("t_relation_company_well_t_company_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdWell") + .HasConstraintName("t_relation_company_well_t_well_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + + b.Navigation("Well"); + }); + + 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.TelemetryAnalysis", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "Operation") + .WithMany("Analysis") + .HasForeignKey("IdOperation") + .HasConstraintName("t_analysis_t_operation_id_fk") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Analysis") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_analysis_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Operation"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSaub") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_telemetry_data_saub_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSpin") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_telemetry_data_spin_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Events") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_event_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Messages") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_messages_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Users") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_telemetry_user_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("Users") + .HasForeignKey("IdCompany") + .HasConstraintName("t_user_t_company_id_fk") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("AsbCloudDb.Model.UserRole", "Role") + .WithMany("Users") + .HasForeignKey("IdRole"); + + b.Navigation("Company"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.HasOne("AsbCloudDb.Model.Cluster", "Cluster") + .WithMany("Wells") + .HasForeignKey("IdCluster") + .HasConstraintName("t_well_t_cluster_id_fk"); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithOne("Well") + .HasForeignKey("AsbCloudDb.Model.Well", "IdTelemetry") + .HasConstraintName("t_well_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("AsbCloudDb.Model.WellType", "WellType") + .WithMany("Wells") + .HasForeignKey("IdWellType"); + + b.Navigation("Cluster"); + + b.Navigation("Telemetry"); + + b.Navigation("WellType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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("Well"); + + b.Navigation("WellSectionType"); + }); + + 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"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Navigation("Clusters"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b => + { + b.Navigation("Measures"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b => + { + b.Navigation("Analysis"); + + 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("Files"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Navigation("RelationCompaniesWells"); + + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.Navigation("Analysis"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Navigation("Wells"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AsbCloudDb/Migrations/20211007052829_Rename_WellOperation_WellDepth_to_WellDepthEnd.cs b/AsbCloudDb/Migrations/20211007052829_Rename_WellOperation_WellDepth_to_WellDepthEnd.cs new file mode 100644 index 00000000..850dfc67 --- /dev/null +++ b/AsbCloudDb/Migrations/20211007052829_Rename_WellOperation_WellDepth_to_WellDepthEnd.cs @@ -0,0 +1,53 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace AsbCloudDb.Migrations +{ + public partial class Rename_WellOperation_WellDepth_to_WellDepthEnd : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "depth", + table: "t_well_operation", + newName: "depth_end"); + + migrationBuilder.RenameColumn( + name: "date", + table: "t_well_operation", + newName: "date_start"); + + migrationBuilder.RenameIndex( + name: "IX_t_well_operation_depth", + table: "t_well_operation", + newName: "IX_t_well_operation_depth_end"); + + migrationBuilder.RenameIndex( + name: "IX_t_well_operation_date", + table: "t_well_operation", + newName: "IX_t_well_operation_date_start"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "depth_end", + table: "t_well_operation", + newName: "depth"); + + migrationBuilder.RenameColumn( + name: "date_start", + table: "t_well_operation", + newName: "date"); + + migrationBuilder.RenameIndex( + name: "IX_t_well_operation_depth_end", + table: "t_well_operation", + newName: "IX_t_well_operation_depth"); + + migrationBuilder.RenameIndex( + name: "IX_t_well_operation_date_start", + table: "t_well_operation", + newName: "IX_t_well_operation_date"); + } + } +} diff --git a/AsbCloudDb/Migrations/20211007053347_Add_WellOperation_WellDepthStart.Designer.cs b/AsbCloudDb/Migrations/20211007053347_Add_WellOperation_WellDepthStart.Designer.cs new file mode 100644 index 00000000..1d6069b2 --- /dev/null +++ b/AsbCloudDb/Migrations/20211007053347_Add_WellOperation_WellDepthStart.Designer.cs @@ -0,0 +1,2382 @@ +// +using System; +using System.Collections.Generic; +using AsbCloudDb.Model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace AsbCloudDb.Migrations +{ + [DbContext(typeof(AsbCloudDbContext))] + [Migration("20211007053347_Add_WellOperation_WellDepthStart")] + partial class Add_WellOperation_WellDepthStart + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasPostgresExtension("adminpack") + .HasAnnotation("Relational:Collation", "Russian_Russia.1251") + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "5.0.10") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .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.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") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .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") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.HasKey("Id"); + + b.ToTable("t_company_type"); + + b.HasData( + new + { + Id = 1, + Caption = "Недрапользователь" + }, + new + { + Id = 2, + Caption = "Буровой подрядчик" + }, + new + { + Id = 3, + Caption = "Сервис автоматизации бурения" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .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.HasKey("Id"); + + b.ToTable("t_deposit"); + + b + .HasComment("Месторождение"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Name") + .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 = "fluidPlanLastData" + }, + new + { + Id = 9, + Name = "Последний замер бурового раствора ФАКТ", + ShortName = "fluidFactLastData" + }, + new + { + Id = 10, + Name = "Последние данные Шламограммы", + ShortName = "mudLastData" + }, + new + { + Id = 11, + Name = "Последние данные ННБ", + ShortName = "nnbLastData" + }, + new + { + Id = 12, + Name = "Рапорт", + ShortName = "report" + }, + new + { + Id = 13, + Name = "Программа бурения, части", + ShortName = "ПБч" + }, + new + { + Id = 14, + Name = "Программа бурения", + ShortName = "ПБ" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + 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") + .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.Measure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property>("Data") + .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 without 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") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Name") + .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.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.ReportProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + 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.Telemetry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Info") + .HasColumnType("jsonb") + .HasColumnName("info") + .HasComment("Информация с панели о скважине"); + + b.Property("RemoteUid") + .HasColumnType("text") + .HasColumnName("remote_uid") + .HasComment("Идентификатор передающего устройства. Может повторяться в списке, так как комплекты оборудования переезжают от скв. к скв."); + + b.HasKey("Id"); + + b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index"); + + b.ToTable("t_telemetry"); + + b + .HasComment("таблица привязки телеметрии от комплектов к конкретной скважине."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryAnalysis", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DurationSec") + .HasColumnType("integer") + .HasColumnName("duration_sec") + .HasComment("Кол-во секунд после предыдущей операции"); + + b.Property("IdOperation") + .HasColumnType("integer") + .HasColumnName("id_operation"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IsBitPositionDecreasing") + .HasColumnType("boolean") + .HasColumnName("is_bit_position_decreasing") + .HasComment("Долото поднимается"); + + b.Property("IsBitPositionIncreasing") + .HasColumnType("boolean") + .HasColumnName("is_bit_position_increasing") + .HasComment("Долото спускается"); + + b.Property("IsBitPositionLt20") + .HasColumnType("boolean") + .HasColumnName("is_bit_posision_lt_20") + .HasComment("Положение долота меньше 20м"); + + b.Property("IsBlockPositionDecreasing") + .HasColumnType("boolean") + .HasColumnName("is_block_posision_decresing") + .HasComment("Талевый блок поднимается"); + + b.Property("IsBlockPositionIncreasing") + .HasColumnType("boolean") + .HasColumnName("is_block_posision_incresing") + .HasComment("Талевый блок спускается"); + + b.Property("IsHookWeightLt3") + .HasColumnType("boolean") + .HasColumnName("is_hook_weight_lt_3") + .HasComment("Вес на крюке менее 3т"); + + b.Property("IsHookWeightNotChanges") + .HasColumnType("boolean") + .HasColumnName("is_hook_weight_not_changes") + .HasComment("Вес на крюке не меняется"); + + b.Property("IsPressureGt20") + .HasColumnType("boolean") + .HasColumnName("is_pressure_gt_20") + .HasComment("Давоение более 20"); + + b.Property("IsPressureLt20") + .HasColumnType("boolean") + .HasColumnName("is_pressure_lt_20") + .HasComment("Давление менее 20"); + + b.Property("IsRotorSpeedGt5") + .HasColumnType("boolean") + .HasColumnName("is_rotor_speed_gt_3") + .HasComment("Обороты ротора выше 3"); + + b.Property("IsRotorSpeedLt5") + .HasColumnType("boolean") + .HasColumnName("is_rotor_speed_lt_3") + .HasComment("Обороты ротора ниже 3"); + + b.Property("IsWellDepthDecreasing") + .HasColumnType("boolean") + .HasColumnName("is_well_depth_decreasing") + .HasComment("Глубина забоя не увеличивается"); + + b.Property("IsWellDepthIncreasing") + .HasColumnType("boolean") + .HasColumnName("is_well_depth_increasing") + .HasComment("Глубина забоя увеличивается"); + + b.Property("OperationEndDepth") + .HasColumnType("double precision") + .HasColumnName("operation_end_depth") + .HasComment("Глубина, на которой закончилась операция"); + + b.Property("OperationStartDepth") + .HasColumnType("double precision") + .HasColumnName("operation_start_depth") + .HasComment("Глубина, на которой началась операция"); + + b.Property("UnixDate") + .HasColumnType("bigint") + .HasColumnName("unix_date") + .HasComment("Unix timestamp для Linq запросов с вычислением дат"); + + b.HasKey("Id"); + + b.HasIndex("IdOperation"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_telemetry_analysis"); + + b + .HasComment("События на скважине"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("AxialLoad") + .HasColumnType("double precision") + .HasColumnName("axial_load") + .HasComment("Осевая нагрузка"); + + b.Property("AxialLoadLimitMax") + .HasColumnType("double precision") + .HasColumnName("axial_load_limit_max") + .HasComment("Осевая нагрузка. Аварийная макс."); + + b.Property("AxialLoadSp") + .HasColumnType("double precision") + .HasColumnName("axial_load_sp") + .HasComment("Осевая нагрузка. Задание"); + + b.Property("BitDepth") + .HasColumnType("double precision") + .HasColumnName("bit_depth") + .HasComment("Положение инструмента"); + + b.Property("BlockPosition") + .HasColumnType("double precision") + .HasColumnName("block_position") + .HasComment("Высота талевого блока"); + + b.Property("BlockPositionMax") + .HasColumnType("double precision") + .HasColumnName("block_position_max") + .HasComment("Талевый блок. Макс положение"); + + b.Property("BlockPositionMin") + .HasColumnType("double precision") + .HasColumnName("block_position_min") + .HasComment("Талевый блок. Мин положение"); + + b.Property("BlockSpeed") + .HasColumnType("double precision") + .HasColumnName("block_speed") + .HasComment("Скорость талевого блока"); + + b.Property("BlockSpeedSp") + .HasColumnType("double precision") + .HasColumnName("block_speed_sp") + .HasComment("Скорости талевого блока. Задание"); + + b.Property("BlockSpeedSpDevelop") + .HasColumnType("double precision") + .HasColumnName("block_speed_sp_develop") + .HasComment("Талевый блок. Задание скорости для проработки"); + + b.Property("BlockSpeedSpRotor") + .HasColumnType("double precision") + .HasColumnName("block_speed_sp_rotor") + .HasComment("Талевый блок. Задание скорости для роторного бурения"); + + b.Property("BlockSpeedSpSlide") + .HasColumnType("double precision") + .HasColumnName("block_speed_sp_slide") + .HasComment("Талевый блок. Задание скорости для режима слайда"); + + b.Property("Date") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("Flow") + .HasColumnType("double precision") + .HasColumnName("flow") + .HasComment("Расход"); + + b.Property("FlowDeltaLimitMax") + .HasColumnType("double precision") + .HasColumnName("flow_delta_limit_max") + .HasComment("Расход. Аварийный макс."); + + b.Property("FlowIdle") + .HasColumnType("double precision") + .HasColumnName("flow_idle") + .HasComment("Расход. Холостой ход"); + + b.Property("HookWeight") + .HasColumnType("double precision") + .HasColumnName("hook_weight") + .HasComment("Вес на крюке"); + + b.Property("HookWeightIdle") + .HasColumnType("double precision") + .HasColumnName("hook_weight_idle") + .HasComment("Вес на крюке. Холостой ход"); + + b.Property("HookWeightLimitMax") + .HasColumnType("double precision") + .HasColumnName("hook_weight_limit_max") + .HasComment("Вес на крюке. Затяжка"); + + b.Property("HookWeightLimitMin") + .HasColumnType("double precision") + .HasColumnName("hook_weight_limit_min") + .HasComment("Вес на крюке. Посадка"); + + b.Property("IdFeedRegulator") + .HasColumnType("double precision") + .HasColumnName("id_feed_regulator") + .HasComment("Текущий критерий бурения"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Пользователь САУБ"); + + b.Property("Mode") + .HasColumnType("integer") + .HasColumnName("mode") + .HasComment("Режим САУБ"); + + b.Property("MseState") + .HasColumnType("double precision") + .HasColumnName("mse_state") + .HasComment("Текущее состояние работы MSE"); + + b.Property("Pressure") + .HasColumnType("double precision") + .HasColumnName("pressure") + .HasComment("Давление"); + + b.Property("PressureDeltaLimitMax") + .HasColumnType("double precision") + .HasColumnName("pressure_delta_limit_max") + .HasComment("Давление дифф. Аварийное макс."); + + b.Property("PressureIdle") + .HasColumnType("double precision") + .HasColumnName("pressure_idle") + .HasComment("Давление. Холостой ход"); + + b.Property("PressureSp") + .HasColumnType("double precision") + .HasColumnName("pressure_sp") + .HasComment("Давление. Задание"); + + b.Property("PressureSpDevelop") + .HasColumnType("double precision") + .HasColumnName("pressure_sp_develop") + .HasComment("Давление. Задание для проработки"); + + b.Property("PressureSpRotor") + .HasColumnType("double precision") + .HasColumnName("pressure_sp_rotor") + .HasComment("Давление. Задание для роторного бурения"); + + b.Property("PressureSpSlide") + .HasColumnType("double precision") + .HasColumnName("pressure_sp_slide") + .HasComment("Давление. Задание для режима слайда"); + + b.Property("RotorSpeed") + .HasColumnType("double precision") + .HasColumnName("rotor_speed") + .HasComment("Обороты ротора"); + + b.Property("RotorTorque") + .HasColumnType("double precision") + .HasColumnName("rotor_torque") + .HasComment("Момент на роторе"); + + b.Property("RotorTorqueIdle") + .HasColumnType("double precision") + .HasColumnName("rotor_torque_idle") + .HasComment("Момент на роторе. Холостой ход"); + + b.Property("RotorTorqueLimitMax") + .HasColumnType("double precision") + .HasColumnName("rotor_torque_limit_max") + .HasComment("Момент на роторе. Аварийный макс."); + + b.Property("RotorTorqueSp") + .HasColumnType("double precision") + .HasColumnName("rotor_torque_sp") + .HasComment("Момент на роторе. Задание"); + + b.Property("WellDepth") + .HasColumnType("double precision") + .HasColumnName("well_depth") + .HasComment("Глубина забоя"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_telemetry_data_saub"); + + b + .HasComment("набор основных данных по SAUB"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BreakAngleK") + .HasColumnType("double precision") + .HasColumnName("break_angle_k") + .HasComment("Коэффициент для расчёта за какой угол нужно тормозить"); + + b.Property("BreakAngleLeft") + .HasColumnType("double precision") + .HasColumnName("break_angle_left") + .HasComment("Угол торможения влево при работе по моменту"); + + b.Property("Date") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("EncoderResolution") + .HasColumnType("double precision") + .HasColumnName("encoder_resolution ") + .HasComment(" Разрешение энкодера"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("Mode") + .HasColumnType("integer") + .HasColumnName("mode") + .HasComment("Выбранный режим управления"); + + b.Property("PidMuxTorqueLeftLimit") + .HasColumnType("double precision") + .HasColumnName("pid_mux_torque_left_limit") + .HasComment(" Момент при котором определяется ехать назад по моменту или по скорости"); + + b.Property("PositionRight") + .HasColumnType("double precision") + .HasColumnName("position_right") + .HasComment("Крайний правый угол осциляции"); + + b.Property("PositionZero") + .HasColumnType("double precision") + .HasColumnName("position_zero") + .HasComment("Нулевая позиция осциляции"); + + b.Property("Ratio") + .HasColumnType("double precision") + .HasColumnName("ratio") + .HasComment(" Коэффициент редукции редектора"); + + b.Property("ReverseKTorque") + .HasColumnType("double precision") + .HasColumnName("reverse_k_torque") + .HasComment("Коэффициент на который умножается момент, для того чтобы система поняла что мы движемся в обратную сторону"); + + b.Property("ReverseSpeedSpZeroTime") + .HasColumnType("integer") + .HasColumnName("reverse_speed_sp_zero_time") + .HasComment("Время выдачи сигнала нулевой скорости на при смене направления"); + + b.Property("RevolsLeftLimit") + .HasColumnType("double precision") + .HasColumnName("revols_left_limit") + .HasComment("Ограничение числа оборотов влево"); + + b.Property("RevolsLeftTotal") + .HasColumnType("double precision") + .HasColumnName("revols_left_total") + .HasComment("Суммарное количество оборотов влево"); + + b.Property("RevolsRightLimit") + .HasColumnType("double precision") + .HasColumnName("revols_right_limit") + .HasComment("Ограничение числа оборотов вправо"); + + b.Property("RevolsRightTotal") + .HasColumnType("double precision") + .HasColumnName("revols_right_total") + .HasComment("Суммарное количество оборотов вправо"); + + b.Property("RotorTorqueAvg") + .HasColumnType("double precision") + .HasColumnName("rotor_torque_avg") + .HasComment(" Момент в роторе средний"); + + b.Property("SpeedLeftSp") + .HasColumnType("double precision") + .HasColumnName("speed_left_sp") + .HasComment("Заданная скорость вращения влево"); + + b.Property("SpeedRightSp") + .HasColumnType("double precision") + .HasColumnName("speed_right_sp") + .HasComment("Заданная скорость вращения вправо"); + + b.Property("State") + .HasColumnType("integer") + .HasColumnName("state") + .HasComment("Переменная этапа"); + + b.Property("TopDriveSpeed") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed") + .HasComment("Скорость СВП"); + + b.Property("TopDriveSpeedErr") + .HasColumnType("integer") + .HasColumnName("top_drive_speed_err"); + + b.Property("TopDriveSpeedMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_max") + .HasComment("верхний предел"); + + b.Property("TopDriveSpeedMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_min") + .HasComment("нижний предел"); + + b.Property("TopDriveSpeedOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_offset") + .HasComment("смещение"); + + b.Property("TopDriveSpeedSpFrom") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_from") + .HasComment("Заданная скорость c СВП"); + + b.Property("TopDriveSpeedSpFromErr") + .HasColumnType("integer") + .HasColumnName("top_drive_speed_sp_from_err"); + + b.Property("TopDriveSpeedSpFromMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_from_max"); + + b.Property("TopDriveSpeedSpFromMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_from_min"); + + b.Property("TopDriveSpeedSpFromOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_from_offset"); + + b.Property("TopDriveSpeedSpTo") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_to") + .HasComment("Задание скорости на СВП"); + + b.Property("TopDriveSpeedSpToErr") + .HasColumnType("integer") + .HasColumnName("top_drive_speed_sp_to_err"); + + b.Property("TopDriveSpeedSpToMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_to_max"); + + b.Property("TopDriveSpeedSpToMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_to_min"); + + b.Property("TopDriveSpeedSpToOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_sp_to_offset"); + + b.Property("TopDriveTorque") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque") + .HasComment("Момент СВП"); + + b.Property("TopDriveTorqueErr") + .HasColumnType("integer") + .HasColumnName("top_drive_torque_err"); + + b.Property("TopDriveTorqueMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_max"); + + b.Property("TopDriveTorqueMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_min"); + + b.Property("TopDriveTorqueOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_offset"); + + b.Property("TopDriveTorqueSpFrom") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_from") + .HasComment("Заданный момент c СВП"); + + b.Property("TopDriveTorqueSpFromErr") + .HasColumnType("integer") + .HasColumnName("top_drive_torque_sp_from_err"); + + b.Property("TopDriveTorqueSpFromMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_from_max"); + + b.Property("TopDriveTorqueSpFromMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_from_min"); + + b.Property("TopDriveTorqueSpFromOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_from_offset"); + + b.Property("TopDriveTorqueSpTo") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_to") + .HasComment("Задание момента на СВП"); + + b.Property("TopDriveTorqueSpToErr") + .HasColumnType("integer") + .HasColumnName("top_drive_torque_sp_to_err"); + + b.Property("TopDriveTorqueSpToMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_to_max"); + + b.Property("TopDriveTorqueSpToMin") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_to_min"); + + b.Property("TopDriveTorqueSpToOffset") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_sp_to_offset"); + + b.Property("TorqueLeftLimit") + .HasColumnType("double precision") + .HasColumnName("torque_left_limit") + .HasComment("Ограничение крутящего момента влево"); + + b.Property("TorqueRampTime") + .HasColumnType("double precision") + .HasColumnName("torque_ramp_time") + .HasComment("Время нарастания момента"); + + b.Property("TorqueRightLimit") + .HasColumnType("double precision") + .HasColumnName("torque_right_limit") + .HasComment("Ограничение крутящего момента вправо"); + + b.Property("TorqueStarting") + .HasColumnType("double precision") + .HasColumnName("torque_starting") + .HasComment(" Страгивающий момент"); + + b.Property("TurnLeftOnceByAngle") + .HasColumnType("double precision") + .HasColumnName("turn_left_once_by_angle") + .HasComment("Доворот по градусам единожды влево"); + + b.Property("TurnLeftOnceByRevols") + .HasColumnType("double precision") + .HasColumnName("turn_left_once_by_revols") + .HasComment("Доворот по оборотам единожды влево"); + + b.Property("TurnLeftOnceByTorque") + .HasColumnType("double precision") + .HasColumnName("turn_left_once_by_torque") + .HasComment("Доворот по моменту единожды влево"); + + b.Property("TurnRightOnceByAngle") + .HasColumnType("double precision") + .HasColumnName("turn_right_once_by_angle") + .HasComment("Доворот по градусам единожды вправо"); + + b.Property("TurnRightOnceByRevols") + .HasColumnType("double precision") + .HasColumnName("turn_right_once_by_revols") + .HasComment("Доворот по оборотам единожды вправо"); + + b.Property("TurnRightOnceByTorque") + .HasColumnType("double precision") + .HasColumnName("turn_right_once_by_torque") + .HasComment("Доворот по моменту единожды вправо"); + + b.Property("UnlockBySectorOut") + .HasColumnType("double precision") + .HasColumnName("unlock_by_sector_out") + .HasComment(" Градус отклонения от сектора для автоматического сброса блокировки"); + + b.Property("Ver") + .HasColumnType("double precision") + .HasColumnName("ver") + .HasComment("Версия ПО ПЛК"); + + b.Property("W2800") + .HasColumnType("integer") + .HasColumnName("w2800") + .HasComment("Установка нуля энкодера"); + + b.Property("W2808") + .HasColumnType("integer") + .HasColumnName("w2808") + .HasComment("Неисправность энкодера"); + + b.Property("W2810") + .HasColumnType("integer") + .HasColumnName("w2810") + .HasComment(" автоматический сброс блокировки"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + 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") + .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") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + 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("Date") + .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") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname"); + + b.HasKey("IdTelemetry", "IdUser"); + + b.ToTable("t_telemetry_user"); + + b + .HasComment("Пользователи панели САУБ. Для сообщений."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Email") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("email") + .HasComment("должность"); + + b.Property("IdCompany") + .HasColumnType("integer") + .HasColumnName("id_company"); + + b.Property("IdRole") + .HasColumnType("integer") + .HasColumnName("id_role"); + + b.Property("Level") + .HasColumnType("integer") + .HasColumnName("level"); + + b.Property("Login") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("login"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("имя"); + + b.Property("PasswordHash") + .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("State") + .HasColumnType("smallint") + .HasColumnName("state") + .HasComment("состояние:\n100 - удален"); + + b.Property("Surname") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname") + .HasComment("фамилия"); + + b.HasKey("Id"); + + b.HasIndex("IdCompany"); + + b.HasIndex("IdRole"); + + b.HasIndex("Login") + .IsUnique(); + + b.ToTable("t_user"); + + b + .HasComment("Пользователи облака"); + + b.HasData( + new + { + Id = 1, + IdCompany = 1, + IdRole = 1, + Level = 2147483647, + Login = "dev", + Name = "Разработчик", + PasswordHash = "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_user_role"); + + b + .HasComment("Роли пользователей в системе"); + + b.HasData( + new + { + Id = 1, + Caption = "Администратор" + }, + new + { + Id = 2, + Caption = "Пользователь" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IdCluster") + .HasColumnType("integer") + .HasColumnName("id_cluster"); + + 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.HasKey("Id"); + + b.HasIndex("IdCluster"); + + b.HasIndex("IdTelemetry") + .IsUnique(); + + b.HasIndex("IdWellType"); + + b.ToTable("t_well"); + + b + .HasComment("скважины"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("CategoryInfo") + .HasColumnType("text") + .HasColumnName("category_info") + .HasComment("Доп. информация к выбраной категории"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DateStart") + .HasColumnType("timestamp without time zone") + .HasColumnName("date_start") + .HasComment("Дата начала операции"); + + b.Property("DurationHours") + .HasColumnType("double precision") + .HasColumnName("duration_hours") + .HasComment("Продолжительность, часы"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("id_type") + .HasComment("0 = План или 1 = Факт"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_well_section_type") + .HasComment("Id тип секции скважины"); + + b.Property("WellDepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина забоя после завершения операции, м"); + + b.Property("WellDepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина забоя на начало операции, м"); + + b.HasKey("Id"); + + b.HasIndex("DateStart"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.HasIndex("WellDepthEnd"); + + b.ToTable("t_well_operation"); + + b + .HasComment("Данные по операциям на скважине"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Code") + .HasColumnType("integer") + .HasColumnName("code") + .HasComment("Код операции"); + + b.Property("Name") + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории операции"); + + b.HasKey("Id"); + + b.ToTable("t_well_operation_category"); + + b + .HasComment("Справочник операций на скважине"); + + b.HasData( + new + { + Id = 1, + Code = 0, + Name = "Невозможно определить операцию" + }, + new + { + Id = 2, + Code = 0, + Name = "Роторное бурение" + }, + new + { + Id = 3, + Code = 0, + Name = "Слайдирование" + }, + new + { + Id = 4, + Code = 0, + Name = "Подъем с проработкой" + }, + new + { + Id = 5, + Code = 0, + Name = "Спуск с проработкой" + }, + new + { + Id = 6, + Code = 0, + Name = "Подъем с промывкой" + }, + new + { + Id = 7, + Code = 0, + Name = "Спуск с промывкой" + }, + new + { + Id = 8, + Code = 0, + Name = "Спуск в скважину" + }, + new + { + Id = 9, + Code = 0, + Name = "Спуск с вращением" + }, + new + { + Id = 10, + Code = 0, + Name = "Подъем из скважины" + }, + new + { + Id = 11, + Code = 0, + Name = "Подъем с вращением" + }, + new + { + Id = 12, + Code = 0, + Name = "Промывка в покое" + }, + new + { + Id = 13, + Code = 0, + Name = "Промывка с вращением" + }, + new + { + Id = 14, + Code = 0, + Name = "Удержание в клиньях" + }, + new + { + Id = 15, + Code = 0, + Name = "Неподвижное состояние" + }, + new + { + Id = 16, + Code = 0, + Name = "Вращение без циркуляции" + }, + new + { + Id = 17, + Code = 0, + Name = "На поверхности" + }, + new + { + Id = 1001, + Code = 0, + Name = "Бурение в интервале" + }, + new + { + Id = 1002, + Code = 0, + Name = "ГИС" + }, + new + { + Id = 1003, + Code = 0, + Name = "ГФР" + }, + new + { + Id = 1004, + Code = 0, + Name = "Монтаж ПВО" + }, + new + { + Id = 1005, + Code = 0, + Name = "Демонтаж ПВО" + }, + new + { + Id = 1006, + Code = 0, + Name = "Установка ФА" + }, + new + { + Id = 1007, + Code = 0, + Name = "Оборудование устья" + }, + new + { + Id = 1008, + Code = 0, + Name = "ОЗЦ" + }, + new + { + Id = 1009, + Code = 0, + Name = "Оборудование устья" + }, + new + { + Id = 1010, + Code = 0, + Name = "ОЗЦ" + }, + new + { + Id = 1011, + Code = 0, + Name = "Начало цикла строительства скважины" + }, + new + { + Id = 1012, + Code = 0, + Name = "Окончание цикла строительства скважины" + }, + new + { + Id = 1013, + Code = 0, + Name = "Опрессовка ПВО" + }, + new + { + Id = 1014, + Code = 0, + Name = "Опресовка Ц.К." + }, + new + { + Id = 1015, + Code = 0, + Name = "Опрессовка ВЗД" + }, + new + { + Id = 1016, + Code = 0, + Name = "Перевод скв на другой тип промывочной жидкости" + }, + new + { + Id = 1017, + Code = 0, + Name = "Перезапись каротажа" + }, + new + { + Id = 1018, + Code = 0, + Name = "Перетяжка талевого каната" + }, + new + { + Id = 1019, + Code = 0, + Name = "Наращивание, промывка" + }, + new + { + Id = 1020, + Code = 0, + Name = "Подъем инструмента" + }, + new + { + Id = 1021, + Code = 0, + Name = "Подъем инструмента с промывкой" + }, + new + { + Id = 1022, + Code = 0, + Name = "Обратная проработка" + }, + new + { + Id = 1023, + Code = 0, + Name = "Сборка инструмента" + }, + new + { + Id = 1024, + Code = 0, + Name = "Подготовительные работы" + }, + new + { + Id = 1025, + Code = 0, + Name = "Сборка КНБК" + }, + new + { + Id = 1026, + Code = 0, + Name = "Разборка КНБК" + }, + new + { + Id = 1027, + Code = 0, + Name = "Промывка" + }, + new + { + Id = 1028, + Code = 0, + Name = "Промежуточная промывка" + }, + new + { + Id = 1029, + Code = 0, + Name = "Прокачка пачек" + }, + new + { + Id = 1030, + Code = 0, + Name = "Разбуривание тех.оснастки" + }, + new + { + Id = 1031, + Code = 0, + Name = "Ремонт" + }, + new + { + Id = 1032, + Code = 0, + Name = "Спуск инструмента" + }, + new + { + Id = 1033, + Code = 0, + Name = "Спуск инструмента с промывкой" + }, + new + { + Id = 1034, + Code = 0, + Name = "Прямая проработка" + }, + new + { + Id = 1035, + Code = 0, + Name = "Принудительная проработка" + }, + new + { + Id = 1036, + Code = 0, + Name = "Спуск обсадной колонны" + }, + new + { + Id = 1037, + Code = 0, + Name = "Тех СПО-подъем" + }, + new + { + Id = 1038, + Code = 0, + Name = "Тех СПО-спуск" + }, + new + { + Id = 1039, + Code = 0, + Name = "Техническое обслуживание" + }, + new + { + Id = 1040, + Code = 0, + Name = "Цементаж" + }, + new + { + Id = 1041, + Code = 0, + Name = "Шаблонировка ствола" + }, + new + { + Id = 1042, + Code = 0, + Name = "Геологическое осложнение" + }, + new + { + Id = 1043, + Code = 0, + Name = "НПВ" + }, + new + { + Id = 1044, + Code = 0, + Name = "ВМР" + }, + new + { + Id = 1045, + Code = 0, + Name = "Прочее" + }, + new + { + Id = 1046, + Code = 0, + Name = "Спуск КНБК" + }, + new + { + Id = 1047, + Code = 0, + Name = "Подъем КНБК" + }, + new + { + Id = 1048, + Code = 0, + Name = "Спуск ОК" + }, + new + { + Id = 1050, + Code = 0, + Name = "Промывка при спуске ОК" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_well_section_type"); + + b + .HasComment("конструкция секции скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Пилотный ствол" + }, + new + { + Id = 2, + Caption = "Направление" + }, + new + { + Id = 3, + Caption = "Кондуктор" + }, + new + { + Id = 4, + Caption = "Эксплуатационная колонна" + }, + new + { + Id = 5, + Caption = "Транспортный ствол" + }, + new + { + Id = 6, + Caption = "Хвостовик" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Caption") + .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.Cluster", b => + { + b.HasOne("AsbCloudDb.Model.Deposit", "Deposit") + .WithMany("Clusters") + .HasForeignKey("IdDeposit") + .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.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.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.RelationCompanyWell", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdCompany") + .HasConstraintName("t_relation_company_well_t_company_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdWell") + .HasConstraintName("t_relation_company_well_t_well_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + + b.Navigation("Well"); + }); + + 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.TelemetryAnalysis", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "Operation") + .WithMany("Analysis") + .HasForeignKey("IdOperation") + .HasConstraintName("t_analysis_t_operation_id_fk") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Analysis") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_analysis_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Operation"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSaub") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_telemetry_data_saub_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSpin") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_telemetry_data_spin_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Events") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_event_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Messages") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_messages_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Users") + .HasForeignKey("IdTelemetry") + .HasConstraintName("t_telemetry_user_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("Users") + .HasForeignKey("IdCompany") + .HasConstraintName("t_user_t_company_id_fk") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("AsbCloudDb.Model.UserRole", "Role") + .WithMany("Users") + .HasForeignKey("IdRole"); + + b.Navigation("Company"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.HasOne("AsbCloudDb.Model.Cluster", "Cluster") + .WithMany("Wells") + .HasForeignKey("IdCluster") + .HasConstraintName("t_well_t_cluster_id_fk"); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithOne("Well") + .HasForeignKey("AsbCloudDb.Model.Well", "IdTelemetry") + .HasConstraintName("t_well_t_telemetry_id_fk") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("AsbCloudDb.Model.WellType", "WellType") + .WithMany("Wells") + .HasForeignKey("IdWellType"); + + b.Navigation("Cluster"); + + b.Navigation("Telemetry"); + + b.Navigation("WellType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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("Well"); + + b.Navigation("WellSectionType"); + }); + + 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"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Navigation("Clusters"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b => + { + b.Navigation("Measures"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b => + { + b.Navigation("Analysis"); + + 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("Files"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Navigation("Users"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Navigation("RelationCompaniesWells"); + + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.Navigation("Analysis"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Navigation("Wells"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AsbCloudDb/Migrations/20211007053347_Add_WellOperation_WellDepthStart.cs b/AsbCloudDb/Migrations/20211007053347_Add_WellOperation_WellDepthStart.cs new file mode 100644 index 00000000..8c5e0120 --- /dev/null +++ b/AsbCloudDb/Migrations/20211007053347_Add_WellOperation_WellDepthStart.cs @@ -0,0 +1,65 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace AsbCloudDb.Migrations +{ + public partial class Add_WellOperation_WellDepthStart : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "duration_hours", + table: "t_well_operation", + type: "double precision", + nullable: false, + comment: "Продолжительность, часы", + oldClrType: typeof(double), + oldType: "double precision", + oldComment: "Продолжительность в часах"); + + migrationBuilder.AlterColumn( + name: "depth_end", + table: "t_well_operation", + type: "double precision", + nullable: false, + comment: "Глубина забоя после завершения операции, м", + oldClrType: typeof(double), + oldType: "double precision", + oldComment: "Глубина, на которой производилась операция"); + + migrationBuilder.AddColumn( + name: "depth_start", + table: "t_well_operation", + type: "double precision", + nullable: false, + defaultValue: 0.0, + comment: "Глубина забоя на начало операции, м"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "depth_start", + table: "t_well_operation"); + + migrationBuilder.AlterColumn( + name: "duration_hours", + table: "t_well_operation", + type: "double precision", + nullable: false, + comment: "Продолжительность в часах", + oldClrType: typeof(double), + oldType: "double precision", + oldComment: "Продолжительность, часы"); + + migrationBuilder.AlterColumn( + name: "depth_end", + table: "t_well_operation", + type: "double precision", + nullable: false, + comment: "Глубина, на которой производилась операция", + oldClrType: typeof(double), + oldType: "double precision", + oldComment: "Глубина забоя после завершения операции, м"); + } + } +} diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index 8ef54777..4a6ba481 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -1475,10 +1475,15 @@ namespace AsbCloudDb.Migrations .HasColumnName("comment") .HasComment("Комментарий"); + b.Property("DateStart") + .HasColumnType("timestamp without time zone") + .HasColumnName("date_start") + .HasComment("Дата начала операции"); + b.Property("DurationHours") .HasColumnType("double precision") .HasColumnName("duration_hours") - .HasComment("Продолжительность в часах"); + .HasComment("Продолжительность, часы"); b.Property("IdCategory") .HasColumnType("integer") @@ -1500,27 +1505,27 @@ namespace AsbCloudDb.Migrations .HasColumnName("id_well_section_type") .HasComment("Id тип секции скважины"); - b.Property("StartDate") - .HasColumnType("timestamp without time zone") - .HasColumnName("date") - .HasComment("Дата начала операции"); - - b.Property("WellDepth") + b.Property("WellDepthEnd") .HasColumnType("double precision") - .HasColumnName("depth") - .HasComment("Глубина, на которой производилась операция"); + .HasColumnName("depth_end") + .HasComment("Глубина забоя после завершения операции, м"); + + b.Property("WellDepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина забоя на начало операции, м"); b.HasKey("Id"); + b.HasIndex("DateStart"); + b.HasIndex("IdCategory"); b.HasIndex("IdWell"); b.HasIndex("IdWellSectionType"); - b.HasIndex("StartDate"); - - b.HasIndex("WellDepth"); + b.HasIndex("WellDepthEnd"); b.ToTable("t_well_operation"); diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index b7857789..21ca685c 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -175,8 +175,8 @@ namespace AsbCloudDb.Model modelBuilder.Entity(entity => { - entity.HasIndex(d => d.WellDepth); - entity.HasIndex(d => d.StartDate); + entity.HasIndex(d => d.DepthEnd); + entity.HasIndex(d => d.DateStart); }); FillData(modelBuilder); diff --git a/AsbCloudDb/Model/WellOperation.cs b/AsbCloudDb/Model/WellOperation.cs index 06ca3d49..6217c794 100644 --- a/AsbCloudDb/Model/WellOperation.cs +++ b/AsbCloudDb/Model/WellOperation.cs @@ -25,13 +25,16 @@ namespace AsbCloudDb.Model [Column("id_type"), Comment("0 = План или 1 = Факт")] public int IdType { get; set; } - [Column("depth"), Comment("Глубина, на которой производилась операция")] - public double WellDepth { get; set; } + [Column("depth_start"), Comment("Глубина на начало операции, м")] + public double DepthStart { get; set; } - [Column("date"), Comment("Дата начала операции")] - public DateTime StartDate { get; set; } + [Column("depth_end"), Comment("Глубина после завершения операции, м")] + public double DepthEnd { get; set; } - [Column("duration_hours"), Comment("Продолжительность в часах")] + [Column("date_start"), Comment("Дата начала операции")] + public DateTime DateStart { get; set; } + + [Column("duration_hours"), Comment("Продолжительность, часы")] public double DurationHours { get; set; } [Column("category_info"), Comment("Доп. информация к выбраной категории")] diff --git a/AsbCloudDbDemoData/DbDemoDataFiller.cs b/AsbCloudDbDemoData/DbDemoDataFiller.cs index c478b9c9..d4756b37 100644 --- a/AsbCloudDbDemoData/DbDemoDataFiller.cs +++ b/AsbCloudDbDemoData/DbDemoDataFiller.cs @@ -82,91 +82,91 @@ namespace AsbCloudDevOperations ); demoContext.WellOperations.AddRange( - new WellOperation { Id = 64049, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 15:30"), DurationHours = 3.5 }, - new WellOperation { Id = 31502, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 1.16666666666667 }, - new WellOperation { Id = 1531, IdWell = 5, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, - new WellOperation { Id = 44572, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 05:00"), DurationHours = 3.5 }, - new WellOperation { Id = 44514, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 19:00"), DurationHours = 3.5 }, - new WellOperation { Id = 53383, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, - new WellOperation { Id = 3431, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 15:40"), DurationHours = 3.5 }, - new WellOperation { Id = 21460, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 01:10"), DurationHours = 3.5 }, - new WellOperation { Id = 30464, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 12:30"), DurationHours = 3.5 }, - new WellOperation { Id = 73111, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 13:00"), DurationHours = 3.5 }, - new WellOperation { Id = 81351, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 05:10"), DurationHours = 3.5 }, - new WellOperation { Id = 24480, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 22:30"), DurationHours = 3.5 }, - new WellOperation { Id = 19101, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 21:30"), DurationHours = 3.5 }, - new WellOperation { Id = 34738, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 02:30"), DurationHours = 3.5 }, - new WellOperation { Id = 37606, IdWell = 5, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, - new WellOperation { Id = 71293, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 22:40"), DurationHours = 3.5 }, - new WellOperation { Id = 91696, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 18:30"), DurationHours = 3.5 }, - new WellOperation { Id = 77916, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 11:00"), DurationHours = 3.5 }, - new WellOperation { Id = 93585, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, - new WellOperation { Id = 42016, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, - new WellOperation { Id = 90466, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 09:10"), DurationHours = 3.5 }, - new WellOperation { Id = 15914, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-27 01:30"), DurationHours = 3.5 }, - new WellOperation { Id = 63469, IdWell = 4, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, - new WellOperation { Id = 23659, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 06:00"), DurationHours = 3.5 }, - new WellOperation { Id = 93508, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 23:00"), DurationHours = 3.5 }, - new WellOperation { Id = 74346, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, - new WellOperation { Id = 3139, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-24 22:10"), DurationHours = 3.5 }, - new WellOperation { Id = 11429, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, - new WellOperation { Id = 14542, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 21:00"), DurationHours = 3.5 }, - new WellOperation { Id = 70906, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, - new WellOperation { Id = 82194, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 02:00"), DurationHours = 3.5 }, - new WellOperation { Id = 13578, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 08:00"), DurationHours = 3.5 }, - new WellOperation { Id = 57798, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 14:30"), DurationHours = 3.5 }, - new WellOperation { Id = 37277, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-25 00:30"), DurationHours = 3.5 }, - new WellOperation { Id = 23233, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 07:30"), DurationHours = 3.5 }, - new WellOperation { Id = 26075, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, - new WellOperation { Id = 8230, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-26 12:40"), DurationHours = 3.5 }, - new WellOperation { Id = 26414, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 15:00"), DurationHours = 3.5 }, - new WellOperation { Id = 92747, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 22:00"), DurationHours = 3.5 }, - new WellOperation { Id = 89559, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-25 19:10"), DurationHours = 3.5 }, - new WellOperation { Id = 99336, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 08:10"), DurationHours = 3.5 }, - new WellOperation { Id = 80943, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 04:00"), DurationHours = 3.5 }, - new WellOperation { Id = 11934, IdWell = 1, IdWellSectionType = 1, IdCategory = 1006, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 08:10"), DurationHours = 2.33333333333333 }, - new WellOperation { Id = 88089, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 11:40"), DurationHours = 3.5 }, - new WellOperation { Id = 57116, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 18:00"), DurationHours = 3.5 }, - new WellOperation { Id = 57561, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, - new WellOperation { Id = 72783, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 01:40"), DurationHours = 3.5 }, - new WellOperation { Id = 75549, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, - new WellOperation { Id = 60717, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, - new WellOperation { Id = 21171, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, - new WellOperation { Id = 13547, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, - new WellOperation { Id = 83361, IdWell = 5, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, - new WellOperation { Id = 58676, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, - new WellOperation { Id = 46864, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 16:00"), DurationHours = 3.5 }, - new WellOperation { Id = 95276, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 18:40"), DurationHours = 3.5 }, - new WellOperation { Id = 33478, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 3.5 }, - new WellOperation { Id = 85086, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 09:30"), DurationHours = 3.5 }, - new WellOperation { Id = 38808, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 05:30"), DurationHours = 3.5 }, - new WellOperation { Id = 60045, IdWell = 5, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, - new WellOperation { Id = 82773, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, - new WellOperation { Id = 38025, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 08:40"), DurationHours = 3.5 }, - new WellOperation { Id = 8312, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 02:10"), DurationHours = 3.5 }, - new WellOperation { Id = 84440, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 19:30"), DurationHours = 3.5 }, - new WellOperation { Id = 78963, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 05:40"), DurationHours = 3.5 }, - new WellOperation { Id = 39690, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, - new WellOperation { Id = 88719, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, - new WellOperation { Id = 64890, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 15:10"), DurationHours = 3.5 }, - new WellOperation { Id = 95476, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 04:30"), DurationHours = 3.5 }, - new WellOperation { Id = 78257, IdWell = 4, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, - new WellOperation { Id = 41260, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 09:00"), DurationHours = 3.5 }, - new WellOperation { Id = 41055, IdWell = 5, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, - new WellOperation { Id = 47051, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 04:40"), DurationHours = 3.5 }, - new WellOperation { Id = 14068, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 12:10"), DurationHours = 3.5 }, - new WellOperation { Id = 96039, IdWell = 4, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, - new WellOperation { Id = 34668, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, - new WellOperation { Id = 43146, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, - new WellOperation { Id = 15263, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, - new WellOperation { Id = 20802, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, - new WellOperation { Id = 81320, IdWell = 4, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, - new WellOperation { Id = 43902, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, - new WellOperation { Id = 62958, IdWell = 4, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, - new WellOperation { Id = 74174, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, - new WellOperation { Id = 76347, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 01:00"), DurationHours = 3.5 }, - new WellOperation { Id = 51329, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, - new WellOperation { Id = 76341, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 11:30"), DurationHours = 3.5 } + new WellOperation { Id = 64049, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-02 15:30"), DurationHours = 3.5 }, + new WellOperation { Id = 31502, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 1.16666666666667 }, + new WellOperation { Id = 1531, IdWell = 5, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, + new WellOperation { Id = 44572, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-08-27 05:00"), DurationHours = 3.5 }, + new WellOperation { Id = 44514, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-02 19:00"), DurationHours = 3.5 }, + new WellOperation { Id = 53383, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, + new WellOperation { Id = 3431, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 15:40"), DurationHours = 3.5 }, + new WellOperation { Id = 21460, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 01:10"), DurationHours = 3.5 }, + new WellOperation { Id = 30464, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-03 12:30"), DurationHours = 3.5 }, + new WellOperation { Id = 73111, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-04 13:00"), DurationHours = 3.5 }, + new WellOperation { Id = 81351, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, DepthEnd = 1110, DateStart = DateTime.Parse("2021-08-25 05:10"), DurationHours = 3.5 }, + new WellOperation { Id = 24480, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-02 22:30"), DurationHours = 3.5 }, + new WellOperation { Id = 19101, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 21:30"), DurationHours = 3.5 }, + new WellOperation { Id = 34738, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-04 02:30"), DurationHours = 3.5 }, + new WellOperation { Id = 37606, IdWell = 5, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, + new WellOperation { Id = 71293, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 22:40"), DurationHours = 3.5 }, + new WellOperation { Id = 91696, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 18:30"), DurationHours = 3.5 }, + new WellOperation { Id = 77916, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 11:00"), DurationHours = 3.5 }, + new WellOperation { Id = 93585, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, + new WellOperation { Id = 42016, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, + new WellOperation { Id = 90466, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-26 09:10"), DurationHours = 3.5 }, + new WellOperation { Id = 15914, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-27 01:30"), DurationHours = 3.5 }, + new WellOperation { Id = 63469, IdWell = 4, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, + new WellOperation { Id = 23659, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-04 06:00"), DurationHours = 3.5 }, + new WellOperation { Id = 93508, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 23:00"), DurationHours = 3.5 }, + new WellOperation { Id = 74346, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, + new WellOperation { Id = 3139, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1110, DateStart = DateTime.Parse("2021-08-24 22:10"), DurationHours = 3.5 }, + new WellOperation { Id = 11429, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, + new WellOperation { Id = 14542, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 21:00"), DurationHours = 3.5 }, + new WellOperation { Id = 70906, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, + new WellOperation { Id = 82194, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 02:00"), DurationHours = 3.5 }, + new WellOperation { Id = 13578, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 08:00"), DurationHours = 3.5 }, + new WellOperation { Id = 57798, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 14:30"), DurationHours = 3.5 }, + new WellOperation { Id = 37277, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-25 00:30"), DurationHours = 3.5 }, + new WellOperation { Id = 23233, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 07:30"), DurationHours = 3.5 }, + new WellOperation { Id = 26075, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, + new WellOperation { Id = 8230, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-26 12:40"), DurationHours = 3.5 }, + new WellOperation { Id = 26414, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 15:00"), DurationHours = 3.5 }, + new WellOperation { Id = 92747, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 22:00"), DurationHours = 3.5 }, + new WellOperation { Id = 89559, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-25 19:10"), DurationHours = 3.5 }, + new WellOperation { Id = 99336, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 08:10"), DurationHours = 3.5 }, + new WellOperation { Id = 80943, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 04:00"), DurationHours = 3.5 }, + new WellOperation { Id = 11934, IdWell = 1, IdWellSectionType = 1, IdCategory = 1006, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 08:10"), DurationHours = 2.33333333333333 }, + new WellOperation { Id = 88089, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 11:40"), DurationHours = 3.5 }, + new WellOperation { Id = 57116, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 18:00"), DurationHours = 3.5 }, + new WellOperation { Id = 57561, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, + new WellOperation { Id = 72783, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, DepthEnd = 1110, DateStart = DateTime.Parse("2021-08-25 01:40"), DurationHours = 3.5 }, + new WellOperation { Id = 75549, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, + new WellOperation { Id = 60717, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, + new WellOperation { Id = 21171, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, + new WellOperation { Id = 13547, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, + new WellOperation { Id = 83361, IdWell = 5, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, + new WellOperation { Id = 58676, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, + new WellOperation { Id = 46864, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 16:00"), DurationHours = 3.5 }, + new WellOperation { Id = 95276, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 18:40"), DurationHours = 3.5 }, + new WellOperation { Id = 33478, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 3.5 }, + new WellOperation { Id = 85086, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-04 09:30"), DurationHours = 3.5 }, + new WellOperation { Id = 38808, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 05:30"), DurationHours = 3.5 }, + new WellOperation { Id = 60045, IdWell = 5, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, + new WellOperation { Id = 82773, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, + new WellOperation { Id = 38025, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 08:40"), DurationHours = 3.5 }, + new WellOperation { Id = 8312, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-26 02:10"), DurationHours = 3.5 }, + new WellOperation { Id = 84440, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 19:30"), DurationHours = 3.5 }, + new WellOperation { Id = 78963, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-26 05:40"), DurationHours = 3.5 }, + new WellOperation { Id = 39690, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, + new WellOperation { Id = 88719, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, + new WellOperation { Id = 64890, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 15:10"), DurationHours = 3.5 }, + new WellOperation { Id = 95476, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 04:30"), DurationHours = 3.5 }, + new WellOperation { Id = 78257, IdWell = 4, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, + new WellOperation { Id = 41260, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-03 09:00"), DurationHours = 3.5 }, + new WellOperation { Id = 41055, IdWell = 5, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, + new WellOperation { Id = 47051, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 04:40"), DurationHours = 3.5 }, + new WellOperation { Id = 14068, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 12:10"), DurationHours = 3.5 }, + new WellOperation { Id = 96039, IdWell = 4, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, + new WellOperation { Id = 34668, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, + new WellOperation { Id = 43146, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, + new WellOperation { Id = 15263, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, + new WellOperation { Id = 20802, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, + new WellOperation { Id = 81320, IdWell = 4, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, + new WellOperation { Id = 43902, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, + new WellOperation { Id = 62958, IdWell = 4, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, + new WellOperation { Id = 74174, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, + new WellOperation { Id = 76347, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 01:00"), DurationHours = 3.5 }, + new WellOperation { Id = 51329, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, + new WellOperation { Id = 76341, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 11:30"), DurationHours = 3.5 } ); int res = demoContext.SaveChanges(); diff --git a/AsbCloudDbDemoData/Readme.md b/AsbCloudDbDemoData/Readme.md new file mode 100644 index 00000000..256bc6fe --- /dev/null +++ b/AsbCloudDbDemoData/Readme.md @@ -0,0 +1,2 @@ +Проект имитации панелей оператора. +Посылает телеметрию на бэк. \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/WellOperationImportService.cs b/AsbCloudInfrastructure/Services/WellOperationImportService.cs new file mode 100644 index 00000000..a3101745 --- /dev/null +++ b/AsbCloudInfrastructure/Services/WellOperationImportService.cs @@ -0,0 +1,37 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ClosedXML.Excel; +using AsbCloudApp.Data; + +namespace AsbCloudInfrastructure.Services +{ + public class WellOperationImportService + { + private const string sheetNamePlan = "План"; + private const string sheetNameFact = "Факт"; + + public IEnumerable ParseFile(string excelFilePath) + { + if (!File.Exists(excelFilePath)) + throw new FileNotFoundException($"Файл {excelFilePath} не найден."); + + using var sourceExcelWorkbook = new XLWorkbook(excelFilePath, XLEventTracking.Disabled); + + var sheetPlan = sourceExcelWorkbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetNamePlan); + if (sheetPlan is null) + throw new FileFormatException($"Файл {excelFilePath} не не содержит листа {sheetNamePlan}."); + + var sheetFact = sourceExcelWorkbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetNameFact); + if (sheetFact is null) + throw new FileFormatException($"Файл {excelFilePath} не не содержит листа {sheetNameFact}."); + + var wellOperations = new List(); + + return wellOperations; + } + } +} diff --git a/AsbCloudInfrastructure/Services/WellOperationService.cs b/AsbCloudInfrastructure/Services/WellOperationService.cs index 582ce15a..51e63e9c 100644 --- a/AsbCloudInfrastructure/Services/WellOperationService.cs +++ b/AsbCloudInfrastructure/Services/WellOperationService.cs @@ -25,7 +25,8 @@ namespace AsbCloudInfrastructure.Services public IEnumerable GetCategories() { - var operationTypes = cachedOperationCategories.Where() + var operationTypes = cachedOperationCategories + //.Where(oc => oc.Code > 999) .Distinct().OrderBy(o => o.Name); var result = operationTypes.Adapt(); @@ -60,16 +61,16 @@ namespace AsbCloudInfrastructure.Services query = query.Where(e => operationCategoryIds.Contains(e.IdCategory)); if (minDepth != double.MinValue) - query = query.Where(e => e.WellDepth >= minDepth); + query = query.Where(e => e.DepthEnd >= minDepth); if (maxDepth != double.MaxValue) - query = query.Where(e => e.WellDepth <= maxDepth); + query = query.Where(e => e.DepthEnd <= maxDepth); if (begin != default) - query = query.Where(e => e.StartDate >= begin); + query = query.Where(e => e.DateStart >= begin); if (end != default) - query = query.Where(e => e.StartDate <= end); + query = query.Where(e => e.DateStart <= end); var result = new PaginationContainer { @@ -79,8 +80,8 @@ namespace AsbCloudInfrastructure.Services }; query = query - .OrderBy(e => e.WellDepth) - .ThenBy(e => e.StartDate) + .OrderBy(e => e.DateStart) + .ThenBy(e => e.DepthEnd) .ThenBy(e => e.Id); if (skip > 0) diff --git a/AsbCloudInfrastructure/Services/WellOperationsStatService.cs b/AsbCloudInfrastructure/Services/WellOperationsStatService.cs index 328bd5a1..1aaba862 100644 --- a/AsbCloudInfrastructure/Services/WellOperationsStatService.cs +++ b/AsbCloudInfrastructure/Services/WellOperationsStatService.cs @@ -12,31 +12,6 @@ using System.Threading.Tasks; namespace AsbCloudInfrastructure.Services { - class OperationParams - { - public OperationParams() { } - - public OperationParams(WellOperation operation) - { - Id = operation.Id; - IdWellSectionType = operation.IdWellSectionType; - IdCategory = operation.IdCategory; - - Start = operation.StartDate; - - WellDepth = operation.WellDepth; - DeltaDepth = 0; - Hours = operation.DurationHours; - } - public int IdWellSectionType { get; } - public int IdCategory { get; } - public int Id { get; } - public DateTime Start { get; } - public double WellDepth { get; set; } - public double DeltaDepth { get; set; } - public double Hours { get; set; } - } - class Race { public DateTime StartDate { get; set; } @@ -49,7 +24,7 @@ namespace AsbCloudInfrastructure.Services public double DeltaHoursTimeNoNpt => (EndDate - StartDate).TotalHours - NonProductiveHours; public double Speed => DeltaDepth / (DeltaHoursTimeNoNpt + double.Epsilon); - public List Operations { get; internal set; } + public List Operations { get; internal set; } } public class WellOperationsStatService : IWellOperationsStatService @@ -90,8 +65,8 @@ namespace AsbCloudInfrastructure.Services var operations = wells .SelectMany(w => w.WellOperations) - .OrderBy(o => o.StartDate) - .ThenBy(o => o.WellDepth); + .OrderBy(o => o.DateStart) + .ThenBy(o => o.DepthEnd); var cluster = await cacheCluster.FirstOrDefaultAsync(c => c.Id == idCluster, token); @@ -119,8 +94,8 @@ namespace AsbCloudInfrastructure.Services { var operations = await db.WellOperations .Where(o => o.IdWell == idWell) - .OrderBy(o => o.StartDate) // ускорит дальнейшие сортировки - .ThenBy(o => o.WellDepth) + .OrderBy(o => o.DateStart) // ускорит дальнейшие сортировки + .ThenBy(o => o.DepthEnd) .AsNoTracking() .ToListAsync(token); @@ -171,12 +146,12 @@ namespace AsbCloudInfrastructure.Services .ToDictionary(s => s.Id); var sections = new List(sectionTypes.Count); - var operationsPlan = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypePlan)); - var operationsFact = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypeFact)); + var operationsPlan = operations.Where(o => o.IdType == idOperationTypePlan); + var operationsFact = operations.Where(o => o.IdType == idOperationTypeFact); foreach ((var id, var sectionType) in sectionTypes) { - StatSectionDto section = new StatSectionDto + var section = new StatSectionDto { Id = id, Caption = sectionType.Caption, @@ -190,8 +165,8 @@ namespace AsbCloudInfrastructure.Services private static PlanFactBase GetStat(IEnumerable operations) { - var operationsPlan = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypePlan)); - var operationsFact = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypeFact)); + var operationsPlan = operations.Where(o => o.IdType == idOperationTypePlan); + var operationsFact = operations.Where(o => o.IdType == idOperationTypeFact); var section = new PlanFactBase { Plan = CalcStat(operationsPlan), @@ -200,17 +175,17 @@ namespace AsbCloudInfrastructure.Services return section; } - private static StatOperationsDto CalcSectionStat(IEnumerable operations, int idSectionType) + private static StatOperationsDto CalcSectionStat(IEnumerable operations, int idSectionType) { var sectionOperations = operations .Where(o => o.IdWellSectionType == idSectionType) - .OrderBy(o => o.Start) - .ThenBy(o => o.WellDepth); + .OrderBy(o => o.DateStart) + .ThenBy(o => o.DepthStart); return CalcStat(sectionOperations); } - private static StatOperationsDto CalcStat(IEnumerable operations) + private static StatOperationsDto CalcStat(IEnumerable operations) { if (!operations.Any()) return null; @@ -219,10 +194,10 @@ namespace AsbCloudInfrastructure.Services var section = new StatOperationsDto { - Start = operations.First().Start, - End = operations.Max(o => (o.Start.AddHours(o.Hours))), - WellDepthStart = operations.Min(o => o.WellDepth), - WellDepthEnd = operations.Max(o => o.WellDepth), + Start = operations.First().DateStart, + End = operations.Max(o => (o.DateStart.AddHours(o.DurationHours))), + WellDepthStart = operations.Min(o => o.DepthStart), + WellDepthEnd = operations.Max(o => o.DepthStart), Rop = CalcROP(operations), RouteSpeed = CalcAvgRaceSpeed(races), BhaDownSpeed = CalcBhaDownSpeed(races), @@ -230,42 +205,43 @@ namespace AsbCloudInfrastructure.Services CasingDownSpeed = CalcCasingDownSpeed(operations), NonProductiveHours = operations .Where(o => o.IdCategory == idOperationNonProductiveTime) - .Sum(o => o.Hours), + .Sum(o => o.DurationHours), }; return section; } - private static double CalcROP(IEnumerable operationsProps) + private static double CalcROP(IEnumerable operationsProps) { var drillingOperations = operationsProps.Where(o => o.IdCategory == idOperationDrilling); var dDepth = 0d; var dHours = 0d; foreach (var operation in drillingOperations) { - dDepth += operation.DeltaDepth; - dHours += operation.Hours; + var deltaDepth = operation.DepthEnd - operation.DepthStart; + dDepth += deltaDepth; + dHours += operation.DurationHours; } return dDepth / (dHours + double.Epsilon); } - private static double CalcCasingDownSpeed(IEnumerable operationsProps) + private static double CalcCasingDownSpeed(IEnumerable operationsProps) { var ops = operationsProps.Where(o => o.IdCategory == idOperationCasingDown); var depth = 0d; var dHours = 0d; foreach (var operation in ops) { - depth += operation.WellDepth; - dHours += operation.Hours; + depth += operation.DepthStart; + dHours += operation.DurationHours; } return depth / (dHours + double.Epsilon); } - private static IEnumerable GetCompleteRaces(IEnumerable operations) + private static IEnumerable GetCompleteRaces(IEnumerable operations) { var races = new List(); var iterator = operations - .OrderBy(o => o.Start) + .OrderBy(o => o.DateStart) .GetEnumerator(); while (iterator.MoveNext()) { @@ -273,20 +249,20 @@ namespace AsbCloudInfrastructure.Services { var race = new Race { - StartDate = iterator.Current.Start.AddHours(iterator.Current.Hours), - StartWellDepth = iterator.Current.WellDepth, - Operations = new List(4), + StartDate = iterator.Current.DateStart.AddHours(iterator.Current.DurationHours), + StartWellDepth = iterator.Current.DepthStart, + Operations = new List(10), }; while (iterator.MoveNext()) { if (iterator.Current.IdCategory == idOperationNonProductiveTime) { - race.NonProductiveHours += iterator.Current.Hours; + race.NonProductiveHours += iterator.Current.DurationHours; } if (iterator.Current.IdCategory == idOperationBhaDisassembly) { - race.EndDate = iterator.Current.Start; - race.EndWellDepth = iterator.Current.WellDepth; + race.EndDate = iterator.Current.DateStart; + race.EndWellDepth = iterator.Current.DepthStart; races.Add(race); break; } @@ -319,7 +295,7 @@ namespace AsbCloudInfrastructure.Services for (var i = 0; i < race.Operations.Count; i++) { if (race.Operations[i].IdCategory == idOperationBhaDown) - dHours += race.Operations[i].Hours; + dHours += race.Operations[i].DurationHours; if (race.Operations[i].IdCategory == idOperationDrilling) break; } @@ -337,7 +313,7 @@ namespace AsbCloudInfrastructure.Services for (var i = race.Operations.Count - 1; i > 0; i--) { if (race.Operations[i].IdCategory == idOperationBhaUp) - dHours += race.Operations[i].Hours; + dHours += race.Operations[i].DurationHours; if (race.Operations[i].IdCategory == idOperationDrilling) break; } @@ -351,21 +327,21 @@ namespace AsbCloudInfrastructure.Services .Include(o => o.OperationCategory) .Include(o => o.WellSectionType) .Where(o => o.IdWell == idWell) - .OrderBy(o => o.StartDate) - .ThenBy(o => o.WellDepth) + .OrderBy(o => o.DateStart) + .ThenBy(o => o.DepthEnd) .AsNoTracking() .ToListAsync(token) .ConfigureAwait(false); var wellOperationsPlan = wellOperations .Where(o => o.IdType == idOperationTypePlan) - .OrderBy(o => o.StartDate) - .ThenBy(o => o.WellDepth); + .OrderBy(o => o.DateStart) + .ThenBy(o => o.DepthEnd); var wellOperationsFact = wellOperations .Where(o => o.IdType == idOperationTypeFact) - .OrderBy(o => o.StartDate) - .ThenBy(o => o.WellDepth); + .OrderBy(o => o.DateStart) + .ThenBy(o => o.DepthEnd); var sectionsIds = wellOperations .Select(o => o.IdWellSectionType) @@ -384,8 +360,8 @@ namespace AsbCloudInfrastructure.Services var planFactPredict = new PlanFactPredictBase { - Plan = item.Item1?.Adapt(WellOperationDtoMutation), - Fact = item.Item2?.Adapt(WellOperationDtoMutation), + Plan = item.Item1?.Adapt(WellOperationDtoMutation), + Fact = item.Item2?.Adapt(WellOperationDtoMutation), Predict = null, }; @@ -400,9 +376,12 @@ namespace AsbCloudInfrastructure.Services return tvd; var lastMatchPlan = merged[iLastMatch].Item1; - var lastMatchPlanOperationEnd = lastMatchPlan.StartDate.AddHours(lastMatchPlan.DurationHours); - var lastMatchFact = merged[iLastMatch].Item2; - var startOffset = lastMatchFact.StartDate.AddHours(lastMatchFact.DurationHours) - lastMatchPlanOperationEnd; + var lastMatchPlanOperationEnd = lastMatchPlan.DateStart.AddHours(lastMatchPlan.DurationHours); + //var lastMatchFact = merged[iLastMatch].Item2; + //var lastMatchFactDateEnd = lastMatchFact.DateStart.AddHours(lastMatchFact.DurationHours); + var lastFact = merged[iLastFact].Item2; + var lastFactDateEnd = lastFact.DateStart.AddHours(lastFact.DurationHours); + var startOffset = lastFactDateEnd - lastMatchPlanOperationEnd; for (int i = iLastMatch + 1; i < merged.Count; i++) { @@ -410,13 +389,13 @@ namespace AsbCloudInfrastructure.Services continue; tvd[i].Predict = merged[i].Item1.Adapt(); tvd[i].Predict.IdType = 2; - tvd[i].Predict.StartDate = tvd[i].Predict.StartDate + startOffset; + tvd[i].Predict.DateStart = tvd[i].Predict.DateStart + startOffset; } return tvd; } private List> MergeArraysBySections( - IEnumerable sectionsIds, + IEnumerable sectionsIds, IOrderedEnumerable wellOperationsPlan, IOrderedEnumerable wellOperationsFact) { @@ -443,7 +422,7 @@ namespace AsbCloudInfrastructure.Services m.Add(new Tuple(item1, item2)); static bool Compare(WellOperation item1, WellOperation item2) => - item1.IdCategory == item2.IdCategory && Math.Abs(item1.WellDepth - item2.WellDepth) < (30d + 0.005d*(item1.WellDepth + item2.WellDepth)); + item1.IdCategory == item2.IdCategory && Math.Abs(item1.DepthEnd - item2.DepthEnd) < (30d + 0.005d * (item1.DepthEnd + item2.DepthEnd)); int i1 = 0; int i2 = 0; @@ -460,14 +439,14 @@ namespace AsbCloudInfrastructure.Services Add(a1[i1++], a2[i2++]); else { - int nextI1 = Array.FindIndex(a1, i1, (item) => Compare(item, a2[i2])); - int nextI2 = Array.FindIndex(a2, i2, (item) => Compare(item, a1[i1])); + int nextI1 = Array.FindIndex(a1, i1, (item) => Compare(item, a2[i2])); + int nextI2 = Array.FindIndex(a2, i2, (item) => Compare(item, a1[i1])); bool deltaI1_Lt_deltaI2 = (nextI1 - i1) < (nextI2 - i2); if (nextI1 == -1 && nextI2 == -1) { - if (a1[i1].WellDepth < a2[i2].WellDepth) + if (a1[i1].DepthEnd < a2[i2].DepthEnd) { Add(a1[i1++], null); } @@ -512,36 +491,5 @@ namespace AsbCloudInfrastructure.Services dest.CategoryName = source.OperationCategory?.Name; dest.WellSectionTypeName = source.WellSectionType?.Caption; }; - - private static IEnumerable MakeOperationsExt(IEnumerable operations) - { - var ops = new List(); - - if (operations.Any()) - { - var sortedOperations = operations - .OrderBy(o => o.StartDate) - .ThenBy(o => o.WellDepth); - var count = operations.Count(); - ops = new List(count); - var item = operations.ElementAt(0); - var wellDepth = item.WellDepth; - var pre = new OperationParams(item); - var current = new OperationParams(item); - for (int i = 1; i < count; i++) - { - item = operations.ElementAt(i); - current = new OperationParams(item) { WellDepth = Helper.Max(wellDepth, item.WellDepth) }; - pre.DeltaDepth = current.WellDepth - wellDepth; - wellDepth = current.WellDepth; - pre.Hours = (current.Start - pre.Start).TotalHours; - ops.Add(pre); - pre = current; - } - ops.Add(current); - } - - return ops; - } } }