Merge branch 'dev' into feature/detected_operations

# Conflicts:
#	AsbCloudApp/Repositories/IDetectedOperationRepository.cs
This commit is contained in:
Степанов Дмитрий 2024-07-25 16:57:41 +03:00
commit a8ef51b102
70 changed files with 39240 additions and 259 deletions

View File

@ -17,5 +17,5 @@ public class ProcessMapPlanAutoHoldTFDto : ProcessMapPlanBaseDto
/// Примечание
/// </summary>
[StringLength(1024, ErrorMessage = "Примечание, должно быть не более 1024 символов")]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
}

View File

@ -17,5 +17,5 @@ public class ProcessMapPlanDamperDto : ProcessMapPlanBaseDto
/// Примечание
/// </summary>
[StringLength(1024, ErrorMessage = "Примечание, должно быть не более 1024 символов")]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
}

View File

@ -41,5 +41,5 @@ public class ProcessMapPlanDrillTestDto : ProcessMapPlanBaseDto
/// Примечание
/// </summary>
[StringLength(1024, ErrorMessage = "Примечание, должно быть не более 1024 символа")]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
}

View File

@ -47,5 +47,5 @@ public class ProcessMapPlanOscillationDto : ProcessMapPlanBaseDto
/// Примечание
/// </summary>
[StringLength(1024, ErrorMessage = "Примечание, должно быть не более 1024 символов")]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
}

View File

@ -47,5 +47,5 @@ public class ProcessMapPlanShockTestDto : ProcessMapPlanBaseDto
/// Примечание
/// </summary>
[StringLength(1024, ErrorMessage = "Примечание, должно быть не более 1024 символов")]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
}

View File

@ -149,7 +149,7 @@ public class ProcessMapPlanReamingRotorDto : ProcessMapPlanBaseDto
/// Проработка 3, Количество повторений, шт.
/// </summary>
[Range(0, 99, ErrorMessage = "Проработка 3, Количество повторений, шт., должно быть в пределах от 0 до 99")]
public double Reaming3RepetitionsCount { get; set; }
public int Reaming3RepetitionsCount { get; set; }
/// <summary>
/// Проработка 3, Скорость, м/ч., Вверх
@ -203,5 +203,5 @@ public class ProcessMapPlanReamingRotorDto : ProcessMapPlanBaseDto
/// Примечание
/// </summary>
[StringLength(1024, ErrorMessage = "Примечание, должно быть не более 1024 символов")]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
}

View File

@ -41,7 +41,7 @@ public class ProcessMapPlanReamingSlideDto : ProcessMapPlanBaseDto
/// Проработка 1, Количество повторений, шт.
/// </summary>
[Range(0.0, 99.0, ErrorMessage = "Проработка 1, Количество повторений, шт., должно быть в пределах от 0 до 99")]
public double Reaming1RepetitionsCount { get; set; }
public int Reaming1RepetitionsCount { get; set; }
/// <summary>
/// Проработка 1, Скорость, м/ч., Вверх
@ -95,7 +95,7 @@ public class ProcessMapPlanReamingSlideDto : ProcessMapPlanBaseDto
/// Проработка 2, Количество повторений, шт.
/// </summary>
[Range(0.0, 99.0, ErrorMessage = "Проработка 2, Количество повторений, шт., должно быть в пределах от 0 до 99")]
public double Reaming2RepetitionsCount { get; set; }
public int Reaming2RepetitionsCount { get; set; }
/// <summary>
/// Проработка 2, Скорость, м/ч., Вверх
@ -149,7 +149,7 @@ public class ProcessMapPlanReamingSlideDto : ProcessMapPlanBaseDto
/// Проработка 3, Количество повторений, шт.
/// </summary>
[Range(0.0, 99.0, ErrorMessage = "Проработка 3, Количество повторений, шт., должно быть в пределах от 0 до 99")]
public double Reaming3RepetitionsCount { get; set; }
public int? Reaming3RepetitionsCount { get; set; }
/// <summary>
/// Проработка 3, Скорость, м/ч., Вверх
@ -203,7 +203,7 @@ public class ProcessMapPlanReamingSlideDto : ProcessMapPlanBaseDto
/// Примечание
/// </summary>
[StringLength(1024, ErrorMessage = "Примечание, должно быть не более 1024 символов")]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
}

View File

