Merge branch 'dev' into feature/7987467

This commit is contained in:
ngfrolov 2022-12-07 09:15:39 +05:00
commit 60ab971cae
16 changed files with 30293 additions and 533 deletions

View File

@ -0,0 +1,62 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace AsbCloudApp.Data;
#nullable enable
/// <summary>
/// Модель группированных операций по скважине
/// </summary>
public class WellGroupOpertionDto
{
/// <summary>
/// Id категории
/// </summary>
public int IdCategory { get; set; }
/// <summary>
/// Название категории
/// </summary>
public string Category { get; set; } = string.Empty;
/// <summary>
/// Идентификатор родителя
/// </summary>
[JsonIgnore]
public int? IdParent { get; set; }
/// <summary>
/// Количество операций
/// </summary>
public int Count { get; set; }
/// <summary>
/// Суммарное время операций, мин
/// </summary>
public double TotalMinutes { get; set; }
/// <summary>
/// Мин продолжительность операции, мин
/// </summary>
public double? MinutesMin { get; set; }
/// <summary>
/// Макс продолжительность операции, мин
/// </summary>
public double? MinutesMax { get; set; }
/// <summary>
/// Средняя продолжительность операции, мин
/// </summary>
public double? MinutesAverage { get; set; }
/// <summary>
/// Общая глубина забоя
/// </summary>
public double DeltaDepth { get; set; }
/// <summary>
/// дочерние операции
/// </summary>
public IEnumerable<WellGroupOpertionDto>? Items { get; set; }
}
#nullable disable

View File

@ -16,9 +16,9 @@ namespace AsbCloudApp.Data
public string Name { get; set; }
/// <summary>
/// код операции
/// Идентификатор родительской категории
/// </summary>
public int Code { get; set; }
public int? IdParent { get; set; }
/// <summary>
/// Название ключевого показателя операции

View File

