This commit is contained in:
ngfrolov 2022-12-12 10:59:30 +05:00
commit 6c204c49dc
34 changed files with 49377 additions and 917 deletions

View File

@ -10,7 +10,7 @@ namespace AsbCloudApp.Data.Subsystems
/// <summary>
/// Активная скважина
/// </summary>
public WellDto Well { get; set; } = null!;
public WellDto Well { get; set; } = null!; //TODO: заменить на WellInfo
/// <summary>
/// Наработки подсистемы АКБ
/// </summary>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class WellOperations_delete_categories : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 22);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1027);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "id_parent", "key_value_name", "key_value_units", "name" },
values: new object[,]
{
{ 22, 4012, "dT", "мин", "Промывка" },
{ 1027, 4012, "dT", "мин", "Промывка" }
});
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class WellOperations_unite_categiries : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(
"UPDATE public.t_well_operation SET id_category=60018 WHERE id_category=14;" +
"UPDATE public.t_well_operation SET id_category=2027 WHERE id_category = 1018;" +
"UPDATE public.t_well_operation SET id_category=60028 WHERE id_category = 1020;" +
"UPDATE public.t_well_operation SET id_category=60004 WHERE id_category = 1032;" +
"UPDATE public.t_well_operation SET id_category=60026 WHERE id_category = 2001;" +
"UPDATE public.t_well_operation SET id_category=60017 WHERE id_category = 2002;" +
"UPDATE public.t_well_operation SET id_category=60020 WHERE id_category = 2012;" +
"UPDATE public.t_well_operation SET id_category=60019 WHERE id_category = 2014;" +
"UPDATE public.t_well_operation SET id_category=60023 WHERE id_category = 2015;");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,76 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class WellOperations_delete_categiries : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 14);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1018);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1020);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1032);
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: 2012);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2014);
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2015);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "id_parent", "key_value_name", "key_value_units", "name" },
values: new object[,]
{
{ 14, 4004, "dT", "мин", "Удержание в клиньях" },
{ 1018, 4013, "dT", "мин", "Перетяжка талевого каната" },
{ 1020, 4005, "dT", "мин", "Подъем инструмента" },
{ 1032, 4005, "dT", "мин", "Спуск инструмента" },
{ 2001, 4003, "dT", "мин", "Проработка во время бурения" },
{ 2002, 4003, "dT", "мин", "Шаблонировка во время бурения" },
{ 2012, 4011, "dT", "мин", "Комплекс ГИС на трубах" },
{ 2014, 4011, "dT", "мин", "Комплекс ГИС на кабеле" },
{ 2015, 4012, "dT", "мин", "Приготовление БР" }
});
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Truncate_detected_operations : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
// требуется для повторного анализа
migrationBuilder.Sql("TRUNCATE t_detected_operation;");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_lost_WellOperationCategory : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "id_parent", "key_value_name", "key_value_units", "name" },
values: new object[] { 60029, 4013, "dT", "мин", "Тех.отстой" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 60029);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,271 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class WellOperationCategory_ids_ordering : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(
@"begin;
alter TABLE t_well_operation drop CONSTRAINT ""FK_t_well_operation_t_well_operation_category_id_category"";
alter TABLE t_detected_operation drop CONSTRAINT ""FK_t_detected_operation_t_well_operation_category_id_category"";
alter TABLE t_well_operation_category drop CONSTRAINT ""FK_t_well_operation_category_t_well_operation_category_id_pare~"";
alter TABLE t_operationvalue drop CONSTRAINT ""FK_t_operationvalue_t_well_operation_category_id_operation_cat~"";
alter TABLE t_well_operation ADD CONSTRAINT ""FK_t_well_operation_t_well_operation_category_id_category""
FOREIGN KEY (id_category) REFERENCES public.t_well_operation_category(id)
ON Update cascade
on delete cascade;
alter TABLE t_detected_operation ADD CONSTRAINT ""FK_t_detected_operation_t_well_operation_category_id_category""
FOREIGN KEY (id_category) REFERENCES public.t_well_operation_category(id)
ON Update cascade
on delete cascade;
alter TABLE t_well_operation_category ADD CONSTRAINT ""FK_t_well_operation_category_t_well_operation_category_id_pare~""
FOREIGN KEY (id_parent) REFERENCES public.t_well_operation_category(id)
ON Update cascade;
alter TABLE t_operationvalue ADD CONSTRAINT ""FK_t_operationvalue_t_well_operation_category_id_operation_cat~""
FOREIGN KEY(id_operation_category) REFERENCES public.t_well_operation_category(id)
ON Update cascade
ON DELETE cascade;
update t_well_operation_category set id = 5000 where id = 1026;
update t_well_operation_category set id = 5001 where id = 1025;
update t_well_operation_category set id = 5002 where id = 60002;
update t_well_operation_category set id = 5003 where id = 60001;
update t_well_operation_category set id = 5004 where id = 60003;
update t_well_operation_category set id = 5005 where id = 20;
update t_well_operation_category set id = 5006 where id = 60026;
update t_well_operation_category set id = 5007 where id = 18;
update t_well_operation_category set id = 5008 where id = 60017;
update t_well_operation_category set id = 5009 where id = 19;
update t_well_operation_category set id = 5010 where id = 2003;
update t_well_operation_category set id = 5011 where id = 60018;
update t_well_operation_category set id = 5012 where id = 60028;
update t_well_operation_category set id = 5013 where id = 1047;
update t_well_operation_category set id = 5014 where id = 60004;
update t_well_operation_category set id = 5015 where id = 1046;
update t_well_operation_category set id = 5016 where id = 1050;
update t_well_operation_category set id = 5017 where id = 1048;
update t_well_operation_category set id = 5018 where id = 1008;
update t_well_operation_category set id = 5019 where id = 60006;
update t_well_operation_category set id = 5020 where id = 2007;
update t_well_operation_category set id = 5021 where id = 2006;
update t_well_operation_category set id = 5022 where id = 2004;
update t_well_operation_category set id = 5023 where id = 2005;
update t_well_operation_category set id = 5024 where id = 2009;
update t_well_operation_category set id = 5025 where id = 2008;
update t_well_operation_category set id = 5026 where id = 2011;
update t_well_operation_category set id = 5027 where id = 2010;
update t_well_operation_category set id = 5028 where id = 2013;
update t_well_operation_category set id = 5029 where id = 60019;
update t_well_operation_category set id = 5030 where id = 60020;
update t_well_operation_category set id = 5031 where id = 60010;
update t_well_operation_category set id = 5032 where id = 60007;
update t_well_operation_category set id = 5033 where id = 2016;
update t_well_operation_category set id = 5034 where id = 60008;
update t_well_operation_category set id = 5035 where id = 60023;
update t_well_operation_category set id = 5036 where id = 60014;
update t_well_operation_category set id = 5037 where id = 1030;
update t_well_operation_category set id = 5038 where id = 60009;
update t_well_operation_category set id = 5039 where id = 1044;
update t_well_operation_category set id = 5040 where id = 1005;
update t_well_operation_category set id = 5041 where id = 2022;
update t_well_operation_category set id = 5042 where id = 1004;
update t_well_operation_category set id = 5043 where id = 2017;
update t_well_operation_category set id = 5044 where id = 2024;
update t_well_operation_category set id = 5045 where id = 1007;
update t_well_operation_category set id = 5046 where id = 1013;
update t_well_operation_category set id = 5047 where id = 2021;
update t_well_operation_category set id = 5048 where id = 2027;
update t_well_operation_category set id = 5049 where id = 2019;
update t_well_operation_category set id = 5050 where id = 2026;
update t_well_operation_category set id = 5051 where id = 2020;
update t_well_operation_category set id = 5052 where id = 2025;
update t_well_operation_category set id = 5053 where id = 60011;
update t_well_operation_category set id = 5054 where id = 2018;
update t_well_operation_category set id = 5055 where id = 60029;
update t_well_operation_category set id = 5056 where id = 2028;
update t_well_operation_category set id = 5057 where id = 2029;
update t_well_operation_category set id = 5058 where id = 60012;
update t_well_operation_category set id = 5059 where id = 2034;
update t_well_operation_category set id = 5060 where id = 2031;
update t_well_operation_category set id = 5061 where id = 2035;
update t_well_operation_category set id = 5062 where id = 2032;
update t_well_operation_category set id = 5063 where id = 2033;
update t_well_operation_category set id = 5064 where id = 2038;
update t_well_operation_category set id = 5065 where id = 2039;
update t_well_operation_category set id = 5066 where id = 2037;
update t_well_operation_category set id = 5067 where id = 2040;
update t_well_operation_category set id = 5068 where id = 2041;
update t_well_operation_category set id = 5069 where id = 2036;
update t_well_operation_category set id = 5070 where id = 2030;
update t_well_operation_category set id = 5071 where id = 2042;
update t_well_operation_category set id = 5072 where id = 2045;
update t_well_operation_category set id = 5073 where id = 2043;
update t_well_operation_category set id = 5074 where id = 2044;
update t_well_operation_category set id = 5075 where id = 2046;
update t_well_operation_category set id = 5076 where id = 60013;
update t_well_operation_category set id = 5077 where id = 2049;
update t_well_operation_category set id = 5078 where id = 2048;
update t_well_operation_category set id = 5079 where id = 2047;
alter TABLE t_well_operation drop CONSTRAINT ""FK_t_well_operation_t_well_operation_category_id_category"" ;
alter TABLE t_detected_operation drop CONSTRAINT ""FK_t_detected_operation_t_well_operation_category_id_category"" ;
alter TABLE t_well_operation_category drop CONSTRAINT ""FK_t_well_operation_category_t_well_operation_category_id_pare~"";
alter TABLE t_operationvalue drop CONSTRAINT ""FK_t_operationvalue_t_well_operation_category_id_operation_cat~"";
alter TABLE t_well_operation ADD CONSTRAINT ""FK_t_well_operation_t_well_operation_category_id_category""
FOREIGN KEY (id_category) REFERENCES public.t_well_operation_category(id)
on delete cascade;
alter TABLE t_detected_operation ADD CONSTRAINT ""FK_t_detected_operation_t_well_operation_category_id_category""
FOREIGN KEY (id_category) REFERENCES public.t_well_operation_category(id)
on delete cascade;
alter TABLE t_well_operation_category ADD CONSTRAINT ""FK_t_well_operation_category_t_well_operation_category_id_pare~""
FOREIGN KEY (id_parent) REFERENCES public.t_well_operation_category(id);
alter TABLE t_operationvalue ADD CONSTRAINT ""FK_t_operationvalue_t_well_operation_category_id_operation_cat~""
FOREIGN KEY(id_operation_category) REFERENCES public.t_well_operation_category(id)
ON DELETE cascade;
");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(
@"begin;
alter TABLE t_well_operation drop CONSTRAINT ""FK_t_well_operation_t_well_operation_category_id_category"";
alter TABLE t_detected_operation drop CONSTRAINT ""FK_t_detected_operation_t_well_operation_category_id_category"";
alter TABLE t_well_operation_category drop CONSTRAINT ""FK_t_well_operation_category_t_well_operation_category_id_pare~"";
alter TABLE t_operationvalue drop CONSTRAINT ""FK_t_operationvalue_t_well_operation_category_id_operation_cat~"";
alter TABLE t_well_operation ADD CONSTRAINT ""FK_t_well_operation_t_well_operation_category_id_category""
FOREIGN KEY (id_category) REFERENCES public.t_well_operation_category(id)
ON Update cascade
on delete cascade;
alter TABLE t_detected_operation ADD CONSTRAINT ""FK_t_detected_operation_t_well_operation_category_id_category""
FOREIGN KEY (id_category) REFERENCES public.t_well_operation_category(id)
ON Update cascade
on delete cascade;
alter TABLE t_well_operation_category ADD CONSTRAINT ""FK_t_well_operation_category_t_well_operation_category_id_pare~""
FOREIGN KEY (id_parent) REFERENCES public.t_well_operation_category(id)
ON Update cascade;
alter TABLE t_operationvalue ADD CONSTRAINT ""FK_t_operationvalue_t_well_operation_category_id_operation_cat~""
FOREIGN KEY(id_operation_category) REFERENCES public.t_well_operation_category(id)
ON Update cascade
ON DELETE cascade;
update t_well_operation_category set id = 1026 where id = 5000;
update t_well_operation_category set id = 1025 where id = 5001;
update t_well_operation_category set id = 60002 where id = 5002;
update t_well_operation_category set id = 60001 where id = 5003;
update t_well_operation_category set id = 60003 where id = 5004;
update t_well_operation_category set id = 20 where id = 5005;
update t_well_operation_category set id = 60026 where id = 5006;
update t_well_operation_category set id = 18 where id = 5007;
update t_well_operation_category set id = 60017 where id = 5008;
update t_well_operation_category set id = 19 where id = 5009;
update t_well_operation_category set id = 2003 where id = 5010;
update t_well_operation_category set id = 60018 where id = 5011;
update t_well_operation_category set id = 60028 where id = 5012;
update t_well_operation_category set id = 1047 where id = 5013;
update t_well_operation_category set id = 60004 where id = 5014;
update t_well_operation_category set id = 1046 where id = 5015;
update t_well_operation_category set id = 1050 where id = 5016;
update t_well_operation_category set id = 1048 where id = 5017;
update t_well_operation_category set id = 1008 where id = 5018;
update t_well_operation_category set id = 60006 where id = 5019;
update t_well_operation_category set id = 2007 where id = 5020;
update t_well_operation_category set id = 2006 where id = 5021;
update t_well_operation_category set id = 2004 where id = 5022;
update t_well_operation_category set id = 2005 where id = 5023;
update t_well_operation_category set id = 2009 where id = 5024;
update t_well_operation_category set id = 2008 where id = 5025;
update t_well_operation_category set id = 2011 where id = 5026;
update t_well_operation_category set id = 2010 where id = 5027;
update t_well_operation_category set id = 2013 where id = 5028;
update t_well_operation_category set id = 60019 where id = 5029;
update t_well_operation_category set id = 60020 where id = 5030;
update t_well_operation_category set id = 60010 where id = 5031;
update t_well_operation_category set id = 60007 where id = 5032;
update t_well_operation_category set id = 2016 where id = 5033;
update t_well_operation_category set id = 60008 where id = 5034;
update t_well_operation_category set id = 60023 where id = 5035;
update t_well_operation_category set id = 60014 where id = 5036;
update t_well_operation_category set id = 1030 where id = 5037;
update t_well_operation_category set id = 60009 where id = 5038;
update t_well_operation_category set id = 1044 where id = 5039;
update t_well_operation_category set id = 1005 where id = 5040;
update t_well_operation_category set id = 2022 where id = 5041;
update t_well_operation_category set id = 1004 where id = 5042;
update t_well_operation_category set id = 2017 where id = 5043;
update t_well_operation_category set id = 2024 where id = 5044;
update t_well_operation_category set id = 1007 where id = 5045;
update t_well_operation_category set id = 1013 where id = 5046;
update t_well_operation_category set id = 2021 where id = 5047;
update t_well_operation_category set id = 2027 where id = 5048;
update t_well_operation_category set id = 2019 where id = 5049;
update t_well_operation_category set id = 2026 where id = 5050;
update t_well_operation_category set id = 2020 where id = 5051;
update t_well_operation_category set id = 2025 where id = 5052;
update t_well_operation_category set id = 60011 where id = 5053;
update t_well_operation_category set id = 2018 where id = 5054;
update t_well_operation_category set id = 60029 where id = 5055;
update t_well_operation_category set id = 2028 where id = 5056;
update t_well_operation_category set id = 2029 where id = 5057;
update t_well_operation_category set id = 60012 where id = 5058;
update t_well_operation_category set id = 2034 where id = 5059;
update t_well_operation_category set id = 2031 where id = 5060;
update t_well_operation_category set id = 2035 where id = 5061;
update t_well_operation_category set id = 2032 where id = 5062;
update t_well_operation_category set id = 2033 where id = 5063;
update t_well_operation_category set id = 2038 where id = 5064;
update t_well_operation_category set id = 2039 where id = 5065;
update t_well_operation_category set id = 2037 where id = 5066;
update t_well_operation_category set id = 2040 where id = 5067;
update t_well_operation_category set id = 2041 where id = 5068;
update t_well_operation_category set id = 2036 where id = 5069;
update t_well_operation_category set id = 2030 where id = 5070;
update t_well_operation_category set id = 2042 where id = 5071;
update t_well_operation_category set id = 2045 where id = 5072;
update t_well_operation_category set id = 2043 where id = 5073;
update t_well_operation_category set id = 2044 where id = 5074;
update t_well_operation_category set id = 2046 where id = 5075;
update t_well_operation_category set id = 60013 where id = 5076;
update t_well_operation_category set id = 2049 where id = 5077;
update t_well_operation_category set id = 2048 where id = 5078;
update t_well_operation_category set id = 2047 where id = 5079;
alter TABLE t_well_operation drop CONSTRAINT ""FK_t_well_operation_t_well_operation_category_id_category"" ;
alter TABLE t_detected_operation drop CONSTRAINT ""FK_t_detected_operation_t_well_operation_category_id_category"" ;
alter TABLE t_well_operation_category drop CONSTRAINT ""FK_t_well_operation_category_t_well_operation_category_id_pare~"";
alter TABLE t_operationvalue drop CONSTRAINT ""FK_t_operationvalue_t_well_operation_category_id_operation_cat~"";
alter TABLE t_well_operation ADD CONSTRAINT ""FK_t_well_operation_t_well_operation_category_id_category""
FOREIGN KEY (id_category) REFERENCES public.t_well_operation_category(id)
on delete cascade;
alter TABLE t_detected_operation ADD CONSTRAINT ""FK_t_detected_operation_t_well_operation_category_id_category""
FOREIGN KEY (id_category) REFERENCES public.t_well_operation_category(id)
on delete cascade;
alter TABLE t_well_operation_category ADD CONSTRAINT ""FK_t_well_operation_category_t_well_operation_category_id_pare~""
FOREIGN KEY (id_parent) REFERENCES public.t_well_operation_category(id);
alter TABLE t_operationvalue ADD CONSTRAINT ""FK_t_operationvalue_t_well_operation_category_id_operation_cat~""
FOREIGN KEY(id_operation_category) REFERENCES public.t_well_operation_category(id)
ON DELETE cascade;
");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Make_wellOperationCategory_name_notNull : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "name",
table: "t_well_operation_category",
type: "text",
nullable: false,
defaultValue: "",
comment: "Название категории операции",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true,
oldComment: "Название категории операции");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "name",
table: "t_well_operation_category",
type: "text",
nullable: true,
comment: "Название категории операции",
oldClrType: typeof(string),
oldType: "text",
oldComment: "Название категории операции");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2,131 +2,117 @@
{
internal class EntityFillerWellOperationCategory : EntityFiller<WellOperationCategory>
{
public override WellOperationCategory[] GetData() => new WellOperationCategory[]{
// Автоматически определяемые операции
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 = 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 = "мин" },
public override WellOperationCategory[] GetData() => new WellOperationCategory[]{
// Этап работ
new () {Id = 3000, Name = "БУРЕНИЕ", KeyValueName = "dT", KeyValueUnits = "м/ч" },
new () {Id = 3001, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdDrilling, 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 = 3003, Name = "ГФР", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 3004, Name = "Вспомогательные операции", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdNonProductiveTime, 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 = WellOperationCategory.IdMechanicalDrilling, 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 = 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 = 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 = "мин" },
new () {Id = WellOperationCategory.IdBhaDisassembly, IdParent = 4000, Name = "Разборка КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdBhaAssembly, IdParent = 4000, Name = "Сборка КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdSlide, IdParent = 4001, Name = "Направленно (СЛАЙД)", KeyValueName = "МСП", KeyValueUnits = "м/ч" },
new () {Id = WellOperationCategory.IdRotor, IdParent = 4001, Name = "Ротором (РУС)", KeyValueName = "МСП", KeyValueUnits = "м/ч" },
new () {Id = WellOperationCategory.IdStaticSurveying, IdParent = 4002, Name = "Замер ЗТС (запись MWD)", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdFlashingBeforeConnection, IdParent = 4003, Name = "Промывка перед наращиванием", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5006, IdParent = 4003, Name = "Проработка во время бурения", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdDevelopment, IdParent = 4003, Name = "Проработка перед наращиванием", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdTemplatingWhileDrilling, IdParent = 4003, Name = "Шаблонировка во время бурения", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdTemplating, IdParent = 4003, Name = "Шаблонировка перед наращиванием", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5010, IdParent = 4004, Name = "Наращивание", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdSlipsTime, IdParent = 4004, Name = "Удержание в клиньях", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5012, IdParent = 4005, Name = "Подъем инструмента", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdBhaUp, IdParent = 4005, Name = "Подъем КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5014, IdParent = 4005, Name = "Спуск инструмента", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdBhaDown, IdParent = 4005, Name = "Спуск КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5016, IdParent = 4006, Name = "Промывка при спуске ОК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdCasingDown, IdParent = 4006, Name = "Спуск ОК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5018, IdParent = 4007, Name = "ОЗЦ", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5019, IdParent = 4007, Name = "Цементирование", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5020, IdParent = 4008, Name = "Опрессовка БИ", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5021, IdParent = 4008, Name = "Опрессовка ОК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5022, IdParent = 4008, Name = "ПЗР при спуске ОК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5023, IdParent = 4008, Name = "ПЗР при цементировании", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5024, IdParent = 4009, Name = "Разборка комплекса приборов ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5025, IdParent = 4009, Name = "Сборка комплекса приборов ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5026, IdParent = 4010, Name = "Подъем приборов ГИС (на трубах)", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5027, IdParent = 4010, Name = "Спуск приборов ГИС (на трубах)", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5028, IdParent = 4011, Name = "Комплекс ГИС на жестком кабеле", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5029, IdParent = 4011, Name = "Комплекс ГИС на кабеле", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5030, IdParent = 4011, Name = "Комплекс ГИС на трубах", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5031, IdParent = 4012, Name = "Закачка/прокачка пачки", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5032, IdParent = 4012, Name = "Обработка БР", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5033, IdParent = 4012, Name = "Ориентирование ТС при бурении", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5034, IdParent = 4012, Name = "Перезапись гаммы-каротажа", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5035, IdParent = 4012, Name = "Приготовление БР", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdFlashing, IdParent = 4012, Name = "Промывка", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5037, IdParent = 4012, Name = "Разбуривание тех.оснастки", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5038, IdParent = 4012, Name = "Спуск инструмента с проработкой", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5039, IdParent = 4013, Name = "ВМР", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5040, IdParent = 4013, Name = "Демонтаж ПВО", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5041, IdParent = 4013, Name = "Долив затруба при подъёме", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5042, IdParent = 4013, Name = "Монтаж ПВО", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5043, IdParent = 4013, Name = "Наработка жёлоба", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5044, IdParent = 4013, Name = "Обвязка устья с циркуляционной системой", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5045, IdParent = 4013, Name = "Оборудование устья", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5046, IdParent = 4013, Name = "Опрессовка ПВО", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5047, IdParent = 4013, Name = "Перемонтаж ПВО ", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5048, IdParent = 4013, Name = "Перетяжка талевого каната", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5049, IdParent = 4013, Name = "ПЗР при сборке КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5050, IdParent = 4013, Name = "Полная замена талевого каната", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5051, IdParent = 4013, Name = "ПР перед забуркой направления", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5052, IdParent = 4013, Name = "Продувка манифольда", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5053, IdParent = 4013, Name = "Срезка", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5054, IdParent = 4013, Name = "Тайм-дриллинг", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5055, IdParent = 4013, Name = "Тех.отстой", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5056, IdParent = 4013, Name = "Учебная тревога \"Выброс\"", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5057, IdParent = 4013, Name = "Чистка ЦСГО/емкостного блока", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = WellOperationCategory.IdEquipmentRepair, IdParent = 4014, Name = "Ремонт бурового оборудования", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5059, IdParent = 4015, Name = "Ловильные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5060, IdParent = 4015, Name = "Ожидание", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5061, IdParent = 4015, Name = "Определение места прихвата и ЛМ", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5062, IdParent = 4015, Name = "Работа яссом", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5063, IdParent = 4015, Name = "Расхаживание", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5064, IdParent = 4015, Name = "СПО - колокол", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5065, IdParent = 4015, Name = "СПО - метчик", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5066, IdParent = 4015, Name = "СПО - овершот", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5067, IdParent = 4015, Name = "СПО - труболовка", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5068, IdParent = 4015, Name = "Торпедирование (встряхивание)", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5069, IdParent = 4015, Name = "Торпедирование (отстрел)", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5070, IdParent = 4015, Name = "Установка ванн", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5071, IdParent = 4015, Name = "Фрезеровка", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5072, IdParent = 4016, Name = "Контролируемое ГНВП", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5073, IdParent = 4016, Name = "Поглощение", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5074, IdParent = 4016, Name = "Сальникообразование", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5075, IdParent = 4016, Name = "Утяжеление БР", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5076, IdParent = 4017, Name = "НПВ / прочее", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5077, IdParent = 4017, Name = "Обработка раствора (несоответствие параметров)", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5078, IdParent = 4017, Name = "подъем ОК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = 5079, IdParent = 4017, Name = "Ревизия КНБК/инструмента/ЗТС", KeyValueName = "dT", KeyValueUnits = "мин" },
};
}
}