@ -1,4 +1,5 @@
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using System;
using System.Collections.Generic;
using System.Threading;
@ -9,7 +10,7 @@ namespace AsbCloudApp.Repositories
/// <summary>
/// Репозиторий работы с данными из таблицы t_data_daub_stat
/// </summary>
public interface IDataSaubStatRepository
public interface IDataSaubStatRepository : ITelemetryDataEditorService
{
/// <summary>
/// Получение записей по ключу телеметрии

View File

@ -1,16 +1,16 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.DetectedOperation;
using AsbCloudApp.Requests;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading;
using AsbCloudApp.Data;
using System.Threading.Tasks;
namespace AsbCloudApp.Repositories;
/// <summary>
/// Таблица автоматически определенных операций
/// </summary>
public interface IDetectedOperationRepository
public interface IDetectedOperationRepository : ITelemetryDataEditorService
{
/// <summary>
/// Добавление нескольких записей

View File

@ -1,5 +1,6 @@
using AsbCloudApp.Data.SAUB;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@ -9,7 +10,7 @@ namespace AsbCloudApp.Repositories
/// <summary>
/// репозиторий по работе с данными drill_test
/// </summary>
public interface IDrillTestRepository
public interface IDrillTestRepository : ITelemetryDataEditorService
{
/// <summary>
/// Получить данные drill_test в соответствии с параметрами запроса

View File

@ -5,13 +5,14 @@ using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Requests;
using AsbCloudApp.Data;
using AsbCloudApp.Services;
namespace AsbCloudApp.Repositories
{
/// <summary>
/// данные ГТИ
/// </summary>
public interface IGtrRepository
public interface IGtrRepository : ITelemetryDataEditorService
{
/// <summary>
/// добавить данные (для панели бурильщика)

View File

@ -1,15 +1,16 @@
using AsbCloudApp.Data;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Repositories
{
/// <summary>
/// Репозиторий по ограничивающим параметрам с фильтрацией
/// </summary>
public interface ILimitingParameterRepository
public interface ILimitingParameterRepository : ITelemetryDataEditorService
{
/// <summary>
/// Получение списка ограничивающих параметров по идентификатору скважины

View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Requests;
/// <summary>
/// Параметры запроса на удаление куска телеметрии
/// </summary>
public class TelemetryPartDeleteRequest : IValidatableObject
{
/// <summary>
/// ключ телеметрии
/// </summary>
public int IdTelemetry { get; set; }
/// <summary>
/// greater or equal then Date. Must be set one of GeDate or LeDate
/// </summary>
public DateTimeOffset? GeDate { get; set; }
/// <summary>
/// less or equal then Date. Must be set one of GeDate or LeDate
/// </summary>
public DateTimeOffset? LeDate { get; set; }
/// <summary>
/// Валидация входящих данных
/// </summary>
/// <param name="validationContext"></param>
/// <returns></returns>
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (IdTelemetry == 0)
yield return new ValidationResult($"IdTelemetry must be defined");
if (!GeDate.HasValue && !LeDate.HasValue)
yield return new ValidationResult($"GeDate or LeDate must be defined");
}
}

View File

@ -10,7 +10,7 @@ namespace AsbCloudApp.Services
/// <summary>
/// Сервис сообщений панели оператора
/// </summary>
public interface IMessageService
public interface IMessageService : ITelemetryDataEditorService
{
/// <summary>
/// Получить сообщения по параметрам

View File

@ -0,0 +1,19 @@
using AsbCloudApp.Requests;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Services;
/// <summary>
/// Сервис по работе с данными телеметрии
/// </summary>
public interface ITelemetryDataEditorService
{
/// <summary>
/// Удаление части телеметрии по запросу
/// </summary>
/// <param name="request"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token);
}

View File

@ -11,7 +11,7 @@ namespace AsbCloudApp.Services
/// сервис данных тех. процесса
/// </summary>
/// <typeparam name="TDto"></typeparam>
public interface ITelemetryDataService<TDto> where TDto : ITelemetryData
public interface ITelemetryDataService<TDto> : ITelemetryDataEditorService where TDto : ITelemetryData
{
/// <summary>

View File

@ -1,4 +1,5 @@
using AsbCloudApp.Data;
using AsbCloudApp.Requests;
using System;
using System.Collections.Generic;
using System.Threading;
@ -9,7 +10,7 @@ namespace AsbCloudApp.Services
/// <summary>
/// The wits record repository.
/// </summary>
public interface IWitsRecordRepository<TDto>
public interface IWitsRecordRepository<TDto> : ITelemetryDataEditorService
where TDto : ITelemetryData
{
/// <summary>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,810 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
/// <inheritdoc />
public partial class NotNullable_Fields_ProcessMapPlanReamingRotorAndSlide : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<double>(
name: "reaming3_stop_point_off_bottom",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Остановка над забоем, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Остановка над забоем, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rpm_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Обороты, об/мин., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Обороты, об/мин., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rpm_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Обороты, об/мин., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Обороты, об/мин., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rop_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Скорость, м/ч., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Скорость, м/ч., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rop_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Скорость, м/ч., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Скорость, м/ч., Вниз");
migrationBuilder.AlterColumn<int>(
name: "reaming3_repetitions_count",
table: "t_process_map_plan_reaming_slide",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "Проработка 3, Количество повторений, шт.",
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true,
oldComment: "Проработка 3, Количество повторений, шт.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_interval",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Интервал проработки, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Интервал проработки, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_flow_rate_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Расход, л/с., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Расход, л/с., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_flow_rate_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Расход, л/с., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Расход, л/с., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming2_stop_point_off_bottom",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Остановка над забоем, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Остановка над забоем, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rpm_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Обороты, об/мин., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Обороты, об/мин., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rpm_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Обороты, об/мин., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Обороты, об/мин., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rop_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Скорость, м/ч., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Скорость, м/ч., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rop_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Скорость, м/ч., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Скорость, м/ч., Вниз");
migrationBuilder.AlterColumn<int>(
name: "reaming2_repetitions_count",
table: "t_process_map_plan_reaming_slide",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "Проработка 2, Количество повторений, шт.",
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true,
oldComment: "Проработка 2, Количество повторений, шт.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_interval",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Интервал проработки, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Интервал проработки, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_flow_rate_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Расход, л/с., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Расход, л/с., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_flow_rate_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Расход, л/с., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Расход, л/с., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming3_stop_point_off_bottom",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Остановка над забоем, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Остановка над забоем, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rpm_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Обороты, об/мин., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Обороты, об/мин., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rpm_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Обороты, об/мин., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Обороты, об/мин., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rop_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Скорость, м/ч., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Скорость, м/ч., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rop_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Скорость, м/ч., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Скорость, м/ч., Вниз");
migrationBuilder.AlterColumn<int>(
name: "reaming3_repetitions_count",
table: "t_process_map_plan_operation_reaming_rotor",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "Проработка 3, Количество повторений, шт.",
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true,
oldComment: "Проработка 3, Количество повторений, шт.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_interval",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Интервал проработки, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Интервал проработки, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_flow_rate_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Расход, л/с., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Расход, л/с., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_flow_rate_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 3, Расход, л/с., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 3, Расход, л/с., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming2_stop_point_off_bottom",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Остановка над забоем, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Остановка над забоем, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rpm_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Обороты, об/мин., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Обороты, об/мин., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rpm_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Обороты, об/мин., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Обороты, об/мин., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rop_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Скорость, м/ч., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Скорость, м/ч., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rop_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Скорость, м/ч., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Скорость, м/ч., Вниз");
migrationBuilder.AlterColumn<int>(
name: "reaming2_repetitions_count",
table: "t_process_map_plan_operation_reaming_rotor",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "Проработка 2, Количество повторений, шт.",
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true,
oldComment: "Проработка 2, Количество повторений, шт.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_interval",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Интервал проработки, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Интервал проработки, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_flow_rate_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Расход, л/с., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Расход, л/с., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_flow_rate_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Проработка 2, Расход, л/с., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldNullable: true,
oldComment: "Проработка 2, Расход, л/с., Вниз");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<double>(
name: "reaming3_stop_point_off_bottom",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Остановка над забоем, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Остановка над забоем, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rpm_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 3, Обороты, об/мин., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Обороты, об/мин., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rpm_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 3, Обороты, об/мин., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Обороты, об/мин., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rop_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 3, Скорость, м/ч., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Скорость, м/ч., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rop_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 3, Скорость, м/ч., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Скорость, м/ч., Вниз");
migrationBuilder.AlterColumn<int>(
name: "reaming3_repetitions_count",
table: "t_process_map_plan_reaming_slide",
type: "integer",
nullable: true,
comment: "Проработка 3, Количество повторений, шт.",
oldClrType: typeof(int),
oldType: "integer",
oldComment: "Проработка 3, Количество повторений, шт.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_interval",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 3, Интервал проработки, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Интервал проработки, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_flow_rate_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 3, Расход, л/с., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Расход, л/с., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_flow_rate_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 3, Расход, л/с., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Расход, л/с., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming2_stop_point_off_bottom",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Остановка над забоем, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Остановка над забоем, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rpm_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 2, Обороты, об/мин., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Обороты, об/мин., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rpm_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 2, Обороты, об/мин., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Обороты, об/мин., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rop_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 2, Скорость, м/ч., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Скорость, м/ч., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rop_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 2, Скорость, м/ч., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Скорость, м/ч., Вниз");
migrationBuilder.AlterColumn<int>(
name: "reaming2_repetitions_count",
table: "t_process_map_plan_reaming_slide",
type: "integer",
nullable: true,
comment: "Проработка 2, Количество повторений, шт.",
oldClrType: typeof(int),
oldType: "integer",
oldComment: "Проработка 2, Количество повторений, шт.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_interval",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 2, Интервал проработки, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Интервал проработки, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_flow_rate_up",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 2, Расход, л/с., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Расход, л/с., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_flow_rate_down",
table: "t_process_map_plan_reaming_slide",
type: "double precision",
nullable: true,
comment: "Проработка 2, Расход, л/с., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Расход, л/с., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming3_stop_point_off_bottom",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Остановка над забоем, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Остановка над забоем, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rpm_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 3, Обороты, об/мин., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Обороты, об/мин., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rpm_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 3, Обороты, об/мин., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Обороты, об/мин., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rop_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 3, Скорость, м/ч., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Скорость, м/ч., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_rop_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 3, Скорость, м/ч., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Скорость, м/ч., Вниз");
migrationBuilder.AlterColumn<int>(
name: "reaming3_repetitions_count",
table: "t_process_map_plan_operation_reaming_rotor",
type: "integer",
nullable: true,
comment: "Проработка 3, Количество повторений, шт.",
oldClrType: typeof(int),
oldType: "integer",
oldComment: "Проработка 3, Количество повторений, шт.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_interval",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 3, Интервал проработки, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Интервал проработки, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming3_flow_rate_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 3, Расход, л/с., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Расход, л/с., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming3_flow_rate_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 3, Расход, л/с., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 3, Расход, л/с., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming2_stop_point_off_bottom",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Остановка над забоем, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Остановка над забоем, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rpm_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 2, Обороты, об/мин., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Обороты, об/мин., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rpm_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 2, Обороты, об/мин., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Обороты, об/мин., Вниз");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rop_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 2, Скорость, м/ч., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Скорость, м/ч., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_rop_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 2, Скорость, м/ч., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Скорость, м/ч., Вниз");
migrationBuilder.AlterColumn<int>(
name: "reaming2_repetitions_count",
table: "t_process_map_plan_operation_reaming_rotor",
type: "integer",
nullable: true,
comment: "Проработка 2, Количество повторений, шт.",
oldClrType: typeof(int),
oldType: "integer",
oldComment: "Проработка 2, Количество повторений, шт.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_interval",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 2, Интервал проработки, м.",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Интервал проработки, м.");
migrationBuilder.AlterColumn<double>(
name: "reaming2_flow_rate_up",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 2, Расход, л/с., Вверх",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Расход, л/с., Вверх");
migrationBuilder.AlterColumn<double>(
name: "reaming2_flow_rate_down",
table: "t_process_map_plan_operation_reaming_rotor",
type: "double precision",
nullable: true,
comment: "Проработка 2, Расход, л/с., Вниз",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Проработка 2, Расход, л/с., Вниз");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,158 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
/// <inheritdoc />
public partial class Update_WellSectionType_Order : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 1,
column: "order",
value: 5f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 5,
column: "order",
value: 4f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 7,
column: "order",
value: 5.1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 11,
column: "order",
value: 4.1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 13,
column: "order",
value: 5.2f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 17,
column: "order",
value: 4.2f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 19,
column: "order",
value: 5.3f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 23,
column: "order",
value: 4.3f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 25,
column: "order",
value: 5.4f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 29,
column: "order",
value: 4.4f);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 1,
column: "order",
value: 4f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 5,
column: "order",
value: 5f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 7,
column: "order",
value: 4.1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 11,
column: "order",
value: 5.1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 13,
column: "order",
value: 4.2f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 17,
column: "order",
value: 5.2f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 19,
column: "order",
value: 4.3f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 23,
column: "order",
value: 5.3f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 25,
column: "order",
value: 4.4f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 29,
column: "order",
value: 5.4f);
}
}
}

View File

@ -1,4 +1,4 @@
// <auto-generated />
// <auto-generated />
using System;
using System.Text.Json;
using AsbCloudDb.Model;
@ -2785,7 +2785,6 @@ namespace AsbCloudDb.Migrations
.HasComment("Тип секции");
b.Property<string>("Note")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("note")
@ -2875,7 +2874,6 @@ namespace AsbCloudDb.Migrations
.HasComment("Тип секции");
b.Property<string>("Note")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("note")
@ -2970,7 +2968,6 @@ namespace AsbCloudDb.Migrations
.HasComment("Величина проходки шага, м.");
b.Property<string>("Note")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("note")
@ -3080,7 +3077,6 @@ namespace AsbCloudDb.Migrations
.HasComment("Режим Авто/Руч");
b.Property<string>("Note")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("note")
@ -3200,7 +3196,6 @@ namespace AsbCloudDb.Migrations
.HasComment("Тип секции");
b.Property<string>("Note")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("note")
@ -3750,7 +3745,6 @@ namespace AsbCloudDb.Migrations
.HasComment("Тип секции");
b.Property<string>("Note")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("note")
@ -3995,7 +3989,6 @@ namespace AsbCloudDb.Migrations
.HasComment("Тип секции");
b.Property<string>("Note")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("note")
@ -4026,8 +4019,8 @@ namespace AsbCloudDb.Migrations
.HasColumnName("reaming1_interval")
.HasComment("Проработка 1, Интервал проработки, м.");
b.Property<double>("Reaming1RepetitionsCount")
.HasColumnType("double precision")
b.Property<int>("Reaming1RepetitionsCount")
.HasColumnType("integer")
.HasColumnName("reaming1_repetitions_count")
.HasComment("Проработка 1. Количество повторений, шт.");
@ -4071,8 +4064,8 @@ namespace AsbCloudDb.Migrations
.HasColumnName("reaming2_interval")
.HasComment("Проработка 2, Интервал проработки, м.");
b.Property<double>("Reaming2RepetitionsCount")
.HasColumnType("double precision")
b.Property<int>("Reaming2RepetitionsCount")
.HasColumnType("integer")
.HasColumnName("reaming2_repetitions_count")
.HasComment("Проработка 2, Количество повторений, шт.");
@ -4116,8 +4109,8 @@ namespace AsbCloudDb.Migrations
.HasColumnName("reaming3_interval")
.HasComment("Проработка 3, Интервал проработки, м.");
b.Property<double>("Reaming3RepetitionsCount")
.HasColumnType("double precision")
b.Property<int>("Reaming3RepetitionsCount")
.HasColumnType("integer")
.HasColumnName("reaming3_repetitions_count")
.HasComment("Проработка 3, Количество повторений, шт.");
@ -9552,7 +9545,7 @@ namespace AsbCloudDb.Migrations
{
Id = 1,
Caption = "Пилотный ствол",
Order = 4f
Order = 5f
},
new
{
@ -9576,7 +9569,7 @@ namespace AsbCloudDb.Migrations
{
Id = 5,
Caption = "Транспортный ствол",
Order = 5f
Order = 4f
},
new
{
@ -9588,7 +9581,7 @@ namespace AsbCloudDb.Migrations
{
Id = 7,
Caption = "Пилотный ствол 2",
Order = 4.1f
Order = 5.1f
},
new
{
@ -9612,7 +9605,7 @@ namespace AsbCloudDb.Migrations
{
Id = 11,
Caption = "Транспортный ствол 2",
Order = 5.1f
Order = 4.1f
},
new
{
@ -9624,7 +9617,7 @@ namespace AsbCloudDb.Migrations
{
Id = 13,
Caption = "Пилотный ствол 3",
Order = 4.2f
Order = 5.2f
},
new
{
@ -9648,7 +9641,7 @@ namespace AsbCloudDb.Migrations
{
Id = 17,
Caption = "Транспортный ствол 3",
Order = 5.2f
Order = 4.2f
},
new
{
@ -9660,7 +9653,7 @@ namespace AsbCloudDb.Migrations
{
Id = 19,
Caption = "Пилотный ствол 4",
Order = 4.3f
Order = 5.3f
},
new
{
@ -9684,7 +9677,7 @@ namespace AsbCloudDb.Migrations
{
Id = 23,
Caption = "Транспортный ствол 4",
Order = 5.3f
Order = 4.3f
},
new
{
@ -9696,7 +9689,7 @@ namespace AsbCloudDb.Migrations
{
Id = 25,
Caption = "Пилотный ствол 5",
Order = 4.4f
Order = 5.4f
},
new
{
@ -9720,7 +9713,7 @@ namespace AsbCloudDb.Migrations
{
Id = 29,
Caption = "Транспортный ствол 5",
Order = 5.4f
Order = 4.4f
},
new
{

View File

@ -4,39 +4,39 @@ namespace AsbCloudDb.Model.DefaultData
{
public override WellSectionType[] GetData() => new WellSectionType[]
{
new (){ Id = 1, Caption = "Пилотный ствол", Order = 4},
new (){ Id = 1, Caption = "Пилотный ствол", Order = 5},
new (){ Id = 2, Caption = "Направление", Order = 0},
new (){ Id = 3, Caption = "Кондуктор", Order = 1},
new (){ Id = 4, Caption = "Эксплуатационная колонна", Order = 3},
new (){ Id = 5, Caption = "Транспортный ствол", Order = 5},
new (){ Id = 5, Caption = "Транспортный ствол", Order = 4},
new (){ Id = 6, Caption = "Хвостовик", Order = 6},
new (){ Id = 7, Caption = "Пилотный ствол 2", Order = 4.1f},
new (){ Id = 7, Caption = "Пилотный ствол 2", Order = 5.1f},
new (){ Id = 8, Caption = "Направление 2", Order = 0.1f},
new (){ Id = 9, Caption = "Кондуктор 2", Order = 1.1f},
new (){ Id = 10, Caption = "Эксплуатационная колонна 2", Order = 3.1f},
new (){ Id = 11, Caption = "Транспортный ствол 2", Order = 5.1f},
new (){ Id = 11, Caption = "Транспортный ствол 2", Order = 4.1f},
new (){ Id = 12, Caption = "Хвостовик 2", Order = 6.1f},
new (){ Id = 13, Caption = "Пилотный ствол 3", Order = 4.2f},
new (){ Id = 13, Caption = "Пилотный ствол 3", Order = 5.2f},
new (){ Id = 14, Caption = "Направление 3", Order = 0.2f},
new (){ Id = 15, Caption = "Кондуктор 3", Order = 1.2f},
new (){ Id = 16, Caption = "Эксплуатационная колонна 3", Order = 3.2f},
new (){ Id = 17, Caption = "Транспортный ствол 3", Order = 5.2f},
new (){ Id = 17, Caption = "Транспортный ствол 3", Order = 4.2f},
new (){ Id = 18, Caption = "Хвостовик 3", Order = 6.2f},
new (){ Id = 19, Caption = "Пилотный ствол 4", Order = 4.3f},
new (){ Id = 19, Caption = "Пилотный ствол 4", Order = 5.3f},
new (){ Id = 20, Caption = "Направление 4", Order = 0.3f},
new (){ Id = 21, Caption = "Кондуктор 4", Order = 1.3f},
new (){ Id = 22, Caption = "Эксплуатационная колонна 4", Order = 3.3f},
new (){ Id = 23, Caption = "Транспортный ствол 4", Order = 5.3f},
new (){ Id = 23, Caption = "Транспортный ствол 4", Order = 4.3f},
new (){ Id = 24, Caption = "Хвостовик 4", Order = 6.3f},
new (){ Id = 25, Caption = "Пилотный ствол 5", Order = 4.4f},
new (){ Id = 25, Caption = "Пилотный ствол 5", Order = 5.4f},
new (){ Id = 26, Caption = "Направление 5", Order = 0.4f},
new (){ Id = 27, Caption = "Кондуктор 5", Order = 1.4f},
new (){ Id = 28, Caption = "Эксплуатационная колонна 5", Order = 3.4f},
new (){ Id = 29, Caption = "Транспортный ствол 5", Order = 5.4f},
new (){ Id = 29, Caption = "Транспортный ствол 5", Order = 4.4f},
new (){ Id = 30, Caption = "Хвостовик 5", Order = 6.4f},
new (){ Id = 31, Caption = "Техническая колонна", Order = 2},

View File

@ -14,7 +14,7 @@ public class ProcessMapPlanAutoHoldTF : ProcessMapPlanBase
public double ZenithAngle { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanAutoHoldTF? Previous { get; set; }

View File

@ -14,7 +14,7 @@ public class ProcessMapPlanDamper : ProcessMapPlanBase
public double StickSlip { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanDamper? Previous { get; set; }

View File

@ -34,7 +34,7 @@ public class ProcessMapPlanDrillTest : ProcessMapPlanBase
public double LengthStep { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanDrillTest? Previous { get; set; }

View File

@ -39,7 +39,7 @@ public class ProcessMapPlanOscillation : ProcessMapPlanBase
public int Mode { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanOscillation? Previous { get; set; }

View File

@ -39,7 +39,7 @@ public class ProcessMapPlanShockTest : ProcessMapPlanBase
public double RpmMin { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanShockTest? Previous { get; set; }

View File

@ -80,78 +80,96 @@ public class ProcessMapPlanReamingRotor : ProcessMapPlanBase
[Column("reaming2_repetitions_count"), Comment("Проработка 2, Количество повторений, шт.")]
[Range(0, 99)]
[Required]
public int Reaming2RepetitionsCount { get; set; }
[Column("reaming2_rop_up"), Comment("Проработка 2, Скорость, м/ч., Вверх")]
[Range(0.0, 999.0)]
[Required]
public double Reaming2RopUp { get; set; }
[Column("reaming2_rop_down"), Comment("Проработка 2, Скорость, м/ч., Вниз")]
[Range(0.0, 999.0)]
[Required]
public double Reaming2RopDown { get; set; }
[Column("reaming2_rpm_up"), Comment("Проработка 2, Обороты, об/мин., Вверх")]
[Range(0.0, 270.0)]
[Required]
public double Reaming2RpmUp { get; set; }
[Column("reaming2_rpm_down"), Comment("Проработка 2, Обороты, об/мин., Вниз")]
[Range(0.0, 270.0)]
[Required]
public double Reaming2RpmDown { get; set; }
[Column("reaming2_flow_rate_up"), Comment("Проработка 2, Расход, л/с., Вверх")]
[Range(0.0, 100.0)]
[Required]
public double Reaming2FlowRateUp { get; set; }
[Column("reaming2_flow_rate_down"), Comment("Проработка 2, Расход, л/с., Вниз")]
[Range(0.0, 100.0)]
[Required]
public double Reaming2FlowRateDown { get; set; }
[Column("reaming2_interval"), Comment("Проработка 2, Интервал проработки, м.")]
[Range(0.0, 30.0)]
[Required]
public double Reaming2Interval { get; set; }
[Column("reaming2_stop_point_off_bottom"), Comment("Остановка над забоем, м.")]
[Range(0.0, 10.0)]
[Required]
public double Reaming2StopPointOffBottom { get; set; }
[Column("reaming3_repetitions_count"), Comment("Проработка 3, Количество повторений, шт.")]
[Range(0, 99)]
[Required]
public int Reaming3RepetitionsCount { get; set; }
[Column("reaming3_rop_up"), Comment("Проработка 3, Скорость, м/ч., Вверх")]
[Range(0.0, 999.0)]
[Required]
public double Reaming3RopUp { get; set; }
[Column("reaming3_rop_down"), Comment("Проработка 3, Скорость, м/ч., Вниз")]
[Range(0.0, 999.0)]
[Required]
public double Reaming3RopDown { get; set; }
[Column("reaming3_rpm_up"), Comment("Проработка 3, Обороты, об/мин., Вверх")]
[Range(0.0, 270.0)]
[Required]
public double Reaming3RpmUp { get; set; }
[Column("reaming3_rpm_down"), Comment("Проработка 3, Обороты, об/мин., Вниз")]
[Range(0.0, 270.0)]
[Required]
public double Reaming3RpmDown { get; set; }
[Column("reaming3_flow_rate_up"), Comment("Проработка 3, Расход, л/с., Вверх")]
[Range(0.0, 100.0)]
[Required]
public double Reaming3FlowRateUp { get; set; }
[Column("reaming3_flow_rate_down"), Comment("Проработка 3, Расход, л/с., Вниз")]
[Range(0.0, 100.0)]
[Required]
public double Reaming3FlowRateDown { get; set; }
[Column("reaming3_interval"), Comment("Проработка 3, Интервал проработки, м.")]
[Range(0.0, 30.0)]
[Required]
public double Reaming3Interval { get; set; }
[Column("reaming3_stop_point_off_bottom"), Comment("Остановка над забоем, м.")]
[Range(0.0, 10.0)]
[Required]
public double Reaming3StopPointOffBottom { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanReamingRotor? Previous { get; set; }

View File

@ -36,7 +36,7 @@ public class ProcessMapPlanReamingSlide : ProcessMapPlanBase
[Column("reaming1_repetitions_count"), Comment("Проработка 1. Количество повторений, шт.")]
[Range(0.0, 99.0)]
[Required]
public double Reaming1RepetitionsCount { get; set; }
public int Reaming1RepetitionsCount { get; set; }
[Column("reaming1_rop_up"), Comment("Проработка 1. Скорость вверх, м/ч.")]
[Range(0.0, 999.0)]
@ -80,78 +80,96 @@ public class ProcessMapPlanReamingSlide : ProcessMapPlanBase
[Column("reaming2_repetitions_count"), Comment("Проработка 2, Количество повторений, шт.")]
[Range(0.0, 99.0)]
public double Reaming2RepetitionsCount { get; set; }
[Required]
public int Reaming2RepetitionsCount { get; set; }
[Column("reaming2_rop_up"), Comment("Проработка 2, Скорость, м/ч., Вверх")]
[Range(0.0, 999.0)]
[Required]
public double Reaming2RopUp { get; set; }
[Column("reaming2_rop_down"), Comment("Проработка 2, Скорость, м/ч., Вниз")]
[Range(0.0, 999.0)]
[Required]
public double Reaming2RopDown { get; set; }
[Column("reaming2_rpm_up"), Comment("Проработка 2, Обороты, об/мин., Вверх")]
[Range(0.0, 270.0)]
[Required]
public double Reaming2RpmUp { get; set; }
[Column("reaming2_rpm_down"), Comment("Проработка 2, Обороты, об/мин., Вниз")]
[Range(0.0, 270.0)]
[Required]
public double Reaming2RpmDown { get; set; }
[Column("reaming2_flow_rate_up"), Comment("Проработка 2, Расход, л/с., Вверх")]
[Range(0.0, 100.0)]
[Required]
public double Reaming2FlowRateUp { get; set; }
[Column("reaming2_flow_rate_down"), Comment("Проработка 2, Расход, л/с., Вниз")]
[Range(0.0, 100.0)]
[Required]
public double Reaming2FlowRateDown { get; set; }
[Column("reaming2_interval"), Comment("Проработка 2, Интервал проработки, м.")]
[Range(0.0, 30.0)]
[Required]
public double Reaming2Interval { get; set; }
[Column("reaming2_stop_point_off_bottom"), Comment("Остановка над забоем, м.")]
[Range(0.0, 10.0)]
[Required]
public double Reaming2StopPointOffBottom { get; set; }
[Column("reaming3_repetitions_count"), Comment("Проработка 3, Количество повторений, шт.")]
[Range(0.0, 99.0)]
public double Reaming3RepetitionsCount { get; set; }
[Required]
public int Reaming3RepetitionsCount { get; set; }
[Column("reaming3_rop_up"), Comment("Проработка 3, Скорость, м/ч., Вверх")]
[Range(0.0, 999.0)]
[Required]
public double Reaming3RopUp { get; set; }
[Column("reaming3_rop_down"), Comment("Проработка 3, Скорость, м/ч., Вниз")]
[Range(0.0, 999.0)]
[Required]
public double Reaming3RopDown { get; set; }
[Column("reaming3_rpm_up"), Comment("Проработка 3, Обороты, об/мин., Вверх")]
[Range(0.0, 270.0)]
[Required]
public double Reaming3RpmUp { get; set; }
[Column("reaming3_rpm_down"), Comment("Проработка 3, Обороты, об/мин., Вниз")]
[Range(0.0, 270.0)]
[Required]
public double Reaming3RpmDown { get; set; }
[Column("reaming3_flow_rate_up"), Comment("Проработка 3, Расход, л/с., Вверх")]
[Range(0.0, 100.0)]
[Required]
public double Reaming3FlowRateUp { get; set; }
[Column("reaming3_flow_rate_down"), Comment("Проработка 3, Расход, л/с., Вниз")]
[Range(0.0, 100.0)]
[Required]
public double Reaming3FlowRateDown { get; set; }
[Column("reaming3_interval"), Comment("Проработка 3, Интервал проработки, м.")]
[Range(0.0, 30.0)]
[Required]
public double Reaming3Interval { get; set; }
[Column("reaming3_stop_point_off_bottom"), Comment("Остановка над забоем, м.")]
[Range(0.0, 10.0)]
[Required]
public double Reaming3StopPointOffBottom { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
public string? Note { get; set; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanReamingSlide? Previous { get; set; }

View File

@ -493,6 +493,8 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellboreService, WellboreService>();
services.AddTransient<ITelemetryDataEditorService, TelemetryDataEditorService>();
services.AddTransient<DetectedOperationExportService>();
services.AddTransient<IDailyReportService, DailyReportService>();

View File

@ -1,5 +1,6 @@
using AsbCloudApp.Data;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Mapster;
@ -81,5 +82,32 @@ namespace AsbCloudInfrastructure.Repository
return entity;
}
private IQueryable<DataSaubStat> BuildQuery(TelemetryPartDeleteRequest request)
{
var query = db.Set<DataSaubStat>()
.Where(o => o.IdTelemetry == request.IdTelemetry);
if (request.LeDate is not null)
{
var leDate = request.LeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateStart <= leDate);
}
if (request.GeDate is not null)
{
var geDate = request.GeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateEnd >= geDate);
}
return query;
}
public async Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
{
var query = BuildQuery(request);
db.Set<DataSaubStat>().RemoveRange(query);
return await db.SaveChangesAsync(token);
}
}
}

View File

@ -15,7 +15,8 @@ using AsbCloudApp.Data;
namespace AsbCloudInfrastructure.Repository;
public class DetectedOperationRepository : CrudRepositoryBase<DetectedOperationDto, DetectedOperation>, IDetectedOperationRepository
public class DetectedOperationRepository
: CrudRepositoryBase<DetectedOperationDto, DetectedOperation>, IDetectedOperationRepository
{
private readonly ITelemetryService telemetryService;
@ -55,6 +56,13 @@ public class DetectedOperationRepository : CrudRepositoryBase<DetectedOperationD
return await dbContext.SaveChangesAsync(token);
}
public async Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
{
var query = BuildQuery(request);
dbContext.Set<DetectedOperation>().RemoveRange(query);
return await dbContext.SaveChangesAsync(token);
}
public async Task<PaginationContainer<DetectedOperationDto>> GetPageAsync(DetectedOperationByTelemetryRequest request, CancellationToken token)
{
var skip = request.Skip ?? 0;
@ -124,7 +132,27 @@ public class DetectedOperationRepository : CrudRepositoryBase<DetectedOperationD
return query;
}
private IQueryable<DetectedOperation> BuildQuery(TelemetryPartDeleteRequest request)
{
var query = dbContext.Set<DetectedOperation>()
.Where(o => o.IdTelemetry == request.IdTelemetry);
if (request.LeDate is not null)
{
var leDate = request.LeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateStart <= leDate);
}
if (request.GeDate is not null)
{
var geDate = request.GeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateEnd >= geDate);
}
return query;
}
private static DetectedOperationDto Convert(DetectedOperation src, TimeSpan offset)
{
var dto = src.Adapt<DetectedOperationDto>();

View File

@ -84,5 +84,33 @@ namespace AsbCloudInfrastructure.Repository
dto.TimeStampStart = dto.TimeStampStart.ToRemoteDateTime(dto.Telemetry?.TimeZone?.Hours ?? 0);
return dto;
}
//TODO: Унифицировать модели данных телеметрии.Чтобы в будущем унифицировать репозитории данных телеметрии.
private IQueryable<DrillTest> BuildQuery(TelemetryPartDeleteRequest request)
{
var query = db.Set<DrillTest>()
.Where(o => o.IdTelemetry == request.IdTelemetry);
if (request.LeDate is not null)
{
var leDate = request.LeDate.Value.ToUniversalTime();
query = query.Where(o => o.TimeStampStart <= leDate);
}
if (request.GeDate is not null)
{
var geDate = request.GeDate.Value.ToUniversalTime();
query = query.Where(o => o.TimeStampStart >= geDate);
}
return query;
}
public async Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
{
var query = BuildQuery(request);
db.Set<DrillTest>().RemoveRange(query);
return await db.SaveChangesAsync(token);
}
}
}

View File

@ -1,9 +1,13 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.GTR;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb;
using AsbCloudDb.Model;
using AsbCloudDb.Model.GTR;
using Mapster;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Concurrent;
@ -12,11 +16,6 @@ using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Requests;
using Mapster;
using AsbCloudApp.Data;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudInfrastructure.Repository
{
@ -87,7 +86,7 @@ namespace AsbCloudInfrastructure.Repository
public async Task<DatesRangeDto?> GetRangeAsync(int idWell, DateTimeOffset? geDate, DateTimeOffset? leDate, CancellationToken token)
{
var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell);
if (telemetry is null)
return null;
@ -109,7 +108,7 @@ namespace AsbCloudInfrastructure.Repository
});
var range = await groupedQuery.FirstOrDefaultAsync(token);
if (range is null)
if (range is null)
return null;
var result = new DatesRangeDto
@ -121,16 +120,16 @@ namespace AsbCloudInfrastructure.Repository
}
private async Task<IEnumerable<GtrWitsDto>> GetAsync<TEntity, TType>(int idWell, GtrRequest request, CancellationToken token)
where TEntity : WitsItemBase<TType>
where TEntity : WitsItemBase<TType>
where TType : notnull
{
var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell);
if (telemetry is null)
return Enumerable.Empty<GtrWitsDto>();
if (telemetry.TimeZone is null)
throw new ArgumentInvalidException(nameof(idWell),$"Telemetry id: {telemetry.Id} can't find timezone");
throw new ArgumentInvalidException(nameof(idWell), $"Telemetry id: {telemetry.Id} can't find timezone");
var query = BuildQuery<TEntity, TType>(telemetry.Id, request);
@ -147,7 +146,7 @@ namespace AsbCloudInfrastructure.Repository
var interval = TimeSpan.FromSeconds(10);
var timezoneOffset = TimeSpan.FromHours(telemetry.TimeZone.Hours);
var dtos = entities
.GroupBy(e => e.DateTime.Ticks / interval.Ticks)
.Select(groupByInterval =>
@ -166,9 +165,9 @@ namespace AsbCloudInfrastructure.Repository
}
private IQueryable<TEntity> BuildQuery<TEntity, TType>(int idTelemetry, GtrRequest request)
where TEntity : WitsItemBase<TType>
where TEntity : WitsItemBase<TType>
where TType : notnull
{
{
var query = db.Set<TEntity>()
.Where(e => e.IdTelemetry == idTelemetry);
@ -183,9 +182,9 @@ namespace AsbCloudInfrastructure.Repository
else
{
var lastDate = query
.OrderBy(e=>e.DateTime)
.OrderBy(e => e.DateTime)
.LastOrDefault()
?.DateTime
?.DateTime
?? DateTimeOffset.UtcNow;
var dateBegin = lastDate.AddSeconds(-request.IntervalSec);
var dateEnd = lastDate;
@ -329,10 +328,10 @@ namespace AsbCloudInfrastructure.Repository
var dateTime = record.Date.ToUtcDateTimeOffset(timezoneHours);
foreach (var item in record.Items)
{
if (cacheTelemetryItems?.TryGetValue((record.Id, item.Key), out var cacheItem) == true)
if (cacheTelemetryItems?.TryGetValue((record.Id, item.Key), out var cacheItem) == true)
if (Math.Abs((dateTime - cacheItem.Date).TotalSeconds) < 1)
continue;
continue;
if (item.Value.Value is string valueString)
{
var entity = MakeEntity<WitsItemString, string>(record.Id, item.Key, idTelemetry, dateTime, valueString);
@ -362,14 +361,15 @@ namespace AsbCloudInfrastructure.Repository
if (ints.Any())
await db.Database.ExecInsertOrIgnoreAsync(db.Set<WitsItemInt>(), ints, token);
}
catch(Exception ex)
catch (Exception ex)
{
Trace.TraceError("Exception while saving GTR Wits data", ex);
}
cache.AddOrUpdate(idTelemetry,
(_) => MakeNewCache(dtos),
(_, oldItemsDictionary) => {
(_, oldItemsDictionary) =>
{
foreach (var record in dtos)
foreach (var item in record.Items)
{
@ -398,7 +398,8 @@ namespace AsbCloudInfrastructure.Repository
{
var items = dtos.SelectMany(record =>
record.Items.Select(
item => new WitsItemRecordDto {
item => new WitsItemRecordDto
{
IdItem = item.Key,
IdRecord = record.Id,
Date = record.Date,
@ -409,7 +410,7 @@ namespace AsbCloudInfrastructure.Repository
.GroupBy(item => (item.IdRecord, item.IdItem));
var pairs = groups.Select(group => new KeyValuePair<(int, int), WitsItemRecordDto>(
group.Key,
group.Key,
group.OrderByDescending(item => item.Date).First()));
return new ConcurrentDictionary<(int, int), WitsItemRecordDto>(pairs);
@ -439,6 +440,47 @@ namespace AsbCloudInfrastructure.Repository
Value = (TValue)dto.Value.Value,
};
private IQueryable<TEntity> BuildQuery<TEntity, TValue>(TelemetryPartDeleteRequest request)
where TEntity : WitsItemBase<TValue>
where TValue : notnull
{
var query = db.Set<TEntity>().Where(i => i.IdTelemetry == request.IdTelemetry);
if (request.LeDate is not null)
{
var leDate = request.LeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateTime <= leDate);
}
if (request.GeDate is not null)
{
var geDate = request.GeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateTime >= geDate);
}
return query;
}
public async Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
{
var result = 0;
result += await DeleteAsync<WitsItemFloat, float>(request, token);
result += await DeleteAsync<WitsItemInt, int>(request, token);
result += await DeleteAsync<WitsItemString, string>(request, token);
return result;
}
private async Task<int> DeleteAsync<TEntity, TType>(TelemetryPartDeleteRequest request, CancellationToken token)
where TEntity : WitsItemBase<TType>
where TType : notnull
{
var query = BuildQuery<TEntity, TType>(request);
db.Set<TEntity>().RemoveRange(query);
return await db.SaveChangesAsync(token);
}
private class WitsRequest
{
public int IdTelemetry { get; set; }

View File

@ -17,10 +17,17 @@ namespace AsbCloudInfrastructure.Repository
private readonly IAsbCloudDbContext context;
public LimitingParameterRepository(IAsbCloudDbContext context)
{
{
this.context = context;
}
public async Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
{
var query = BuildQuery(request);
context.Set<LimitingParameter>().RemoveRange(query);
return await context.SaveChangesAsync(token);
}
public async Task<IEnumerable<LimitingParameterDataDto>> GetLimitingParametersAsync(LimitingParameterRequest request, WellDto wellDto, CancellationToken token)
{
var timezoneOffset = wellDto.Timezone.Hours;
@ -74,6 +81,26 @@ namespace AsbCloudInfrastructure.Repository
return query;
}
private IQueryable<LimitingParameter> BuildQuery(TelemetryPartDeleteRequest request)
{
var query = context.Set<LimitingParameter>()
.Where(o => o.IdTelemetry == request.IdTelemetry);
if (request.LeDate is not null)
{
var leDate = request.LeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateStart <= leDate);
}
if (request.GeDate is not null)
{
var geDate = request.GeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateEnd >= geDate);
}
return query;
}
}
}

View File

@ -1,3 +1,4 @@
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Mapster;
@ -20,7 +21,7 @@ namespace AsbCloudInfrastructure.Repository
private readonly IAsbCloudDbContext db;
private readonly ITelemetryService telemetryService;
private static readonly ConcurrentDictionary<int, TDto> cache = new ();
private static readonly ConcurrentDictionary<int, TDto> cache = new();
public WitsRecordRepository(IAsbCloudDbContext db, ITelemetryService telemetryService)
{
@ -58,6 +59,33 @@ namespace AsbCloudInfrastructure.Repository
return data.Select(d => Convert(d, timezoneHours));
}
private IQueryable<TEntity> BuildQuery(TelemetryPartDeleteRequest request)
{
var query = db.Set<TEntity>()
.Where(o => o.IdTelemetry == request.IdTelemetry);
if (request.LeDate is not null)
{
var leDate = request.LeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateTime <= leDate);
}
if (request.GeDate is not null)
{
var geDate = request.GeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateTime >= geDate);
}
return query;
}
public async Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
{
var query = BuildQuery(request);
dbset.RemoveRange(query);
return await db.SaveChangesAsync(token);
}
public TDto? GetLastOrDefault(int idTelemetry)
=> cache.GetValueOrDefault(idTelemetry);
@ -66,7 +94,7 @@ namespace AsbCloudInfrastructure.Repository
if (!dtos.Any())
return;
cache.AddOrUpdate(idTelemetry, dtos.Last(), (_,_) => dtos.OrderBy(r => r.DateTime).Last());
cache.AddOrUpdate(idTelemetry, dtos.Last(), (_, _) => dtos.OrderBy(r => r.DateTime).Last());
var timezoneHours = telemetryService.GetTimezone(idTelemetry).Hours;
var entities = dtos
@ -81,7 +109,7 @@ namespace AsbCloudInfrastructure.Repository
.Select(e => e.DateTime)
.OrderBy(d => d)
.ToArrayAsync(token);
foreach (var entity in entities)
{
if (!existingEntities.Any(e => e == entity.DateTime))
@ -101,9 +129,9 @@ namespace AsbCloudInfrastructure.Repository
(dt.Millisecond + random.Next(1, 283)) % 1000,
dt.Offset);
dbset.Add(entity);
}
}
}
await db.SaveChangesAsync(token);
}
@ -126,8 +154,8 @@ namespace AsbCloudInfrastructure.Repository
{
var entity = dto.Adapt<TEntity>();
entity.Recid = GetRecId(dto);
entity.IdTelemetry = idTelemetry;
entity.DateTime = dto.DateTime.ToUtcDateTimeOffset(timezoneHours);
entity.IdTelemetry = idTelemetry;
entity.DateTime = dto.DateTime.ToUtcDateTimeOffset(timezoneHours);
return entity;
}

View File

@ -8,9 +8,9 @@ public class ProcessMapPlanAntiCrashRotationTemplate : ITemplateParameters
{
public string SheetName => "Противоаварийное вращение";
public int HeaderRowsCount => 3;
public int HeaderRowsCount => 2;
public string FileName => "ProcessMapPlanAntiCrashRotation.xlsx";
public string FileName => "ProcessMapPlanAnticrashRotation.xlsx";
public IDictionary<string, Cell> Cells => new Dictionary<string, Cell>
{

View File

@ -5,7 +5,7 @@ namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlan
public class ProcessMapPlanDrillTestTemplate : ITemplateParameters
{
public string SheetName => "Дрилтест";
public string SheetName => "DrillTest";
public int HeaderRowsCount => 2;

View File

@ -6,9 +6,9 @@ namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlan
public class ProcessMapPlanReamingRotorTemplate : ITemplateParameters
{
public string SheetName => "Проработка ротор";
public string SheetName => "Проработка для ротора";
public int HeaderRowsCount => 2;
public int HeaderRowsCount => 3;
public string FileName => "ProcessMapPlanReamingRotor.xlsx";
@ -42,7 +42,7 @@ public class ProcessMapPlanReamingRotorTemplate : ITemplateParameters
{ nameof(ProcessMapPlanReamingRotorDto.Reaming2StopPointOffBottom), new Cell(26, typeof(double)) },
{ nameof(ProcessMapPlanReamingRotorDto.Reaming3RepetitionsCount), new Cell(27, typeof(double)) },
{ nameof(ProcessMapPlanReamingRotorDto.Reaming3RopUp), new Cell(28, typeof(double)) },
{ nameof(ProcessMapPlanReamingRotorDto.Reaming1RopDown), new Cell(29, typeof(double)) },
{ nameof(ProcessMapPlanReamingRotorDto.Reaming3RopDown), new Cell(29, typeof(double)) },
{ nameof(ProcessMapPlanReamingRotorDto.Reaming3RpmUp), new Cell(30, typeof(double)) },
{ nameof(ProcessMapPlanReamingRotorDto.Reaming3RpmDown), new Cell(31, typeof(double)) },
{ nameof(ProcessMapPlanReamingRotorDto.Reaming3FlowRateUp), new Cell(32, typeof(double)) },

View File

@ -5,7 +5,7 @@ namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlan
public class ProcessMapPlanReamingSlideTemplate : ITemplateParameters
{
public string SheetName => "Проработка слайд";
public string SheetName => "Проработка для слайда";
public int HeaderRowsCount => 2;
@ -41,7 +41,7 @@ public class ProcessMapPlanReamingSlideTemplate : ITemplateParameters
{ nameof(ProcessMapPlanReamingSlideDto.Reaming2StopPointOffBottom), new Cell(26, typeof(double)) },
{ nameof(ProcessMapPlanReamingSlideDto.Reaming3RepetitionsCount), new Cell(27, typeof(double)) },
{ nameof(ProcessMapPlanReamingSlideDto.Reaming3RopUp), new Cell(28, typeof(double)) },
{ nameof(ProcessMapPlanReamingSlideDto.Reaming1RopDown), new Cell(29, typeof(double)) },
{ nameof(ProcessMapPlanReamingSlideDto.Reaming3RopDown), new Cell(29, typeof(double)) },
{ nameof(ProcessMapPlanReamingSlideDto.Reaming3RpmUp), new Cell(30, typeof(double)) },
{ nameof(ProcessMapPlanReamingSlideDto.Reaming3RpmDown), new Cell(31, typeof(double)) },
{ nameof(ProcessMapPlanReamingSlideDto.Reaming3FlowRateUp), new Cell(32, typeof(double)) },

View File

@ -28,6 +28,6 @@ public class ProcessMapPlanRotorTemplate : ITemplateParameters
{ nameof(ProcessMapPlanRotorDto.RpmMax), new Cell(13, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.FlowRate), new Cell(14, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.FlowRateMax), new Cell(15, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.Note), new Cell(16, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.Note), new Cell(16, typeof(string)) },
};
}

View File

@ -5,7 +5,7 @@ namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlan
public class ProcessMapPlanShockTestTemplate : ITemplateParameters
{
public string SheetName => "Запись shock test";
public string SheetName => "ShockTest";
public int HeaderRowsCount => 2;

View File

@ -17,10 +17,8 @@ public class ProcessMapPlanSwitchingOffThePumpTemplate : ITemplateParameters
{ nameof(ProcessMapPlanSwitchingOffThePumpDto.Section), new Cell(1, typeof(string)) },
{ nameof(ProcessMapPlanSwitchingOffThePumpDto.DepthStart), new Cell(2, typeof(double)) },
{ nameof(ProcessMapPlanSwitchingOffThePumpDto.DepthEnd), new Cell(3, typeof(double)) },
{ nameof(ProcessMapPlanSwitchingOffThePumpDto.Duration), new Cell(4, typeof(double)) },
{ nameof(ProcessMapPlanSwitchingOffThePumpDto.ResidualPressureLimit), new Cell(5, typeof(double)) },
{ nameof(ProcessMapPlanSwitchingOffThePumpDto.Note), new Cell(6, typeof(string)) },
};
}

View File

@ -96,7 +96,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
var allUsers = await memoryCache.GetOrCreateBasicAsync(db.Set<TelemetryUser>(), token);
var users = allUsers.Where(u => u.IdTelemetry == telemetry.Id);
var eventsDict = events.ToDictionary(x=>x.IdEvent, x => x);
var eventsDict = events.ToDictionary(x => x.IdEvent, x => x);
var usersDict = users.ToDictionary(x => x.IdUser, x => x);
var messagesDtoList = new List<MessageDto>();
@ -142,7 +142,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
return Task.CompletedTask;
var telemetry = telemetryService.GetOrCreateTelemetryByUid(uid);
foreach (var dto in dtos)
{
var entity = dto.Adapt<TelemetryMessage>();
@ -154,6 +154,33 @@ namespace AsbCloudInfrastructure.Services.SAUB
return db.SaveChangesAsync(token);
}
private IQueryable<TelemetryMessage> BuildQuery(TelemetryPartDeleteRequest request)
{
var query = db.Set<TelemetryMessage>()
.Where(o => o.IdTelemetry == request.IdTelemetry);
if (request.GeDate is not null)
{
var geDate = request.GeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateTime <= geDate);
}
if (request.LeDate is not null)
{
var leDate = request.LeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateTime >= leDate);
}
return query;
}
public async Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
{
var query = BuildQuery(request);
db.Set<TelemetryMessage>().RemoveRange(query);
return await db.SaveChangesAsync(token);
}
}
}

View File

@ -1,6 +1,7 @@
using AsbCloudApp.Data;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb;
using AsbCloudDb.Model;
@ -11,8 +12,6 @@ using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Requests;
using Mapster;
namespace AsbCloudInfrastructure.Services.SAUB
{
@ -160,12 +159,12 @@ namespace AsbCloudInfrastructure.Services.SAUB
public async Task<IEnumerable<TDto>> GetByTelemetryAsync(int idTelemetry, TelemetryDataRequest request, CancellationToken token)
{
var timezone = telemetryService.GetTimezone(idTelemetry);
var cache = telemetryDataCache.GetOrDefault(idTelemetry, request);
if(cache is not null)
if (cache is not null)
return cache;
var query = BuildQuery(idTelemetry, request);
var entities = await query
@ -219,10 +218,30 @@ namespace AsbCloudInfrastructure.Services.SAUB
return query;
}
private IQueryable<TEntity> BuildQuery(TelemetryPartDeleteRequest request)
{
var query = db.Set<TEntity>()
.Where(o => o.IdTelemetry == request.IdTelemetry);
if (request.GeDate is not null)
{
var geDate = request.GeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateTime <= geDate);
}
if (request.LeDate is not null)
{
var leDate = request.LeDate.Value.ToUniversalTime();
query = query.Where(o => o.DateTime >= leDate);
}
return query;
}
/// <inheritdoc/>
public async Task<DatesRangeDto?> GetRangeAsync(int idWell, DateTimeOffset geDate, DateTimeOffset? leDate, CancellationToken token)
{
var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell)
var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell)
?? throw new ArgumentInvalidException(nameof(idWell), $"По скважине id:{idWell} нет телеметрии");
if ((DateTimeOffset.UtcNow - geDate) < TimeSpan.FromHours(12))
@ -231,7 +250,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
var cachedRange = telemetryDataCache.GetOrDefaultCachedDataDateRange(telemetry.Id);
if (cachedRange is not null)
{
var datesRange = new DatesRangeDto {From = cachedRange.From, To = cachedRange.To };
var datesRange = new DatesRangeDto { From = cachedRange.From, To = cachedRange.To };
if (geDate >= cachedRange.From)
datesRange.From = geDate.ToOffset(cachedRange.From.Offset);
@ -246,7 +265,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
.Where(entity => entity.IdTelemetry == telemetry.Id)
.Where(entity => entity.DateTime >= geDate.ToUniversalTime());
if(leDate.HasValue)
if (leDate.HasValue)
query = query.Where(entity => entity.DateTime <= leDate.Value.ToUniversalTime());
var groupQuery = query
@ -282,5 +301,11 @@ namespace AsbCloudInfrastructure.Services.SAUB
protected abstract TEntity Convert(TDto src, double timezoneOffset);
public async Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
{
var query = BuildQuery(request);
db.Set<TEntity>().RemoveRange(query);
return await db.SaveChangesAsync(token);
}
}
}

View File

@ -0,0 +1,82 @@
using AsbCloudApp.Data.SAUB;
using AsbCloudApp.Data.WITS;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.SAUB
{
/// <summary>
/// Сервис по работе с данными телеметрии
/// </summary>
public class TelemetryDataEditorService : ITelemetryDataEditorService
{
private readonly ITelemetryDataEditorService[] repositories;
/// <summary>
///
/// </summary>
/// <param name="dataSaubService"></param>
/// <param name="dataSpinService"></param>
/// <param name="dataSaubStatRepository"></param>
/// <param name="messageService"></param>
/// <param name="drillTestRepository"></param>
/// <param name="limitingParameterRepository"></param>
/// <param name="detectedOperationRepository"></param>
/// <param name="witsRecord1Repository"></param>
/// <param name="witsRecord7Repository"></param>
/// <param name="witsRecord8Repository"></param>
/// <param name="witsRecord50Repository"></param>
/// <param name="witsRecord60Repository"></param>
/// <param name="witsRecord61Repository"></param>
/// <param name="gtrRepository"></param>
public TelemetryDataEditorService(
ITelemetryDataSaubService dataSaubService,
ITelemetryDataService<TelemetryDataSpinDto> dataSpinService,
IDataSaubStatRepository dataSaubStatRepository,
IMessageService messageService,
IDrillTestRepository drillTestRepository,
ILimitingParameterRepository limitingParameterRepository,
IDetectedOperationRepository detectedOperationRepository,
IWitsRecordRepository<Record1Dto> witsRecord1Repository,
IWitsRecordRepository<Record7Dto> witsRecord7Repository,
IWitsRecordRepository<Record8Dto> witsRecord8Repository,
IWitsRecordRepository<Record50Dto> witsRecord50Repository,
IWitsRecordRepository<Record60Dto> witsRecord60Repository,
IWitsRecordRepository<Record61Dto> witsRecord61Repository,
IGtrRepository gtrRepository
)
{
repositories =
[
dataSaubService,
dataSpinService,
dataSaubStatRepository,
messageService,
drillTestRepository,
limitingParameterRepository,
detectedOperationRepository,
witsRecord1Repository,
witsRecord7Repository,
witsRecord8Repository,
witsRecord50Repository,
witsRecord60Repository,
witsRecord61Repository,
gtrRepository,
];
}
public async Task<int> DeleteAsync(TelemetryPartDeleteRequest request, CancellationToken token)
{
var result = 0;
foreach (var repository in repositories)
{
result += await repository.DeleteAsync(request, token);
}
return result;
}
}
}

View File

@ -1,69 +0,0 @@
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
using AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
using AsbCloudWebApi.IntegrationTests.Controllers.ProcessMapPlan;
using AsbCloudWebApi.IntegrationTests;
using Microsoft.EntityFrameworkCore;
using Xunit;
using AsbCloudDb.Model.ProcessMapPlan.Functions;
using AsbCloudApp.Data.ProcessMaps.Functions;
namespace AsbCloudWebApi.IntegrationTests.Controllers.ProcessMapPlan.Functions;
/// <summary>
/// РТК план обновление холостого хода
/// </summary>
public class ProcessMapPlanUpdatingNoloadParametersControllerTest :
ProcessMapPlanBaseControllerTest<ProcessMapPlanUpdatingNoloadParameters, ProcessMapPlanUpdatingNoloadParametersDto>
{
public ProcessMapPlanUpdatingNoloadParametersControllerTest(WebAppFactoryFixture factory) : base(factory, "ProcessMapPlanUpdatingNoloadParameters")
{
}
private readonly ProcessMapPlanUpdatingNoloadParametersDto dto = new ProcessMapPlanUpdatingNoloadParametersDto()
{
IdWell = 1,
DepthStart = 1,
DepthEnd = 2,
Id = 0,
IdWellSectionType = 1,
IdDeclineSocketColumn = true,
Note = "1",
};
private readonly ProcessMapPlanUpdatingNoloadParameters entity = new ProcessMapPlanUpdatingNoloadParameters()
{
IdWell = 1,
DepthEnd = 10,
DepthStart = 2,
Id = 0,
IdWellSectionType = 1,
IdAuthor = 1,
IdEditor = 1,
Creation = DateTimeOffset.UtcNow,
IdDeclineSocketColumn = true,
Note = "1"
};
[Fact]
public async Task Get_actual_returns_success()
{
await Get(entity, dto);
}
protected override ProcessMapPlanUpdatingNoloadParameters GetByNote(DbSet<ProcessMapPlanUpdatingNoloadParameters> dbSet, ProcessMapPlanUpdatingNoloadParametersDto dto)
{
throw new NotImplementedException();
}
protected override ProcessMapPlanUpdatingNoloadParametersDto GetByNote(IEnumerable<ProcessMapPlanUpdatingNoloadParametersDto> dtos, ProcessMapPlanUpdatingNoloadParametersDto dto)
{
throw new NotImplementedException();
}
protected override ProcessMapPlanUpdatingNoloadParameters? GetByWellId()
{
throw new NotImplementedException();
}
}

View File

@ -1,68 +0,0 @@
using AsbCloudApp.Data.ProcessMaps.Operations;
using AsbCloudDb.Model.ProcessMapPlan.Operations;
using Microsoft.EntityFrameworkCore;
using Xunit;
namespace AsbCloudWebApi.IntegrationTests.Controllers.ProcessMapPlan.Operations;
/// <summary>
/// РТК план встряхивание бурового инструмента
/// </summary>
public class ProcessMapPlanRotorRpmAccelerationControllerTest :
ProcessMapPlanBaseControllerTest<ProcessMapPlanRotorRpmAcceleration, ProcessMapPlanRotorRpmAccelerationDto>
{
public ProcessMapPlanRotorRpmAccelerationControllerTest(WebAppFactoryFixture factory) : base(factory, "ProcessMapPlanRotorRpmAcceleration")
{
}
private readonly ProcessMapPlanRotorRpmAccelerationDto dto = new ProcessMapPlanRotorRpmAccelerationDto()
{
IdWell = 1,
DepthStart = 1,
DepthEnd = 2,
Id = 0,
IdWellSectionType = 1,
Note = "1",
Rpm = 1,
RpmMax = 2,
TopDriveTorque = 2,
TopDriveTorqueMax = 3,
};
private readonly ProcessMapPlanRotorRpmAcceleration entity = new ProcessMapPlanRotorRpmAcceleration()
{
IdWell = 1,
DepthEnd = 10,
DepthStart = 2,
Id = 0,
IdWellSectionType = 1,
IdAuthor = 1,
IdEditor = 1,
Creation = DateTimeOffset.UtcNow,
Note = "1",
Rpm = 1,
RpmMax = 2,
TopDriveTorque = 2,
TopDriveTorqueMax = 3,
};
[Fact]
public async Task Get_actual_returns_success()
{
await Get(entity, dto);
}
protected override ProcessMapPlanRotorRpmAcceleration GetByNote(DbSet<ProcessMapPlanRotorRpmAcceleration> dbSet, ProcessMapPlanRotorRpmAccelerationDto dto)
{
throw new NotImplementedException();
}
protected override ProcessMapPlanRotorRpmAccelerationDto GetByNote(IEnumerable<ProcessMapPlanRotorRpmAccelerationDto> dtos, ProcessMapPlanRotorRpmAccelerationDto dto)
{
throw new NotImplementedException();
}
protected override ProcessMapPlanRotorRpmAcceleration? GetByWellId()
{
throw new NotImplementedException();
}
}

View File

@ -1,7 +1,10 @@
using AsbCloudApp.Data;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading;
using System.Threading.Tasks;
@ -16,12 +19,15 @@ namespace AsbCloudWebApi.Controllers
public class AdminTelemetryController : CrudController<TelemetryDto, ICrudRepository<TelemetryDto>>
{
private readonly ITelemetryService telemetryService;
private readonly ITelemetryDataEditorService telemetryEditorService;
public AdminTelemetryController(ICrudRepository<TelemetryDto> service,
ITelemetryService telemetryService)
ITelemetryService telemetryService,
ITelemetryDataEditorService telemetryEditorService)
: base(service)
{
this.telemetryService = telemetryService;
this.telemetryEditorService = telemetryEditorService;
}
/// <summary>
@ -36,5 +42,22 @@ namespace AsbCloudWebApi.Controllers
.ConfigureAwait(false);
return Ok(count);
}
/// <summary>
/// Удаление куска телеметрии по запросу
/// </summary>
/// <param name="request">запрос</param>
/// <param name="token"></param>
/// <returns></returns>
[HttpDelete("part")]
[Permission]
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
public async Task<IActionResult> DeleteAsync([FromQuery] TelemetryPartDeleteRequest request,CancellationToken token)
{
var result = await telemetryEditorService.DeleteAsync(request, token);
return Ok(result);
}
}
}