@ -46,13 +46,37 @@ namespace AsbCloudApp.Services
int take = 32,
CancellationToken token = default);
/// <summary>
/// Получить статистику операции по скважине с группировкой по категориям
/// </summary>
/// <param name="idWell"></param>
/// <param name="operationType"></param>
/// <param name="sectionTypeIds"></param>
/// <param name="operationCategoryIds"></param>
/// <param name="begin"></param>
/// <param name="end"></param>
/// <param name="minDepth"></param>
/// <param name="maxDepth"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<WellGroupOpertionDto>> GetGroupOperationsStatAsync(
int idWell,
int? operationType = null,
IEnumerable<int> sectionTypeIds = null,
IEnumerable<int> operationCategoryIds = null,
DateTime begin = default,
DateTime end = default,
double minDepth = double.MinValue,
double maxDepth = double.MaxValue,
CancellationToken token = default);
/// <summary>
/// Получить операцию по id
/// </summary>
/// <param name="id"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<WellOperationDto> GetAsync(int id, CancellationToken token);
Task<WellOperationDto> GetOrDefaultAsync(int id, CancellationToken token);
//todo: idWell Не нужен
/// <summary>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class WellOperationCategory_editDBmodel : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "code",
table: "t_well_operation_category");
migrationBuilder.AddColumn<int>(
name: "id_parent",
table: "t_well_operation_category",
type: "integer",
nullable: true,
comment: "id родительской категории");
migrationBuilder.CreateIndex(
name: "IX_t_well_operation_category_id_parent",
table: "t_well_operation_category",
column: "id_parent");
migrationBuilder.AddForeignKey(
name: "FK_t_well_operation_category_t_well_operation_category_id_pare~",
table: "t_well_operation_category",
column: "id_parent",
principalTable: "t_well_operation_category",
principalColumn: "id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_well_operation_category_t_well_operation_category_id_pare~",
table: "t_well_operation_category");
migrationBuilder.DropIndex(
name: "IX_t_well_operation_category_id_parent",
table: "t_well_operation_category");
migrationBuilder.DropColumn(
name: "id_parent",
table: "t_well_operation_category");
migrationBuilder.AddColumn<int>(
name: "code",
table: "t_well_operation_category",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "Код операции");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,673 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class WellOperationCategory_editDefaultData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 10);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 16);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 17);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1006);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1011);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1012);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1014);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1023);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1024);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1045);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1052);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1055);
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "id_parent", "key_value_name", "key_value_units", "name" },
values: new object[,]
{
{ 3000, null, "dT", "м/ч", "БУРЕНИЕ" },
{ 3001, null, "dT", "мин", "СПО" },
{ 3002, null, "dT", "мин", "КРЕПЛЕНИЕ" },
{ 3003, null, "dT", "мин", "ГФР" },
{ 3004, null, "dT", "мин", "Вспомогательные операции" },
{ 3005, null, "dT", "мин", "Непроизводительное время (НПВ)" }
});
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "id_parent", "key_value_name", "key_value_units", "name" },
values: new object[,]
{
{ 4000, 3000, "dT", "мин", "КНБК" },
{ 4001, 3000, "dT", "м/ч", "Механическое. бурение" },
{ 4002, 3000, "dT", "мин", "Статический замер" },
{ 4003, 3000, "dT", "мин", "Нормализация диаметра скважины" },
{ 4004, 3000, "dT", "мин", "Наращивание" },
{ 4005, 3001, "dT", "мин", "СПО" },
{ 4006, 3002, "dT", "мин", "Спуск обсадной колонны" },
{ 4007, 3002, "dT", "мин", "Цементирование" },
{ 4008, 3002, "dT", "мин", "Вспомогательные работы при креплении" },
{ 4009, 3003, "dT", "мин", "Сборка/разборка приборов ГИС" },
{ 4010, 3003, "dT", "мин", "СПО" },
{ 4011, 3003, "dT", "мин", "ГИС" },
{ 4012, 3004, "dT", "мин", "Промывка, ОБР" },
{ 4013, 3004, "dT", "мин", "Вспомогательные работы" },
{ 4014, 3005, "dT", "мин", "Ремонт оборудования" },
{ 4015, 3005, "dT", "мин", "Аварийные работы" },
{ 4016, 3005, "dT", "мин", "Осложнение" },
{ 4017, 3005, "dT", "мин", "Незаложенные в ГГД операции" }
});
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "id_parent", "key_value_name", "key_value_units", "name" },
values: new object[,]
{
{ 2001, 4003, "dT", "мин", "Проработка во время бурения" },
{ 2002, 4003, "dT", "мин", "Шаблонировка во время бурения" },
{ 2003, 4004, "dT", "мин", "Наращивание" },
{ 2004, 4008, "dT", "мин", "ПЗР при спуске ОК" },
{ 2005, 4008, "dT", "мин", "ПЗР при цементировании" },
{ 2006, 4008, "dT", "мин", "Опрессовка ОК" },
{ 2007, 4008, "dT", "мин", "Опрессовка БИ" },
{ 2008, 4009, "dT", "мин", "Сборка комплекса приборов ГИС" },
{ 2009, 4009, "dT", "мин", "Разборка комплекса приборов ГИС" },
{ 2010, 4010, "dT", "мин", "Спуск приборов ГИС (на трубах)" },
{ 2011, 4010, "dT", "мин", "Подъем приборов ГИС (на трубах)" },
{ 2012, 4011, "dT", "мин", "Комплекс ГИС на трубах" },
{ 2013, 4011, "dT", "мин", "Комплекс ГИС на жестком кабеле" },
{ 2014, 4011, "dT", "мин", "Комплекс ГИС на кабеле" },
{ 2015, 4012, "dT", "мин", "Приготовление БР" },
{ 2016, 4012, "dT", "мин", "Ориентирование ТС при бурении" },
{ 2017, 4013, "dT", "мин", "Наработка жёлоба" },
{ 2018, 4013, "dT", "мин", "Тайм-дриллинг" },
{ 2019, 4013, "dT", "мин", "ПЗР при сборке КНБК" },
{ 2020, 4013, "dT", "мин", "ПР перед забуркой направления" },
{ 2021, 4013, "dT", "мин", "Перемонтаж ПВО " },
{ 2022, 4013, "dT", "мин", "Долив затруба при подъёме" },
{ 2024, 4013, "dT", "мин", "Обвязка устья с циркуляционной системой" },
{ 2025, 4013, "dT", "мин", "Продувка манифольда" },
{ 2026, 4013, "dT", "мин", "Полная замена талевого каната" },
{ 2027, 4013, "dT", "мин", "Перетяжка талевого каната" },
{ 2028, 4013, "dT", "мин", "Учебная тревога \"Выброс\"" },
{ 2029, 4013, "dT", "мин", "Чистка ЦСГО/емкостного блока" },
{ 2030, 4015, "dT", "мин", "Установка ванн" },
{ 2031, 4015, "dT", "мин", "Ожидание" },
{ 2032, 4015, "dT", "мин", "Работа яссом" },
{ 2033, 4015, "dT", "мин", "Расхаживание" },
{ 2034, 4015, "dT", "мин", "Ловильные работы" },
{ 2035, 4015, "dT", "мин", "Определение места прихвата и ЛМ" },
{ 2036, 4015, "dT", "мин", "Торпедирование (отстрел)" },
{ 2037, 4015, "dT", "мин", "СПО - овершот" },
{ 2038, 4015, "dT", "мин", "СПО - колокол" },
{ 2039, 4015, "dT", "мин", "СПО - метчик" },
{ 2040, 4015, "dT", "мин", "СПО - труболовка" },
{ 2041, 4015, "dT", "мин", "Торпедирование (встряхивание)" },
{ 2042, 4015, "dT", "мин", "Фрезеровка" },
{ 2043, 4016, "dT", "мин", "Поглощение" },
{ 2044, 4016, "dT", "мин", "Сальникообразование" },
{ 2045, 4016, "dT", "мин", "Контролируемое ГНВП" },
{ 2046, 4016, "dT", "мин", "Утяжеление БР" },
{ 2047, 4017, "dT", "мин", "Ревизия КНБК/инструмента/ЗТС" },
{ 2048, 4017, "dT", "мин", "подъем ОК" },
{ 2049, 4017, "dT", "мин", "Обработка раствора (несоответствие параметров)" },
{ 60001, 4001, "МСП", "м/ч", "Ротором (РУС)" },
{ 60002, 4001, "МСП", "м/ч", "Направленно (СЛАЙД)" },
{ 60003, 4002, "dT", "мин", "Замер ЗТС (запись MWD)" },
{ 60004, 4005, "dT", "мин", "Спуск инструмента" },
{ 60006, 4007, "dT", "мин", "Цементирование" },
{ 60007, 4012, "dT", "мин", "Обработка БР" },
{ 60008, 4012, "dT", "мин", "Перезапись гаммы-каротажа" },
{ 60009, 4012, "dT", "мин", "Спуск инструмента с проработкой" },
{ 60010, 4012, "dT", "мин", "Закачка/прокачка пачки" },
{ 60011, 4013, "dT", "мин", "Срезка" },
{ 60012, 4014, "dT", "мин", "Ремонт бурового оборудования" },
{ 60013, 4017, "dT", "мин", "НПВ / прочее" },
{ 60014, 4012, "dT", "мин", "Промывка" },
{ 60017, 4003, "dT", "мин", "Шаблонировка во время бурения" },
{ 60018, 4004, "dT", "мин", "Удержание в клиньях" },
{ 60019, 4011, "dT", "мин", "Комплекс ГИС на кабеле" },
{ 60020, 4011, "dT", "мин", "Комплекс ГИС на трубах" },
{ 60023, 4012, "dT", "мин", "Приготовление БР" },
{ 60026, 4003, "dT", "мин", "Проработка во время бурения" },
{ 60028, 4005, "dT", "мин", "Подъем инструмента" }
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2001);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2002);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2003);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2004);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2005);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2006);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2007);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2008);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2009);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2010);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2011);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2012);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2013);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2014);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2015);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2016);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2017);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2018);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2019);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2020);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2021);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2022);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2024);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2025);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2026);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2027);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2028);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2029);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2030);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2031);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2032);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2033);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2034);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2035);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2036);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2037);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2038);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2039);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2040);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2041);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2042);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2043);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2044);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2045);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2046);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2047);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2048);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2049);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4000);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4006);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60001);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60002);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60003);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60004);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60006);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60007);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60008);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60009);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60010);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60011);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60012);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60013);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60014);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60017);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60018);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60019);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60020);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60023);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60026);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60028);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4001);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4002);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4003);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4004);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4005);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4007);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4008);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4009);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4010);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4011);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4012);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4013);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4014);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4015);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4016);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4017);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 3000);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 3001);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 3002);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 3003);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 3004);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 3005);
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "id_parent", "key_value_name", "key_value_units", "name" },
values: new object[,]
{
{ 1, null, "dT", "мин", "Невозможно определить операцию" },
{ 10, null, "dT", "мин", "Подъем из скважины" },
{ 16, null, "dT", "мин", "Вращение без циркуляции" },
{ 17, null, "dT", "мин", "На поверхности" },
{ 1006, null, "dT", "мин", "Установка ФА" },
{ 1011, null, "dT", "мин", "Начало цикла строительства скважины" },
{ 1012, null, "dT", "мин", "Окончание цикла строительства скважины" },
{ 1014, null, "dT", "мин", "Опрессовка Ц.К." },
{ 1023, null, "dT", "мин", "Сборка инструмента с мостков" },
{ 1024, null, "dT", "мин", "Подготовительные работы" },
{ 1045, null, "dT", "мин", "Прочее" },
{ 1052, null, "dT", "мин", "Тех. отстой" },
{ 1055, null, "dT", "мин", "Вспомогательные работы" }
});
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,59 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class WellOperation_Manual_updateIdCategory : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql
("UPDATE public.t_well_operation SET id_category=60001 WHERE id_category=2; " +
"UPDATE public.t_well_operation SET id_category=60002 WHERE id_category=3; " +
"UPDATE public.t_well_operation SET id_category=60003 WHERE id_category=21; " +
"UPDATE public.t_well_operation SET id_category=60004 WHERE id_category=8; " +
"UPDATE public.t_well_operation SET id_category=60006 WHERE id_category=1040; " +
"UPDATE public.t_well_operation SET id_category=60007 WHERE id_category=1053; " +
"UPDATE public.t_well_operation SET id_category=60008 WHERE id_category=1017; " +
"UPDATE public.t_well_operation SET id_category=60009 WHERE id_category=5; " +
"UPDATE public.t_well_operation SET id_category=60010 WHERE id_category=1029; " +
"UPDATE public.t_well_operation SET id_category=60011 WHERE id_category=1054; " +
"UPDATE public.t_well_operation SET id_category=60012 WHERE id_category=1031; " +
"UPDATE public.t_well_operation SET id_category=60013 WHERE id_category=1043; " +
"UPDATE public.t_well_operation SET id_category=60014 WHERE id_category=12; " +
"UPDATE public.t_well_operation SET id_category=60014 WHERE id_category=13; " +
"UPDATE public.t_well_operation SET id_category=60001 WHERE id_category=1001; " +
"UPDATE public.t_well_operation SET id_category=60017 WHERE id_category=23; " +
"UPDATE public.t_well_operation SET id_category=60018 WHERE id_category=15; " +
"UPDATE public.t_well_operation SET id_category=60019 WHERE id_category=1002; " +
"UPDATE public.t_well_operation SET id_category=60020 WHERE id_category=1003; " +
"UPDATE public.t_well_operation SET id_category=60014 WHERE id_category=1015; " +
"UPDATE public.t_well_operation SET id_category=60023 WHERE id_category=1016; " +
"UPDATE public.t_well_operation SET id_category=60014 WHERE id_category=1019; " +
"UPDATE public.t_well_operation SET id_category=60014 WHERE id_category=1028; " +
"UPDATE public.t_well_operation SET id_category=60026 WHERE id_category=1034; " +
"UPDATE public.t_well_operation SET id_category=60026 WHERE id_category=1035; " +
"UPDATE public.t_well_operation SET id_category=60028 WHERE id_category=1037; " +
"UPDATE public.t_well_operation SET id_category=60004 WHERE id_category=1038; " +
"UPDATE public.t_well_operation SET id_category=60009 WHERE id_category=1033; " +
"UPDATE public.t_well_operation SET id_category=60012 WHERE id_category=1039; " +
"UPDATE public.t_well_operation SET id_category=60017 WHERE id_category=1041; " +
"UPDATE public.t_well_operation SET id_category=60013 WHERE id_category=1042; " +
"UPDATE public.t_well_operation SET id_category=60003 WHERE id_category=1051; " +
"UPDATE public.t_well_operation SET id_category=60026 WHERE id_category=4; " +
"UPDATE public.t_well_operation SET id_category=60014 WHERE id_category=6; " +
"UPDATE public.t_well_operation SET id_category=60004 WHERE id_category=9; " +
"UPDATE public.t_well_operation SET id_category=60028 WHERE id_category=11; " +
"UPDATE public.t_well_operation SET id_category=60014 WHERE id_category=1021; " +
"UPDATE public.t_well_operation SET id_category=60026 WHERE id_category=1022; " +
"UPDATE public.t_well_operation SET id_category=60014 WHERE id_category=22; " +
"UPDATE public.t_well_operation SET id_category=60014 WHERE id_category=1027; ");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,563 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class delete_old_WellOperationCategory : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 3);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 5);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 6);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 7);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 8);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 9);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 11);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 12);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 13);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 15);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 21);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 22);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 23);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1001);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1002);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1003);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1015);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1016);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1017);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1019);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1021);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1022);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1028);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1027);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1029);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1031);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1033);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1034);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1035);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1037);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1038);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1039);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1040);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1041);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1042);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1043);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1051);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1053);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1054);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 14,
column: "id_parent",
value: 4004);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 18,
column: "id_parent",
value: 4003);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 19,
column: "id_parent",
value: 4003);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 20,
column: "id_parent",
value: 4003);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1004,
column: "id_parent",
value: 4013);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1005,
column: "id_parent",
value: 4013);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1007,
column: "id_parent",
value: 4013);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1008,
column: "id_parent",
value: 4007);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1013,
column: "id_parent",
value: 4013);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1018,
column: "id_parent",
value: 4013);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1020,
column: "id_parent",
value: 4005);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1025,
column: "id_parent",
value: 4000);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1026,
column: "id_parent",
value: 4000);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1030,
column: "id_parent",
value: 4012);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1032,
column: "id_parent",
value: 4005);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1044,
column: "id_parent",
value: 4013);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1046,
column: "id_parent",
value: 4005);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1047,
column: "id_parent",
value: 4005);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1048,
column: "id_parent",
value: 4006);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1050,
column: "id_parent",
value: 4006);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 14,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 18,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 19,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 20,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 22,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1004,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1005,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1007,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1008,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1013,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1018,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1020,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1025,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1026,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1027,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1030,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1032,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1044,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1046,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1047,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1048,
column: "id_parent",
value: null);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1050,
column: "id_parent",
value: null);
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "id_parent", "key_value_name", "key_value_units", "name" },
values: new object[,]
{
{ 2, null, "МСП", "м/ч", "Роторное бурение" },
{ 3, null, "МСП", "м/ч", "Слайдирование" },
{ 4, null, "dT", "мин", "Подъем с проработкой" },
{ 5, null, "dT", "мин", "Спуск с проработкой" },
{ 6, null, "dT", "мин", "Подъем с промывкой" },
{ 7, null, "dT", "мин", "Спуск с промывкой" },
{ 8, null, "dT", "мин", "Спуск в скважину" },
{ 9, null, "dT", "мин", "Спуск с вращением" },
{ 11, null, "dT", "мин", "Подъем с вращением" },
{ 12, null, "dT", "мин", "Промывка в покое" },
{ 13, null, "dT", "мин", "Промывка с вращением" },
{ 15, null, "dT", "мин", "Неподвижное состояние" },
{ 21, null, "dT", "мин", "Статический замер телесистемы" },
{ 22, null, "dT", "мин", "Промывка" },
{ 23, null, "dT", "мин", "Шаблонировка при бурении" },
{ 1001, null, "МСП", "м/ч", "Бурение" },
{ 1002, null, "dT", "мин", "ГИС" },
{ 1003, null, "dT", "мин", "ГФР" },
{ 1015, null, "dT", "мин", "Опрессовка ВЗД" },
{ 1016, null, "dT", "мин", "Перевод скв на другой тип промывочной жидкости" },
{ 1017, null, "dT", "мин", "Перезапись каротажа" },
{ 1019, null, "dT", "мин", "Наращивание, промывка" },
{ 1021, null, "dT", "мин", "Подъем инструмента с промывкой" },
{ 1022, null, "dT", "мин", "Обратная проработка" },
{ 1027, null, "dT", "мин", "Промывка" },
{ 1028, null, "dT", "мин", "Промежуточная промывка" },
{ 1029, null, "dT", "мин", "Прокачка пачек" },
{ 1031, null, "dT", "мин", "Ремонт" },
{ 1033, null, "dT", "мин", "Спуск инструмента с промывкой" },
{ 1034, null, "dT", "мин", "Прямая проработка" },
{ 1035, null, "dT", "мин", "Принудительная проработка" },
{ 1037, null, "dT", "мин", "Тех СПО-подъем" },
{ 1038, null, "dT", "мин", "Тех СПО-спуск" },
{ 1039, null, "dT", "мин", "Техническое обслуживание" },
{ 1040, null, "dT", "мин", "Цементаж" },
{ 1041, null, "dT", "мин", "Шаблонировка ствола" },
{ 1042, null, "dT", "мин", "Геологическое осложнение" },
{ 1043, null, "dT", "мин", "НПВ" },
{ 1051, null, "dT", "мин", "Замер ТС" },
{ 1053, null, "dT", "мин", "Циркуляция и Обработка БР" },
{ 1054, null, "dT", "мин", "Срезка ствола" }
});
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -4,82 +4,129 @@
{
public override WellOperationCategory[] GetData() => new WellOperationCategory[]{
// Автоматически определяемые операции
new () {Id = 1, Name = "Невозможно определить операцию", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин"},
new () {Id = 2, Name = "Роторное бурение", Code = 0, KeyValueName = "МСП", KeyValueUnits = "м/ч" },
new () {Id = 3, Name = "Слайдирование", Code = 0, KeyValueName = "МСП", KeyValueUnits = "м/ч" },
new () {Id = 4, Name = "Подъем с проработкой", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5, Name = "Спуск с проработкой", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 6, Name = "Подъем с промывкой", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 7, Name = "Спуск с промывкой", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 8, Name = "Спуск в скважину", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 9, Name = "Спуск с вращением", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 10, Name = "Подъем из скважины", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 11, Name = "Подъем с вращением", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 12, Name = "Промывка в покое", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 13, Name = "Промывка с вращением", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 14, Name = "Удержание в клиньях", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 15, Name = "Неподвижное состояние", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 16, Name = "Вращение без циркуляции", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 17, Name = "На поверхности", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 18, Name = "Проработка перед наращиванием", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 19, Name = "Шаблонировка перед наращиванием", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 20, Name = "Промывка перед наращиванием", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 21, Name = "Статический замер телесистемы", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 22, Name = "Промывка", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 23, Name = "Шаблонировка при бурении", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 14, IdParent = 4004, Name = "Удержание в клиньях" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 18, IdParent = 4003, Name = "Проработка перед наращиванием" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 19, IdParent = 4003, Name = "Шаблонировка перед наращиванием" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 20, IdParent = 4003, Name = "Промывка перед наращиванием" , KeyValueName = "dT", KeyValueUnits = "мин" },
// Операции ручного ввода
new () {Id = 1001, Name = "Бурение", Code = 0, KeyValueName = "МСП", KeyValueUnits = "м/ч" },
new () {Id = 1002, Name = "ГИС", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1003, Name = "ГФР", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1004, Name = "Монтаж ПВО", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1005, Name = "Демонтаж ПВО", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1006, Name = "Установка ФА", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1007, Name = "Оборудование устья", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1008, Name = "ОЗЦ", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1011, Name = "Начало цикла строительства скважины", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1012, Name = "Окончание цикла строительства скважины", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1013, Name = "Опрессовка ПВО", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1014, Name = "Опрессовка Ц.К.", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1015, Name = "Опрессовка ВЗД", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1016, Name = "Перевод скв на другой тип промывочной жидкости", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1017, Name = "Перезапись каротажа", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1018, Name = "Перетяжка талевого каната", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1019, Name = "Наращивание, промывка", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1020, Name = "Подъем инструмента", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1021, Name = "Подъем инструмента с промывкой", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1022, Name = "Обратная проработка", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1023, Name = "Сборка инструмента с мостков", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1024, Name = "Подготовительные работы", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1025, Name = "Сборка КНБК", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1026, Name = "Разборка КНБК", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1027, Name = "Промывка", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1028, Name = "Промежуточная промывка", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1029, Name = "Прокачка пачек", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1030, Name = "Разбуривание тех.оснастки", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1031, Name = "Ремонт", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1032, Name = "Спуск инструмента", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1033, Name = "Спуск инструмента с промывкой", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1034, Name = "Прямая проработка", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1035, Name = "Принудительная проработка", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1037, Name = "Тех СПО-подъем", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1038, Name = "Тех СПО-спуск", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1039, Name = "Техническое обслуживание", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1040, Name = "Цементаж", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1041, Name = "Шаблонировка ствола", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1042, Name = "Геологическое осложнение", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1043, Name = "НПВ", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1044, Name = "ВМР", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1045, Name = "Прочее", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1046, Name = "Спуск КНБК", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1047, Name = "Подъем КНБК", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1048, Name = "Спуск ОК", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1050, Name = "Промывка при спуске ОК", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1051, Name = "Замер ТС", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1052, Name = "Тех. отстой", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1053, Name = "Циркуляция и Обработка БР", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1054, Name = "Срезка ствола", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1055, Name = "Вспомогательные работы", Code = 0, KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1004, IdParent = 4013, Name = "Монтаж ПВО" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1005, IdParent = 4013, Name = "Демонтаж ПВО" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1007, IdParent = 4013, Name = "Оборудование устья" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1008, IdParent = 4007, Name = "ОЗЦ" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1013, IdParent = 4013, Name = "Опрессовка ПВО" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1018, IdParent = 4013, Name = "Перетяжка талевого каната" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1020, IdParent = 4005, Name = "Подъем инструмента" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1025, IdParent = 4000, Name = "Сборка КНБК" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1026, IdParent = 4000, Name = "Разборка КНБК" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1030, IdParent = 4012, Name = "Разбуривание тех.оснастки" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1032, IdParent = 4005, Name = "Спуск инструмента" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1044, IdParent = 4013, Name = "ВМР" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1046, IdParent = 4005, Name = "Спуск КНБК" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1047, IdParent = 4005, Name = "Подъем КНБК" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1048, IdParent = 4006, Name = "Спуск ОК" , KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 1050, IdParent = 4006, Name = "Промывка при спуске ОК" , KeyValueName = "dT", KeyValueUnits = "мин" },
//Добавленные согласно постановке задачи
new () {Id = 2001 ,IdParent=4003, Name = "Проработка во время бурения", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2002 ,IdParent=4003, Name = "Шаблонировка во время бурения", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2003, IdParent=4004, Name = "Наращивание", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2004, IdParent=4008, Name = "ПЗР при спуске ОК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2005, IdParent=4008, Name = "ПЗР при цементировании", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2006,IdParent=4008, Name = "Опрессовка ОК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2007,IdParent=4008, Name = "Опрессовка БИ", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2008,IdParent=4009, Name = "Сборка комплекса приборов ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2009,IdParent=4009, Name = "Разборка комплекса приборов ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2010,IdParent=4010, Name = "Спуск приборов ГИС (на трубах)", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2011,IdParent=4010, Name = "Подъем приборов ГИС (на трубах)", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2012,IdParent=4011, Name = "Комплекс ГИС на трубах", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2013,IdParent=4011, Name = "Комплекс ГИС на жестком кабеле", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2014,IdParent=4011, Name = "Комплекс ГИС на кабеле", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2015,IdParent=4012, Name = "Приготовление БР", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2016,IdParent=4012, Name = "Ориентирование ТС при бурении", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2017,IdParent=4013, Name = "Наработка жёлоба", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2018,IdParent=4013, Name = "Тайм-дриллинг", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2019,IdParent=4013, Name = "ПЗР при сборке КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2020,IdParent=4013, Name = "ПР перед забуркой направления", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2021, IdParent=4013, Name = "Перемонтаж ПВО ", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2022, IdParent=4013, Name = "Долив затруба при подъёме", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2024, IdParent=4013, Name = "Обвязка устья с циркуляционной системой", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2025, IdParent=4013, Name = "Продувка манифольда", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2026, IdParent=4013, Name = "Полная замена талевого каната", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2027, IdParent=4013, Name = "Перетяжка талевого каната", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2028, IdParent=4013, Name = "Учебная тревога \"Выброс\"", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2029, IdParent=4013, Name = "Чистка ЦСГО/емкостного блока", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2030, IdParent=4015, Name = "Установка ванн", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2031, IdParent=4015, Name = "Ожидание", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2032, IdParent=4015, Name = "Работа яссом", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2033, IdParent=4015, Name = "Расхаживание", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2034, IdParent=4015, Name = "Ловильные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2035, IdParent=4015, Name = "Определение места прихвата и ЛМ", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2036, IdParent=4015, Name = "Торпедирование (отстрел)", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2037, IdParent=4015, Name = "СПО - овершот", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2038, IdParent=4015, Name = "СПО - колокол", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2039, IdParent=4015, Name = "СПО - метчик", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2040, IdParent=4015, Name = "СПО - труболовка", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2041, IdParent=4015, Name = "Торпедирование (встряхивание)", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2042, IdParent=4015, Name = "Фрезеровка", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2043, IdParent=4016, Name = "Поглощение", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2044, IdParent=4016, Name = "Сальникообразование", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2045, IdParent=4016, Name = "Контролируемое ГНВП", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2046, IdParent=4016, Name = "Утяжеление БР", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2047, IdParent=4017, Name = "Ревизия КНБК/инструмента/ЗТС", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2048, IdParent=4017, Name = "подъем ОК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 2049, IdParent=4017, Name = "Обработка раствора (несоответствие параметров)", KeyValueName = "dT", KeyValueUnits = "мин" },
// Этап работ
new () {Id = 3000, Name = "БУРЕНИЕ", KeyValueName = "dT", KeyValueUnits = "м/ч" },
new () {Id = 3001, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 3002, Name = "КРЕПЛЕНИЕ", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 3003, Name = "ГФР", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 3004, Name = "Вспомогательные операции", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 3005, Name = "Непроизводительное время (НПВ)", KeyValueName = "dT", KeyValueUnits = "мин" },
// Виды работ
new () {Id = 4000, IdParent = 3000, Name = "КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4001, IdParent = 3000, Name = "Механическое. бурение", KeyValueName = "dT", KeyValueUnits = "м/ч" },
new () {Id = 4002, IdParent = 3000, Name = "Статический замер", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4003, IdParent = 3000, Name = "Нормализация диаметра скважины", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4004, IdParent = 3000, Name = "Наращивание", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4005, IdParent = 3001, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4006, IdParent = 3002, Name = "Спуск обсадной колонны", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4007, IdParent = 3002, Name = "Цементирование", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4008, IdParent = 3002, Name = "Вспомогательные работы при креплении", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4009, IdParent = 3003, Name = "Сборка/разборка приборов ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4010, IdParent = 3003, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4011, IdParent = 3003, Name = "ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4012, IdParent = 3004, Name = "Промывка, ОБР", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4013, IdParent = 3004, Name = "Вспомогательные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4014, IdParent = 3005, Name = "Ремонт оборудования", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4015, IdParent = 3005, Name = "Аварийные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4016, IdParent = 3005, Name = "Осложнение", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 4017, IdParent = 3005, Name = "Незаложенные в ГГД операции", KeyValueName = "dT", KeyValueUnits = "мин" },
//переименованные категории с новым ИД
new () {Id = 60001,IdParent = 4001, Name = "Ротором (РУС)", KeyValueName = "МСП", KeyValueUnits = "м/ч" },
new () {Id = 60002,IdParent = 4001, Name = "Направленно (СЛАЙД)", KeyValueName = "МСП", KeyValueUnits = "м/ч" },
new () {Id = 60003, IdParent = 4002,Name = "Замер ЗТС (запись MWD)", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60004,IdParent=4005, Name = "Спуск инструмента", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60006, IdParent=4007, Name = "Цементирование", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60007, IdParent=4012, Name = "Обработка БР", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60008, IdParent=4012, Name = "Перезапись гаммы-каротажа", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60009,IdParent=4012, Name = "Спуск инструмента с проработкой", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60010, IdParent=4012, Name = "Закачка/прокачка пачки", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60011, IdParent=4013, Name = "Срезка", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60012, IdParent=4014, Name = "Ремонт бурового оборудования", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60013, IdParent=4017, Name = "НПВ / прочее", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60014,IdParent=4012, Name = "Промывка", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60017 ,IdParent=4003, Name = "Шаблонировка во время бурения", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60018,IdParent=4004, Name = "Удержание в клиньях", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60019, IdParent=4011, Name = "Комплекс ГИС на кабеле", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60020, IdParent=4011, Name = "Комплекс ГИС на трубах", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60023, IdParent=4012, Name = "Приготовление БР", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60026 ,IdParent=4003, Name = "Проработка во время бурения", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 60028, IdParent=4005, Name = "Подъем инструмента", KeyValueName = "dT", KeyValueUnits = "мин" },
};
}
}

View File

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace AsbCloudDb.Model
{
@ -15,13 +16,17 @@ namespace AsbCloudDb.Model
[Column("name"), Comment("Название категории операции")]
public string Name { get; set; }
[Column("code"), Comment("Код операции")]
public int Code { get; set; }
[Column("id_parent"), Comment("id родительской категории")]
public int? IdParent { get; set; }
[Column("key_value_name"), Comment("Название ключевого показателя операции"), StringLength(32)]
public string KeyValueName { get; set; }
[Column("key_value_units"), Comment("Единицы измерения ключевого показателя операции"), StringLength(16)]
public string KeyValueUnits { get; set; }
[JsonIgnore]
[ForeignKey(nameof(IdParent))]
public virtual WellOperationCategory Parent { get; set; } = null!;
}
}

