forked from ddrilling/AsbCloudServer
fix gtr
This commit is contained in:
parent
b6cb2d8efc
commit
4df94466f0
@ -4,11 +4,11 @@
|
||||
/// Класс позволяющий хранить значение неопределенного типа.
|
||||
/// Все возможные типы должны быть описаны в JsonValueJsonConverter.
|
||||
/// </summary>
|
||||
/// <param name="Value"></param>
|
||||
public record JsonValue(object Value)
|
||||
/// <param name="value"></param>
|
||||
public record JsonValue(object value)
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
=> Value.ToString() ?? string.Empty;
|
||||
=> value.ToString() ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,96 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class add_table_wits_and_manualHypertable : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_wits_float",
|
||||
columns: table => new
|
||||
{
|
||||
id_telemetry = table.Column<int>(type: "integer", nullable: false),
|
||||
id_record = table.Column<int>(type: "integer", nullable: false),
|
||||
id_item = table.Column<int>(type: "integer", nullable: false),
|
||||
date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
Value = table.Column<float>(type: "real", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_wits_float", x => new { x.id_telemetry, x.id_record, x.id_item, x.date });
|
||||
table.ForeignKey(
|
||||
name: "FK_t_wits_float_t_telemetry_id_telemetry",
|
||||
column: x => x.id_telemetry,
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "таблица данных ГТИ с типом значения ");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_wits_int",
|
||||
columns: table => new
|
||||
{
|
||||
id_telemetry = table.Column<int>(type: "integer", nullable: false),
|
||||
id_record = table.Column<int>(type: "integer", nullable: false),
|
||||
id_item = table.Column<int>(type: "integer", nullable: false),
|
||||
date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
Value = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_wits_int", x => new { x.id_telemetry, x.id_record, x.id_item, x.date });
|
||||
table.ForeignKey(
|
||||
name: "FK_t_wits_int_t_telemetry_id_telemetry",
|
||||
column: x => x.id_telemetry,
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "таблица данных ГТИ с типом значения int16 int32");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_wits_string",
|
||||
columns: table => new
|
||||
{
|
||||
id_telemetry = table.Column<int>(type: "integer", nullable: false),
|
||||
id_record = table.Column<int>(type: "integer", nullable: false),
|
||||
id_item = table.Column<int>(type: "integer", nullable: false),
|
||||
date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_wits_string", x => new { x.id_telemetry, x.id_record, x.id_item, x.date });
|
||||
table.ForeignKey(
|
||||
name: "FK_t_wits_string_t_telemetry_id_telemetry",
|
||||
column: x => x.id_telemetry,
|
||||
principalTable: "t_telemetry",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "таблица данных ГТИ с типом значения string");
|
||||
migrationBuilder.Sql
|
||||
("SELECT create_hypertable('t_wits_string','date','id_telemetry', 2, chunk_time_interval => INTERVAL '5 day'); " +
|
||||
"SELECT create_hypertable('t_wits_float','date','id_telemetry', 2, chunk_time_interval => INTERVAL '5 day'); " +
|
||||
"SELECT create_hypertable('t_wits_int','date','id_telemetry', 2, chunk_time_interval => INTERVAL '5 day'); ");
|
||||
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_wits_float");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_wits_int");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_wits_string");
|
||||
}
|
||||
}
|
||||
}
|
@ -63,7 +63,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdDeposit");
|
||||
|
||||
b.ToTable("t_cluster");
|
||||
b.ToTable("t_cluster", (string)null);
|
||||
|
||||
b.HasComment("Кусты");
|
||||
});
|
||||
@ -93,7 +93,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdCompanyType");
|
||||
|
||||
b.ToTable("t_company");
|
||||
b.ToTable("t_company", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
@ -121,7 +121,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("t_company_type");
|
||||
b.ToTable("t_company_type", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
@ -162,7 +162,7 @@ namespace AsbCloudDb.Migrations
|
||||
b.HasKey("IdWell", "StartDate")
|
||||
.HasName("t_id_well_date_start_pk");
|
||||
|
||||
b.ToTable("t_daily_report");
|
||||
b.ToTable("t_daily_report", (string)null);
|
||||
|
||||
b.HasComment("Ежедневные отчёты");
|
||||
});
|
||||
@ -198,7 +198,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("t_deposit");
|
||||
b.ToTable("t_deposit", (string)null);
|
||||
|
||||
b.HasComment("Месторождение");
|
||||
});
|
||||
@ -262,7 +262,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdTelemetry");
|
||||
|
||||
b.ToTable("t_detected_operation");
|
||||
b.ToTable("t_detected_operation", (string)null);
|
||||
|
||||
b.HasComment("автоматически определенные операции по телеметрии");
|
||||
});
|
||||
@ -299,7 +299,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("t_driller");
|
||||
b.ToTable("t_driller", (string)null);
|
||||
|
||||
b.HasComment("Бурильщик");
|
||||
});
|
||||
@ -328,7 +328,7 @@ namespace AsbCloudDb.Migrations
|
||||
b.HasIndex("IdWell", "IdFileCategory")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("t_drilling_program_part");
|
||||
b.ToTable("t_drilling_program_part", (string)null);
|
||||
|
||||
b.HasComment("части программ бурения");
|
||||
});
|
||||
@ -355,7 +355,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("t_file_category");
|
||||
b.ToTable("t_file_category", (string)null);
|
||||
|
||||
b.HasComment("Категории файлов");
|
||||
|
||||
@ -745,7 +745,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_file_info");
|
||||
b.ToTable("t_file_info", (string)null);
|
||||
|
||||
b.HasComment("Файлы всех категорий");
|
||||
});
|
||||
@ -796,99 +796,11 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdUser");
|
||||
|
||||
b.ToTable("t_file_mark");
|
||||
b.ToTable("t_file_mark", (string)null);
|
||||
|
||||
b.HasComment("Действия с файлами.");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemFloat", b =>
|
||||
{
|
||||
b.Property<int>("IdTelemetry")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_telemetry");
|
||||
|
||||
b.Property<int>("IdRecord")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_record");
|
||||
|
||||
b.Property<int>("IdItem")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_item");
|
||||
|
||||
b.Property<DateTimeOffset>("DateTime")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date");
|
||||
|
||||
b.Property<float>("Value")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("Value");
|
||||
|
||||
b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime");
|
||||
|
||||
b.ToTable("t_wits_float");
|
||||
|
||||
b.HasComment("таблица данных ГТИ с типом значения ");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemInt", b =>
|
||||
{
|
||||
b.Property<int>("IdTelemetry")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_telemetry");
|
||||
|
||||
b.Property<int>("IdRecord")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_record");
|
||||
|
||||
b.Property<int>("IdItem")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_item");
|
||||
|
||||
b.Property<DateTimeOffset>("DateTime")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date");
|
||||
|
||||
b.Property<int>("Value")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("Value");
|
||||
|
||||
b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime");
|
||||
|
||||
b.ToTable("t_wits_int");
|
||||
|
||||
b.HasComment("таблица данных ГТИ с типом значения int16 int32");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemString", b =>
|
||||
{
|
||||
b.Property<int>("IdTelemetry")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_telemetry");
|
||||
|
||||
b.Property<int>("IdRecord")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_record");
|
||||
|
||||
b.Property<int>("IdItem")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_item");
|
||||
|
||||
b.Property<DateTimeOffset>("DateTime")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("date");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("Value");
|
||||
|
||||
b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime");
|
||||
|
||||
b.ToTable("t_wits_string");
|
||||
|
||||
b.HasComment("таблица данных ГТИ с типом значения string");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -926,7 +838,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdTelemetry");
|
||||
|
||||
b.ToTable("t_limiting_parameter");
|
||||
b.ToTable("t_limiting_parameter", (string)null);
|
||||
|
||||
b.HasComment("Ограничения по параметрам телеметрии");
|
||||
});
|
||||
@ -972,7 +884,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_measure");
|
||||
b.ToTable("t_measure", (string)null);
|
||||
|
||||
b.HasComment("Таблица c данными для вкладки 'Последние данные'");
|
||||
});
|
||||
@ -999,7 +911,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("t_measure_category");
|
||||
b.ToTable("t_measure_category", (string)null);
|
||||
|
||||
b.HasComment("Категория последних данных");
|
||||
|
||||
@ -1070,7 +982,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_operationvalue");
|
||||
b.ToTable("t_operationvalue", (string)null);
|
||||
|
||||
b.HasComment("Целевые/нормативные показатели операции");
|
||||
});
|
||||
@ -1099,7 +1011,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("t_permission");
|
||||
b.ToTable("t_permission", (string)null);
|
||||
|
||||
b.HasComment("Разрешения на доступ к данным");
|
||||
|
||||
@ -2009,7 +1921,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_planned_trajectory");
|
||||
b.ToTable("t_planned_trajectory", (string)null);
|
||||
|
||||
b.HasComment("Загрузка плановой траектории");
|
||||
});
|
||||
@ -2129,7 +2041,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWellSectionType");
|
||||
|
||||
b.ToTable("t_process_map");
|
||||
b.ToTable("t_process_map", (string)null);
|
||||
|
||||
b.HasComment("Операции по скважине – РТК");
|
||||
});
|
||||
@ -2148,7 +2060,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_relation_company_well");
|
||||
b.ToTable("t_relation_company_well", (string)null);
|
||||
|
||||
b.HasComment("отношение скважин и компаний");
|
||||
});
|
||||
@ -2173,7 +2085,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdDrillingProgramPart");
|
||||
|
||||
b.ToTable("t_relation_user_drilling_program_part");
|
||||
b.ToTable("t_relation_user_drilling_program_part", (string)null);
|
||||
|
||||
b.HasComment("Отношение пользователей и частей ПБ");
|
||||
});
|
||||
@ -2192,7 +2104,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdPermission");
|
||||
|
||||
b.ToTable("t_relation_user_role_permission");
|
||||
b.ToTable("t_relation_user_role_permission", (string)null);
|
||||
|
||||
b.HasComment("Отношение ролей пользователей и разрешений доступа");
|
||||
|
||||
@ -3449,7 +3361,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdInclude");
|
||||
|
||||
b.ToTable("t_relation_user_role_user_role");
|
||||
b.ToTable("t_relation_user_role_user_role", (string)null);
|
||||
|
||||
b.HasComment("Отношение ролей к ролям");
|
||||
|
||||
@ -3740,7 +3652,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdUserRole");
|
||||
|
||||
b.ToTable("t_relation_user_user_role");
|
||||
b.ToTable("t_relation_user_user_role", (string)null);
|
||||
|
||||
b.HasComment("Отношение пользователей и ролей");
|
||||
|
||||
@ -3796,7 +3708,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_report_property");
|
||||
b.ToTable("t_report_property", (string)null);
|
||||
|
||||
b.HasComment("Отчеты с данными по буровым");
|
||||
});
|
||||
@ -3847,7 +3759,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_schedule");
|
||||
b.ToTable("t_schedule", (string)null);
|
||||
|
||||
b.HasComment("График работы бурильщика");
|
||||
});
|
||||
@ -3902,7 +3814,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_setpoints_rquest");
|
||||
b.ToTable("t_setpoints_rquest", (string)null);
|
||||
|
||||
b.HasComment("Запросы на изменение уставок панели оператора");
|
||||
});
|
||||
@ -3929,7 +3841,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("t_subsystem");
|
||||
b.ToTable("t_subsystem", (string)null);
|
||||
|
||||
b.HasComment("Описание подсистем");
|
||||
|
||||
@ -4004,7 +3916,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdTelemetry");
|
||||
|
||||
b.ToTable("t_subsystem_operation_time");
|
||||
b.ToTable("t_subsystem_operation_time", (string)null);
|
||||
|
||||
b.HasComment("наработки подсистем");
|
||||
});
|
||||
@ -4040,7 +3952,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index");
|
||||
|
||||
b.ToTable("t_telemetry");
|
||||
b.ToTable("t_telemetry", (string)null);
|
||||
|
||||
b.HasComment("таблица привязки телеметрии от комплектов к конкретной скважине.");
|
||||
});
|
||||
@ -4243,7 +4155,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("IdTelemetry", "DateTime");
|
||||
|
||||
b.ToTable("t_telemetry_data_saub");
|
||||
b.ToTable("t_telemetry_data_saub", (string)null);
|
||||
|
||||
b.HasComment("набор основных данных по SAUB");
|
||||
});
|
||||
@ -4340,7 +4252,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("IdTelemetry", "DateTime");
|
||||
|
||||
b.ToTable("t_telemetry_data_spin");
|
||||
b.ToTable("t_telemetry_data_spin", (string)null);
|
||||
|
||||
b.HasComment("набор основных данных по SpinMaster");
|
||||
});
|
||||
@ -4366,7 +4278,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("IdTelemetry", "IdEvent");
|
||||
|
||||
b.ToTable("t_telemetry_event");
|
||||
b.ToTable("t_telemetry_event", (string)null);
|
||||
|
||||
b.HasComment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.");
|
||||
});
|
||||
@ -4426,7 +4338,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdTelemetry");
|
||||
|
||||
b.ToTable("t_telemetry_message");
|
||||
b.ToTable("t_telemetry_message", (string)null);
|
||||
|
||||
b.HasComment("Сообщения на буровых");
|
||||
});
|
||||
@ -4463,7 +4375,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("IdTelemetry", "IdUser");
|
||||
|
||||
b.ToTable("t_telemetry_user");
|
||||
b.ToTable("t_telemetry_user", (string)null);
|
||||
|
||||
b.HasComment("Пользователи панели САУБ. Для сообщений.");
|
||||
});
|
||||
@ -4505,7 +4417,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("IdTelemetry");
|
||||
|
||||
b.ToTable("t_telemetry_wireline_run_out");
|
||||
b.ToTable("t_telemetry_wireline_run_out", (string)null);
|
||||
|
||||
b.HasComment("Наработка талевого каната");
|
||||
});
|
||||
@ -4585,7 +4497,7 @@ namespace AsbCloudDb.Migrations
|
||||
b.HasIndex("Login")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("t_user");
|
||||
b.ToTable("t_user", (string)null);
|
||||
|
||||
b.HasComment("Пользователи облака");
|
||||
|
||||
@ -4624,7 +4536,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("t_user_role");
|
||||
b.ToTable("t_user_role", (string)null);
|
||||
|
||||
b.HasComment("Роли пользователей в системе");
|
||||
|
||||
@ -4962,7 +4874,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("IdUser", "Key");
|
||||
|
||||
b.ToTable("t_user_settings");
|
||||
b.ToTable("t_user_settings", (string)null);
|
||||
|
||||
b.HasComment("настройки интерфейса пользователя");
|
||||
});
|
||||
@ -5022,7 +4934,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWellType");
|
||||
|
||||
b.ToTable("t_well");
|
||||
b.ToTable("t_well", (string)null);
|
||||
|
||||
b.HasComment("скважины");
|
||||
});
|
||||
@ -5050,7 +4962,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWellSrc");
|
||||
|
||||
b.ToTable("t_well_composite");
|
||||
b.ToTable("t_well_composite", (string)null);
|
||||
|
||||
b.HasComment("Композитная скважина");
|
||||
});
|
||||
@ -5076,7 +4988,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdUser");
|
||||
|
||||
b.ToTable("t_well_final_documents");
|
||||
b.ToTable("t_well_final_documents", (string)null);
|
||||
|
||||
b.HasComment("Дело скважины");
|
||||
});
|
||||
@ -5165,7 +5077,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWellSectionType");
|
||||
|
||||
b.ToTable("t_well_operation");
|
||||
b.ToTable("t_well_operation", (string)null);
|
||||
|
||||
b.HasComment("Данные по операциям на скважине");
|
||||
});
|
||||
@ -5206,7 +5118,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdParent");
|
||||
|
||||
b.ToTable("t_well_operation_category");
|
||||
b.ToTable("t_well_operation_category", (string)null);
|
||||
|
||||
b.HasComment("Справочник операций на скважине");
|
||||
|
||||
@ -6217,7 +6129,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("t_well_section_type");
|
||||
b.ToTable("t_well_section_type", (string)null);
|
||||
|
||||
b.HasComment("конструкция секции скважины");
|
||||
|
||||
@ -6407,7 +6319,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("t_well_type");
|
||||
b.ToTable("t_well_type", (string)null);
|
||||
|
||||
b.HasComment("конструкция скважины");
|
||||
|
||||
@ -6464,7 +6376,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasKey("IdTelemetry", "DateTime");
|
||||
|
||||
b.ToTable("t_telemetry_wits_base");
|
||||
b.ToTable("t_telemetry_wits_base", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b =>
|
||||
@ -6628,7 +6540,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("TelemetryId");
|
||||
|
||||
b.ToTable("t_telemetry_wits_1");
|
||||
b.ToTable("t_telemetry_wits_1", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b =>
|
||||
@ -6716,7 +6628,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("TelemetryId");
|
||||
|
||||
b.ToTable("t_telemetry_wits_50");
|
||||
b.ToTable("t_telemetry_wits_50", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b =>
|
||||
@ -6768,7 +6680,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("TelemetryId");
|
||||
|
||||
b.ToTable("t_telemetry_wits_60");
|
||||
b.ToTable("t_telemetry_wits_60", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b =>
|
||||
@ -6824,7 +6736,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("TelemetryId");
|
||||
|
||||
b.ToTable("t_telemetry_wits_61");
|
||||
b.ToTable("t_telemetry_wits_61", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b =>
|
||||
@ -6912,7 +6824,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("TelemetryId");
|
||||
|
||||
b.ToTable("t_telemetry_wits_7");
|
||||
b.ToTable("t_telemetry_wits_7", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b =>
|
||||
@ -7116,7 +7028,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("TelemetryId");
|
||||
|
||||
b.ToTable("t_telemetry_wits_8");
|
||||
b.ToTable("t_telemetry_wits_8", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Cluster", b =>
|
||||
@ -7237,39 +7149,6 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemFloat", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdTelemetry")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemInt", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdTelemetry")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemString", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdTelemetry")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
|
||||
|
@ -5,6 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
namespace AsbCloudDb.Model.GTR
|
||||
{
|
||||
public class WitsItemBase<T> : ITelemetryData
|
||||
where T: notnull
|
||||
{
|
||||
[Column("id_telemetry")]
|
||||
public int IdTelemetry { get; set; }
|
||||
@ -18,7 +19,7 @@ namespace AsbCloudDb.Model.GTR
|
||||
[Column("date", TypeName = "timestamp with time zone")]
|
||||
public DateTimeOffset DateTime { get; set; }
|
||||
|
||||
[Column("Value")]
|
||||
[Column("value")]
|
||||
public T Value { get; set; } = default!;
|
||||
|
||||
[ForeignKey(nameof(IdTelemetry))]
|
||||
|
@ -81,7 +81,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
Items = g.Select(r => new {
|
||||
Key = r.IdItem,
|
||||
Value = r.Item
|
||||
}).ToList().ToDictionary(x => x.Key, x => x.Value)
|
||||
}).ToDictionary(x => x.Key, x => x.Value)
|
||||
});
|
||||
return dtos;
|
||||
}
|
||||
@ -94,17 +94,17 @@ namespace AsbCloudInfrastructure.Repository
|
||||
foreach (var item in dto.Items)
|
||||
{
|
||||
var jsonValue = item.Value;
|
||||
if(jsonValue.Value is string valueString)
|
||||
if(jsonValue.value is string valueString)
|
||||
{
|
||||
var entity = ConvertToEntity(dto, valueString, item.Key, timezoneHours);
|
||||
db.WitsItemString.Add(entity.Adapt<WitsItemString>());
|
||||
}
|
||||
if (jsonValue.Value is float valueFloat)
|
||||
if (jsonValue.value is float valueFloat)
|
||||
{
|
||||
var entity = ConvertToEntity(dto, valueFloat, item.Key, timezoneHours);
|
||||
db.WitsItemFloat.Add(entity.Adapt<WitsItemFloat>());
|
||||
}
|
||||
if (jsonValue.Value is int valueInt)
|
||||
if (jsonValue.value is int valueInt)
|
||||
{
|
||||
var entity = ConvertToEntity(dto, valueInt, item.Key, timezoneHours);
|
||||
db.WitsItemInt.Add(entity.Adapt<WitsItemInt>());
|
||||
@ -116,6 +116,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
private static async Task<IEnumerable<ItemRecord>> GetItemsOrDefaultAsync<T>(IQueryable<WitsItemBase<T>> query,
|
||||
DateTimeOffset dateEnd, bool filterByDateEnd, int approxPointsCount, double timezoneHours
|
||||
, CancellationToken token)
|
||||
where T: notnull
|
||||
{
|
||||
if (filterByDateEnd)
|
||||
query = query.Where(d => d.DateTime <= dateEnd);
|
||||
@ -150,6 +151,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
return items;
|
||||
}
|
||||
private static WitsItemBase<Tvalue> ConvertToEntity<Tvalue>(WitsRecordDto record, Tvalue value, int idItems, double timezoneHours)
|
||||
where Tvalue: notnull
|
||||
{
|
||||
var entity = new WitsItemBase<Tvalue>
|
||||
{
|
||||
@ -168,7 +170,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
public int IdTelemetry { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public int IdItem { get; set; }
|
||||
public JsonValue Item { get; set; }
|
||||
public JsonValue Item { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
|
Loading…
Reference in New Issue
Block a user