View File

@ -2,31 +2,147 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
using System;
namespace AsbCloudDb.Model
{
#nullable disable
#nullable enable
[Table("t_well_operation_category"), Comment("Справочник операций на скважине")]
public class WellOperationCategory : IId
{
#region constants category operations ids
/// <summary>
/// БУРЕНИЕ
/// </summary>
public const int IdDrilling = 3000;
/// <summary>
/// Непроизводительное время (НПВ)
/// </summary>
public const int IdNonProductiveTime = 3005;
/// <summary>
/// Механическое. бурение
/// </summary>
public const int IdMechanicalDrilling = 4001;
/// <summary>
/// Разборка КНБК
/// </summary>
public const int IdBhaDisassembly = 5000;
/// <summary>
/// Сборка КНБК
/// </summary>
public const int IdBhaAssembly = 5001;
/// <summary>
/// Направленно (СЛАЙД)
/// </summary>
public const int IdSlide = 5002;
/// <summary>
/// Ротором (РУС)
/// </summary>
public const int IdRotor = 5003;
/// <summary>
/// Замер ЗТС (запись MWD)
/// </summary>
public const int IdStaticSurveying = 5004;
/// <summary>
/// Промывка перед наращиванием
/// </summary>
public const int IdFlashingBeforeConnection = 5005;
/// <summary>
/// Проработка перед наращиванием
/// </summary>
public const int IdDevelopment = 5007;
/// <summary>
/// Шаблонировка во время бурения
/// </summary>
public const int IdTemplatingWhileDrilling = 5008;
/// <summary>
/// Шаблонировка перед наращиванием
/// </summary>
public const int IdTemplating = 5009;
/// <summary>
/// Удержание в клиньях
/// </summary>
public const int IdSlipsTime = 5011;
/// <summary>
/// Подъем КНБК
/// </summary>
public const int IdBhaUp = 5013;
/// <summary>
/// Спуск КНБК
/// </summary>
public const int IdBhaDown = 5015;
/// <summary>
/// Спуск ОК
/// </summary>
public const int IdCasingDown = 5017;
/// <summary>
/// Промывка
/// </summary>
public const int IdFlashing = 5036;
/// <summary>
/// Ремонт бурового оборудования
/// </summary>
public const int IdEquipmentRepair = 5058;
/// <summary>
/// Список всех категорий НПВ
/// </summary>
public static readonly int[] NonProductiveTimeSubIds = {
IdEquipmentRepair,
5059,
5060,
5061,
5062,
5063,
5064,
5065,
5066,
5067,
5068,
5069,
5070,
5071,
5072,
5073,
5074,
5075,
5076,
5077,
5078,
5079,
4014,
4015,
4016,
4017,
IdNonProductiveTime,
};
public static readonly int[] MechanicalDrillingSubIds = { IdRotor, IdSlide, IdMechanicalDrilling, };
#endregion
[Key]
[Column("id")]
public int Id { get; set; }
[Column("name"), Comment("Название категории операции")]
public string Name { get; set; }
public string Name { get; set; } = null!;
[Column("id_parent"), Comment("id родительской категории")]
public int? IdParent { get; set; }
[Column("key_value_name"), Comment("Название ключевого показателя операции"), StringLength(32)]
public string KeyValueName { get; set; }
public string? KeyValueName { get; set; }
[Column("key_value_units"), Comment("Единицы измерения ключевого показателя операции"), StringLength(16)]
public string KeyValueUnits { get; set; }
public string? KeyValueUnits { get; set; }
[JsonIgnore]
[ForeignKey(nameof(IdParent))]
public virtual WellOperationCategory Parent { get; set; } = null!;
public virtual WellOperationCategory? Parent { get; set; } = null!;
}
#nullable disable
}