View File

@ -77,8 +77,8 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
public async Task<PaginationContainer<WellOperationDto>> GetOperationsAsync(
int idWell,
int? operationType = default,
IEnumerable<int> sectionTypeIds = default,
IEnumerable<int> operationCategoryIds = default,
IEnumerable<int>? sectionTypeIds = null,
IEnumerable<int>? operationCategoryIds = null,
DateTime begin = default,
DateTime end = default,
double minDepth = double.MinValue,
@ -89,39 +89,16 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
{
var timezone = wellService.GetTimezone(idWell);
var query = db.WellOperations
.Include(s => s.WellSectionType)
.Include(s => s.OperationCategory)
.Where(s => s.IdWell == idWell);
var dateStart = query.Min(o => o.DateStart);
if (operationType != default)
query = query.Where(e => e.IdType == (int)operationType);
if (sectionTypeIds != default && sectionTypeIds.Any())
query = query.Where(e => sectionTypeIds.Contains(e.IdWellSectionType));
if (operationCategoryIds != default && operationCategoryIds.Any())
query = query.Where(e => operationCategoryIds.Contains(e.IdCategory));
if (minDepth != double.MinValue)
query = query.Where(e => e.DepthEnd >= minDepth);
if (maxDepth != double.MaxValue)
query = query.Where(e => e.DepthEnd <= maxDepth);
if (begin != default)
{
var beginOffset = begin.ToUtcDateTimeOffset(timezone.Hours);
query = query.Where(e => e.DateStart >= beginOffset);
}
if (end != default)
{
var endOffset = end.ToUtcDateTimeOffset(timezone.Hours);
query = query.Where(e => e.DateStart <= endOffset);
}
var query = BuildQuery(
idWell,
operationType,
sectionTypeIds,
operationCategoryIds,
begin,
end,
minDepth,
maxDepth,
token);
var result = new PaginationContainer<WellOperationDto>
{
@ -129,7 +106,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
Take = take,
Count = await query.CountAsync(token).ConfigureAwait(false),
};
var dateStart = query.Min(o => o.DateStart);
query = query
.OrderBy(e => e.DateStart)
.ThenBy(e => e.DepthEnd)
@ -162,7 +139,76 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
return result;
}
public async Task<WellOperationDto> GetAsync(int id,
public async Task<IEnumerable<WellGroupOpertionDto>> GetGroupOperationsStatAsync(
int idWell,
int? operationType = default,
IEnumerable<int>? sectionTypeIds = default,
IEnumerable<int>? operationCategoryIds = default,
DateTime begin = default,
DateTime end = default,
double minDepth = double.MinValue,
double maxDepth = double.MaxValue,
CancellationToken token = default)
{
var query = BuildQuery(
idWell,
operationType,
sectionTypeIds,
operationCategoryIds,
begin,
end,
minDepth,
maxDepth,
token);
var entities = await query
.Select(o => new {
o.IdCategory,
DurationMinutes = o.DurationHours * 60,
DurationDepth = o.DepthEnd - o.DepthStart
})
.ToListAsync(token);
var parentRelationDictionary = GetCategories()
.ToDictionary(c => c.Id, cc => new
{
Name = cc.Name,
IdParent = cc.IdParent
});
var dtos = entities
.GroupBy(o => o.IdCategory)
.Select(g => new WellGroupOpertionDto
{
IdCategory = g.Key,
Category = parentRelationDictionary[g.Key].Name,
Count = g.Count(),
MinutesAverage = g.Average(o => o.DurationMinutes),
MinutesMin = g.Min(o => o.DurationMinutes),
MinutesMax = g.Max(o => o.DurationMinutes),
TotalMinutes = g.Sum(o => o.DurationMinutes),
DeltaDepth = g.Sum(o => o.DurationDepth),
IdParent = parentRelationDictionary[g.Key].IdParent
});
var defaultId = 0;
while (dtos.Any(x => x.IdParent != null))
{
defaultId--;
dtos = dtos
.GroupBy(o => o.IdParent)
.Select(g => new WellGroupOpertionDto
{
IdCategory = g.Key.HasValue ? g.Key.Value : defaultId,
Category = g.Key.HasValue ? parentRelationDictionary[g.Key.Value].Name : "unknown",
Count = g.Sum(o => o.Count),
DeltaDepth = g.Sum(o => o.DeltaDepth),
TotalMinutes = g.Sum(o => o.TotalMinutes),
Items = g.ToList(),
IdParent = g.Key.HasValue ? parentRelationDictionary[g.Key.Value].IdParent : defaultId,
});
}
return dtos;
}
public async Task<WellOperationDto?> GetOrDefaultAsync(int id,
CancellationToken token = default)
{
@ -222,6 +268,61 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
return await db.SaveChangesAsync(token)
.ConfigureAwait(false);
}
private IQueryable<WellOperation> BuildQuery(
int idWell,
int? operationType = default,
IEnumerable<int>? sectionTypeIds = null,
IEnumerable<int>? operationCategoryIds = null,
DateTime begin = default,
DateTime end = default,
double minDepth = double.MinValue,
double maxDepth = double.MaxValue,
CancellationToken token = default)
{
var timezone = wellService.GetTimezone(idWell);
var query = db.WellOperations
.Include(s => s.WellSectionType)
.Include(s => s.OperationCategory)
.Where(s => s.IdWell == idWell);
var dateStart = query.Min(o => o.DateStart);
if (operationType.HasValue)
query = query.Where(e => e.IdType == operationType.Value);
if (sectionTypeIds != default && sectionTypeIds.Any())
query = query.Where(e => sectionTypeIds.Contains(e.IdWellSectionType));
if (operationCategoryIds != default && operationCategoryIds.Any())
query = query.Where(e => operationCategoryIds.Contains(e.IdCategory));
if (minDepth != double.MinValue)
query = query.Where(e => e.DepthEnd >= minDepth);
if (maxDepth != double.MaxValue)
query = query.Where(e => e.DepthEnd <= maxDepth);
if (begin != default)
{
var beginOffset = begin.ToUtcDateTimeOffset(timezone.Hours);
query = query.Where(e => e.DateStart >= beginOffset);
}
if (end != default)
{
var endOffset = end.ToUtcDateTimeOffset(timezone.Hours);
query = query.Where(e => e.DateStart <= endOffset);
}
query = query
.OrderBy(e => e.DateStart)
.ThenBy(e => e.DepthEnd)
.ThenBy(e => e.Id);
return query;
}
}
#nullable disable
}

