DailyReport. Rename dtos and entities. Remove time offset from DailyReportService.

This commit is contained in:
ngfrolov 2022-07-25 18:02:39 +05:00
parent c5785fbb5f
commit cc5fd56f43
36 changed files with 347 additions and 358 deletions

View File

@ -13,7 +13,4 @@
<ItemGroup>
<None Remove="Data\DailyReport\" />
</ItemGroup>
<ItemGroup>
<Folder Include="Data\DailyReport\" />
</ItemGroup>
</Project>

View File

@ -1,6 +1,9 @@
namespace AsbCloudApp.Data.DailyReport
{
public class DailyReportBhaDto
/// <summary>
/// блок КНБК
/// </summary>
public class BhaDto
{
/// <summary>
/// КНБК описание

View File

@ -0,0 +1,38 @@
namespace AsbCloudApp.Data.DailyReport
{
/// <summary>
/// Блоки для формирования суточного рапорта
/// </summary>
public class DailyReportDto
{
/// <summary>
/// блок заголовка
/// </summary>
public HeadDto Head { get; set; } = new();
/// <summary>
/// блок КНБК
/// </summary>
public BhaDto Bha { get; set; } = new();
/// <summary>
/// блок безметражные работы
/// </summary>
public NoDrillingDto NoDrilling { get; set; } = new();
/// <summary>
/// блок баланса времени
/// </summary>
public TimeBalanceDto TimeBalance { get; set; } = new();
/// <summary>
/// блок САУБ
/// </summary>
public SaubDto Saub { get; set; } = new();
/// <summary>
/// блок подписи
/// </summary>
public SignDto Sign { get; set; } = new();
}
}

View File

@ -1,8 +1,10 @@
using System;
namespace AsbCloudApp.Data.DailyReport
{
public class DailyReportHeadDto
/// <summary>
/// блок заголовка
/// </summary>
public class HeadDto
{
/// <summary>
/// название скважины

View File

@ -1,6 +1,9 @@
namespace AsbCloudApp.Data.DailyReport
{
public class DailyReportDimensionlessDto
/// <summary>
/// блок безметражные работы
/// </summary>
public class NoDrillingDto
{
/// <summary>
/// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию

View File

@ -2,7 +2,10 @@
namespace AsbCloudApp.Data.DailyReport
{
public class DailyReportSaubDto
/// <summary>
/// блок САУБ
/// </summary>
public class SaubDto
{
/// <summary>
/// Режимы бурения в роторе

View File

@ -1,6 +1,9 @@
namespace AsbCloudApp.Data.DailyReport
{
public class DailyReportSignDto
/// <summary>
/// блок подписи
/// </summary>
public class SignDto
{
/// <summary>
/// ФИО Мастера буровой

View File

@ -1,6 +1,9 @@
namespace AsbCloudApp.Data.DailyReport
{
public class DailyReportTimeBalanceDto
/// <summary>
/// блок баланса времени
/// </summary>
public class TimeBalanceDto
{
/// <summary>
/// Бурение
@ -32,8 +35,6 @@
/// </summary>
public string Repair { get; set; }
/// <summary>
/// КНБК
/// </summary>
@ -64,7 +65,6 @@
/// </summary>
public string Gis { get; set; }
/// <summary>
/// ОЗЦ
/// </summary>

View File

@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using AsbCloudApp.Data.DailyReport;
namespace AsbCloudApp.Data
{
/// <summary>
/// Блоки для формирования суточного рапорта
/// </summary>
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; }
}
}

View File

@ -1,4 +1,4 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.DailyReport;
using System;
using System.Collections.Generic;
using System.IO;

View File

@ -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");

View File

@ -1,6 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
#nullable disable

View File

@ -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 =>

View File

@ -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<Cluster> Clusters => Set<Cluster>();
public virtual DbSet<Company> Companies => Set<Company>();
public virtual DbSet<CompanyType> CompaniesTypes => Set<CompanyType>();
public virtual DbSet<DailyReport> DailyReports => Set<DailyReport>();
public virtual DbSet<DailyReport.DailyReport> DailyReports => Set <DailyReport.DailyReport >();
public virtual DbSet<Deposit> Deposits => Set<Deposit>();
public virtual DbSet<DetectedOperation> DetectedOperations => Set<DetectedOperation>();
public virtual DbSet<DrillFlowChart> DrillFlowChart => Set<DrillFlowChart>();
@ -275,7 +274,7 @@ namespace AsbCloudDb.Model
.IsRequired();
});
modelBuilder.Entity<DailyReport>(entity =>
modelBuilder.Entity<DailyReport.DailyReport >(entity =>
{
entity.HasKey(e => new { e.IdWell, e.StartDate })
.HasName("t_id_well_date_start_pk");

View File

@ -0,0 +1,62 @@
namespace AsbCloudDb.Model.DailyReport
{
public class Bha
{
/// <summary>
/// КНБК описание
/// </summary>
public string BHADescription { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2195-2763м. Время начала
/// </summary>
public string ExtensionDrillingOneBegin { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2195-2763м. Время окончания
/// </summary>
public string ExtensionDrillingOneFinish { get; set; }
/// <summary>
/// Промывка. Время начала
/// </summary>
public string SluiceBegin { get; set; }
/// <summary>
/// Промывка. Время окончания
/// </summary>
public string SluiceFinish { get; set; }
/// <summary>
/// Подьем КНБК. Время начала
/// </summary>
public string ClimbBegin { get; set; }
/// <summary>
/// Подьем КНБК. Время окончания
/// </summary>
public string ClimbFinish { get; set; }
/// <summary>
/// Спуск КНБК. Время начала
/// </summary>
public string DescentBegin { get; set; }
/// <summary>
/// Спуск КНБК. Время окончания
/// </summary>
public string DescentFinish { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2763-2850м. Время начала
/// </summary>
public string ExtensionDrillingTwoBegin { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2763-2850м. Время окончания
/// </summary>
public string ExtensionDrillingTwoFinish { get; set; }
}
}

View File

@ -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("Ежедневные отчёты")]

View File

@ -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; }
}
}

View File

@ -1,8 +1,8 @@
using System;
namespace AsbCloudDb.Model.DailyReportDB
{
public class DailyReportHead
{
namespace AsbCloudDb.Model.DailyReport
{
public class Head
{
/// <summary>
/// название скважины
/// </summary>

View File

@ -1,6 +1,6 @@
namespace AsbCloudDb.Model.DailyReportDB
namespace AsbCloudDb.Model.DailyReport
{
public class DailyReportDimensionless
public class NoDrilling
{
/// <summary>
/// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию

View File

@ -1,8 +1,8 @@
using System.Collections.Generic;
namespace AsbCloudDb.Model.DailyReportDB
namespace AsbCloudDb.Model.DailyReport
{
public class DailyReportSaub
public class Saub
{
/// <summary>
/// Режимы бурения в роторе

View File

@ -1,7 +1,7 @@
namespace AsbCloudDb.Model.DailyReportDB
namespace AsbCloudDb.Model.DailyReport
{
public class DailyReportSign
{
public class Sign
{
/// <summary>
/// ФИО Мастера буровой
/// </summary>

View File

@ -0,0 +1,96 @@
namespace AsbCloudDb.Model.DailyReport
{
public class TimeBalance
{
/// <summary>
/// Бурение
/// </summary>
public string Drilling { get; set; }
/// <summary>
/// Промывка
/// </summary>
public string Flushing { get; set; }
/// <summary>
/// Наращивание
/// </summary>
public string Building { get; set; }
/// <summary>
/// Проработка
/// </summary>
public string Elaboration { get; set; }
/// <summary>
/// Расширка
/// </summary>
public string Extension { get; set; }
/// <summary>
/// Ремонт
/// </summary>
public string Repair { get; set; }
/// <summary>
/// КНБК
/// </summary>
public string Knbk { get; set; }
/// <summary>
/// СПО
/// </summary>
public string Spo { get; set; }
/// <summary>
/// ПЗР
/// </summary>
public string Pzr { get; set; }
/// <summary>
/// ПВО
/// </summary>
public string Pvo { get; set; }
/// <summary>
/// ПГР
/// </summary>
public string Pgr { get; set; }
/// <summary>
/// ГИС
/// </summary>
public string Gis { get; set; }
/// <summary>
/// ОЗЦ
/// </summary>
public string Ozc { get; set; }
/// <summary>
/// Тех. работы
/// </summary>
public string EngineeringWorks { get; set; }
/// <summary>
/// Снятие замера
/// </summary>
public string TakingMeasure { get; set; }
/// <summary>
/// Цементирование
/// </summary>
public string Cementing { get; set; }
/// <summary>
/// Простой
/// </summary>
public string Simple { get; set; }
/// <summary>
/// НПВ
/// </summary>
public string Npv { get; set; }
}
}

View File

@ -1,62 +0,0 @@
namespace AsbCloudDb.Model.DailyReportDB
{
public class DailyReportBha
{
/// <summary>
/// КНБК описание
/// </summary>
public string BHADescription { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2195-2763м. Время начала
/// </summary>
public string ExtensionDrillingOneBegin { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2195-2763м. Время окончания
/// </summary>
public string ExtensionDrillingOneFinish { get; set; }
/// <summary>
/// Промывка. Время начала
/// </summary>
public string SluiceBegin { get; set; }
/// <summary>
/// Промывка. Время окончания
/// </summary>
public string SluiceFinish { get; set; }
/// <summary>
/// Подьем КНБК. Время начала
/// </summary>
public string ClimbBegin { get; set; }
/// <summary>
/// Подьем КНБК. Время окончания
/// </summary>
public string ClimbFinish { get; set; }
/// <summary>
/// Спуск КНБК. Время начала
/// </summary>
public string DescentBegin { get; set; }
/// <summary>
/// Спуск КНБК. Время окончания
/// </summary>
public string DescentFinish { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2763-2850м. Время начала
/// </summary>
public string ExtensionDrillingTwoBegin { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2763-2850м. Время окончания
/// </summary>
public string ExtensionDrillingTwoFinish { get; set; }
}
}

View File

@ -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; }
}
}

View File

@ -1,102 +0,0 @@
namespace AsbCloudDb.Model.DailyReportDB
{
public class DailyReportTimeBalance
{
/// <summary>
/// Бурение
/// </summary>
public string Drilling { get; set; }
/// <summary>
/// Промывка
/// </summary>
public string Flushing { get; set; }
/// <summary>
/// Наращивание
/// </summary>
public string Building { get; set; }
/// <summary>
/// Проработка
/// </summary>
public string Elaboration { get; set; }
/// <summary>
/// Расширка
/// </summary>
public string Extension { get; set; }
/// <summary>
/// Ремонт
/// </summary>
public string Repair { get; set; }
/// <summary>
/// КНБК
/// </summary>
public string Knbk { get; set; }
/// <summary>
/// СПО
/// </summary>
public string Spo { get; set; }
/// <summary>
/// ПЗР
/// </summary>
public string Pzr { get; set; }
/// <summary>
/// ПВО
/// </summary>
public string Pvo { get; set; }
/// <summary>
/// ПГР
/// </summary>
public string Pgr { get; set; }
/// <summary>
/// ГИС
/// </summary>
public string Gis { get; set; }
/// <summary>
/// ОЗЦ
/// </summary>
public string Ozc { get; set; }
/// <summary>
/// Тех. работы
/// </summary>
public string EngineeringWorks { get; set; }
/// <summary>
/// Снятие замера
/// </summary>
public string TakingMeasure { get; set; }
/// <summary>
/// Цементирование
/// </summary>
public string Cementing { get; set; }
/// <summary>
/// Простой
/// </summary>
public string Simple { get; set; }
/// <summary>
/// НПВ
/// </summary>
public string Npv { get; set; }
}
}

View File

@ -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<Cluster> Clusters { get; }
DbSet<Company> Companies { get; }
DbSet<DailyReport> DailyReports { get; }
DbSet<DailyReport.DailyReport> DailyReports { get; }
DbSet<Deposit> Deposits { get; }
DbSet<DetectedOperation> DetectedOperations { get; }
DbSet<DrillFlowChart> DrillFlowChart { get; }

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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<IEnumerable<DailyReportDto>> 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<DailyReportDto> 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<int> 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<int> 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<DailyReportDto?> 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<DailyReportDto> 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<DailyReportBhaDto>(),
Head = entity.Info.Head.Adapt<DailyReportHeadDto>(),
TimeBalance = entity.Info.TimeBalance.Adapt<DailyReportTimeBalanceDto>(),
Dimensionless = entity.Info.Dimensionless.Adapt<DailyReportDimensionlessDto>(),
Saub = entity.Info.Saub.Adapt<DailyReportSaubDto>(),
Sign = entity.Info.Sign.Adapt<DailyReportSignDto>()
};
dto.Head.ReportDate = entity.StartDate
.ToRemoteDateTime(offsetHours);
private static DailyReportDto Convert(AsbCloudDb.Model.DailyReport.DailyReport entity)
{
var dto = entity.Info.Adapt<DailyReportDto>();
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<DailyReportInfo>();
entity.Head.ReportDate = dto.Head.ReportDate
.ToUtcDateTimeOffset(offsetHours)
.Date;
entity.Head.ReportDate = dto.Head.ReportDate.Date.Date;
return entity;
}
}
#nullable disable
}

View File

@ -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
}
/// <summary>
/// новый набор данных для формирования рапорта (на новую дату). Если в архиве на эту дату уже есть данные то вернуться они.
/// Получить из БД или генерировать набор данных для формирования рапорта на новую дату.
/// </summary>
/// <param name="idWell"></param>
/// <param name="date"></param>

View File

@ -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,