View File

@ -9,9 +9,6 @@ using AsbCloudApp.Services;
using AsbCloudDb.Model;
using System.Collections.Generic;
using AsbCloudApp.Data.DailyReport;
using AsbCloudApp.Requests;
using AsbCloudInfrastructure.Services.DetectOperations;
using AsbCloudApp.Data.DetectedOperation;
using AsbCloudApp.Exceptions;
namespace AsbCloudInfrastructure.Services.DailyReport
@ -21,14 +18,12 @@ namespace AsbCloudInfrastructure.Services.DailyReport
{
private readonly IAsbCloudDbContext db;
private readonly IWellService wellService;
private readonly IDetectedOperationService detectedOperationService;
private readonly DailyReportMakerExcel dailyReportMaker = new DailyReportMakerExcel();
public DailyReportService(IAsbCloudDbContext db, IWellService wellService, IDetectedOperationService detectedOperationService)
public DailyReportService(IAsbCloudDbContext db, IWellService wellService)
{
this.db = db;
this.wellService = wellService;
this.detectedOperationService = detectedOperationService;
}
public async Task<IEnumerable<DailyReportDto>> GetListAsync(int idWell, DateTime? begin, DateTime? end, CancellationToken token)
@ -141,7 +136,6 @@ namespace AsbCloudInfrastructure.Services.DailyReport
WellName = well?.Caption ?? "",
ClusterName = well?.Cluster ?? "",
},
TimeBalance = await MakeTimeBalanceAsync(idWell, date, token),
Bha = await GetPrevOrNewBhaAsync(idWell, date, token)
};
return dto;
@ -163,43 +157,6 @@ namespace AsbCloudInfrastructure.Services.DailyReport
return dto.Bha;
}
private async Task<TimeBalanceDto> MakeTimeBalanceAsync(int idWell, DateTime date, CancellationToken token)
{
var stat = await detectedOperationService.GetOperationsStatAsync(new DetectedOperationRequest
{
IdWell = idWell,
GtDate = date.Date,
LtDate = date.Date.AddDays(1)
}, token);
if (stat is null)
return new TimeBalanceDto();
var dto = new TimeBalanceDto()
{
Drilling = $"{GetHoursFromStat(stat, DetectedOperationService.IdOperationRotor, DetectedOperationService.IdOperationSlide):#0.00}",
Flushing = $"{GetHoursFromStat(stat, DetectedOperationService.idOperationFlushing):#0.00}",
Building = $"{GetHoursFromStat(stat, DetectedOperationService.IdOperationSlipsTime):#0.00}",
Elaboration = $"{GetHoursFromStat(stat, DetectedOperationService.IdOperationElaboration):#0.00}",
ElaborationBeforeBuilding = $"{GetHoursFromStat(stat, DetectedOperationService.IdOperationElaborationBeforeBuilding):#0.00}",
TemplatingBeforeBuilding = $"{GetHoursFromStat(stat, DetectedOperationService.IdOperationTemplatingBeforeBuilding):#0.00}",
FlushingBeforeBuilding = $"{GetHoursFromStat(stat, DetectedOperationService.IdOperationFlushingBeforeBuilding):#0.00}",
StaticSurveying = $"{GetHoursFromStat(stat, DetectedOperationService.IdOperationStaticSurveying):#0.00}",
Gis = $"{GetHoursFromStat(stat, DetectedOperationService.IdOperationGis):#0.00}",
Ozc = $"{GetHoursFromStat(stat, DetectedOperationService.IdOperationOzc):#0.00}",
Cementing = $"{GetHoursFromStat(stat, DetectedOperationService.IdOperationCementing):#0.00}",
Npv = $"{GetHoursFromStat(stat, DetectedOperationService.IdOperationNpv):#0.00}",
};
return dto;
}
private static double GetHoursFromStat(IEnumerable<DetectedOperationStatDto> stat, params int[] idCategories)
{
var valueMinutes = stat.Where(o => idCategories.Contains(o.IdCategory))
.Sum(o => o.MinutesTotal);
return valueMinutes / 60d;
}
private static DailyReportDto Convert(AsbCloudDb.Model.DailyReport.DailyReport entity)
{
var dto = entity.Info.Adapt<DailyReportDto>();

View File

@ -18,23 +18,6 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
#nullable enable
public class DetectedOperationService : IDetectedOperationService
{
public const int IdOperationRotor = 2;
public const int IdOperationSlide = 3;
public const int IdOperationSlipsTime = 14;
public const int idOperationFlushing = 22;
public const int IdOperationElaboration = 1022;
public const int idOperationRepair = 1031;
public const int IdOperationGis = 1001;
public const int IdOperationOzc = 1008;
public const int IdOperationCementing = 1040;
public const int IdOperationNpv = 1043;
public const int IdOperationElaborationBeforeBuilding = 18;
public const int IdOperationTemplatingBeforeBuilding = 19;
public const int IdOperationFlushingBeforeBuilding = 20;
public const int IdOperationStaticSurveying = 21;
private readonly IAsbCloudDbContext db;
private readonly IWellService wellService;
private readonly IRepositoryWellRelated<OperationValueDto> operationValueService;
@ -95,8 +78,8 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
.Select(g => new
{
IdTelemetry = g.Key,
RotorDepthInterval = g.Where(o => o.IdCategory == IdOperationRotor).Sum(o => o.DepthEnd - o.DepthStart),
SlideDepthInterval = g.Where(o => o.IdCategory == IdOperationSlide).Sum(o => o.DepthEnd - o.DepthStart)
RotorDepthInterval = g.Where(o => o.IdCategory == WellOperationCategory.IdRotor).Sum(o => o.DepthEnd - o.DepthStart),
SlideDepthInterval = g.Where(o => o.IdCategory == WellOperationCategory.IdSlide).Sum(o => o.DepthEnd - o.DepthStart)
});
var data = await query.ToArrayAsync(token);
var result = data.Select(g =>
@ -202,9 +185,9 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
{
return (op.IdCategory) switch
{
IdOperationRotor => op.Value > op.OperationValue?.TargetValue,
IdOperationSlide => op.Value > op.OperationValue?.TargetValue,
IdOperationSlipsTime => op.Value > op.OperationValue?.TargetValue,
WellOperationCategory.IdRotor => op.Value > op.OperationValue?.TargetValue,
WellOperationCategory.IdSlide => op.Value > op.OperationValue?.TargetValue,
WellOperationCategory.IdSlipsTime => op.Value > op.OperationValue?.TargetValue,
_ => op.Value > op.OperationValue?.TargetValue,
};
}
@ -213,9 +196,9 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
{
return (op.IdCategory) switch
{
IdOperationRotor => 0,
IdOperationSlide => 0,
IdOperationSlipsTime => op.Value - op.OperationValue?.TargetValue??0,
WellOperationCategory.IdRotor => 0,
WellOperationCategory.IdSlide => 0,
WellOperationCategory.IdSlipsTime => op.Value - op.OperationValue?.TargetValue??0,
_ => 0,
};
}

View File

@ -3,17 +3,20 @@
namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
{
#nullable enable
/// <summary>
/// Проработка перед наращиванием
/// </summary>
internal class DetectorDevelopment : DetectorAbstract
{
public DetectorDevelopment()
: base(18) { }
: base(WellOperationCategory.IdDevelopment) { }
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
=> CalcDeltaMinutes(telemetry, begin, end);
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{
if (previousOperation?.IdCategory == 14)
if (previousOperation?.IdCategory == WellOperationCategory.IdSlipsTime)
return false;
var point0 = telemetry[position];

View File

@ -9,15 +9,16 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
internal class DetectorFlashing : DetectorAbstract
{
public DetectorFlashing()
: base(22) { }
: base(WellOperationCategory.IdFlashing)
{ }
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
=> CalcDeltaMinutes(telemetry, begin, end);
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{
if (!((previousOperation?.IdCategory == 2) ||
(previousOperation?.IdCategory == 3)))
if (!((previousOperation?.IdCategory == WellOperationCategory.IdRotor) ||
(previousOperation?.IdCategory == WellOperationCategory.IdSlide)))
return false;
var point0 = telemetry[position];

View File

@ -9,15 +9,15 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
internal class DetectorFlashingBeforeConnection : DetectorAbstract
{
public DetectorFlashingBeforeConnection()
: base(20) { }
: base(WellOperationCategory.IdFlashingBeforeConnection) { }
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
=> CalcDeltaMinutes(telemetry, begin, end);
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{
if (!((previousOperation?.IdCategory == 2) ||
(previousOperation?.IdCategory == 3)))
if (!((previousOperation?.IdCategory == WellOperationCategory.IdRotor) ||
(previousOperation?.IdCategory == WellOperationCategory.IdSlide)))
return false;
var point0 = telemetry[position];

View File

@ -6,7 +6,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
internal class DetectorRotor : DetectorAbstract
{
public DetectorRotor()
: base(2) { }
: base(WellOperationCategory.IdRotor) { }
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{

View File

@ -6,7 +6,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
internal class DetectorSlide : DetectorAbstract
{
public DetectorSlide()
: base(3) { }
: base(WellOperationCategory.IdSlide) { }
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{

View File

@ -6,7 +6,8 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
internal class DetectorSlipsTime : DetectorAbstract
{
public DetectorSlipsTime()
: base(14) { }
: base(WellOperationCategory.IdSlipsTime)
{ }
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
=> CalcDeltaMinutes(telemetry, begin, end);

View File

@ -12,7 +12,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
internal class DetectorStaticSurveying: DetectorAbstract
{
public DetectorStaticSurveying()
: base(21) { }
: base(WellOperationCategory.IdStaticSurveying) { }
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{

View File

@ -7,14 +7,14 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
internal class DetectorTemplating : DetectorAbstract
{
public DetectorTemplating()
: base(19) { }
: base(WellOperationCategory.IdTemplating) { }
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
=> CalcDeltaMinutes(telemetry, begin, end);
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{
if(previousOperation?.IdCategory == 14)
if(previousOperation?.IdCategory == WellOperationCategory.IdSlipsTime)
return false;
var point0 = telemetry[position];

View File

@ -9,14 +9,14 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
internal class DetectorTemplatingWhileDrilling : DetectorAbstract
{
public DetectorTemplatingWhileDrilling()
: base(23) { }
: base(WellOperationCategory.IdTemplatingWhileDrilling) { }
protected override double CalcValue(DetectableTelemetry[] telemetry, int begin, int end)
=> CalcDeltaMinutes(telemetry, begin, end);
protected override bool DetectBegin(DetectableTelemetry[] telemetry, int position, DetectedOperation? previousOperation)
{
if (previousOperation?.IdCategory != 22)
if (previousOperation?.IdCategory != WellOperationCategory.IdFlashing)
return false;
var point0 = telemetry[position];

View File

@ -1,4 +1,4 @@
# Алгоритм определения шаблонировки перед наращиванием
# Алгоритм определения проработки перед наращиванием
## Описание
Проработка перед наращиванием бурильного инструмента операция, во время которой после добуривания очередной трубы/ свечи начинается подъем и спуск бурильного инструмента с вращением. Следующей операцией после проработки будет либо шаблонировка (аналогично проработке, но без вращения), либо разгрузка инструмента в клинья (снижение веса на крюке) - наращивание

View File

@ -237,7 +237,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
BhaUpSpeed = CalcBhaUpSpeed(races),
CasingDownSpeed = CalcCasingDownSpeed(operations),
NonProductiveHours = operations
.Where(o => o.IdCategory == WellOperationService.idOperationNonProductiveTime)
.Where(o => WellOperationCategory.NonProductiveTimeSubIds.Contains( o.IdCategory))
.Sum(o => o.DurationHours),
};
return section;
@ -245,7 +245,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
private static double CalcROP(IEnumerable<WellOperation> operationsProps)
{
var drillingOperations = operationsProps.Where(o => o.IdCategory == WellOperationService.idOperationDrilling);
var drillingOperations = operationsProps.Where(o => WellOperationCategory.MechanicalDrillingSubIds.Contains(o.IdCategory));
var dDepth = 0d;
var dHours = 0d;
foreach (var operation in drillingOperations)
@ -259,7 +259,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
private static double CalcCasingDownSpeed(IEnumerable<WellOperation> operationsProps)
{
var ops = operationsProps.Where(o => o.IdCategory == WellOperationService.idOperationCasingDown);
var ops = operationsProps.Where(o => o.IdCategory == WellOperationCategory.IdCasingDown);
var depth = 0d;
var dHours = 0d;
foreach (var operation in ops)
@ -278,7 +278,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
.GetEnumerator();
while (iterator.MoveNext())
{
if (iterator.Current.IdCategory == WellOperationService.idOperationBhaAssembly)
if (iterator.Current.IdCategory == WellOperationCategory.IdBhaAssembly)
{
var race = new Race
{
@ -288,13 +288,13 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
};
while (iterator.MoveNext())
{
if (iterator.Current.IdCategory == WellOperationService.idOperationTypeRepair)
if (iterator.Current.IdCategory == WellOperationCategory.IdEquipmentRepair)
race.RepairHours += iterator.Current.DurationHours;
if (iterator.Current.IdCategory == WellOperationService.idOperationNonProductiveTime)
if (WellOperationCategory.NonProductiveTimeSubIds.Contains(iterator.Current.IdCategory))
race.NonProductiveHours += iterator.Current.DurationHours;
if (iterator.Current.IdCategory == WellOperationService.idOperationBhaDisassembly)
if (iterator.Current.IdCategory == WellOperationCategory.IdBhaDisassembly)
{
race.EndDate = iterator.Current.DateStart.ToRemoteDateTime(timezoneOffsetH);
race.EndWellDepth = iterator.Current.DepthStart;
@ -329,9 +329,9 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
dDepth += race.StartWellDepth;
for (var i = 0; i < race.Operations.Count; i++)
{
if (race.Operations[i].IdCategory == WellOperationService.idOperationBhaDown)
if (race.Operations[i].IdCategory == WellOperationCategory.IdBhaDown)
dHours += race.Operations[i].DurationHours;
if (race.Operations[i].IdCategory == WellOperationService.idOperationDrilling)
if (WellOperationCategory.MechanicalDrillingSubIds.Contains( race.Operations[i].IdCategory))
break;
}
}
@ -347,9 +347,9 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
dDepth += race.EndWellDepth;
for (var i = race.Operations.Count - 1; i > 0; i--)
{
if (race.Operations[i].IdCategory == WellOperationService.idOperationBhaUp)
if (race.Operations[i].IdCategory == WellOperationCategory.IdBhaUp)
dHours += race.Operations[i].DurationHours;
if (race.Operations[i].IdCategory == WellOperationService.idOperationDrilling)
if (WellOperationCategory.MechanicalDrillingSubIds.Contains(race.Operations[i].IdCategory))
break;
}
}
@ -400,7 +400,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
var plan = item.Item1;
var fact = item.Item2;
if (fact?.IdCategory == WellOperationService.idOperationNonProductiveTime)
if (fact is not null && WellOperationCategory.NonProductiveTimeSubIds.Contains(fact.IdCategory))
{
nptHours += fact.DurationHours;
}

View File

@ -1,5 +1,6 @@
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using ClosedXML.Excel;
using System;
using System.Collections.Generic;
@ -141,7 +142,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
SetCell(row, columnDateEndFact, tvdItem.Fact?.DateStart.AddHours(tvdItem.Fact?.DurationHours ?? 0));
SetCell(row, columnDateEndPredict, tvdItem.Predict?.DateStart.AddHours(tvdItem.Predict?.DurationHours ?? 0));
if (tvdItem.Fact?.IdCategory == WellOperationService.idOperationNonProductiveTime)
if (tvdItem.Fact is not null && WellOperationCategory.NonProductiveTimeSubIds.Contains(tvdItem.Fact.IdCategory))
{
SetCell(row, columnGuilty, tvdItem.Fact.Comment);
SetCell(row, columnNpt, tvdItem.Fact.DurationHours);

View File

@ -21,16 +21,8 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
private Dictionary<int, DateTimeOffset?>? firstOperationsCache = null;
public const int idOperationBhaAssembly = 1025;
public const int idOperationBhaDisassembly = 1026;
public const int idOperationNonProductiveTime = 1043;
public const int idOperationDrilling = 1001;
public const int idOperationBhaDown = 1046;
public const int idOperationBhaUp = 1047;
public const int idOperationCasingDown = 1048;
public const int idOperationTypePlan = 0;
public const int idOperationTypeFact = 1;
public const int idOperationTypeRepair = 1031;
public WellOperationService(IAsbCloudDbContext db, IMemoryCache memoryCache, IWellService wellService)
{
@ -46,10 +38,18 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
public IEnumerable<WellOperationCategoryDto> GetCategories()
{
var operationCategories = memoryCache
.GetOrCreateBasic<WellOperationCategory>(db)
.Distinct()
.OrderBy(o => o.Name);
var allCategories = memoryCache
.GetOrCreateBasic<WellOperationCategory>(db);
var parentIds = allCategories
.Select(o => o.IdParent)
.Distinct();
var operationCategories = allCategories
.Where(o => !parentIds.Contains(o.Id))
.OrderBy(o => o.IdParent)
.ThenBy(o => o.Name);
var result = operationCategories.Adapt<IEnumerable<WellOperationCategoryDto>>();
return result;
}
@ -129,7 +129,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
dto.CategoryName = entity.OperationCategory.Name;
if (entity.IdType == idOperationTypeFact)
{
if (entity.IdCategory == idOperationNonProductiveTime)
if (WellOperationCategory.NonProductiveTimeSubIds.Contains(entity.IdCategory))
nptHours += entity.DurationHours;
dto.NptHours = nptHours;
}