View File

@ -109,6 +109,51 @@ namespace AsbCloudWebApi.Controllers
return Ok(result);
}
/// <summary>
/// Статистика операций по скважине, группированая по категориям
/// </summary>
/// <param name="idWell">id скважины</param>
/// <param name="opertaionType"></param>
/// <param name="sectionTypeIds"></param>
/// <param name="operationCategoryIds"></param>
/// <param name="begin"></param>
/// <param name="end"></param>
/// <param name="minDepth"></param>
/// <param name="maxDepth"></param>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet]
[Route("groupStat")]
[Permission]
[ProducesResponseType(typeof(IEnumerable<WellGroupOpertionDto>), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> GetGroupOperationsAsync(
[FromRoute] int idWell,
[FromQuery] int? opertaionType = default,
[FromQuery] IEnumerable<int> sectionTypeIds = default,
[FromQuery] IEnumerable<int> operationCategoryIds = default,
[FromQuery] DateTime begin = default,
[FromQuery] DateTime end = default,
[FromQuery] double minDepth = double.MinValue,
[FromQuery] double maxDepth = double.MaxValue,
CancellationToken token = default)
{
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
return Forbid();
var result = await operationService.GetGroupOperationsStatAsync(
idWell,
opertaionType,
sectionTypeIds,
operationCategoryIds,
begin,
end,
minDepth,
maxDepth,
token)
.ConfigureAwait(false);
return Ok(result);
}
/// <summary>
/// Возвращает нужную операцию на скважине
/// </summary>
@ -126,7 +171,7 @@ namespace AsbCloudWebApi.Controllers
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
return Forbid();
var result = await operationService.GetAsync(idOperation, token).ConfigureAwait(false);
var result = await operationService.GetOrDefaultAsync(idOperation, token).ConfigureAwait(false);
return Ok(result);
}