diff --git a/AsbCloudApp/AsbCloudApp.csproj b/AsbCloudApp/AsbCloudApp.csproj index ec491ed5..fa88576c 100644 --- a/AsbCloudApp/AsbCloudApp.csproj +++ b/AsbCloudApp/AsbCloudApp.csproj @@ -13,7 +13,4 @@ - - - diff --git a/AsbCloudApp/Data/DailyReport/DailyReportBhaDto.cs b/AsbCloudApp/Data/DailyReport/BhaDto.cs similarity index 95% rename from AsbCloudApp/Data/DailyReport/DailyReportBhaDto.cs rename to AsbCloudApp/Data/DailyReport/BhaDto.cs index bc55e29f..d858bd8c 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportBhaDto.cs +++ b/AsbCloudApp/Data/DailyReport/BhaDto.cs @@ -1,6 +1,9 @@ namespace AsbCloudApp.Data.DailyReport { - public class DailyReportBhaDto + /// + /// блок КНБК + /// + public class BhaDto { /// /// КНБК описание diff --git a/AsbCloudApp/Data/DailyReport/DailyReportDto.cs b/AsbCloudApp/Data/DailyReport/DailyReportDto.cs new file mode 100644 index 00000000..c47b8934 --- /dev/null +++ b/AsbCloudApp/Data/DailyReport/DailyReportDto.cs @@ -0,0 +1,38 @@ +namespace AsbCloudApp.Data.DailyReport +{ + /// + /// Блоки для формирования суточного рапорта + /// + public class DailyReportDto + { + /// + /// блок заголовка + /// + public HeadDto Head { get; set; } = new(); + + /// + /// блок КНБК + /// + public BhaDto Bha { get; set; } = new(); + + /// + /// блок безметражные работы + /// + public NoDrillingDto NoDrilling { get; set; } = new(); + + /// + /// блок баланса времени + /// + public TimeBalanceDto TimeBalance { get; set; } = new(); + + /// + /// блок САУБ + /// + public SaubDto Saub { get; set; } = new(); + + /// + /// блок подписи + /// + public SignDto Sign { get; set; } = new(); + } +} diff --git a/AsbCloudApp/Data/DailyReport/DailyReportHeadDto.cs b/AsbCloudApp/Data/DailyReport/HeadDto.cs similarity index 97% rename from AsbCloudApp/Data/DailyReport/DailyReportHeadDto.cs rename to AsbCloudApp/Data/DailyReport/HeadDto.cs index db9d9d4d..05537aae 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportHeadDto.cs +++ b/AsbCloudApp/Data/DailyReport/HeadDto.cs @@ -1,8 +1,10 @@ using System; namespace AsbCloudApp.Data.DailyReport { - - public class DailyReportHeadDto + /// + /// блок заголовка + /// + public class HeadDto { /// /// название скважины diff --git a/AsbCloudApp/Data/DailyReport/DailyReportDimensionlessDto.cs b/AsbCloudApp/Data/DailyReport/NoDrillingDto.cs similarity index 88% rename from AsbCloudApp/Data/DailyReport/DailyReportDimensionlessDto.cs rename to AsbCloudApp/Data/DailyReport/NoDrillingDto.cs index 2f8235ba..55f34e1c 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportDimensionlessDto.cs +++ b/AsbCloudApp/Data/DailyReport/NoDrillingDto.cs @@ -1,6 +1,9 @@ namespace AsbCloudApp.Data.DailyReport { - public class DailyReportDimensionlessDto + /// + /// блок безметражные работы + /// + public class NoDrillingDto { /// /// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию diff --git a/AsbCloudApp/Data/DailyReport/DailyReportSaubDto.cs b/AsbCloudApp/Data/DailyReport/SaubDto.cs similarity index 97% rename from AsbCloudApp/Data/DailyReport/DailyReportSaubDto.cs rename to AsbCloudApp/Data/DailyReport/SaubDto.cs index b4d3481b..ee632699 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportSaubDto.cs +++ b/AsbCloudApp/Data/DailyReport/SaubDto.cs @@ -2,7 +2,10 @@ namespace AsbCloudApp.Data.DailyReport { - public class DailyReportSaubDto + /// + /// блок САУБ + /// + public class SaubDto { /// /// Режимы бурения в роторе diff --git a/AsbCloudApp/Data/DailyReport/DailyReportSignDto.cs b/AsbCloudApp/Data/DailyReport/SignDto.cs similarity index 78% rename from AsbCloudApp/Data/DailyReport/DailyReportSignDto.cs rename to AsbCloudApp/Data/DailyReport/SignDto.cs index 49963fe9..3c75bf33 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportSignDto.cs +++ b/AsbCloudApp/Data/DailyReport/SignDto.cs @@ -1,6 +1,9 @@ namespace AsbCloudApp.Data.DailyReport { - public class DailyReportSignDto + /// + /// блок подписи + /// + public class SignDto { /// /// ФИО Мастера буровой diff --git a/AsbCloudApp/Data/DailyReport/DailyReportTimeBalanceDto.cs b/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs similarity index 94% rename from AsbCloudApp/Data/DailyReport/DailyReportTimeBalanceDto.cs rename to AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs index 94695a9e..96f6bba6 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportTimeBalanceDto.cs +++ b/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs @@ -1,6 +1,9 @@ namespace AsbCloudApp.Data.DailyReport { - public class DailyReportTimeBalanceDto + /// + /// блок баланса времени + /// + public class TimeBalanceDto { /// /// Бурение @@ -32,8 +35,6 @@ /// public string Repair { get; set; } - - /// /// КНБК /// @@ -64,7 +65,6 @@ /// public string Gis { get; set; } - /// /// ОЗЦ /// diff --git a/AsbCloudApp/Data/DailyReportDto.cs b/AsbCloudApp/Data/DailyReportDto.cs deleted file mode 100644 index 63b22dd2..00000000 --- a/AsbCloudApp/Data/DailyReportDto.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using AsbCloudApp.Data.DailyReport; - - -namespace AsbCloudApp.Data -{ - /// - /// Блоки для формирования суточного рапорта - /// - public class DailyReportDto - { - - public DailyReportHeadDto Head { get; set; } - public DailyReportBhaDto Bha { get; set; } - public DailyReportDimensionlessDto Dimensionless { get; set; } - public DailyReportTimeBalanceDto TimeBalance { get; set; } - public DailyReportSaubDto Saub { get; set; } - public DailyReportSignDto Sign { get; set; } - - - } -} diff --git a/AsbCloudApp/Services/IDailyReportService.cs b/AsbCloudApp/Services/IDailyReportService.cs index 380622d1..ba9f58a7 100644 --- a/AsbCloudApp/Services/IDailyReportService.cs +++ b/AsbCloudApp/Services/IDailyReportService.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data; +using AsbCloudApp.Data.DailyReport; using System; using System.Collections.Generic; using System.IO; diff --git a/AsbCloudDb/Migrations/20211123130153_Add_UserRoles_Permissions.cs b/AsbCloudDb/Migrations/20211123130153_Add_UserRoles_Permissions.cs index dbd30cbf..87089dab 100644 --- a/AsbCloudDb/Migrations/20211123130153_Add_UserRoles_Permissions.cs +++ b/AsbCloudDb/Migrations/20211123130153_Add_UserRoles_Permissions.cs @@ -7,7 +7,7 @@ namespace AsbCloudDb.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { - + migrationBuilder.DropForeignKey( name: "FK_t_user_t_user_role_id_role", table: "t_user"); diff --git a/AsbCloudDb/Migrations/20220526071639_Add_Driller_and_Schedule.cs b/AsbCloudDb/Migrations/20220526071639_Add_Driller_and_Schedule.cs index fe5f9941..b31f3f60 100644 --- a/AsbCloudDb/Migrations/20220526071639_Add_Driller_and_Schedule.cs +++ b/AsbCloudDb/Migrations/20220526071639_Add_Driller_and_Schedule.cs @@ -1,6 +1,6 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using System; #nullable disable diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index 7cf792d3..1a5a12cf 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -61,7 +61,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdDeposit"); - b.ToTable("t_cluster"); + b.ToTable("t_cluster", (string)null); b.HasComment("Кусты"); }); @@ -90,7 +90,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdCompanyType"); - b.ToTable("t_company"); + b.ToTable("t_company", (string)null); b.HasData( new @@ -117,7 +117,7 @@ namespace AsbCloudDb.Migrations b.HasKey("Id"); - b.ToTable("t_company_type"); + b.ToTable("t_company_type", (string)null); b.HasData( new @@ -157,7 +157,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("Ежедневные отчёты"); }); @@ -191,7 +191,7 @@ namespace AsbCloudDb.Migrations b.HasKey("Id"); - b.ToTable("t_deposit"); + b.ToTable("t_deposit", (string)null); b.HasComment("Месторождение"); }); @@ -250,7 +250,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdTelemetry"); - b.ToTable("t_detected_operation"); + b.ToTable("t_detected_operation", (string)null); b.HasComment("автоматически определенные операции по телеметрии"); }); @@ -287,7 +287,7 @@ namespace AsbCloudDb.Migrations b.HasKey("Id"); - b.ToTable("t_driller"); + b.ToTable("t_driller", (string)null); b.HasComment("Бурильщик"); }); @@ -382,7 +382,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWellOperationCategory"); - b.ToTable("t_drill_flow_chart"); + b.ToTable("t_drill_flow_chart", (string)null); b.HasComment("Параметры коридоров бурения (диапазоны параметров бурения)"); }); @@ -411,7 +411,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("части программ бурения"); }); @@ -526,7 +526,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWellSectionType"); - b.ToTable("t_drill_params"); + b.ToTable("t_drill_params", (string)null); b.HasComment("Режим бурения в секции (диапазоны параметров бурения)"); }); @@ -552,7 +552,7 @@ namespace AsbCloudDb.Migrations b.HasKey("Id"); - b.ToTable("t_file_category"); + b.ToTable("t_file_category", (string)null); b.HasComment("Категории файлов"); @@ -726,7 +726,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWell"); - b.ToTable("t_file_info"); + b.ToTable("t_file_info", (string)null); b.HasComment("Файлы всех категорий"); }); @@ -777,7 +777,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdUser"); - b.ToTable("t_file_mark"); + b.ToTable("t_file_mark", (string)null); b.HasComment("Действия с файлами."); }); @@ -822,7 +822,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWell"); - b.ToTable("t_measure"); + b.ToTable("t_measure", (string)null); b.HasComment("Таблица c данными для вкладки 'Последние данные'"); }); @@ -848,7 +848,7 @@ namespace AsbCloudDb.Migrations b.HasKey("Id"); - b.ToTable("t_measure_category"); + b.ToTable("t_measure_category", (string)null); b.HasComment("Категория последних данных"); @@ -919,7 +919,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWell"); - b.ToTable("t_operationvalue"); + b.ToTable("t_operationvalue", (string)null); b.HasComment("Целевые/нормативные показатели операции"); }); @@ -947,7 +947,7 @@ namespace AsbCloudDb.Migrations b.HasKey("Id"); - b.ToTable("t_permission"); + b.ToTable("t_permission", (string)null); b.HasComment("Разрешения на доступ к данным"); @@ -1664,7 +1664,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWell"); - b.ToTable("t_relation_company_well"); + b.ToTable("t_relation_company_well", (string)null); b.HasComment("отношение скважин и компаний"); }); @@ -1689,7 +1689,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("Отношение пользователей и частей ПБ"); }); @@ -1708,7 +1708,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("Отношение ролей пользователей и разрешений доступа"); @@ -2290,7 +2290,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("Отношение ролей к ролям"); @@ -2581,7 +2581,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("Отношение пользователей и ролей"); @@ -2637,7 +2637,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWell"); - b.ToTable("t_report_property"); + b.ToTable("t_report_property", (string)null); b.HasComment("Отчеты с данными по буровым"); }); @@ -2688,7 +2688,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWell"); - b.ToTable("t_schedule"); + b.ToTable("t_schedule", (string)null); b.HasComment("График работы бурильщика"); }); @@ -2742,7 +2742,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWell"); - b.ToTable("t_setpoints_rquest"); + b.ToTable("t_setpoints_rquest", (string)null); b.HasComment("Запросы на изменение уставок панели оператора"); }); @@ -2775,7 +2775,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("таблица привязки телеметрии от комплектов к конкретной скважине."); }); @@ -2978,7 +2978,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"); }); @@ -3319,7 +3319,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"); }); @@ -3344,7 +3344,7 @@ namespace AsbCloudDb.Migrations b.HasKey("IdTelemetry", "IdEvent"); - b.ToTable("t_telemetry_event"); + b.ToTable("t_telemetry_event", (string)null); b.HasComment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии."); }); @@ -3404,7 +3404,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdTelemetry"); - b.ToTable("t_telemetry_message"); + b.ToTable("t_telemetry_message", (string)null); b.HasComment("Сообщения на буровых"); }); @@ -3440,7 +3440,7 @@ namespace AsbCloudDb.Migrations b.HasKey("IdTelemetry", "IdUser"); - b.ToTable("t_telemetry_user"); + b.ToTable("t_telemetry_user", (string)null); b.HasComment("Пользователи панели САУБ. Для сообщений."); }); @@ -3517,7 +3517,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("Login") .IsUnique(); - b.ToTable("t_user"); + b.ToTable("t_user", (string)null); b.HasComment("Пользователи облака"); @@ -3554,7 +3554,7 @@ namespace AsbCloudDb.Migrations b.HasKey("Id"); - b.ToTable("t_user_role"); + b.ToTable("t_user_role", (string)null); b.HasComment("Роли пользователей в системе"); @@ -3926,7 +3926,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWellType"); - b.ToTable("t_well"); + b.ToTable("t_well", (string)null); b.HasComment("скважины"); }); @@ -3954,7 +3954,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWellSrc"); - b.ToTable("t_well_composite"); + b.ToTable("t_well_composite", (string)null); b.HasComment("Композитная скважина"); }); @@ -4030,7 +4030,7 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWellSectionType"); - b.ToTable("t_well_operation"); + b.ToTable("t_well_operation", (string)null); b.HasComment("Данные по операциям на скважине"); }); @@ -4056,7 +4056,7 @@ namespace AsbCloudDb.Migrations b.HasKey("Id"); - b.ToTable("t_well_operation_category"); + b.ToTable("t_well_operation_category", (string)null); b.HasComment("Справочник операций на скважине"); @@ -4489,7 +4489,7 @@ namespace AsbCloudDb.Migrations b.HasKey("Id"); - b.ToTable("t_well_section_type"); + b.ToTable("t_well_section_type", (string)null); b.HasComment("конструкция секции скважины"); @@ -4664,7 +4664,7 @@ namespace AsbCloudDb.Migrations b.HasKey("Id"); - b.ToTable("t_well_type"); + b.ToTable("t_well_type", (string)null); b.HasComment("конструкция скважины"); @@ -4721,7 +4721,7 @@ namespace AsbCloudDb.Migrations b.HasKey("IdTelemetry", "DateTime"); - b.ToTable("RecordBase"); + b.ToTable("RecordBase", (string)null); }); modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b => @@ -4885,7 +4885,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 => @@ -4973,7 +4973,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 => @@ -5025,7 +5025,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 => @@ -5081,7 +5081,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 => @@ -5169,7 +5169,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 => @@ -5373,7 +5373,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 => diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index a1f421f9..29be4d2a 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -1,5 +1,4 @@ -using AsbCloudDb.Model.DailyReportDB; -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -11,7 +10,7 @@ namespace AsbCloudDb.Model public virtual DbSet Clusters => Set(); public virtual DbSet Companies => Set(); public virtual DbSet CompaniesTypes => Set(); - public virtual DbSet DailyReports => Set(); + public virtual DbSet DailyReports => Set (); public virtual DbSet Deposits => Set(); public virtual DbSet DetectedOperations => Set(); public virtual DbSet DrillFlowChart => Set(); @@ -275,7 +274,7 @@ namespace AsbCloudDb.Model .IsRequired(); }); - modelBuilder.Entity(entity => + modelBuilder.Entity(entity => { entity.HasKey(e => new { e.IdWell, e.StartDate }) .HasName("t_id_well_date_start_pk"); diff --git a/AsbCloudDb/Model/DailyReport/Bha.cs b/AsbCloudDb/Model/DailyReport/Bha.cs new file mode 100644 index 00000000..5167c4b8 --- /dev/null +++ b/AsbCloudDb/Model/DailyReport/Bha.cs @@ -0,0 +1,62 @@ +namespace AsbCloudDb.Model.DailyReport +{ + public class Bha + { + /// + /// КНБК описание + /// + public string BHADescription { get; set; } + + /// + /// Бурение с наращиваниями в инт. 2195-2763м. Время начала + /// + public string ExtensionDrillingOneBegin { get; set; } + + /// + /// Бурение с наращиваниями в инт. 2195-2763м. Время окончания + /// + public string ExtensionDrillingOneFinish { get; set; } + + /// + /// Промывка. Время начала + /// + public string SluiceBegin { get; set; } + + /// + /// Промывка. Время окончания + /// + public string SluiceFinish { get; set; } + + /// + /// Подьем КНБК. Время начала + /// + public string ClimbBegin { get; set; } + + /// + /// Подьем КНБК. Время окончания + /// + public string ClimbFinish { get; set; } + + /// + /// Спуск КНБК. Время начала + /// + public string DescentBegin { get; set; } + + /// + /// Спуск КНБК. Время окончания + /// + public string DescentFinish { get; set; } + + /// + /// Бурение с наращиваниями в инт. 2763-2850м. Время начала + /// + public string ExtensionDrillingTwoBegin { get; set; } + + /// + /// Бурение с наращиваниями в инт. 2763-2850м. Время окончания + /// + public string ExtensionDrillingTwoFinish { get; set; } + + } +} + diff --git a/AsbCloudDb/Model/DailyReportDB/DailyReport.cs b/AsbCloudDb/Model/DailyReport/DailyReport.cs similarity index 88% rename from AsbCloudDb/Model/DailyReportDB/DailyReport.cs rename to AsbCloudDb/Model/DailyReport/DailyReport.cs index 7d985a03..bb685c55 100644 --- a/AsbCloudDb/Model/DailyReportDB/DailyReport.cs +++ b/AsbCloudDb/Model/DailyReport/DailyReport.cs @@ -1,8 +1,8 @@ -using System; -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; using System.ComponentModel.DataAnnotations.Schema; -namespace AsbCloudDb.Model.DailyReportDB +namespace AsbCloudDb.Model.DailyReport { #nullable disable [Table("t_daily_report"), Comment("Ежедневные отчёты")] diff --git a/AsbCloudDb/Model/DailyReport/DailyReportInfo.cs b/AsbCloudDb/Model/DailyReport/DailyReportInfo.cs new file mode 100644 index 00000000..ab21607e --- /dev/null +++ b/AsbCloudDb/Model/DailyReport/DailyReportInfo.cs @@ -0,0 +1,16 @@ +using AsbCloudDb.Model.DailyReport; + +namespace AsbCloudDb.Model +{ +#nullable disable + public class DailyReportInfo + { + public Head Head { get; set; } + public Bha Bha { get; set; } + public NoDrilling NoDrilling { get; set; } + public TimeBalance TimeBalance { get; set; } + public Saub Saub { get; set; } + public Sign Sign { get; set; } + } + +} diff --git a/AsbCloudDb/Model/DailyReportDB/DailyReportHead.cs b/AsbCloudDb/Model/DailyReport/Head.cs similarity index 97% rename from AsbCloudDb/Model/DailyReportDB/DailyReportHead.cs rename to AsbCloudDb/Model/DailyReport/Head.cs index 3e2120c8..8d90a556 100644 --- a/AsbCloudDb/Model/DailyReportDB/DailyReportHead.cs +++ b/AsbCloudDb/Model/DailyReport/Head.cs @@ -1,8 +1,8 @@ using System; -namespace AsbCloudDb.Model.DailyReportDB -{ - public class DailyReportHead - { +namespace AsbCloudDb.Model.DailyReport +{ + public class Head + { /// /// название скважины /// diff --git a/AsbCloudDb/Model/DailyReportDB/DailyReportDimensionless.cs b/AsbCloudDb/Model/DailyReport/NoDrilling.cs similarity index 91% rename from AsbCloudDb/Model/DailyReportDB/DailyReportDimensionless.cs rename to AsbCloudDb/Model/DailyReport/NoDrilling.cs index 79cc5ffd..ef203694 100644 --- a/AsbCloudDb/Model/DailyReportDB/DailyReportDimensionless.cs +++ b/AsbCloudDb/Model/DailyReport/NoDrilling.cs @@ -1,6 +1,6 @@ -namespace AsbCloudDb.Model.DailyReportDB +namespace AsbCloudDb.Model.DailyReport { - public class DailyReportDimensionless + public class NoDrilling { /// /// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию diff --git a/AsbCloudDb/Model/DailyReportDB/DailyReportSaub.cs b/AsbCloudDb/Model/DailyReport/Saub.cs similarity index 98% rename from AsbCloudDb/Model/DailyReportDB/DailyReportSaub.cs rename to AsbCloudDb/Model/DailyReport/Saub.cs index a45fd7a8..55038257 100644 --- a/AsbCloudDb/Model/DailyReportDB/DailyReportSaub.cs +++ b/AsbCloudDb/Model/DailyReport/Saub.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -namespace AsbCloudDb.Model.DailyReportDB +namespace AsbCloudDb.Model.DailyReport { - public class DailyReportSaub + public class Saub { /// /// Режимы бурения в роторе diff --git a/AsbCloudDb/Model/DailyReportDB/DailyReportSign.cs b/AsbCloudDb/Model/DailyReport/Sign.cs similarity index 79% rename from AsbCloudDb/Model/DailyReportDB/DailyReportSign.cs rename to AsbCloudDb/Model/DailyReport/Sign.cs index 96427e1f..ebef294d 100644 --- a/AsbCloudDb/Model/DailyReportDB/DailyReportSign.cs +++ b/AsbCloudDb/Model/DailyReport/Sign.cs @@ -1,7 +1,7 @@ -namespace AsbCloudDb.Model.DailyReportDB +namespace AsbCloudDb.Model.DailyReport { - public class DailyReportSign - { + public class Sign + { /// /// ФИО Мастера буровой /// diff --git a/AsbCloudDb/Model/DailyReport/TimeBalance.cs b/AsbCloudDb/Model/DailyReport/TimeBalance.cs new file mode 100644 index 00000000..a2d3a7e7 --- /dev/null +++ b/AsbCloudDb/Model/DailyReport/TimeBalance.cs @@ -0,0 +1,96 @@ +namespace AsbCloudDb.Model.DailyReport +{ + public class TimeBalance + { + /// + /// Бурение + /// + public string Drilling { get; set; } + + /// + /// Промывка + /// + public string Flushing { get; set; } + + /// + /// Наращивание + /// + public string Building { get; set; } + + /// + /// Проработка + /// + public string Elaboration { get; set; } + + /// + /// Расширка + /// + public string Extension { get; set; } + + /// + /// Ремонт + /// + public string Repair { get; set; } + + /// + /// КНБК + /// + public string Knbk { get; set; } + + /// + /// СПО + /// + public string Spo { get; set; } + + /// + /// ПЗР + /// + public string Pzr { get; set; } + + /// + /// ПВО + /// + public string Pvo { get; set; } + + /// + /// ПГР + /// + public string Pgr { get; set; } + + /// + /// ГИС + /// + public string Gis { get; set; } + + /// + /// ОЗЦ + /// + public string Ozc { get; set; } + + /// + /// Тех. работы + /// + public string EngineeringWorks { get; set; } + + /// + /// Снятие замера + /// + public string TakingMeasure { get; set; } + + /// + /// Цементирование + /// + public string Cementing { get; set; } + + /// + /// Простой + /// + public string Simple { get; set; } + + /// + /// НПВ + /// + public string Npv { get; set; } + } +} + diff --git a/AsbCloudDb/Model/DailyReportDB/DailyReportBha.cs b/AsbCloudDb/Model/DailyReportDB/DailyReportBha.cs deleted file mode 100644 index 14c53798..00000000 --- a/AsbCloudDb/Model/DailyReportDB/DailyReportBha.cs +++ /dev/null @@ -1,62 +0,0 @@ -namespace AsbCloudDb.Model.DailyReportDB -{ - public class DailyReportBha - { - /// - /// КНБК описание - /// - public string BHADescription { get; set; } - - /// - /// Бурение с наращиваниями в инт. 2195-2763м. Время начала - /// - public string ExtensionDrillingOneBegin { get; set; } - - /// - /// Бурение с наращиваниями в инт. 2195-2763м. Время окончания - /// - public string ExtensionDrillingOneFinish { get; set; } - - /// - /// Промывка. Время начала - /// - public string SluiceBegin { get; set; } - - /// - /// Промывка. Время окончания - /// - public string SluiceFinish { get; set; } - - /// - /// Подьем КНБК. Время начала - /// - public string ClimbBegin { get; set; } - - /// - /// Подьем КНБК. Время окончания - /// - public string ClimbFinish { get; set; } - - /// - /// Спуск КНБК. Время начала - /// - public string DescentBegin { get; set; } - - /// - /// Спуск КНБК. Время окончания - /// - public string DescentFinish { get; set; } - - /// - /// Бурение с наращиваниями в инт. 2763-2850м. Время начала - /// - public string ExtensionDrillingTwoBegin { get; set; } - - /// - /// Бурение с наращиваниями в инт. 2763-2850м. Время окончания - /// - public string ExtensionDrillingTwoFinish { get; set; } - - } -} - diff --git a/AsbCloudDb/Model/DailyReportDB/DailyReportInfo.cs b/AsbCloudDb/Model/DailyReportDB/DailyReportInfo.cs deleted file mode 100644 index c0ae5b22..00000000 --- a/AsbCloudDb/Model/DailyReportDB/DailyReportInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using AsbCloudDb.Model.DailyReportDB; - -namespace AsbCloudDb.Model -{ -#nullable disable - public class DailyReportInfo - { - public DailyReportHead Head { get; set; } - public DailyReportBha Bha { get; set; } - public DailyReportDimensionless Dimensionless { get; set; } - public DailyReportTimeBalance TimeBalance { get; set; } - public DailyReportSaub Saub { get; set; } - public DailyReportSign Sign { get; set; } - } - -} diff --git a/AsbCloudDb/Model/DailyReportDB/DailyReportTimeBalance.cs b/AsbCloudDb/Model/DailyReportDB/DailyReportTimeBalance.cs deleted file mode 100644 index f80b7d91..00000000 --- a/AsbCloudDb/Model/DailyReportDB/DailyReportTimeBalance.cs +++ /dev/null @@ -1,102 +0,0 @@ -namespace AsbCloudDb.Model.DailyReportDB -{ - public class DailyReportTimeBalance - { - - /// - /// Бурение - /// - public string Drilling { get; set; } - - /// - /// Промывка - /// - public string Flushing { get; set; } - - /// - /// Наращивание - /// - public string Building { get; set; } - - /// - /// Проработка - /// - public string Elaboration { get; set; } - - /// - /// Расширка - /// - public string Extension { get; set; } - - /// - /// Ремонт - /// - public string Repair { get; set; } - - - - /// - /// КНБК - /// - public string Knbk { get; set; } - - /// - /// СПО - /// - public string Spo { get; set; } - - /// - /// ПЗР - /// - public string Pzr { get; set; } - - /// - /// ПВО - /// - public string Pvo { get; set; } - - /// - /// ПГР - /// - public string Pgr { get; set; } - - /// - /// ГИС - /// - public string Gis { get; set; } - - - /// - /// ОЗЦ - /// - public string Ozc { get; set; } - - /// - /// Тех. работы - /// - public string EngineeringWorks { get; set; } - - /// - /// Снятие замера - /// - public string TakingMeasure { get; set; } - - /// - /// Цементирование - /// - public string Cementing { get; set; } - - /// - /// Простой - /// - public string Simple { get; set; } - - /// - /// НПВ - /// - public string Npv { get; set; } - - - } -} - diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs index 8fbd7de5..72af1fda 100644 --- a/AsbCloudDb/Model/IAsbCloudDbContext.cs +++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs @@ -1,5 +1,4 @@ -using AsbCloudDb.Model.DailyReportDB; -using AsbCloudDb.Model.WITS; +using AsbCloudDb.Model.WITS; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using System; @@ -12,7 +11,7 @@ namespace AsbCloudDb.Model { DbSet Clusters { get; } DbSet Companies { get; } - DbSet DailyReports { get; } + DbSet DailyReports { get; } DbSet Deposits { get; } DbSet DetectedOperations { get; } DbSet DrillFlowChart { get; } diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/BhaBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/BhaBlock.cs index 66d5b018..60505718 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/BhaBlock.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/BhaBlock.cs @@ -5,7 +5,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks { class BhaBlock : BlockAbstract { - private readonly DailyReportBhaDto blockDto; + private readonly BhaDto blockDto; public CellAddress AddressBhaDescription { get; } public CellAddress AddressOperationTitle { get; } @@ -18,7 +18,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks public override CellAddress AddressBlockBegin { get; } public override CellAddress AddressBlockEnd { get; } - public BhaBlock(CellAddress addressBlockBegin, DailyReportBhaDto blockDto) + public BhaBlock(CellAddress addressBlockBegin, BhaDto blockDto) { this.blockDto = blockDto; AddressBlockBegin = addressBlockBegin.Copy(); diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs index 35e1b6b4..8fedbc8c 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs @@ -6,7 +6,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks internal class DimensionlessBlock : BlockAbstract { - private readonly DailyReportDimensionlessDto blockDto; + private readonly NoDrillingDto blockDto; public SaubBlock SaubBlock { get; set; } @@ -22,7 +22,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks public CellAddress AddressBlockFormula { get; } public override CellAddress AddressBlockBegin { get; } public override CellAddress AddressBlockEnd { get; } - public DimensionlessBlock(CellAddress addressBlockBegin, DailyReportDimensionlessDto blockDto) + public DimensionlessBlock(CellAddress addressBlockBegin, NoDrillingDto blockDto) { AddressBlockBegin = addressBlockBegin.Copy(); this.blockDto = blockDto; diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs index 324b70bb..2eab984d 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs @@ -6,7 +6,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks class HeadBlock : BlockAbstract { - private readonly DailyReportHeadDto blockDto; + private readonly HeadDto blockDto; public CellAddress AddressTitle { get; } public CellAddress AddressCustomer { get; } @@ -30,7 +30,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks public CellAddress[] AddressTrajectoryTableDataArray { get; } public override CellAddress AddressBlockBegin { get; } public override CellAddress AddressBlockEnd { get; } - public HeadBlock(CellAddress addressBlockBegin, DailyReportHeadDto blockDto) + public HeadBlock(CellAddress addressBlockBegin, HeadDto blockDto) { AddressBlockBegin = addressBlockBegin.Copy(); this.blockDto = blockDto; diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs index b91351d3..da5ef393 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs @@ -5,7 +5,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks { internal class SaubBlock : BlockAbstract { - private readonly DailyReportSaubDto blockDto; + private readonly SaubDto blockDto; private readonly HeadBlock headBlock; public CellAddress AddressRotorDrilling { get; } public CellAddress AddressSlideDrilling { get; } @@ -41,7 +41,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks public override CellAddress AddressBlockBegin { get; } public override CellAddress AddressBlockEnd { get; } - public SaubBlock(CellAddress addressBlockBegin, DailyReportSaubDto blockDto, HeadBlock headBlock) + public SaubBlock(CellAddress addressBlockBegin, SaubDto blockDto, HeadBlock headBlock) { this.headBlock = headBlock; AddressBlockBegin = addressBlockBegin.Copy(); diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs index 94aefd7c..b4fd4e8f 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs @@ -5,7 +5,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks { internal class SignBlock : BlockAbstract { - private readonly DailyReportSignDto blockDto; + private readonly SignDto blockDto; public CellAddress AddressDrillMasterHead { get; } public CellAddress AddressDrillMaster { get; } public CellAddress AddressSupervisorHead { get; } @@ -14,7 +14,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks public override CellAddress AddressBlockBegin { get; } public override CellAddress AddressBlockEnd { get; } - public SignBlock(CellAddress addressBlockBegin, DailyReportSignDto blockDto) + public SignBlock(CellAddress addressBlockBegin, SignDto blockDto) { AddressBlockBegin = addressBlockBegin.Copy(); this.blockDto = blockDto; diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs index 694d9c95..512fcf10 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs @@ -5,7 +5,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks { class TimeBalanceBlock : BlockAbstract { - private readonly DailyReportTimeBalanceDto blockDto; + private readonly TimeBalanceDto blockDto; public CellAddress AddressTitle { get; } public CellAddress AddressDrilling { get; set; } public CellAddress AddressFlushing { get; set; } @@ -47,7 +47,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks public override CellAddress AddressBlockBegin { get; } public override CellAddress AddressBlockEnd { get; } - public TimeBalanceBlock(CellAddress addressBlockBegin, DailyReportTimeBalanceDto blockDto) + public TimeBalanceBlock(CellAddress addressBlockBegin, TimeBalanceDto blockDto) { AddressBlockBegin = addressBlockBegin.Copy(); this.blockDto = blockDto; diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs index 70670293..d5e9728a 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data; +using AsbCloudApp.Data.DailyReport; using AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks; using ClosedXML.Excel; using System.IO; @@ -29,7 +29,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport var timeBalance = new TimeBalanceBlock(addressStart, dto.TimeBalance); addressStart = timeBalance.AddressBlockEnd + (1, 0); addressStart.ColumnNumber = 2; - var blockDimensionless = new DimensionlessBlock(addressStart, dto.Dimensionless); + var blockDimensionless = new DimensionlessBlock(addressStart, dto.NoDrilling); addressStart = blockDimensionless.AddressBlockEnd + (1, 0); addressStart.ColumnNumber = 2; var blockSaub = new SaubBlock(addressStart, dto.Saub, blockHeader); diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs index c61c22b9..d29c4b34 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs @@ -5,7 +5,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Mapster; -using AsbCloudApp.Data; using AsbCloudApp.Services; using AsbCloudDb.Model; using System.Collections.Generic; @@ -29,44 +28,34 @@ namespace AsbCloudInfrastructure.Services.DailyReport public async Task> GetListAsync(int idWell, DateTime? begin, DateTime? end, CancellationToken token) { var query = db.DailyReports.Where(r => r.IdWell == idWell); - var offsetHours = wellService.GetTimezone(idWell).Hours; if (begin is not null) - { - var beginOffset = ((DateTime)begin).ToUtcDateTimeOffset(offsetHours); - query = query.Where(d => d.StartDate >= beginOffset); - } + query = query.Where(d => d.StartDate >= begin.Value.Date); if (end is not null) - { - var endOffset = ((DateTime)end).ToUtcDateTimeOffset(offsetHours); - query = query.Where(d => d.StartDate <= endOffset); - } + query = query.Where(d => d.StartDate <= end.Value.Date); var entities = await query .ToListAsync(token); - return entities.Select(r => Convert(r, offsetHours)); + return entities.Select(r => Convert(r)); } public async Task GetOrGenerateAsync(int idWell, DateTime date, CancellationToken token) { var dailyReportDto = await GetAsync(idWell, date, token); if (dailyReportDto is null) - return await MakeDefaultDailyReportAsync(idWell, date, token); - else - return dailyReportDto; + dailyReportDto = await MakeDefaultDailyReportAsync(idWell, date, token); + return dailyReportDto; } public async Task AddAsync(int idWell, DailyReportDto dto, CancellationToken token = default) { - var offsetHours = wellService.GetTimezone(idWell).Hours; - var reportDateOffset = dto.Head.ReportDate.ToUtcDateTimeOffset(offsetHours); - var info = Convert(dto, offsetHours); - var entity = new AsbCloudDb.Model.DailyReportDB.DailyReport + var info = Convert(dto); + var entity = new AsbCloudDb.Model.DailyReport.DailyReport { IdWell = idWell, - StartDate = reportDateOffset, + StartDate = info.Head.ReportDate, Info = info }; db.DailyReports.Add(entity); @@ -76,8 +65,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport public async Task UpdateAsync(int idWell, DateTime date, DailyReportDto dto, CancellationToken token) { - var offsetHours = wellService.GetTimezone(idWell).Hours; - var dateOffset = date.ToUtcDateTimeOffset(offsetHours); + var dateOffset = date.Date; var entity = await db.DailyReports .FirstOrDefaultAsync(r => r.IdWell == idWell && r.StartDate.Year == dateOffset.Year && @@ -87,7 +75,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport if (entity is null) return 0; - entity.Info = Convert(dto, offsetHours); + entity.Info = Convert(dto); db.DailyReports.Update(entity); var result = await db.SaveChangesAsync(token); return result; @@ -103,12 +91,9 @@ namespace AsbCloudInfrastructure.Services.DailyReport return memoryStream; } - - private async Task GetAsync(int idWell, DateTime date, CancellationToken token) { - var offsetHours = wellService.GetTimezone(idWell).Hours; - var dateOffset = date.ToUtcDateTimeOffset(offsetHours); + var dateOffset = date.Date; var entity = await db.DailyReports .FirstOrDefaultAsync(r => r.IdWell == idWell && r.StartDate.Year == dateOffset.Year && @@ -117,53 +102,39 @@ namespace AsbCloudInfrastructure.Services.DailyReport if (entity is null) return null; - else - return Convert(entity, offsetHours); + var dto = Convert(entity); + return dto; } private async Task MakeDefaultDailyReportAsync(int idWell, DateTime date, CancellationToken token) { var well = await wellService.GetAsync(idWell, token); - var offsetHours = wellService.GetTimezone(idWell).Hours; var dto = new DailyReportDto() { - Head=new DailyReportHeadDto() + Head = new HeadDto() { - ReportDate = DateTimeOffset.UtcNow.ToRemoteDateTime(offsetHours), - WellName = well.Caption, - ClusterName = well.Cluster + ReportDate = date.Date, + WellName = well?.Caption ?? "", + ClusterName = well?.Cluster ?? "" } }; return dto; } - private static DailyReportDto Convert(AsbCloudDb.Model.DailyReportDB.DailyReport entity, double offsetHours) - { - var dto = new DailyReportDto() - { - Bha = entity.Info.Bha.Adapt(), - Head = entity.Info.Head.Adapt(), - TimeBalance = entity.Info.TimeBalance.Adapt(), - Dimensionless = entity.Info.Dimensionless.Adapt(), - Saub = entity.Info.Saub.Adapt(), - Sign = entity.Info.Sign.Adapt() - }; - - dto.Head.ReportDate = entity.StartDate - .ToRemoteDateTime(offsetHours); + private static DailyReportDto Convert(AsbCloudDb.Model.DailyReport.DailyReport entity) + { + var dto = entity.Info.Adapt(); + dto.Head.ReportDate = entity.StartDate.Date; return dto; } - private static DailyReportInfo Convert(DailyReportDto dto, double offsetHours) + private static DailyReportInfo Convert(DailyReportDto dto) { var entity = dto.Adapt(); - entity.Head.ReportDate = dto.Head.ReportDate - .ToUtcDateTimeOffset(offsetHours) - .Date; + entity.Head.ReportDate = dto.Head.ReportDate.Date.Date; return entity; } } #nullable disable } - diff --git a/AsbCloudWebApi/Controllers/DailyReportController.cs b/AsbCloudWebApi/Controllers/DailyReportController.cs index 7aec2106..b466abc6 100644 --- a/AsbCloudWebApi/Controllers/DailyReportController.cs +++ b/AsbCloudWebApi/Controllers/DailyReportController.cs @@ -1,4 +1,4 @@ -using AsbCloudApp.Data; +using AsbCloudApp.Data.DailyReport; using AsbCloudApp.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -42,7 +42,7 @@ namespace AsbCloudWebApi.Controllers } /// - /// новый набор данных для формирования рапорта (на новую дату). Если в архиве на эту дату уже есть данные то вернуться они. + /// Получить из БД или генерировать набор данных для формирования рапорта на новую дату. /// /// /// diff --git a/ConsoleApp1/Program.cs b/ConsoleApp1/Program.cs index e70f4f76..5b345220 100644 --- a/ConsoleApp1/Program.cs +++ b/ConsoleApp1/Program.cs @@ -16,7 +16,7 @@ namespace ConsoleApp1 { - var block = new DailyReportHeadDto() + var block = new HeadDto() { AzimuthAngle = 12, WellName = "WellName", @@ -28,11 +28,11 @@ namespace ConsoleApp1 WellDepthIntervalStartDate = 26.5, BottomholeDepth = 66.6 }; - var block2 = new DailyReportBhaDto() + var block2 = new BhaDto() { BHADescription = "sadasdasdasdasdasdjlaskjdaksjdlasdlalskdklj" }; - var block3 = new DailyReportSaubDto(); + var block3 = new SaubDto(); var bloks = new DailyReportDto() { Head = block,