Правка по результатам ревью + разделение парсера, экспортсервиса, автотестов на ротор и слайд

This commit is contained in:
Olga Nemt 2024-06-21 09:53:45 +05:00
parent 089ce64e65
commit d5d0afba78
38 changed files with 1326 additions and 1292 deletions

View File

@ -1,103 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план бурение скважины
/// </summary>
public class ProcessMapPlanDrillingDto : ProcessMapPlanBaseDto
{
/// <summary>
/// Id режима 1-ротор, 2 - слайд
/// </summary>
[Range(1, 2, ErrorMessage = "Id режима должен быть либо 1-ротор либо 2-слайд")]
public int IdMode { get; set; }
/// <summary>
/// Название режима бурения
/// </summary>
public string? Mode { get; set; }
/// <summary>
/// Осевая нагрузка, т план
/// </summary>
[Range(0, 99999.9, ErrorMessage = "Осевая нагрузка, т должна быть в пределах от 0 до 99999.9")]
public double AxialLoadPlan { get; set; }
/// <summary>
/// Осевая нагрузка, т ограничение
/// </summary>
[Range(0, 99999.9, ErrorMessage = "Осевая нагрузка, т должна быть в пределах от 0 до 99999.9")]
public double AxialLoadLimitMax { get; set; }
/// <summary>
/// Перепад давления, атм план
/// </summary>
[Range(0, 99999.9, ErrorMessage = "Перепад давления, атм должна быть в пределах от 0 до 99999.9")]
public double DeltaPressurePlan { get; set; }
/// <summary>
/// Перепад давления, атм ограничение
/// </summary>
[Range(0, 99999.9, ErrorMessage = "Перепад давления, атм должна быть в пределах от 0 до 99999.9")]
public double DeltaPressureLimitMax { get; set; }
/// <summary>
/// Момент на ВСП, кН*м план
/// </summary>
[Range(0, 99999.9, ErrorMessage = "Момент на ВСП, кН*м должна быть в пределах от 0 до 99999.9")]
public double TopDriveTorquePlan { get; set; }
/// <summary>
/// Момент на ВСП, кН*м ограничение
/// </summary>
[Range(0, 99999.9, ErrorMessage = "Момент на ВСП, кН*м должна быть в пределах от 0 до 99999.9")]
public double TopDriveTorqueLimitMax { get; set; }
/// <summary>
/// Обороты на ВСП, об/мин план
/// </summary>
[Range(0, 99999.9, ErrorMessage = "Обороты на ВСП, об/мин должна быть в пределах от 0 до 99999.9")]
public double TopDriveSpeedPlan { get; set; }
/// <summary>
/// Обороты на ВСП, об/мин ограничение
/// </summary>
[Range(0, 99999.9, ErrorMessage = "Обороты на ВСП, об/мин должна быть в пределах от 0 до 99999.9")]
public double TopDriveSpeedLimitMax { get; set; }
/// <summary>
/// Расход, л/с план
/// </summary>
[Range(0, 99999.9, ErrorMessage = "Расход, л/с должна быть в пределах от 0 до 99999.9")]
public double FlowPlan { get; set; }
/// <summary>
/// Расход, л/с ограничение
/// </summary>
[Range(0, 99999.9, ErrorMessage = "Расход, л/с должна быть в пределах от 0 до 99999.9")]
public double FlowLimitMax { get; set; }
/// <summary>
/// Плановая механическая скорость, м/ч
/// </summary>
[Range(0, 99999.9, ErrorMessage = "Плановая механическая скорость, м/ч должно быть в пределах от 0 до 99999.9")]
public double RopPlan { get; set; }
/// <summary>
/// Плановый процент использования АКБ
/// </summary>
[Range(0, 100, ErrorMessage = "Процент использования АКБ должен быть в пределах от 0 до 100")]
public double UsageSaub { get; set; }
/// <summary>
/// Плановый процент использования spin master
/// </summary>
[Range(0, 100, ErrorMessage = "Процент использования spin master должен быть в пределах от 0 до 100")]
public double UsageSpin { get; set; }
/// <summary>
/// Комментарий
/// </summary>
public string Comment { get; set; } = string.Empty;
}

View File

@ -34,6 +34,6 @@ namespace AsbCloudApp.Repositories
/// <param name="idWell"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<ProcessMapPlanDrillingDto>> GetCompositeProcessMap(int idWell, CancellationToken token);
Task<IEnumerable<ProcessMapPlanBaseDto>> GetCompositeProcessMap(int idWell, CancellationToken token);
}
}

View File

@ -13,7 +13,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations
{
[DbContext(typeof(AsbCloudDbContext))]
[Migration("20240611044842_Add_ProcessMapPlanRotor_And_Slide")]
[Migration("20240613110103_Add_ProcessMapPlanRotor_And_Slide")]
partial class Add_ProcessMapPlanRotor_And_Slide
{
/// <inheritdoc />
@ -2632,161 +2632,6 @@ namespace AsbCloudDb.Migrations
});
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanDrilling", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasComment("Идентификатор");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<double>("AxialLoadLimitMax")
.HasColumnType("double precision")
.HasColumnName("axial_load_limit_max")
.HasComment("Осевая нагрузка, т, допустимый максимум");
b.Property<double>("AxialLoadPlan")
.HasColumnType("double precision")
.HasColumnName("axial_load_plan")
.HasComment("Осевая нагрузка, т, план");
b.Property<string>("Comment")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("comment")
.HasComment("Комментарий");
b.Property<DateTimeOffset>("Creation")
.HasColumnType("timestamp with time zone")
.HasColumnName("creation")
.HasComment("дата создания");
b.Property<double>("DeltaPressureLimitMax")
.HasColumnType("double precision")
.HasColumnName("delta_pressure_limit_max")
.HasComment("Перепад давления, атм, допустимый максимум");
b.Property<double>("DeltaPressurePlan")
.HasColumnType("double precision")
.HasColumnName("delta_pressure_plan")
.HasComment("Перепад давления, атм, план");
b.Property<double>("DepthEnd")
.HasColumnType("double precision")
.HasColumnName("depth_end")
.HasComment("Глубина по стволу до, м");
b.Property<double>("DepthStart")
.HasColumnType("double precision")
.HasColumnName("depth_start")
.HasComment("Глубина по стволу от, м");
b.Property<double>("FlowLimitMax")
.HasColumnType("double precision")
.HasColumnName("flow_limit_max")
.HasComment("Расход, л/с, допустимый максимум");
b.Property<double>("FlowPlan")
.HasColumnType("double precision")
.HasColumnName("flow_plan")
.HasComment("Расход, л/с, план");
b.Property<int>("IdAuthor")
.HasColumnType("integer")
.HasColumnName("id_author")
.HasComment("Автор");
b.Property<int?>("IdEditor")
.HasColumnType("integer")
.HasColumnName("id_editor")
.HasComment("Редактор");
b.Property<int>("IdMode")
.HasColumnType("integer")
.HasColumnName("id_mode")
.HasComment("Id режима (1- ротор, 2 слайд)");
b.Property<int?>("IdPrevious")
.HasColumnType("integer")
.HasColumnName("id_previous")
.HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная");
b.Property<int>("IdState")
.HasColumnType("integer")
.HasColumnName("id_state")
.HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная");
b.Property<int>("IdWell")
.HasColumnType("integer")
.HasColumnName("id_well")
.HasComment("Id скважины");
b.Property<int>("IdWellSectionType")
.HasColumnType("integer")
.HasColumnName("id_wellsection_type")
.HasComment("Тип секции");
b.Property<DateTimeOffset?>("Obsolete")
.HasColumnType("timestamp with time zone")
.HasColumnName("obsolete")
.HasComment("дата устаревания");
b.Property<double>("RopPlan")
.HasColumnType("double precision")
.HasColumnName("rop_plan")
.HasComment("Плановая механическая скорость, м/ч");
b.Property<double>("TopDriveSpeedLimitMax")
.HasColumnType("double precision")
.HasColumnName("top_drive_speed_limit_max")
.HasComment("Обороты на ВСП, допустимый максимум");
b.Property<double>("TopDriveSpeedPlan")
.HasColumnType("double precision")
.HasColumnName("top_drive_speed_plan")
.HasComment("Обороты на ВСП, план");
b.Property<double>("TopDriveTorqueLimitMax")
.HasColumnType("double precision")
.HasColumnName("top_drive_torque_limit_max")
.HasComment("Момент на ВСП, допустимый максимум");
b.Property<double>("TopDriveTorquePlan")
.HasColumnType("double precision")
.HasColumnName("top_drive_torque_plan")
.HasComment("Момент на ВСП, план");
b.Property<double>("UsageSaub")
.HasColumnType("double precision")
.HasColumnName("usage_saub")
.HasComment("Плановый процент использования АКБ");
b.Property<double>("UsageSpin")
.HasColumnType("double precision")
.HasColumnName("usage_spin")
.HasComment("Плановый процент использования spin master");
b.HasKey("Id");
b.HasIndex("IdAuthor");
b.HasIndex("IdEditor");
b.HasIndex("IdPrevious");
b.HasIndex("IdWell");
b.HasIndex("IdWellSectionType");
b.ToTable("t_process_map_plan_drilling", t =>
{
t.HasComment("РТК план бурение");
});
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanReam", b =>
{
b.Property<int>("Id")
@ -2933,26 +2778,26 @@ namespace AsbCloudDb.Migrations
.HasColumnName("depth_start")
.HasComment("Глубина по стволу от, м");
b.Property<double>("DifferentialPressure")
.HasColumnType("double precision")
.HasColumnName("differential_pressure")
.HasComment("Перепад давления, атм. Уставка");
b.Property<double>("DifferentialPressureLimitMax")
.HasColumnType("double precision")
.HasColumnName("differential_pressure_limit_max")
.HasComment("Перепад давления, атм. Ограничение");
b.Property<double>("DifferentialPressurePlan")
b.Property<double>("FlowRate")
.HasColumnType("double precision")
.HasColumnName("differential_pressure_plan")
.HasComment("Перепад давления, атм. Уставка");
.HasColumnName("flow_rate")
.HasComment("Расход л/с. Уставка");
b.Property<double>("FlowRateLimitMax")
.HasColumnType("double precision")
.HasColumnName("flow_rate_limit_max")
.HasComment("Расход л/с. Ограничение");
b.Property<double>("FlowRatePlan")
.HasColumnType("double precision")
.HasColumnName("flow_rate_plan")
.HasComment("Расход л/с. Уставка");
b.Property<int>("IdAuthor")
.HasColumnType("integer")
.HasColumnName("id_author")
@ -2983,11 +2828,6 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_wellsection_type")
.HasComment("Тип секции");
b.Property<double>("MaxAllowablePressure")
.HasColumnType("double precision")
.HasColumnName("max_allowable_pressure")
.HasComment("Максимально допустимое давление, атм");
b.Property<string>("Note")
.IsRequired()
.HasMaxLength(1024)
@ -3000,41 +2840,46 @@ namespace AsbCloudDb.Migrations
.HasColumnName("obsolete")
.HasComment("дата устаревания");
b.Property<double>("PressureLimitMax")
.HasColumnType("double precision")
.HasColumnName("pressure_limit_max")
.HasComment("Максимально допустимое давление, атм");
b.Property<double>("RevolutionsPerMinute")
.HasColumnType("double precision")
.HasColumnName("revolution_per_minute")
.HasComment("Обороты на ВСП, об/мин. Уставка");
b.Property<double>("RevolutionsPerMinuteLimitMax")
.HasColumnType("double precision")
.HasColumnName("revolutions_per_minute_limit_max")
.HasComment("Обороты на ВСП, об/мин. Ограничение");
b.Property<double>("RevolutionsPerMinutePlan")
b.Property<double>("RopLimitMax")
.HasColumnType("double precision")
.HasColumnName("revolution_per_minute_plan")
.HasComment("Обороты на ВСП, об/мин. Уставка");
b.Property<double>("RopPlan")
.HasColumnType("double precision")
.HasColumnName("rop_plan")
.HasColumnName("rop_limit_max")
.HasComment("Максимально допустимая скорость, м/ч");
b.Property<double>("TopDriveTorquePlan")
b.Property<double>("TopDriveTorque")
.HasColumnType("double precision")
.HasColumnName("top_drive_torque_plan")
.HasColumnName("top_drive_torque")
.HasComment("Момент на ВСП, кН*м. Уставка");
b.Property<double>("TopDriveTorquetLimit")
b.Property<double>("TopDriveTorqueLimit")
.HasColumnType("double precision")
.HasColumnName("top_drive_torque_limit_max")
.HasComment("Момент на ВСП, кН*м. Ограничение");
b.Property<double>("WeightOnBit")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit")
.HasComment("Нагрузка, т. Уставка");
b.Property<double>("WeightOnBitLimitMax")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit_limit_max")
.HasComment("Нагрузка, т. Ограничение");
b.Property<double>("WeightOnBitPlan")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit_plan")
.HasComment("Нагрузка, т. Уставка");
b.HasKey("Id");
b.HasIndex("IdAuthor");
@ -3078,31 +2923,26 @@ namespace AsbCloudDb.Migrations
.HasColumnName("depth_start")
.HasComment("Глубина по стволу от, м");
b.Property<double>("DesignSpring")
b.Property<double>("DifferentialPressure")
.HasColumnType("double precision")
.HasColumnName("design_spring")
.HasComment("Расчётная пружина, градус");
.HasColumnName("differential_pressure")
.HasComment("Перепад давления, атм. Уставка");
b.Property<double>("DifferentialPressureLimitMax")
.HasColumnType("double precision")
.HasColumnName("differential_pressure_limit_max")
.HasComment("Перепад давления, атм. Ограничение");
b.Property<double>("DifferentialPressurePlan")
b.Property<double>("FlowRate")
.HasColumnType("double precision")
.HasColumnName("differential_pressure_plan")
.HasComment("Перепад давления, атм. Уставка");
.HasColumnName("flow_rate")
.HasComment("Расход л/с. Уставка");
b.Property<double>("FlowRateLimitMax")
.HasColumnType("double precision")
.HasColumnName("flow_rate_limit_max")
.HasComment("Расход л/с. Ограничение");
b.Property<double>("FlowRatePlan")
.HasColumnType("double precision")
.HasColumnName("flow_rate_plan")
.HasComment("Расход л/с. Уставка");
b.Property<int>("IdAuthor")
.HasColumnType("integer")
.HasColumnName("id_author")
@ -3133,11 +2973,6 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_wellsection_type")
.HasComment("Тип секции");
b.Property<double>("MaxAllowablePressure")
.HasColumnType("double precision")
.HasColumnName("max_allowable_pressure")
.HasComment("Максимально допустимое давление, атм");
b.Property<string>("Note")
.IsRequired()
.HasMaxLength(1024)
@ -3150,26 +2985,36 @@ namespace AsbCloudDb.Migrations
.HasColumnName("obsolete")
.HasComment("дата устаревания");
b.Property<double>("RopPlan")
b.Property<double>("PressureLimitMax")
.HasColumnType("double precision")
.HasColumnName("rop_plan")
.HasColumnName("pressure_limit_max")
.HasComment("Максимально допустимое давление, атм");
b.Property<double>("RopLimitMax")
.HasColumnType("double precision")
.HasColumnName("rop_limit_max")
.HasComment("Максимально допустимая скорость, м/ч");
b.Property<double>("Spring")
.HasColumnType("double precision")
.HasColumnName("spring")
.HasComment("Расчётная пружина, градус");
b.Property<double>("ToolBuckling")
.HasColumnType("double precision")
.HasColumnName("tool_buckling")
.HasComment("Складывание инструмента, м");
b.Property<double>("WeightOnBit")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit")
.HasComment("Нагрузка, т. Уставка");
b.Property<double>("WeightOnBitLimitMax")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit_limit_max")
.HasComment("Нагрузка, т. Ограничение");
b.Property<double>("WeightOnBitPlan")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit_plan")
.HasComment("Нагрузка, т. Уставка");
b.HasKey("Id");
b.HasIndex("IdAuthor");
@ -9147,46 +8992,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("Well");
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanDrilling", b =>
{
b.HasOne("AsbCloudDb.Model.User", "Author")
.WithMany()
.HasForeignKey("IdAuthor")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("AsbCloudDb.Model.User", "Editor")
.WithMany()
.HasForeignKey("IdEditor")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanDrilling", "Previous")
.WithMany()
.HasForeignKey("IdPrevious");
b.HasOne("AsbCloudDb.Model.Well", "Well")
.WithMany()
.HasForeignKey("IdWell")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType")
.WithMany()
.HasForeignKey("IdWellSectionType")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Editor");
b.Navigation("Previous");
b.Navigation("Well");
b.Navigation("WellSectionType");
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanReam", b =>
{
b.HasOne("AsbCloudDb.Model.User", "Author")
@ -9273,7 +9078,7 @@ namespace AsbCloudDb.Migrations
.HasForeignKey("IdEditor")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanDrilling", "Previous")
b.HasOne("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanSlide", "Previous")
.WithMany()
.HasForeignKey("IdPrevious");

View File

@ -4,6 +4,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace AsbCloudDb.Migrations
{
/// <inheritdoc />
@ -18,17 +20,17 @@ namespace AsbCloudDb.Migrations
{
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
rop_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимая скорость, м/ч"),
max_allowable_pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимое давление, атм"),
differential_pressure_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления, атм. Уставка"),
rop_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимая скорость, м/ч"),
pressure_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимое давление, атм"),
differential_pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления, атм. Уставка"),
differential_pressure_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления, атм. Ограничение"),
weight_on_bit_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Нагрузка, т. Уставка"),
weight_on_bit = table.Column<double>(type: "double precision", nullable: false, comment: "Нагрузка, т. Уставка"),
weight_on_bit_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Нагрузка, т. Ограничение"),
top_drive_torque_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Момент на ВСП, кН*м. Уставка"),
top_drive_torque = table.Column<double>(type: "double precision", nullable: false, comment: "Момент на ВСП, кН*м. Уставка"),
top_drive_torque_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Момент на ВСП, кН*м. Ограничение"),
revolution_per_minute_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Обороты на ВСП, об/мин. Уставка"),
revolution_per_minute = table.Column<double>(type: "double precision", nullable: false, comment: "Обороты на ВСП, об/мин. Уставка"),
revolutions_per_minute_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Обороты на ВСП, об/мин. Ограничение"),
flow_rate_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Расход л/с. Уставка"),
flow_rate = table.Column<double>(type: "double precision", nullable: false, comment: "Расход л/с. Уставка"),
flow_rate_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Расход л/с. Ограничение"),
note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
@ -83,15 +85,15 @@ namespace AsbCloudDb.Migrations
{
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
rop_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимая скорость, м/ч"),
max_allowable_pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимое давление, атм"),
differential_pressure_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления, атм. Уставка"),
rop_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимая скорость, м/ч"),
pressure_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимально допустимое давление, атм"),
differential_pressure = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления, атм. Уставка"),
differential_pressure_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления, атм. Ограничение"),
weight_on_bit_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Нагрузка, т. Уставка"),
weight_on_bit = table.Column<double>(type: "double precision", nullable: false, comment: "Нагрузка, т. Уставка"),
weight_on_bit_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Нагрузка, т. Ограничение"),
flow_rate_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Расход л/с. Уставка"),
flow_rate = table.Column<double>(type: "double precision", nullable: false, comment: "Расход л/с. Уставка"),
flow_rate_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Расход л/с. Ограничение"),
design_spring = table.Column<double>(type: "double precision", nullable: false, comment: "Расчётная пружина, градус"),
spring = table.Column<double>(type: "double precision", nullable: false, comment: "Расчётная пружина, градус"),
tool_buckling = table.Column<double>(type: "double precision", nullable: false, comment: "Складывание инструмента, м"),
note = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Примечание"),
id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
@ -109,9 +111,9 @@ namespace AsbCloudDb.Migrations
{
table.PrimaryKey("PK_t_process_map_plan_slide", x => x.id);
table.ForeignKey(
name: "FK_t_process_map_plan_slide_t_process_map_plan_drilling_id_pre~",
name: "FK_t_process_map_plan_slide_t_process_map_plan_slide_id_previo~",
column: x => x.id_previous,
principalTable: "t_process_map_plan_drilling",
principalTable: "t_process_map_plan_slide",
principalColumn: "id");
table.ForeignKey(
name: "FK_t_process_map_plan_slide_t_user_id_author",
@ -191,28 +193,30 @@ namespace AsbCloudDb.Migrations
column: "id_wellsection_type");
migrationBuilder.Sql(@"INSERT INTO public.t_process_map_plan_rotor
(id, id_wellsection_type, rop_plan, depth_start, depth_end, differential_pressure_plan,
differential_pressure_limit_max, weight_on_bit_plan, weight_on_bit_limit_max,
top_drive_torque_plan, top_drive_torque_limit_max, revolution_per_minute_plan,
revolutions_per_minute_limit_max, flow_rate_plan, flow_rate_limit_max, note,
max_allowable_pressure, id_author, creation, id_state, id_well, id_editor, obsolete, id_previous)
(id, id_wellsection_type, rop_limit_max, depth_start, depth_end, differential_pressure,
differential_pressure_limit_max, weight_on_bit, weight_on_bit_limit_max,
top_drive_torque, top_drive_torque_limit_max, revolution_per_minute,
revolutions_per_minute_limit_max, flow_rate, flow_rate_limit_max, note,
pressure_limit_max, id_author, creation, id_state, id_well, id_editor)
SELECT id, id_wellsection_type, rop_plan, depth_start, depth_end, delta_pressure_plan,
delta_pressure_limit_max, axial_load_plan, axial_load_limit_max,
top_drive_torque_plan, top_drive_torque_limit_max, top_drive_speed_plan,
top_drive_speed_limit_max, flow_plan, flow_limit_max, comment, 0, id_author, creation, id_state, id_well,
id_editor, obsolete, id_previous
FROM public.t_process_map_plan_drilling WHERE id_mode = 1");
id_editor
FROM public.t_process_map_plan_drilling WHERE id_mode = 1 AND obsolete is null");
migrationBuilder.Sql(@"INSERT INTO public.t_process_map_plan_slide
(id, id_wellsection_type, rop_plan, depth_start, depth_end, differential_pressure_plan,
differential_pressure_limit_max, weight_on_bit_plan, weight_on_bit_limit_max,
flow_rate_plan, flow_rate_limit_max, note, max_allowable_pressure, id_author, creation,
id_state, id_well, design_spring, tool_buckling, id_editor, obsolete, id_previous)
(id, id_wellsection_type, rop_limit_max, depth_start, depth_end, differential_pressure,
differential_pressure_limit_max, weight_on_bit, weight_on_bit_limit_max,
flow_rate, flow_rate_limit_max, note, pressure_limit_max, id_author, creation,
id_state, id_well, spring, tool_buckling, id_editor)
SELECT id, id_wellsection_type, rop_plan, depth_start, depth_end, delta_pressure_plan,
delta_pressure_limit_max, axial_load_plan, axial_load_limit_max,
flow_plan, flow_limit_max, comment, 0, id_author, creation, id_state, id_well, 0, 0, id_editor, obsolete, id_previous
flow_plan, flow_limit_max, comment, 0, id_author, creation, id_state, id_well, 0, 0, id_editor
FROM public.t_process_map_plan_drilling
WHERE id_mode = 2");
WHERE id_mode = 2 AND obsolete is null");
migrationBuilder.DropTable(name: "t_process_map_plan_drilling");
}
/// <inheritdoc />
@ -223,6 +227,98 @@ namespace AsbCloudDb.Migrations
migrationBuilder.DropTable(
name: "t_process_map_plan_slide");
migrationBuilder.CreateTable(
name: "t_process_map_plan_drilling",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор")
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_author = table.Column<int>(type: "integer", nullable: false, comment: "Автор"),
id_editor = table.Column<int>(type: "integer", nullable: true, comment: "Редактор"),
id_previous = table.Column<int>(type: "integer", nullable: true, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Тип секции"),
axial_load_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Осевая нагрузка, т, допустимый максимум"),
axial_load_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Осевая нагрузка, т, план"),
comment = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false, comment: "Комментарий"),
creation = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "дата создания"),
delta_pressure_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления, атм, допустимый максимум"),
delta_pressure_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Перепад давления, атм, план"),
depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу до, м"),
depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина по стволу от, м"),
flow_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Расход, л/с, допустимый максимум"),
flow_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Расход, л/с, план"),
id_mode = table.Column<int>(type: "integer", nullable: false, comment: "Id режима (1- ротор, 2 слайд)"),
id_state = table.Column<int>(type: "integer", nullable: false, comment: "ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная"),
obsolete = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true, comment: "дата устаревания"),
rop_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Плановая механическая скорость, м/ч"),
top_drive_speed_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Обороты на ВСП, допустимый максимум"),
top_drive_speed_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Обороты на ВСП, план"),
top_drive_torque_limit_max = table.Column<double>(type: "double precision", nullable: false, comment: "Момент на ВСП, допустимый максимум"),
top_drive_torque_plan = table.Column<double>(type: "double precision", nullable: false, comment: "Момент на ВСП, план"),
usage_saub = table.Column<double>(type: "double precision", nullable: false, comment: "Плановый процент использования АКБ"),
usage_spin = table.Column<double>(type: "double precision", nullable: false, comment: "Плановый процент использования spin master")
},
constraints: table =>
{
table.PrimaryKey("PK_t_process_map_plan_drilling", x => x.id);
table.ForeignKey(
name: "FK_t_process_map_plan_drilling_t_process_map_plan_drilling_id_~",
column: x => x.id_previous,
principalTable: "t_process_map_plan_drilling",
principalColumn: "id");
table.ForeignKey(
name: "FK_t_process_map_plan_drilling_t_user_id_author",
column: x => x.id_author,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_t_process_map_plan_drilling_t_user_id_editor",
column: x => x.id_editor,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_t_process_map_plan_drilling_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_process_map_plan_drilling_t_well_section_type_id_wellsect~",
column: x => x.id_wellsection_type,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "РТК план бурение");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_plan_drilling_id_author",
table: "t_process_map_plan_drilling",
column: "id_author");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_plan_drilling_id_editor",
table: "t_process_map_plan_drilling",
column: "id_editor");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_plan_drilling_id_previous",
table: "t_process_map_plan_drilling",
column: "id_previous");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_plan_drilling_id_well",
table: "t_process_map_plan_drilling",
column: "id_well");
migrationBuilder.CreateIndex(
name: "IX_t_process_map_plan_drilling_id_wellsection_type",
table: "t_process_map_plan_drilling",
column: "id_wellsection_type");
}
}
}

View File

@ -2629,161 +2629,6 @@ namespace AsbCloudDb.Migrations
});
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanDrilling", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id")
.HasComment("Идентификатор");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<double>("AxialLoadLimitMax")
.HasColumnType("double precision")
.HasColumnName("axial_load_limit_max")
.HasComment("Осевая нагрузка, т, допустимый максимум");
b.Property<double>("AxialLoadPlan")
.HasColumnType("double precision")
.HasColumnName("axial_load_plan")
.HasComment("Осевая нагрузка, т, план");
b.Property<string>("Comment")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("character varying(1024)")
.HasColumnName("comment")
.HasComment("Комментарий");
b.Property<DateTimeOffset>("Creation")
.HasColumnType("timestamp with time zone")
.HasColumnName("creation")
.HasComment("дата создания");
b.Property<double>("DeltaPressureLimitMax")
.HasColumnType("double precision")
.HasColumnName("delta_pressure_limit_max")
.HasComment("Перепад давления, атм, допустимый максимум");
b.Property<double>("DeltaPressurePlan")
.HasColumnType("double precision")
.HasColumnName("delta_pressure_plan")
.HasComment("Перепад давления, атм, план");
b.Property<double>("DepthEnd")
.HasColumnType("double precision")
.HasColumnName("depth_end")
.HasComment("Глубина по стволу до, м");
b.Property<double>("DepthStart")
.HasColumnType("double precision")
.HasColumnName("depth_start")
.HasComment("Глубина по стволу от, м");
b.Property<double>("FlowLimitMax")
.HasColumnType("double precision")
.HasColumnName("flow_limit_max")
.HasComment("Расход, л/с, допустимый максимум");
b.Property<double>("FlowPlan")
.HasColumnType("double precision")
.HasColumnName("flow_plan")
.HasComment("Расход, л/с, план");
b.Property<int>("IdAuthor")
.HasColumnType("integer")
.HasColumnName("id_author")
.HasComment("Автор");
b.Property<int?>("IdEditor")
.HasColumnType("integer")
.HasColumnName("id_editor")
.HasComment("Редактор");
b.Property<int>("IdMode")
.HasColumnType("integer")
.HasColumnName("id_mode")
.HasComment("Id режима (1- ротор, 2 слайд)");
b.Property<int?>("IdPrevious")
.HasColumnType("integer")
.HasColumnName("id_previous")
.HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная");
b.Property<int>("IdState")
.HasColumnType("integer")
.HasColumnName("id_state")
.HasComment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная");
b.Property<int>("IdWell")
.HasColumnType("integer")
.HasColumnName("id_well")
.HasComment("Id скважины");
b.Property<int>("IdWellSectionType")
.HasColumnType("integer")
.HasColumnName("id_wellsection_type")
.HasComment("Тип секции");
b.Property<DateTimeOffset?>("Obsolete")
.HasColumnType("timestamp with time zone")
.HasColumnName("obsolete")
.HasComment("дата устаревания");
b.Property<double>("RopPlan")
.HasColumnType("double precision")
.HasColumnName("rop_plan")
.HasComment("Плановая механическая скорость, м/ч");
b.Property<double>("TopDriveSpeedLimitMax")
.HasColumnType("double precision")
.HasColumnName("top_drive_speed_limit_max")
.HasComment("Обороты на ВСП, допустимый максимум");
b.Property<double>("TopDriveSpeedPlan")
.HasColumnType("double precision")
.HasColumnName("top_drive_speed_plan")
.HasComment("Обороты на ВСП, план");
b.Property<double>("TopDriveTorqueLimitMax")
.HasColumnType("double precision")
.HasColumnName("top_drive_torque_limit_max")
.HasComment("Момент на ВСП, допустимый максимум");
b.Property<double>("TopDriveTorquePlan")
.HasColumnType("double precision")
.HasColumnName("top_drive_torque_plan")
.HasComment("Момент на ВСП, план");
b.Property<double>("UsageSaub")
.HasColumnType("double precision")
.HasColumnName("usage_saub")
.HasComment("Плановый процент использования АКБ");
b.Property<double>("UsageSpin")
.HasColumnType("double precision")
.HasColumnName("usage_spin")
.HasComment("Плановый процент использования spin master");
b.HasKey("Id");
b.HasIndex("IdAuthor");
b.HasIndex("IdEditor");
b.HasIndex("IdPrevious");
b.HasIndex("IdWell");
b.HasIndex("IdWellSectionType");
b.ToTable("t_process_map_plan_drilling", t =>
{
t.HasComment("РТК план бурение");
});
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanReam", b =>
{
b.Property<int>("Id")
@ -2930,26 +2775,26 @@ namespace AsbCloudDb.Migrations
.HasColumnName("depth_start")
.HasComment("Глубина по стволу от, м");
b.Property<double>("DifferentialPressure")
.HasColumnType("double precision")
.HasColumnName("differential_pressure")
.HasComment("Перепад давления, атм. Уставка");
b.Property<double>("DifferentialPressureLimitMax")
.HasColumnType("double precision")
.HasColumnName("differential_pressure_limit_max")
.HasComment("Перепад давления, атм. Ограничение");
b.Property<double>("DifferentialPressurePlan")
b.Property<double>("FlowRate")
.HasColumnType("double precision")
.HasColumnName("differential_pressure_plan")
.HasComment("Перепад давления, атм. Уставка");
.HasColumnName("flow_rate")
.HasComment("Расход л/с. Уставка");
b.Property<double>("FlowRateLimitMax")
.HasColumnType("double precision")
.HasColumnName("flow_rate_limit_max")
.HasComment("Расход л/с. Ограничение");
b.Property<double>("FlowRatePlan")
.HasColumnType("double precision")
.HasColumnName("flow_rate_plan")
.HasComment("Расход л/с. Уставка");
b.Property<int>("IdAuthor")
.HasColumnType("integer")
.HasColumnName("id_author")
@ -2980,11 +2825,6 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_wellsection_type")
.HasComment("Тип секции");
b.Property<double>("MaxAllowablePressure")
.HasColumnType("double precision")
.HasColumnName("max_allowable_pressure")
.HasComment("Максимально допустимое давление, атм");
b.Property<string>("Note")
.IsRequired()
.HasMaxLength(1024)
@ -2997,41 +2837,46 @@ namespace AsbCloudDb.Migrations
.HasColumnName("obsolete")
.HasComment("дата устаревания");
b.Property<double>("PressureLimitMax")
.HasColumnType("double precision")
.HasColumnName("pressure_limit_max")
.HasComment("Максимально допустимое давление, атм");
b.Property<double>("RevolutionsPerMinute")
.HasColumnType("double precision")
.HasColumnName("revolution_per_minute")
.HasComment("Обороты на ВСП, об/мин. Уставка");
b.Property<double>("RevolutionsPerMinuteLimitMax")
.HasColumnType("double precision")
.HasColumnName("revolutions_per_minute_limit_max")
.HasComment("Обороты на ВСП, об/мин. Ограничение");
b.Property<double>("RevolutionsPerMinutePlan")
b.Property<double>("RopLimitMax")
.HasColumnType("double precision")
.HasColumnName("revolution_per_minute_plan")
.HasComment("Обороты на ВСП, об/мин. Уставка");
b.Property<double>("RopPlan")
.HasColumnType("double precision")
.HasColumnName("rop_plan")
.HasColumnName("rop_limit_max")
.HasComment("Максимально допустимая скорость, м/ч");
b.Property<double>("TopDriveTorquePlan")
b.Property<double>("TopDriveTorque")
.HasColumnType("double precision")
.HasColumnName("top_drive_torque_plan")
.HasColumnName("top_drive_torque")
.HasComment("Момент на ВСП, кН*м. Уставка");
b.Property<double>("TopDriveTorquetLimit")
b.Property<double>("TopDriveTorqueLimit")
.HasColumnType("double precision")
.HasColumnName("top_drive_torque_limit_max")
.HasComment("Момент на ВСП, кН*м. Ограничение");
b.Property<double>("WeightOnBit")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit")
.HasComment("Нагрузка, т. Уставка");
b.Property<double>("WeightOnBitLimitMax")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit_limit_max")
.HasComment("Нагрузка, т. Ограничение");
b.Property<double>("WeightOnBitPlan")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit_plan")
.HasComment("Нагрузка, т. Уставка");
b.HasKey("Id");
b.HasIndex("IdAuthor");
@ -3075,31 +2920,26 @@ namespace AsbCloudDb.Migrations
.HasColumnName("depth_start")
.HasComment("Глубина по стволу от, м");
b.Property<double>("DesignSpring")
b.Property<double>("DifferentialPressure")
.HasColumnType("double precision")
.HasColumnName("design_spring")
.HasComment("Расчётная пружина, градус");
.HasColumnName("differential_pressure")
.HasComment("Перепад давления, атм. Уставка");
b.Property<double>("DifferentialPressureLimitMax")
.HasColumnType("double precision")
.HasColumnName("differential_pressure_limit_max")
.HasComment("Перепад давления, атм. Ограничение");
b.Property<double>("DifferentialPressurePlan")
b.Property<double>("FlowRate")
.HasColumnType("double precision")
.HasColumnName("differential_pressure_plan")
.HasComment("Перепад давления, атм. Уставка");
.HasColumnName("flow_rate")
.HasComment("Расход л/с. Уставка");
b.Property<double>("FlowRateLimitMax")
.HasColumnType("double precision")
.HasColumnName("flow_rate_limit_max")
.HasComment("Расход л/с. Ограничение");
b.Property<double>("FlowRatePlan")
.HasColumnType("double precision")
.HasColumnName("flow_rate_plan")
.HasComment("Расход л/с. Уставка");
b.Property<int>("IdAuthor")
.HasColumnType("integer")
.HasColumnName("id_author")
@ -3130,11 +2970,6 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_wellsection_type")
.HasComment("Тип секции");
b.Property<double>("MaxAllowablePressure")
.HasColumnType("double precision")
.HasColumnName("max_allowable_pressure")
.HasComment("Максимально допустимое давление, атм");
b.Property<string>("Note")
.IsRequired()
.HasMaxLength(1024)
@ -3147,26 +2982,36 @@ namespace AsbCloudDb.Migrations
.HasColumnName("obsolete")
.HasComment("дата устаревания");
b.Property<double>("RopPlan")
b.Property<double>("PressureLimitMax")
.HasColumnType("double precision")
.HasColumnName("rop_plan")
.HasColumnName("pressure_limit_max")
.HasComment("Максимально допустимое давление, атм");
b.Property<double>("RopLimitMax")
.HasColumnType("double precision")
.HasColumnName("rop_limit_max")
.HasComment("Максимально допустимая скорость, м/ч");
b.Property<double>("Spring")
.HasColumnType("double precision")
.HasColumnName("spring")
.HasComment("Расчётная пружина, градус");
b.Property<double>("ToolBuckling")
.HasColumnType("double precision")
.HasColumnName("tool_buckling")
.HasComment("Складывание инструмента, м");
b.Property<double>("WeightOnBit")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit")
.HasComment("Нагрузка, т. Уставка");
b.Property<double>("WeightOnBitLimitMax")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit_limit_max")
.HasComment("Нагрузка, т. Ограничение");
b.Property<double>("WeightOnBitPlan")
.HasColumnType("double precision")
.HasColumnName("weight_on_bit_plan")
.HasComment("Нагрузка, т. Уставка");
b.HasKey("Id");
b.HasIndex("IdAuthor");
@ -9144,46 +8989,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("Well");
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanDrilling", b =>
{
b.HasOne("AsbCloudDb.Model.User", "Author")
.WithMany()
.HasForeignKey("IdAuthor")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("AsbCloudDb.Model.User", "Editor")
.WithMany()
.HasForeignKey("IdEditor")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanDrilling", "Previous")
.WithMany()
.HasForeignKey("IdPrevious");
b.HasOne("AsbCloudDb.Model.Well", "Well")
.WithMany()
.HasForeignKey("IdWell")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType")
.WithMany()
.HasForeignKey("IdWellSectionType")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Editor");
b.Navigation("Previous");
b.Navigation("Well");
b.Navigation("WellSectionType");
});
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanReam", b =>
{
b.HasOne("AsbCloudDb.Model.User", "Author")
@ -9270,7 +9075,7 @@ namespace AsbCloudDb.Migrations
.HasForeignKey("IdEditor")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanDrilling", "Previous")
b.HasOne("AsbCloudDb.Model.ProcessMaps.ProcessMapPlanSlide", "Previous")
.WithMany()
.HasForeignKey("IdPrevious");

View File

@ -19,7 +19,6 @@ namespace AsbCloudDb.Model
public virtual DbSet<Deposit> Deposits => Set<Deposit>();
public virtual DbSet<DetectedOperation> DetectedOperations => Set<DetectedOperation>();
public virtual DbSet<TrajectoryPlan> TrajectoriesPlan => Set<TrajectoryPlan>();
public virtual DbSet<ProcessMapPlanDrilling> ProcessMapPlanDrilling => Set<ProcessMapPlanDrilling>();
public virtual DbSet<ProcessMapPlanRotor> ProcessMapPlanRotor => Set<ProcessMapPlanRotor>();
public virtual DbSet<ProcessMapPlanSlide> ProcessMapPlanSlide => Set<ProcessMapPlanSlide>();
public virtual DbSet<ProcessMapPlanReam> ProcessMapPlanReams => Set<ProcessMapPlanReam>();
@ -444,11 +443,6 @@ namespace AsbCloudDb.Model
.HasIndex(w => new { w.IdWell, w.IdSectionType })
.IsUnique();
modelBuilder.Entity<ProcessMapPlanDrilling>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Author)
.WithMany()
@ -459,11 +453,6 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanDrilling>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()

View File

@ -1,58 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using AsbCloudDb.Model.ProcessMapPlan;
using Microsoft.EntityFrameworkCore;
namespace AsbCloudDb.Model.ProcessMaps;
[Table("t_process_map_plan_drilling"), Comment("РТК план бурение")]
public class ProcessMapPlanDrilling : ProcessMapPlanBase
{
[Column("id_mode"), Comment("Id режима (1- ротор, 2 слайд)")]
public int IdMode { get; set; }
[Column("axial_load_plan"), Comment("Осевая нагрузка, т, план")]
public double AxialLoadPlan { get; set; }
[Column("axial_load_limit_max"), Comment("Осевая нагрузка, т, допустимый максимум")]
public double AxialLoadLimitMax { get; set; }
[Column("delta_pressure_plan"), Comment("Перепад давления, атм, план")]
public double DeltaPressurePlan { get; set; }
[Column("delta_pressure_limit_max"), Comment("Перепад давления, атм, допустимый максимум")]
public double DeltaPressureLimitMax { get; set; }
[Column("top_drive_torque_plan"), Comment("Момент на ВСП, план")]
public double TopDriveTorquePlan { get; set; }
[Column("top_drive_torque_limit_max"), Comment("Момент на ВСП, допустимый максимум")]
public double TopDriveTorqueLimitMax { get; set; }
[Column("top_drive_speed_plan"), Comment("Обороты на ВСП, план")]
public double TopDriveSpeedPlan { get; set; }
[Column("top_drive_speed_limit_max"), Comment("Обороты на ВСП, допустимый максимум")]
public double TopDriveSpeedLimitMax { get; set; }
[Column("flow_plan"), Comment("Расход, л/с, план")]
public double FlowPlan { get; set; }
[Column("flow_limit_max"), Comment("Расход, л/с, допустимый максимум")]
public double FlowLimitMax { get; set; }
[Column("rop_plan"), Comment("Плановая механическая скорость, м/ч")]
public double RopPlan { get; set; }
[Column("usage_saub"), Comment("Плановый процент использования АКБ")]
public double UsageSaub { get; set; }
[Column("usage_spin"), Comment("Плановый процент использования spin master")]
public double UsageSpin { get; set; }
[Column("comment"), Comment("Комментарий"), StringLength(1024)]
public string Comment { get; set; } = string.Empty;
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanDrilling? Previous { get; set; }
}

View File

@ -8,60 +8,60 @@ namespace AsbCloudDb.Model.ProcessMaps;
[Table("t_process_map_plan_rotor"), Comment("РТК план бурение ротор")]
public class ProcessMapPlanRotor : ProcessMapPlanBase
{
[Column("rop_plan"), Comment("Максимально допустимая скорость, м/ч")]
[Column("rop_limit_max"), Comment("Максимально допустимая скорость, м/ч")]
[Range(0, 800.0)]
[Required]
public double RopPlan { get; set; }
public double RopLimitMax { get; set; }
[Column("max_allowable_pressure"), Comment("Максимально допустимое давление, атм")]
[Column("pressure_limit_max"), Comment("Максимально допустимое давление, атм")]
[Range(0.0, 400.0)]
[Required]
public double MaxAllowablePressure { get; set; }
public double PressureLimitMax { get; set; }
[Column("differential_pressure_plan"), Comment("Перепад давления, атм. Уставка")]
[Column("differential_pressure"), Comment("Перепад давления, атм. Уставка")]
[Range(0.0, 60.0)]
[Required]
public double DifferentialPressurePlan { get; set; }
public double DifferentialPressure { get; set; }
[Column("differential_pressure_limit_max"), Comment("Перепад давления, атм. Ограничение")]
[Range(0.0, 60.0)]
[Required]
public double DifferentialPressureLimitMax { get; set; }
[Column("weight_on_bit_plan"), Comment("Нагрузка, т. Уставка")]
[Column("weight_on_bit"), Comment("Нагрузка, т. Уставка")]
[Range(0.0, 99.0)]
[Required]
public double WeightOnBitPlan { get; set; }
public double WeightOnBit { get; set; }
[Column("weight_on_bit_limit_max"), Comment("Нагрузка, т. Ограничение")]
[Range(0.0, 99.0)]
[Required]
public double WeightOnBitLimitMax { get; set; }
[Column("top_drive_torque_plan"), Comment("Момент на ВСП, кН*м. Уставка")]
[Column("top_drive_torque"), Comment("Момент на ВСП, кН*м. Уставка")]
[Range(0.0, 35.0)]
[Required]
public double TopDriveTorquePlan { get; set; }
public double TopDriveTorque { get; set; }
[Column("top_drive_torque_limit_max"), Comment("Момент на ВСП, кН*м. Ограничение")]
[Range(0.0, 35.0)]
[Required]
public double TopDriveTorquetLimit { get; set; }
public double TopDriveTorqueLimit { get; set; }
[Column("revolution_per_minute_plan"), Comment("Обороты на ВСП, об/мин. Уставка")]
[Column("revolution_per_minute"), Comment("Обороты на ВСП, об/мин. Уставка")]
[Range(0.0, 270.0)]
[Required]
public double RevolutionsPerMinutePlan { get; set; }
public double RevolutionsPerMinute { get; set; }
[Column("revolutions_per_minute_limit_max"), Comment("Обороты на ВСП, об/мин. Ограничение")]
[Range(0.0, 270.0)]
[Required]
public double RevolutionsPerMinuteLimitMax { get; set; }
[Column("flow_rate_plan"), Comment("Расход л/с. Уставка")]
[Column("flow_rate"), Comment("Расход л/с. Уставка")]
[Range(0.0, 100.0)]
[Required]
public double FlowRatePlan { get; set; }
public double FlowRate { get; set; }
[Column("flow_rate_limit_max"), Comment("Расход л/с. Ограничение")]
[Range(0.0, 100.0)]

View File

@ -8,50 +8,50 @@ namespace AsbCloudDb.Model.ProcessMaps;
[Table("t_process_map_plan_slide"), Comment("РТК план бурение слайд")]
public class ProcessMapPlanSlide : ProcessMapPlanBase
{
[Column("rop_plan"), Comment("Максимально допустимая скорость, м/ч")]
[Column("rop_limit_max"), Comment("Максимально допустимая скорость, м/ч")]
[Range(0, 800.0)]
[Required]
public double RopPlan { get; set; }
public double RopLimitMax { get; set; }
[Column("max_allowable_pressure"), Comment("Максимально допустимое давление, атм")]
[Column("pressure_limit_max"), Comment("Максимально допустимое давление, атм")]
[Range(0, 400.0)]
[Required]
public double MaxAllowablePressure { get; set; }
public double PressureLimitMax { get; set; }
[Column("differential_pressure_plan"), Comment("Перепад давления, атм. Уставка")]
[Column("differential_pressure"), Comment("Перепад давления, атм. Уставка")]
[Range(0, 60.0)]
[Required]
public double DifferentialPressurePlan { get; set; }
public double DifferentialPressure { get; set; }
[Column("differential_pressure_limit_max"), Comment("Перепад давления, атм. Ограничение")]
[Range(0, 60.0)]
[Required]
public double DifferentialPressureLimitMax { get; set; }
[Column("weight_on_bit_plan"), Comment("Нагрузка, т. Уставка")]
[Column("weight_on_bit"), Comment("Нагрузка, т. Уставка")]
[Range(0, 50.0)]
[Required]
public double WeightOnBitPlan { get; set; }
public double WeightOnBit { get; set; }
[Column("weight_on_bit_limit_max"), Comment("Нагрузка, т. Ограничение")]
[Range(0, 50.0)]
[Required]
public double WeightOnBitLimitMax { get; set; }
[Column("flow_rate_plan"), Comment("Расход л/с. Уставка")]
[Column("flow_rate"), Comment("Расход л/с. Уставка")]
[Range(0, 100.0)]
[Required]
public double FlowRatePlan { get; set; }
public double FlowRate { get; set; }
[Column("flow_rate_limit_max"), Comment("Расход л/с. Ограничение")]
[Range(0, 100.0)]
[Required]
public double FlowRateLimitMax { get; set; }
[Column("design_spring"), Comment("Расчётная пружина, градус")]
[Column("spring"), Comment("Расчётная пружина, градус")]
[Range(0, 9999.9)]
[Required]
public double DesignSpring { get; set; }
public double Spring { get; set; }
[Column("tool_buckling"), Comment("Складывание инструмента, м")]
[Range(0, 9999.9)]
@ -62,5 +62,5 @@ public class ProcessMapPlanSlide : ProcessMapPlanBase
public string Note { get; set; } = string.Empty;
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanDrilling? Previous { get; set; }
public virtual ProcessMapPlanSlide? Previous { get; set; }
}

View File

@ -15,6 +15,8 @@
<None Remove="Services\DailyReport\DailyReportTemplate.xlsx" />
<None Remove="Services\DrillTestReport\DrillTestReportTemplate.xlsx" />
<None Remove="Services\ProcessMapPlan\Templates\ProcessMapPlanReamTemplate.xlsx" />
<None Remove="Services\ProcessMapPlan\Templates\ProcessMapPlanRotorTemplate.xlsx" />
<None Remove="Services\ProcessMapPlan\Templates\ProcessMapPlanSlideTemplate.xlsx" />
<None Remove="Services\ProcessMaps\Report\ProcessMapReportDataSaubStatTemplate.xlsx" />
<None Remove="Services\Trajectory\FactTrajectoryTemplate.xlsx" />
<None Remove="Services\Trajectory\NnbTrajectoryTemplate.xlsx" />
@ -40,6 +42,8 @@
<EmbeddedResource Include="Services\DrillTestReport\DrillTestReportTemplate.xlsx" />
<EmbeddedResource Include="Services\ProcessMapPlan\Templates\ProcessMapPlanReamTemplate.xlsx" />
<EmbeddedResource Include="Services\ProcessMapPlan\Templates\ProcessMapPlanDrillingTemplate.xlsx" />
<EmbeddedResource Include="Services\ProcessMapPlan\Templates\ProcessMapPlanRotorTemplate.xlsx" />
<EmbeddedResource Include="Services\ProcessMapPlan\Templates\ProcessMapPlanSlideTemplate.xlsx" />
<EmbeddedResource Include="Services\ProcessMaps\Report\ProcessMapReportDataSaubStatTemplate.xlsx" />
<EmbeddedResource Include="Services\Trajectory\Templates\TrajectoryFactNnbTemplate.xlsx" />
<EmbeddedResource Include="Services\Trajectory\Templates\TrajectoryFactManualTemplate.xlsx" />

View File

@ -132,11 +132,18 @@ namespace AsbCloudInfrastructure
Plan = src.WellDepthPlan
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanDrillingDto>>.NewConfig()
.Include<ProcessMapPlanDrilling, ChangeLogDto<ProcessMapPlanDrillingDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanDrillingDto>()
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanRotorDto>>.NewConfig()
.Include<ProcessMapPlanRotor, ChangeLogDto<ProcessMapPlanRotorDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanRotorDto>()
{
Item = src.Adapt<ProcessMapPlanDrillingDto>()
Item = src.Adapt<ProcessMapPlanRotorDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanSlideDto>>.NewConfig()
.Include<ProcessMapPlanSlide, ChangeLogDto<ProcessMapPlanSlideDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanSlideDto>()
{
Item = src.Adapt<ProcessMapPlanSlideDto>()
});
}
@ -196,8 +203,12 @@ namespace AsbCloudInfrastructure
services.AddTransient<IDataSaubStatRepository, DataSaubStatRepository>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto>>();
IChangeLogRepository<ProcessMapPlanRotorDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanRotor, ProcessMapPlanRotorDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanSlideDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanSlide, ProcessMapPlanSlideDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell>,
@ -248,7 +259,8 @@ namespace AsbCloudInfrastructure
services.AddTransient<IHelpPageRepository, HelpPageRepository>();
services.AddTransient<IFileRepository, FileRepository>();
services.AddTransient<IFileStorageRepository, FileStorageRepository>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanRotorDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanSlideDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -302,15 +314,16 @@ namespace AsbCloudInfrastructure
services.AddTransient<TrajectoryPlanParser>();
services.AddTransient<TrajectoryFactManualParser>();
services.AddTransient<ProcessMapPlanDrillingParser<ProcessMapPlanRotorDto>>();
services.AddTransient<ProcessMapPlanDrillingParser<ProcessMapPlanSlideDto>>();
services.AddTransient<ProcessMapPlanRotorParser>();
services.AddTransient<ProcessMapPlanSlideParser>();
services.AddTransient<ProcessMapPlanReamParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
services.AddTransient<TrajectoryFactNnbExportService>();
services.AddTransient<ProcessMapPlanDrillingExportService>();
services.AddTransient<ProcessMapPlanRotorExportService>();
services.AddTransient<ProcessMapPlanSlideExportService>();
services.AddTransient<ProcessMapPlanReamExportService>();
services.AddTransient<WellOperationParserFactory>();

View File

@ -13,14 +13,15 @@ using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Repository;
public class WellCompositeRepository : IWellCompositeRepository
public class WellCompositeRepository<TDto> : IWellCompositeRepository
where TDto : ProcessMapPlanBaseDto
{
private readonly IAsbCloudDbContext db;
private readonly IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanDrillingRepository;
private readonly IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanDrillingRepository;
public WellCompositeRepository(
IAsbCloudDbContext db,
IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanDrillingRepository)
IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanDrillingRepository)
{
this.db = db;
this.processMapPlanDrillingRepository = processMapPlanDrillingRepository;
@ -51,7 +52,7 @@ public class WellCompositeRepository : IWellCompositeRepository
}
/// <inheritdoc/>
public Task<IEnumerable<ProcessMapPlanDrillingDto>> GetCompositeProcessMap(int idWell, CancellationToken token)
public Task<IEnumerable<ProcessMapPlanBaseDto>> GetCompositeProcessMap(int idWell, CancellationToken token)
{
throw new NotImplementedException();
}

View File

@ -1,35 +0,0 @@
using System.Collections.Generic;
using AsbCloudApp.Data.ProcessMaps;
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
public class ProcessMapPlanDrillingTemplate : ITemplateParameters
{
public string SheetName => "План";
public int HeaderRowsCount => 2;
public string FileName => "ProcessMapPlanDrillingTemplate.xlsx";
public IDictionary<string, Cell> Cells => new Dictionary<string, Cell>
{
{ nameof(ProcessMapPlanDrillingDto.Section), new Cell(1, typeof(string)) },
{ nameof(ProcessMapPlanDrillingDto.Mode), new Cell(2, typeof(string)) },
{ nameof(ProcessMapPlanDrillingDto.DepthStart), new Cell(3, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.DepthEnd), new Cell(4, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.DeltaPressurePlan), new Cell(5, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.DeltaPressureLimitMax), new Cell(6, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.AxialLoadPlan), new Cell(7, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.AxialLoadLimitMax), new Cell(8, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.TopDriveTorquePlan), new Cell(9, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.TopDriveTorqueLimitMax), new Cell(10, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.TopDriveSpeedPlan), new Cell(11, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.TopDriveSpeedLimitMax), new Cell(12, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.FlowPlan), new Cell(13, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.FlowLimitMax), new Cell(14, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.RopPlan), new Cell(15, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.UsageSaub), new Cell(16, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.UsageSpin), new Cell(17, typeof(double)) },
{ nameof(ProcessMapPlanDrillingDto.Comment), new Cell(18, typeof(string)) }
};
}

View File

@ -0,0 +1,33 @@
using System.Collections.Generic;
using AsbCloudApp.Data.ProcessMaps;
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
public class ProcessMapPlanRotorTemplate : ITemplateParameters
{
public string SheetName => "Бурение ротор";
public int HeaderRowsCount => 2;
public string FileName => "ProcessMapPlanRotorTemplate.xlsx";
public IDictionary<string, Cell> Cells => new Dictionary<string, Cell>
{
{ nameof(ProcessMapPlanRotorDto.Section), new Cell(1, typeof(string)) },
{ nameof(ProcessMapPlanRotorDto.DepthStart), new Cell(2, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.DepthEnd), new Cell(3, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.RopLimitMax), new Cell(4, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.PressureLimitMax), new Cell(5, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.DifferentialPressure), new Cell(6, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.DifferentialPressureLimitMax), new Cell(7, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.WeightOnBit), new Cell(8, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.WeightOnBitLimitMax), new Cell(9, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.TopDriveTorque), new Cell(10, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.TopDriveTorqueLimit), new Cell(11, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.RevolutionsPerMinute), new Cell(12, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.RevolutionsPerMinuteLimitMax), new Cell(13, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.FlowRate), new Cell(14, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.FlowRateLimitMax), new Cell(15, typeof(double)) },
{ nameof(ProcessMapPlanRotorDto.Note), new Cell(16, typeof(double)) },
};
}

View File

@ -0,0 +1,31 @@
using System.Collections.Generic;
using AsbCloudApp.Data.ProcessMaps;
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
public class ProcessMapPlanSlideTemplate : ITemplateParameters
{
public string SheetName => "Бурение слайд";
public int HeaderRowsCount => 2;
public string FileName => "ProcessMapPlanSlideTemplate.xlsx";
public IDictionary<string, Cell> Cells => new Dictionary<string, Cell>
{
{ nameof(ProcessMapPlanSlideDto.Section), new Cell(1, typeof(string)) },
{ nameof(ProcessMapPlanSlideDto.DepthStart), new Cell(2, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.DepthEnd), new Cell(3, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.RopLimitMax), new Cell(4, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.PressureLimitMax), new Cell(5, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.DifferentialPressure), new Cell(6, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.DifferentialPressureLimitMax), new Cell(7, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.WeightOnBit), new Cell(8, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.WeightOnBitLimitMax), new Cell(9, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.FlowRate), new Cell(10, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.FlowRateLimitMax), new Cell(11, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.Spring), new Cell(12, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.ToolBuckling), new Cell(13, typeof(double)) },
{ nameof(ProcessMapPlanSlideDto.Note), new Cell(14, typeof(double)) }
};
}

View File

@ -0,0 +1,38 @@
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Requests.ExportOptions;
using AsbCloudApp.Services;
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
public class ProcessMapPlanRotorExportService : ProcessMapPlanExportService<ProcessMapPlanRotorDto>
{
public ProcessMapPlanRotorExportService(
IChangeLogRepository<ProcessMapPlanRotorDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
IWellService wellService)
: base(processMapPlanRepository, wellService)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanRotorTemplate();
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
{
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
return $"{caption}_РТК_План_бурение_ротор.xlsx";
}
protected override async Task<IEnumerable<ProcessMapPlanRotorDto>> GetDtosAsync(WellRelatedExportRequest options,
CancellationToken token)
{
var dtos = await base.GetDtosAsync(options, token);
return dtos;
}
}

View File

@ -13,40 +13,28 @@ using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemp
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
public class ProcessMapPlanDrillingExportService : ProcessMapPlanExportService<ProcessMapPlanDrillingDto>
public class ProcessMapPlanSlideExportService : ProcessMapPlanExportService<ProcessMapPlanSlideDto>
{
public ProcessMapPlanDrillingExportService(
IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
public ProcessMapPlanSlideExportService(
IChangeLogRepository<ProcessMapPlanSlideDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
IWellService wellService)
: base(processMapPlanRepository, wellService)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanDrillingTemplate();
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanSlideTemplate();
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
{
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
return $"{caption}_РТК_План_бурение.xlsx";
return $"{caption}_РТК_План_бурение_слайд.xlsx";
}
protected override async Task<IEnumerable<ProcessMapPlanDrillingDto>> GetDtosAsync(WellRelatedExportRequest options,
protected override async Task<IEnumerable<ProcessMapPlanSlideDto>> GetDtosAsync(WellRelatedExportRequest options,
CancellationToken token)
{
var dtos = await base.GetDtosAsync(options, token);
var dtosWithMode = dtos.Select(dto =>
{
dto.Mode = dto.IdMode switch
{
1 => "Ротор",
2 => "Слайд",
_ => throw new ArgumentOutOfRangeException()
};
return dto;
});
return dtosWithMode;
return dtos;
}
}

View File

@ -9,17 +9,16 @@ using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemp
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
public class ProcessMapPlanDrillingParser<TDto> : ProcessMapPlanParser<TDto>
where TDto : ProcessMapPlanBaseDto
public class ProcessMapPlanRotorParser : ProcessMapPlanParser<ProcessMapPlanRotorDto>
{
public ProcessMapPlanDrillingParser(IWellOperationRepository wellOperationRepository)
public ProcessMapPlanRotorParser(IWellOperationRepository wellOperationRepository)
: base(wellOperationRepository)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanDrillingTemplate();
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanRotorTemplate();
protected override TDto BuildDto(IDictionary<string, object?> row, int rowNumber)
protected override ProcessMapPlanRotorDto BuildDto(IDictionary<string, object?> row, int rowNumber)
{
var dto = base.BuildDto(row, rowNumber);

View File

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories;
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
public class ProcessMapPlanSlideParser : ProcessMapPlanParser<ProcessMapPlanSlideDto>
{
public ProcessMapPlanSlideParser(IWellOperationRepository wellOperationRepository)
: base(wellOperationRepository)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanSlideTemplate();
protected override ProcessMapPlanSlideDto BuildDto(IDictionary<string, object?> row, int rowNumber)
{
var dto = base.BuildDto(row, rowNumber);
var section = sections.FirstOrDefault(s =>
string.Equals(s.Caption.Trim(), dto.Section?.Trim(), StringComparison.CurrentCultureIgnoreCase));
if (section is null)
{
var message = string.Format(XLExtentions.ProblemDetailsTemplate,
TemplateParameters.SheetName,
rowNumber,
TemplateParameters.Cells[nameof(ProcessMapPlanBaseDto.Section)],
"Указана некорректная секция");
throw new FileFormatException(message);
}
dto.IdWellSectionType = section.Id;
return dto;
}
}

View File

@ -20,20 +20,23 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report;
public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
{
private readonly IWellService wellService;
private readonly IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanBaseRepository;
private readonly IChangeLogRepository<ProcessMapPlanRotorDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRotorRepository;
private readonly IChangeLogRepository<ProcessMapPlanSlideDto, ProcessMapPlanBaseRequestWithWell> processMapPlanSlideRepository;
private readonly IDataSaubStatRepository dataSaubStatRepository;
private readonly IWellOperationRepository wellOperationRepository;
private readonly IWellOperationCategoryRepository wellOperationCategoryRepository;
public ProcessMapReportDrillingService(IWellService wellService,
IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanBaseRepository,
IChangeLogRepository<ProcessMapPlanRotorDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRotorRepository,
IChangeLogRepository<ProcessMapPlanSlideDto, ProcessMapPlanBaseRequestWithWell> processMapPlanSlideRepository,
IDataSaubStatRepository dataSaubStatRepository,
IWellOperationRepository wellOperationRepository,
IWellOperationCategoryRepository wellOperationCategoryRepository
)
{
this.wellService = wellService;
this.processMapPlanBaseRepository = processMapPlanBaseRepository;
this.processMapPlanRotorRepository = processMapPlanRotorRepository;
this.processMapPlanSlideRepository = processMapPlanSlideRepository;
this.dataSaubStatRepository = dataSaubStatRepository;
this.wellOperationRepository = wellOperationRepository;
this.wellOperationCategoryRepository = wellOperationCategoryRepository;
@ -48,7 +51,15 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
return Enumerable.Empty<ProcessMapReportDataSaubStatDto>();
var requestProcessMapPlan = new ProcessMapPlanBaseRequestWithWell(idWell);
var changeLogProcessMaps = await processMapPlanBaseRepository.GetChangeLogForDate(requestProcessMapPlan, null, token);
var changeLogProcessMapsRotor = await processMapPlanRotorRepository.GetChangeLogForDate(requestProcessMapPlan, null, token);
var changeLogProcessMapsSlide = await processMapPlanSlideRepository.GetChangeLogForDate(requestProcessMapPlan, null, token);
var changeLogProcessMaps = changeLogProcessMapsRotor
.Select(p => ConvertToChangeLogDtoWithProcessMapPlanBase(p))
.Union(changeLogProcessMapsSlide.Select(p => ConvertToChangeLogDtoWithProcessMapPlanBase(p)));
if (!changeLogProcessMaps.Any())
return Enumerable.Empty<ProcessMapReportDataSaubStatDto>();
@ -95,9 +106,24 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
return result;
}
private ChangeLogDto<ProcessMapPlanBaseDto> ConvertToChangeLogDtoWithProcessMapPlanBase<T>(ChangeLogDto<T> p)
where T: ProcessMapPlanBaseDto
{
return new ChangeLogDto<ProcessMapPlanBaseDto>()
{
Item = p.Item,
Author = p.Author,
Creation = p.Creation,
Editor = p.Editor,
IdPrevious = p.IdPrevious,
IdState = p.IdState,
Obsolete = p.Obsolete,
};
}
private static IEnumerable<ProcessMapReportDataSaubStatDto> CalcByIntervals(
DataSaubStatRequest request,
IEnumerable<ChangeLogDto<ProcessMapPlanDrillingDto>> changeLogProcessMaps,
IEnumerable<ChangeLogDto<ProcessMapPlanBaseDto>> changeLogProcessMaps,
Span<DataSaubStatDto> dataSaubStats,
IEnumerable<WellOperationDto> wellOperations,
IEnumerable<WellOperationCategoryDto> wellOperationCategories,
@ -125,15 +151,15 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
return operation.IdWellSectionType;
}
ProcessMapPlanDrillingDto? GetProcessMapPlan(int idWellSectionType, DataSaubStatDto data)
=> changeLogProcessMaps
.Where(p => p.Item.IdWellSectionType == idWellSectionType)
.Where(p => p.Item.DepthStart <= data.DepthStart)
.Where(p => p.Item.DepthEnd >= data.DepthStart)
.Where(p => IsModeMatchOperationCategory(p.Item.IdMode, data.IdCategory))
.WhereActualAtMoment(data.DateStart)
.Select(p => p.Item)
.FirstOrDefault();
ProcessMapPlanBaseDto? GetProcessMapPlan(int idWellSectionType, DataSaubStatDto data)
=> changeLogProcessMaps
.Where(p => p.Item.IdWellSectionType == idWellSectionType)
.Where(p => p.Item.DepthStart <= data.DepthStart)
.Where(p => p.Item.DepthEnd >= data.DepthStart)
.Where(p => IsModeMatchOperationCategory(p.Item, data.IdCategory))
.WhereActualAtMoment(data.DateStart)
.Select(p => p.Item)
.FirstOrDefault();
var idWellSectionType = GetSection(firstElemInInterval);
var prevProcessMapPlan = GetProcessMapPlan(idWellSectionType, firstElemInInterval);
@ -175,13 +201,13 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
return list;
}
private static bool IsModeMatchOperationCategory(int idMode, int idCategory)
private static bool IsModeMatchOperationCategory(ProcessMapPlanBaseDto dto, int idCategory)
{
return (idMode == 1 && idCategory == 5003) || (idMode == 2 && idCategory == 5002);
return (dto is ProcessMapPlanRotorDto && idCategory == 5003) || (dto is ProcessMapPlanSlideDto && idCategory == 5002);
}
private static ProcessMapReportDataSaubStatDto? CalcStat(
ProcessMapPlanDrillingDto? processMapPlanFilteredByDepth,
ProcessMapPlanBaseDto? processMapPlanFilteredByDepth,
Span<DataSaubStatDto> span,
string wellOperationCategoryName,
WellSectionTypeDto wellSectionType
@ -206,54 +232,70 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
DrillingMode = wellOperationCategoryName,
PressureDiff = new ProcessMapReportDataSaubStatParamsDto()
{
SetpointPlan = processMapPlanFilteredByDepth?.DeltaPressurePlan,
SetpointFact = firstElemInInterval.PressureSp - firstElemInInterval.PressureIdle,
FactWavg = aggregatedValues.Pressure,
Limit = processMapPlanFilteredByDepth?.DeltaPressureLimitMax,
SetpointUsage = aggregatedValues.SetpointUsagePressure
},
AxialLoad = new ProcessMapReportDataSaubStatParamsDto()
{
SetpointPlan = processMapPlanFilteredByDepth?.AxialLoadPlan,
SetpointFact = aggregatedValues.AxialLoadSp,
FactWavg = aggregatedValues.AxialLoad,
Limit = processMapPlanFilteredByDepth?.AxialLoadLimitMax,
SetpointUsage = aggregatedValues.SetpointUsageAxialLoad
},
TopDriveTorque = new ProcessMapReportDataSaubStatParamsDto()
{
SetpointPlan = processMapPlanFilteredByDepth?.TopDriveTorquePlan,
SetpointFact = aggregatedValues.RotorTorqueSp,
FactWavg = aggregatedValues.RotorTorque,
FactMax = aggregatedValues.RotorTorqueMax,
Limit = processMapPlanFilteredByDepth?.TopDriveTorqueLimitMax,
SetpointUsage = aggregatedValues.SetpointUsageRotorTorque
},
SpeedLimit = new ProcessMapReportDataSaubStatParamsDto
{
SetpointPlan = processMapPlanFilteredByDepth?.RopPlan,
SetpointFact = aggregatedValues.BlockSpeedSp,
FactWavg = deltaDepth / aggregatedValues.DrilledTime,
SetpointUsage = aggregatedValues.SetpointUsageRopPlan
},
TopDriveSpeed = new ProcessMapReportDataSaubStatParamsDto
{
SetpointPlan = processMapPlanFilteredByDepth?.TopDriveSpeedPlan,
FactWavg = aggregatedValues.RotorSpeed,
FactMax = aggregatedValues.RotorSpeedMax
},
Flow = new ProcessMapReportDataSaubStatParamsDto
{
SetpointPlan = processMapPlanFilteredByDepth?.FlowPlan,
FactWavg = aggregatedValues.MaxFlow,
Limit = processMapPlanFilteredByDepth?.FlowLimitMax,
},
Rop = new PlanFactDto<double?>
{
Plan = processMapPlanFilteredByDepth?.RopPlan,
Fact = deltaDepth / aggregatedValues.DrilledTime
},
};
if(processMapPlanFilteredByDepth is ProcessMapPlanRotorDto processMapPlanRotorFilteredByDepth)
{
result.PressureDiff.SetpointPlan = processMapPlanRotorFilteredByDepth?.DifferentialPressure;
result.PressureDiff.Limit = processMapPlanRotorFilteredByDepth?.DifferentialPressureLimitMax;
result.AxialLoad.SetpointPlan = processMapPlanRotorFilteredByDepth?.WeightOnBit;
result.AxialLoad.Limit = processMapPlanRotorFilteredByDepth?.WeightOnBitLimitMax;
result.TopDriveTorque.SetpointPlan = processMapPlanRotorFilteredByDepth?.TopDriveTorque;
result.TopDriveTorque.Limit = processMapPlanRotorFilteredByDepth?.TopDriveTorqueLimit;
result.SpeedLimit.SetpointPlan = processMapPlanRotorFilteredByDepth?.RopLimitMax;
result.TopDriveSpeed.SetpointPlan = processMapPlanRotorFilteredByDepth?.RevolutionsPerMinute;
result.Flow.SetpointPlan = processMapPlanRotorFilteredByDepth?.FlowRate;
result.Flow.Limit = processMapPlanRotorFilteredByDepth?.FlowRateLimitMax;
result.Rop.Plan = processMapPlanRotorFilteredByDepth?.RopLimitMax;
}
if (processMapPlanFilteredByDepth is ProcessMapPlanSlideDto processMapPlanSlideFilteredByDepth)
{
result.PressureDiff.SetpointPlan = processMapPlanSlideFilteredByDepth?.DifferentialPressure;
result.PressureDiff.Limit = processMapPlanSlideFilteredByDepth?.DifferentialPressureLimitMax;
result.AxialLoad.SetpointPlan = processMapPlanSlideFilteredByDepth?.WeightOnBit;
result.AxialLoad.Limit = processMapPlanSlideFilteredByDepth?.WeightOnBitLimitMax;
result.SpeedLimit.SetpointPlan = processMapPlanSlideFilteredByDepth?.RopLimitMax;
result.Flow.SetpointPlan = processMapPlanSlideFilteredByDepth?.FlowRate;
result.Flow.Limit = processMapPlanSlideFilteredByDepth?.FlowRateLimitMax;
result.Rop.Plan = processMapPlanSlideFilteredByDepth?.RopLimitMax;
}
return result;
}

View File

@ -32,7 +32,8 @@ public class WellInfoService
{
var wellService = services.GetRequiredService<IWellService>();
var operationsStatService = services.GetRequiredService<IOperationsStatService>();
var processMapPlanWellDrillingRepository = services.GetRequiredService<IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell>>();
var processMapPlanRotorRepository = services.GetRequiredService<IChangeLogRepository<ProcessMapPlanRotorDto, ProcessMapPlanBaseRequestWithWell>>();
var processMapPlanSlideRepository = services.GetRequiredService<IChangeLogRepository<ProcessMapPlanSlideDto, ProcessMapPlanBaseRequestWithWell>>();
var subsystemService = services.GetRequiredService<ISubsystemService>();
var telemetryDataSaubCache = services.GetRequiredService<ITelemetryDataCache<TelemetryDataSaubDto>>();
var messageHub = services.GetRequiredService<IIntegrationEventHandler<UpdateWellInfoEvent>>();
@ -44,11 +45,14 @@ public class WellInfoService
var wellsIds = activeWells.Select(w => w.Id);
var processMapPlanWellDrillingRequests = wellsIds.Select(id => new ProcessMapPlanBaseRequestWithWell(id));
var processMapPlanWellDrillings = new List<ProcessMapPlanDrillingDto>();
var processMapPlanWellDrillings = new List<ProcessMapPlanBaseDto>();
foreach (var processMapPlanWellDrillingRequest in processMapPlanWellDrillingRequests)
{
var processMaps = await processMapPlanWellDrillingRepository.GetCurrent(processMapPlanWellDrillingRequest, token);
processMapPlanWellDrillings.AddRange(processMaps);
var processMapsRotor = await processMapPlanRotorRepository.GetCurrent(processMapPlanWellDrillingRequest, token);
var processMapsSlide = await processMapPlanSlideRepository.GetCurrent(processMapPlanWellDrillingRequest, token);
processMapPlanWellDrillings.AddRange(processMapsRotor);
processMapPlanWellDrillings.AddRange(processMapsSlide);
}
var wellDepthByProcessMap = processMapPlanWellDrillings
@ -95,7 +99,7 @@ public class WellInfoService
.OrderBy(p => p.DepthEnd);
int? idSection = wellLastFactSection?.Id;
ProcessMapPlanDrillingDto? processMapPlanWellDrilling = null;
ProcessMapPlanBaseDto? processMapPlanWellDrilling = null;
if (idSection.HasValue && currentDepth.HasValue)
{
@ -126,25 +130,21 @@ public class WellInfoService
wellMapInfo.AxialLoad = new()
{
Plan = processMapPlanWellDrilling?.AxialLoadPlan,
Fact = lastSaubTelemetry?.AxialLoad
};
wellMapInfo.TopDriveSpeed = new()
{
Plan = processMapPlanWellDrilling?.TopDriveSpeedPlan,
Fact = lastSaubTelemetry?.RotorSpeed
};
wellMapInfo.TopDriveTorque = new()
{
Plan = processMapPlanWellDrilling?.TopDriveTorquePlan,
Fact = lastSaubTelemetry?.RotorTorque
};
wellMapInfo.Pressure = new()
{
Plan = processMapPlanWellDrilling?.DeltaPressurePlan,
Fact = lastSaubTelemetry?.Pressure
};
@ -158,7 +158,6 @@ public class WellInfoService
wellMapInfo.ROP = new()
{
Plan = processMapPlanWellDrilling?.RopPlan,
Fact = wellOperationsStat?.Total.Fact?.Rop,
};
@ -168,6 +167,28 @@ public class WellInfoService
Fact = wellOperationsStat?.Total.Fact?.RouteSpeed,
};
if(processMapPlanWellDrilling is ProcessMapPlanRotorDto processMapPlanRotor)
{
wellMapInfo.AxialLoad.Plan = processMapPlanRotor?.WeightOnBit;
wellMapInfo.TopDriveSpeed.Plan = processMapPlanRotor?.RevolutionsPerMinute;
wellMapInfo.TopDriveTorque.Plan = processMapPlanRotor?.TopDriveTorque;
wellMapInfo.Pressure.Plan = processMapPlanRotor?.DifferentialPressure;
wellMapInfo.ROP.Plan = processMapPlanRotor?.RopLimitMax;
}
if (processMapPlanWellDrilling is ProcessMapPlanSlideDto processMapPlanSlide)
{
wellMapInfo.AxialLoad.Plan = processMapPlanSlide?.WeightOnBit;
wellMapInfo.Pressure.Plan = processMapPlanSlide?.DifferentialPressure;
wellMapInfo.ROP.Plan = processMapPlanSlide?.RopLimitMax;
}
var wellSubsystemStat = subsystemStat.FirstOrDefault(s => s.Well.Id == well.Id);
wellMapInfo.SaubUsage = wellSubsystemStat?.SubsystemAPD?.KUsage ?? 0d;
wellMapInfo.SpinUsage = wellSubsystemStat?.SubsystemOscillation?.KUsage ?? 0d;

View File

@ -19,10 +19,18 @@
</ItemGroup>
<ItemGroup>
<None Remove="Controllers\ProcessMapPlan\Files\ProcessMapPlanRotorInvalid.xlsx" />
<None Remove="Controllers\ProcessMapPlan\Files\ProcessMapPlanRotorValid.xlsx" />
<None Remove="Controllers\ProcessMapPlan\Files\ProcessMapPlanSlideInvalid.xlsx" />
<None Remove="Controllers\ProcessMapPlan\Files\ProcessMapPlanSlideValid.xlsx" />
<None Remove="WellOperationsPlan.xlsx" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Controllers\ProcessMapPlan\Files\ProcessMapPlanRotorInvalid.xlsx" />
<EmbeddedResource Include="Controllers\ProcessMapPlan\Files\ProcessMapPlanRotorValid.xlsx" />
<EmbeddedResource Include="Controllers\ProcessMapPlan\Files\ProcessMapPlanSlideInvalid.xlsx" />
<EmbeddedResource Include="Controllers\ProcessMapPlan\Files\ProcessMapPlanSlideValid.xlsx" />
<EmbeddedResource Include="Controllers\WellOperations\Files\PlanWellOperations.xlsx" />
<EmbeddedResource Include="Controllers\WellOperations\Files\FactWellOperations.xlsx" />
<EmbeddedResource Include="WellOperationsPlan.xlsx" />
@ -32,9 +40,4 @@
<ProjectReference Include="..\AsbCloudWebApi\AsbCloudWebApi.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Controllers\ProcessMapPlan\Files\ProcessMapPlanDrillingInvalid.xlsx" />
<EmbeddedResource Include="Controllers\ProcessMapPlan\Files\ProcessMapPlanDrillingValid.xlsx" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,41 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.ProcessMaps;
using Refit;
namespace AsbCloudWebApi.IntegrationTests.Clients;
public interface IProcessMapPlanClient<TDto> where TDto : ProcessMapPlanBaseDto
{
public const string BaseRoute = "/api/well/{idWell}/{controller}";
[Post(BaseRoute)]
Task<IApiResponse<int>> InsertRange(int idWell, string controller, [Body] IEnumerable<TDto> dtos);
[Post($"{BaseRoute}/replace")]
Task<IApiResponse<int>> ClearAndInsertRange(int idWell, string controller, [Body] IEnumerable<TDto> dtos);
[Delete(BaseRoute)]
Task<IApiResponse<int>> DeleteRange(int idWell, string controller, [Body] IEnumerable<int> ids);
[Delete($"{BaseRoute}/clear")]
Task<IApiResponse<int>> Clear(int idWell, string controller);
[Get(BaseRoute)]
Task<IApiResponse<IEnumerable<TDto>>> Get(int idWell, string controller);
[Get($"{BaseRoute}/changelogByMoment")]
Task<IApiResponse<IEnumerable<ChangeLogDto<TDto>>>> Get(int idWell, string controller, DateTimeOffset? moment);
[Get("/api/telemetry/{uid}/{controller}")]
Task<IApiResponse<IEnumerable<ChangeLogDto<TDto>>>> Get(string uid, string controller, DateTimeOffset? updateFrom);
[Get($"{BaseRoute}/dates")]
Task<IApiResponse<IEnumerable<DateOnly>>> GetDatesChange(int idWell, string controller);
[Put(BaseRoute)]
Task<IApiResponse<int>> UpdateOrInsertRange(int idWell, string controller, IEnumerable<TDto> dtos);
[Multipart]
[Post(BaseRoute + "/parse")]
Task<IApiResponse<ParserResultDto<TDto>>> Parse(int idWell, string controller, [AliasAs("file")] StreamPart stream);
}

View File

@ -1,156 +1,75 @@
using AsbCloudApp.Requests;
using AsbCloudApp.Data;
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Data.User;
using AsbCloudApp.Requests;
using AsbCloudDb.Model;
using AsbCloudDb.Model.ProcessMapPlan;
using AsbCloudWebApi.IntegrationTests.Clients;
using AsbCloudWebApi.IntegrationTests.Data;
using Mapster;
using Microsoft.EntityFrameworkCore;
using Refit;
using System.Net;
using System.Reflection;
using AsbCloudDb.Model.ProcessMaps;
using AsbCloudWebApi.IntegrationTests.Data;
using Refit;
using Xunit;
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudDb.Model;
using AsbCloudApp.Data.User;
using AsbCloudApp.Data;
namespace AsbCloudWebApi.IntegrationTests.Controllers.ProcessMapPlan;
public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
public abstract class ProcessMapPlanBaseControllerTest<TEntity, TDto> : BaseIntegrationTest
where TEntity : ProcessMapPlanBase
where TDto : ProcessMapPlanBaseDto
{
private const int IdWell = 1;
private IProcessMapPlanClient<TDto> client;
private string controllerName;
private readonly ProcessMapPlanDrillingDto dto = new()
protected abstract TEntity? GetByWellId();
protected abstract TEntity GetByNote(DbSet<TEntity> dbSet, TDto dto);
protected abstract TDto GetByNote(IEnumerable<TDto> dtos, TDto dto);
public ProcessMapPlanBaseControllerTest(WebAppFactoryFixture factory, string controllerName) : base(factory)
{
Id = 0,
IdWell = IdWell,
Section = "Кондуктор",
IdWellSectionType = 3,
DepthStart = 0.5,
DepthEnd = 1.5,
IdMode = 1,
AxialLoadPlan = 2.718281,
AxialLoadLimitMax = 3.1415926,
DeltaPressurePlan = 4,
DeltaPressureLimitMax = 5,
TopDriveTorquePlan = 6,
TopDriveTorqueLimitMax = 7,
TopDriveSpeedPlan = 8,
TopDriveSpeedLimitMax = 9,
FlowPlan = 10,
FlowLimitMax = 11,
RopPlan = 12,
UsageSaub = 13,
UsageSpin = 14,
Comment = "это тестовая запись",
};
private readonly ProcessMapPlanDrilling entity = new()
{
Id = 0,
IdAuthor = 1,
IdEditor = null,
Creation = DateTimeOffset.UtcNow,
Obsolete = null,
IdState = AsbCloudDb.Model.ChangeLogAbstract.IdStateActual,
IdPrevious = null,
IdWell = IdWell,
IdWellSectionType = 1,
DepthStart = 0.5,
DepthEnd = 1.5,
IdMode = 1,
AxialLoadPlan = 2.718281,
AxialLoadLimitMax = 3.1415926,
DeltaPressurePlan = 4,
DeltaPressureLimitMax = 5,
TopDriveTorquePlan = 6,
TopDriveTorqueLimitMax = 7,
TopDriveSpeedPlan = 8,
TopDriveSpeedLimitMax = 9,
FlowPlan = 10,
FlowLimitMax = 11,
RopPlan = 12,
UsageSaub = 13,
UsageSpin = 14,
Comment = "это тестовая запись",
};
private IProcessMapPlanDrillingClient<ProcessMapPlanDrillingDto> client;
public ProcessMapPlanDrillingControllerTest(WebAppFactoryFixture factory) : base(factory)
{
dbContext.CleanupDbSet<ProcessMapPlanDrilling>();
client = factory.GetAuthorizedHttpClient<IProcessMapPlanDrillingClient<ProcessMapPlanDrillingDto>>(string.Empty);
dbContext.CleanupDbSet<TEntity>();
client = factory.GetAuthorizedHttpClient<IProcessMapPlanClient<TDto>>(string.Empty);
this.controllerName = controllerName;
}
[Fact]
public async Task InsertRange_returns_success()
public async Task InsertRangeSuccess(TDto dto)
{
//arrange
var expected = dto.Adapt<ProcessMapPlanDrillingDto>();
var expected = dto.Adapt<TDto>();
//act
var response = await client.InsertRange(dto.IdWell, new[] { expected });
var response = await client.InsertRange(dto.IdWell, controllerName, new TDto[] { expected });
//assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal(1, response.Content);
var entity = dbContext
.Set<ProcessMapPlanDrilling>()
.Where(p => p.AxialLoadPlan == dto.AxialLoadPlan)
.Where(p => p.AxialLoadLimitMax == dto.AxialLoadLimitMax)
.Where(p => p.Comment == dto.Comment)
.FirstOrDefault(p => p.IdWell == dto.IdWell);
var entity = GetByWellId();
Assert.NotNull(entity);
var actual = entity.Adapt<ChangeLogDto<ProcessMapPlanDrillingDto>>();
var actual = entity.Adapt<ChangeLogDto<TDto>>();
Assert.Equal(ProcessMapPlanBase.IdStateActual, actual.IdState);
var excludeProps = new[] {
nameof(ProcessMapPlanDrillingDto.Id),
nameof(ProcessMapPlanDrillingDto.Section)
nameof(ProcessMapPlanBaseDto.Id),
nameof(ProcessMapPlanBaseDto.Section)
};
MatchHelper.Match(expected, actual.Item, excludeProps);
}
[Fact]
public async Task InsertRange_returns_BadRequest_for_IdWellSectionType()
public async Task InsertRangeFailed(TDto dto)
{
//arrange
var badDto = dto.Adapt<ProcessMapPlanDrillingDto>();
badDto.IdWellSectionType = int.MaxValue;
//act
var response = await client.InsertRange(dto.IdWell, new[] { badDto });
var response = await client.InsertRange(dto.IdWell, controllerName, new[] { dto });
//assert
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
}
[Fact]
public async Task InsertRange_returns_BadRequest_for_IdMode()
{
//arrange
var badDto = dto.Adapt<ProcessMapPlanDrillingDto>();
badDto.IdMode = int.MaxValue;
//act
var response = await client.InsertRange(dto.IdWell, new[] { badDto });
//assert
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
}
[Fact]
public async Task ClearAndInsertRange_returns_success()
public async Task ClearAndInsertRange(TEntity entity, TDto dto)
{
// arrange
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
var dbset = dbContext.Set<TEntity>();
var entry = dbset.Add(entity);
dbContext.SaveChanges();
@ -159,7 +78,7 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
var startTime = DateTimeOffset.UtcNow;
// act
var result = await client.ClearAndInsertRange(entity.IdWell, new ProcessMapPlanDrillingDto[] { dto });
var result = await client.ClearAndInsertRange(entity.IdWell, controllerName, new TDto[] { dto });
// assert
var doneTime = DateTimeOffset.UtcNow;
@ -184,13 +103,12 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.InRange(newEntity.Creation, startTime, doneTime);
}
[Fact]
public async Task UpdateOrInsertRange_returns_success()
public async Task UpdateOrInsertRange(TEntity entity, TDto dtoUpdate, TDto dtoInsert)
{
// arrange
var startTime = DateTimeOffset.UtcNow;
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
var dbset = dbContext.Set<TEntity>();
var user = dbContext.Set<User>().First().Adapt<UserDto>();
user.Surname = "userSurname";
user.Email = "user@mail.domain";
@ -199,43 +117,10 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
dbContext.SaveChanges();
entry.State = EntityState.Detached;
var dtoUpdate = dto.Adapt<ProcessMapPlanDrillingDto>();
dtoUpdate.IdWell = 0;
dtoUpdate.Id = entry.Entity.Id;
dtoUpdate.Comment = "nebuchadnezzar";
dtoUpdate.DeltaPressureLimitMax++;
dtoUpdate.DeltaPressurePlan++;
dtoUpdate.FlowPlan++;
dtoUpdate.FlowLimitMax++;
dtoUpdate.RopPlan++;
dtoUpdate.AxialLoadPlan++;
dtoUpdate.AxialLoadLimitMax++;
dtoUpdate.DepthStart++;
dtoUpdate.DepthEnd++;
dtoUpdate.TopDriveSpeedPlan++;
dtoUpdate.TopDriveSpeedLimitMax++;
dtoUpdate.TopDriveTorquePlan++;
dtoUpdate.TopDriveTorqueLimitMax++;
var dtoInsert = dtoUpdate.Adapt<ProcessMapPlanDrillingDto>();
dtoInsert.Id = 0;
dtoInsert.Comment = "nebuchad";
dtoInsert.DeltaPressureLimitMax++;
dtoInsert.DeltaPressurePlan++;
dtoInsert.FlowPlan++;
dtoInsert.FlowLimitMax++;
dtoInsert.RopPlan++;
dtoInsert.AxialLoadPlan++;
dtoInsert.AxialLoadLimitMax++;
dtoInsert.DepthStart++;
dtoInsert.DepthEnd++;
dtoInsert.TopDriveSpeedPlan++;
dtoInsert.TopDriveSpeedLimitMax++;
dtoInsert.TopDriveTorquePlan++;
dtoInsert.TopDriveTorqueLimitMax++;
// act
var result = await client.UpdateOrInsertRange(entity.IdWell, new ProcessMapPlanDrillingDto[] { dtoUpdate, dtoInsert });
var result = await client.UpdateOrInsertRange(entity.IdWell, controllerName, new TDto[] { dtoUpdate, dtoInsert });
// assert
var doneTime = DateTimeOffset.UtcNow;
@ -251,7 +136,7 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.NotNull(oldEntity.Obsolete);
Assert.InRange(oldEntity.Obsolete.Value, startTime, doneTime);
var newEntity = dbset.First(p => p.Comment == dtoUpdate.Comment);
var newEntity = GetByNote(dbset, dtoUpdate);
Assert.Equal(ProcessMapPlanBase.IdStateActual, newEntity.IdState);
Assert.Equal(1, newEntity.IdAuthor);
Assert.Null(newEntity.IdEditor);
@ -259,23 +144,22 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.Equal(oldEntity.Id, newEntity.IdPrevious);
Assert.InRange(newEntity.Creation, startTime, doneTime);
var expected = dtoUpdate.Adapt<ProcessMapPlanDrilling>();
var expected = dtoUpdate.Adapt<TEntity>();
var excludeProps = new[] {
nameof(ProcessMapPlanDrilling.Id),
nameof(ProcessMapPlanDrilling.IdWell),
nameof(ProcessMapPlanDrilling.Author),
nameof(ProcessMapPlanDrilling.IdAuthor),
nameof(ProcessMapPlanDrilling.Editor),
nameof(ProcessMapPlanDrilling.Creation),
};
nameof(ProcessMapPlanBase.Id),
nameof(ProcessMapPlanBase.IdWell),
nameof(ProcessMapPlanBase.Author),
nameof(ProcessMapPlanBase.IdAuthor),
nameof(ProcessMapPlanBase.Editor),
nameof(ProcessMapPlanBase.Creation),
};
MatchHelper.Match(expected, newEntity!, excludeProps);
}
[Fact]
public async Task DeleteRange_returns_success()
public async Task DeleteRange(TEntity entity, TDto dto)
{
//arrange
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
var dbset = dbContext.Set<TEntity>();
var entry = dbset.Add(entity);
dbContext.SaveChanges();
@ -284,7 +168,7 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
var startTime = DateTimeOffset.UtcNow;
//act
var response = await client.DeleteRange(dto.IdWell, new[] { entry.Entity.Id });
var response = await client.DeleteRange(dto.IdWell, controllerName, new[] { entry.Entity.Id });
//assert
var doneTime = DateTimeOffset.UtcNow;
@ -292,7 +176,7 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.Equal(1, response.Content);
var actual = dbContext
.Set<ProcessMapPlanDrilling>()
.Set<TEntity>()
.FirstOrDefault(p => p.Id == entry.Entity.Id);
Assert.NotNull(actual);
@ -302,12 +186,10 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.InRange(actual.Obsolete.Value, startTime, doneTime);
}
[Fact]
public async Task Clear_returns_success()
public async Task Clear(TEntity entity, TDto dto)
{
//arrange
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
var dbset = dbContext.Set<TEntity>();
var entry = dbset.Add(entity);
dbContext.SaveChanges();
@ -316,7 +198,7 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
var startTime = DateTimeOffset.UtcNow;
//act
var response = await client.Clear(dto.IdWell);
var response = await client.Clear(dto.IdWell, controllerName);
//assert
var doneTime = DateTimeOffset.UtcNow;
@ -324,7 +206,7 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.Equal(1, response.Content);
var actual = dbContext
.Set<ProcessMapPlanDrilling>()
.Set<TEntity>()
.FirstOrDefault(p => p.Id == entry.Entity.Id);
Assert.NotNull(actual);
@ -334,13 +216,12 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.InRange(actual.Obsolete.Value, startTime, doneTime);
}
[Fact]
public async Task GetDatesChange_returns_success()
public async Task GetDatesChange(TEntity entity, TDto dto)
{
//arrange
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
var dbset = dbContext.Set<TEntity>();
var entity2 = entity.Adapt<ProcessMapPlanDrilling>();
var entity2 = entity.Adapt<TEntity>();
entity2.Creation = entity.Creation.AddDays(1);
dbset.Add(entity);
dbset.Add(entity2);
@ -352,7 +233,7 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
.Select(d => new DateOnly(d.Year, d.Month, d.Day));
//act
var response = await client.GetDatesChange(dto.IdWell);
var response = await client.GetDatesChange(dto.IdWell, controllerName);
//assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
@ -361,25 +242,23 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.All(response.Content, d => dates.Contains(d));
}
[Fact]
public async Task Get_actual_returns_success()
public async Task Get(TEntity entity, TDto dto)
{
//arrange
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
var dbset = dbContext.Set<TEntity>();
dbset.Add(entity);
var entityDeleted = entity.Adapt<ProcessMapPlanDrilling>();
var entityDeleted = entity.Adapt<TEntity>();
entityDeleted.Creation = entity.Creation.AddDays(-1);
entityDeleted.Obsolete = entity.Creation;
entityDeleted.IdState = ProcessMapPlanBase.IdStateDeleted;
entityDeleted.IdEditor = 1;
entityDeleted.Comment = "nothing";
dbset.Add(entityDeleted);
dbContext.SaveChanges();
var response = await client.Get(dto.IdWell);
var response = await client.Get(dto.IdWell, controllerName);
//assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
@ -390,40 +269,37 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.NotNull(actual.Section);
Assert.NotEmpty(actual.Section);
var expected = entity.Adapt<ProcessMapPlanDrillingDto>()!;
var expected = entity.Adapt<TDto>()!;
var excludeProps = new[] {
nameof(ProcessMapPlanDrillingDto.Id),
};
nameof(ProcessMapPlanBaseDto.Id),
};
MatchHelper.Match(expected, actual, excludeProps);
}
[Fact]
public async Task Get_at_moment_returns_success()
public async Task GetAtMoment(TEntity entity, TDto dto)
{
//arrange
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
var dbset = dbContext.Set<TEntity>();
var now = DateTimeOffset.UtcNow;
var entityDeleted = entity.Adapt<ProcessMapPlanDrilling>();
var entityDeleted = entity.Adapt<TEntity>();
entityDeleted.Creation = now;
entityDeleted.Obsolete = now.AddMinutes(1);
entityDeleted.IdState = ProcessMapPlanBase.IdStateDeleted;
entityDeleted.IdEditor = 1;
entityDeleted.Comment = "nothing";
dbset.Add(entityDeleted);
var entityDeleted2 = entity.Adapt<ProcessMapPlanDrilling>();
var entityDeleted2 = entity.Adapt<TEntity>();
entityDeleted2.Creation = now.AddMinutes(1);
entityDeleted2.Obsolete = now.AddMinutes(2);
entityDeleted2.IdState = ProcessMapPlanBase.IdStateDeleted;
entityDeleted2.IdEditor = 1;
entityDeleted2.Comment = "nothing";
dbset.Add(entityDeleted2);
dbContext.SaveChanges();
//act
var response = await client.Get(dto.IdWell, now.AddMinutes(0.5));
var response = await client.Get(dto.IdWell, controllerName, now.AddMinutes(0.5));
//assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
@ -431,21 +307,20 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.Single(response.Content);
}
[Fact]
public async Task Get_by_updated_from_returns_success()
public async Task GetByUpdated(TEntity entity, TDto dto)
{
//arrange
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
var dbset = dbContext.Set<TEntity>();
dbset.Add(entity);
var entity2 = entity.Adapt<ProcessMapPlanDrilling>();
var entity2 = entity.Adapt<TEntity>();
entity2.Obsolete = DateTimeOffset.UtcNow;
dbset.Add(entity2);
dbContext.SaveChanges();
//act
var response = await client.Get(Defaults.RemoteUid, DateTimeOffset.UtcNow.AddHours(-1));
var response = await client.Get(Defaults.RemoteUid, controllerName, DateTimeOffset.UtcNow.AddHours(-1));
//assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
@ -453,22 +328,19 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.Equal(2, response.Content.Count());
}
[Fact]
public async Task Get_updated_returns_success()
public async Task GetUpdated(TEntity entity, TDto dto)
{
//arrange
var dbset = dbContext.Set<ProcessMapPlanDrilling>();
var dbset = dbContext.Set<TEntity>();
dbset.Add(entity);
var entity2 = entity.Adapt<ProcessMapPlanDrilling>();
var entity2 = entity.Adapt<TEntity>();
entity2.Creation = entity.Creation.AddHours(1);
entity2.Comment = "IdWellSectionType = 2";
dbset.Add(entity2);
var entity3 = entity.Adapt<ProcessMapPlanDrilling>();
var entity3 = entity.Adapt<TEntity>();
entity3.Obsolete = entity.Creation.AddHours(1);
entity3.Comment = "IdWellSectionType = 3";
dbset.Add(entity3);
dbContext.SaveChanges();
@ -482,34 +354,32 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
{
UpdateFrom = updateFrom,
};
var response = await client.Get(dto.IdWell);
var response = await client.Get(dto.IdWell, controllerName);
//assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.NotNull(response.Content);
Assert.Equal(2, response.Content.Count());
var actual = response.Content
.First(p => p.Comment == entity2.Comment);
var entity2Dto = entity2.Adapt<TDto>();
var actual = GetByNote(response.Content, entity2Dto);
var expected = entity2.Adapt<ProcessMapPlanDrillingDto>();
var expected = entity2.Adapt<TDto>();
var excludeProps = new[] {
nameof(ProcessMapPlanDrillingDto.Id),
};
nameof(ProcessMapPlanBaseDto.Id),
};
MatchHelper.Match(expected, actual, excludeProps);
}
[Fact]
public async Task Parse_returns_success()
public async Task Parse(int IdWell, string fileName, TDto dto)
{
//arrange
const string fileName = "ProcessMapPlanDrillingValid.xlsx";
var stream = Assembly.GetExecutingAssembly().GetFileCopyStream(fileName);
var streamPart = new StreamPart(stream, fileName, "application/octet-stream");
//act
var response = await client.Parse(IdWell, streamPart);
var response = await client.Parse(IdWell, controllerName, streamPart);
//assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
@ -525,21 +395,19 @@ public class ProcessMapPlanDrillingControllerTest : BaseIntegrationTest
Assert.True(row.IsValid);
var excludeProps = new[] { nameof(ProcessMapPlanDrillingDto.IdWell) };
var excludeProps = new[] { nameof(ProcessMapPlanBaseDto.IdWell) };
MatchHelper.Match(dto, dtoActual, excludeProps);
}
[Fact]
public async Task Parse_returns_success_for_result_with_warnings()
public async Task ParseWithWarnings(int IdWell, string fileName)
{
//arrange
const string fileName = "ProcessMapPlanDrillingInvalid.xlsx";
var stream = Assembly.GetExecutingAssembly().GetFileCopyStream(fileName);
var streamPart = new StreamPart(stream, fileName, "application/octet-stream");
//act
var response = await client.Parse(IdWell, streamPart);
var response = await client.Parse(IdWell, controllerName, streamPart);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);

View File

@ -0,0 +1,210 @@
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudDb.Model.ProcessMaps;
using DocumentFormat.OpenXml.Drawing.Charts;
using Mapster;
using Microsoft.EntityFrameworkCore;
using Xunit;
namespace AsbCloudWebApi.IntegrationTests.Controllers.ProcessMapPlan;
public class ProcessMapPlanRotorControllerTest : ProcessMapPlanBaseControllerTest<AsbCloudDb.Model.ProcessMaps.ProcessMapPlanRotor, ProcessMapPlanRotorDto>
{
private readonly ProcessMapPlanRotorDto dto = new ProcessMapPlanRotorDto()
{
IdWell = 1,
DepthStart = 1,
DepthEnd = 2,
RopLimitMax = 3,
PressureLimitMax = 4,
DifferentialPressure = 5,
DifferentialPressureLimitMax = 6,
WeightOnBit = 7,
WeightOnBitLimitMax = 8,
TopDriveTorque = 9,
TopDriveTorqueLimit = 10,
RevolutionsPerMinute = 11,
RevolutionsPerMinuteLimitMax = 12,
FlowRate = 13,
FlowRateLimitMax = 14,
Note = "15",
Id = 0,
IdWellSectionType = 1,
};
private readonly ProcessMapPlanRotor entity = new ProcessMapPlanRotor()
{
IdWell = 1,
DepthEnd = 10,
DepthStart = 2,
DifferentialPressure = 3,
DifferentialPressureLimitMax = 4,
FlowRate = 5,
FlowRateLimitMax = 6,
Id = 0,
IdWellSectionType = 1,
Note = "1",
PressureLimitMax = 2,
RevolutionsPerMinute = 3,
RevolutionsPerMinuteLimitMax = 4,
RopLimitMax = 5,
TopDriveTorque = 6,
TopDriveTorqueLimit = 7,
WeightOnBit = 8,
WeightOnBitLimitMax = 9,
IdAuthor = 1,
IdEditor = 1,
Creation = DateTimeOffset.UtcNow
};
public ProcessMapPlanRotorControllerTest(WebAppFactoryFixture factory) : base(factory, "ProcessMapPlanRotor")
{
}
protected override ProcessMapPlanRotor? GetByWellId()
{
var entity = dbContext
.Set<ProcessMapPlanRotor>()
.Where(p => p.WeightOnBit == dto.WeightOnBit)
.Where(p => p.WeightOnBitLimitMax == dto.WeightOnBitLimitMax)
.Where(p => p.Note == dto.Note)
.FirstOrDefault(p => p.IdWell == dto.IdWell);
return entity;
}
protected override ProcessMapPlanRotor GetByNote(
DbSet<ProcessMapPlanRotor> dbSet,
ProcessMapPlanRotorDto dto)
{
var entity = dbSet.First(p => p.Note == dto.Note);
return entity;
}
protected override ProcessMapPlanRotorDto GetByNote(
IEnumerable<ProcessMapPlanRotorDto> dtos,
ProcessMapPlanRotorDto dto)
{
var entity = dtos.First(p => p.Note == dto.Note);
return entity;
}
[Fact]
public async Task InsertRange_returns_success()
{
await InsertRangeSuccess(dto);
}
[Fact]
public async Task InsertRange_returns_BadRequest_for_IdWellSectionType()
{
//arrange
var badDto = dto.Adapt<ProcessMapPlanRotorDto>();
badDto.IdWellSectionType = int.MaxValue;
await InsertRangeFailed(badDto);
}
[Fact]
public async Task ClearAndInsertRange_returns_success()
{
await ClearAndInsertRange(entity, dto);
}
[Fact]
public async Task UpdateOrInsertRange_returns_success()
{
var dtoUpdate = dto.Adapt<ProcessMapPlanRotorDto>();
dtoUpdate.IdWell = 0;
dtoUpdate.Note = "nebuchadnezzar";
dtoUpdate.DifferentialPressureLimitMax++;
dtoUpdate.DifferentialPressure++;
dtoUpdate.FlowRate++;
dtoUpdate.FlowRateLimitMax++;
dtoUpdate.RopLimitMax++;
dtoUpdate.WeightOnBit++;
dtoUpdate.WeightOnBitLimitMax++;
dtoUpdate.DepthStart++;
dtoUpdate.DepthEnd++;
dtoUpdate.RevolutionsPerMinute++;
dtoUpdate.RevolutionsPerMinuteLimitMax++;
dtoUpdate.TopDriveTorque++;
dtoUpdate.TopDriveTorqueLimit++;
var dtoInsert = dtoUpdate.Adapt<ProcessMapPlanRotorDto>();
dtoInsert.Id = 0;
dtoInsert.Note = "nebuchad";
dtoInsert.DifferentialPressureLimitMax++;
dtoInsert.DifferentialPressure++;
dtoInsert.FlowRate++;
dtoInsert.FlowRateLimitMax++;
dtoInsert.RopLimitMax++;
dtoInsert.WeightOnBit++;
dtoInsert.WeightOnBitLimitMax++;
dtoInsert.DepthStart++;
dtoInsert.DepthEnd++;
dtoInsert.RevolutionsPerMinute++;
dtoInsert.RevolutionsPerMinuteLimitMax++;
dtoInsert.TopDriveTorque++;
dtoInsert.TopDriveTorqueLimit++;
await UpdateOrInsertRange(entity, dtoUpdate, dtoInsert);
}
[Fact]
public async Task DeleteRange_returns_success()
{
await DeleteRange(entity, dto);
}
[Fact]
public async Task Clear_returns_success()
{
await Clear(entity, dto);
}
[Fact]
public async Task GetDatesChange_returns_success()
{
await GetDatesChange(entity, dto);
}
[Fact]
public async Task Get_actual_returns_success()
{
await Get(entity, dto);
}
[Fact]
public async Task Get_at_moment_returns_success()
{
await GetAtMoment(entity, dto);
}
[Fact]
public async Task Get_by_updated_from_returns_success()
{
await GetByUpdated(entity, dto);
}
[Fact]
public async Task Get_updated_returns_success()
{
await GetUpdated(entity, dto);
}
[Fact]
public async Task Parse_returns_success()
{
await Parse(dto.IdWell, "ProcessMapPlanRotorValid.xlsx", dto);
}
[Fact]
public async Task Parse_returns_success_for_result_with_warnings()
{
await ParseWithWarnings(dto.IdWell, "ProcessMapPlanRotorInvalid.xlsx");
}
}

View File

@ -0,0 +1,201 @@
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudDb.Model.ProcessMaps;
using Mapster;
using Microsoft.EntityFrameworkCore;
using Xunit;
namespace AsbCloudWebApi.IntegrationTests.Controllers.ProcessMapPlan;
public class ProcessMapPlanSlideControllerTest : ProcessMapPlanBaseControllerTest<ProcessMapPlanSlide, ProcessMapPlanSlideDto>
{
private readonly ProcessMapPlanSlideDto dto = new ProcessMapPlanSlideDto()
{
IdWell = 1,
DepthStart = 1,
DepthEnd = 2,
RopLimitMax = 3,
PressureLimitMax = 4,
DifferentialPressure = 5,
DifferentialPressureLimitMax = 6,
WeightOnBit = 7,
WeightOnBitLimitMax = 8,
FlowRate = 9,
FlowRateLimitMax = 10,
Spring = 11,
ToolBuckling = 12,
Id = 0,
IdWellSectionType = 1,
Note = "13"
};
private readonly ProcessMapPlanSlide entity = new ProcessMapPlanSlide()
{
IdWell = 1,
DepthEnd = 10,
DepthStart = 2,
DifferentialPressure = 3,
DifferentialPressureLimitMax = 4,
FlowRate = 5,
FlowRateLimitMax = 6,
Id = 0,
IdWellSectionType = 1,
Note = "1",
PressureLimitMax = 2,
RopLimitMax = 5,
WeightOnBit = 8,
WeightOnBitLimitMax = 9,
IdAuthor = 1,
IdEditor = 1,
Creation = DateTimeOffset.UtcNow,
Spring = 10,
ToolBuckling = 11,
};
public ProcessMapPlanSlideControllerTest(WebAppFactoryFixture factory) : base(factory, "ProcessMapPlanSlide")
{
}
protected override ProcessMapPlanSlide? GetByWellId()
{
var entity = dbContext
.Set<ProcessMapPlanSlide>()
.Where(p => p.WeightOnBit == dto.WeightOnBit)
.Where(p => p.WeightOnBitLimitMax == dto.WeightOnBitLimitMax)
.Where(p => p.Note == dto.Note)
.FirstOrDefault(p => p.IdWell == dto.IdWell);
return entity;
}
protected override ProcessMapPlanSlide GetByNote(
DbSet<ProcessMapPlanSlide> dbSet,
ProcessMapPlanSlideDto dto)
{
var entity = dbSet.First(p => p.Note == dto.Note);
return entity;
}
protected override ProcessMapPlanSlideDto GetByNote(
IEnumerable<ProcessMapPlanSlideDto> dtos,
ProcessMapPlanSlideDto dto)
{
var entity = dtos.First(p => p.Note == dto.Note);
return entity;
}
[Fact]
public async Task InsertRange_returns_success()
{
await InsertRangeSuccess(dto);
}
[Fact]
public async Task InsertRange_returns_BadRequest_for_IdWellSectionType()
{
//arrange
var badDto = dto.Adapt<ProcessMapPlanSlideDto>();
badDto.IdWellSectionType = int.MaxValue;
await InsertRangeFailed(badDto);
}
[Fact]
public async Task ClearAndInsertRange_returns_success()
{
await ClearAndInsertRange(entity, dto);
}
[Fact]
public async Task UpdateOrInsertRange_returns_success()
{
var dtoUpdate = dto.Adapt<ProcessMapPlanSlideDto>();
dtoUpdate.IdWell = 0;
dtoUpdate.Note = "nebuchadnezzar";
dtoUpdate.DifferentialPressureLimitMax++;
dtoUpdate.DifferentialPressure++;
dtoUpdate.FlowRate++;
dtoUpdate.FlowRateLimitMax++;
dtoUpdate.RopLimitMax++;
dtoUpdate.WeightOnBit++;
dtoUpdate.WeightOnBitLimitMax++;
dtoUpdate.DepthStart++;
dtoUpdate.DepthEnd++;
dtoUpdate.Spring++;
dtoUpdate.ToolBuckling++;
var dtoInsert = dtoUpdate.Adapt<ProcessMapPlanSlideDto>();
dtoInsert.Id = 0;
dtoInsert.Note = "nebuchad";
dtoInsert.DifferentialPressureLimitMax++;
dtoInsert.DifferentialPressure++;
dtoInsert.FlowRate++;
dtoInsert.FlowRateLimitMax++;
dtoInsert.RopLimitMax++;
dtoInsert.WeightOnBit++;
dtoInsert.WeightOnBitLimitMax++;
dtoInsert.DepthStart++;
dtoInsert.DepthEnd++;
dtoUpdate.Spring++;
dtoUpdate.ToolBuckling++;
await UpdateOrInsertRange(entity, dtoUpdate, dtoInsert);
}
[Fact]
public async Task DeleteRange_returns_success()
{
await DeleteRange(entity, dto);
}
[Fact]
public async Task Clear_returns_success()
{
await Clear(entity, dto);
}
[Fact]
public async Task GetDatesChange_returns_success()
{
await GetDatesChange(entity, dto);
}
[Fact]
public async Task Get_actual_returns_success()
{
await Get(entity, dto);
}
[Fact]
public async Task Get_at_moment_returns_success()
{
await GetAtMoment(entity, dto);
}
[Fact]
public async Task Get_by_updated_from_returns_success()
{
await GetByUpdated(entity, dto);
}
[Fact]
public async Task Get_updated_returns_success()
{
await GetUpdated(entity, dto);
}
[Fact]
public async Task Parse_returns_success()
{
await Parse(dto.IdWell, "ProcessMapPlanSlideValid.xlsx", dto);
}
[Fact]
public async Task Parse_returns_success_for_result_with_warnings()
{
await ParseWithWarnings(dto.IdWell, "ProcessMapPlanSlideInvalid.xlsx");
}
}

View File

@ -1,256 +1,256 @@
using AsbCloudApp.Requests;
using AsbCloudDb.Model;
using AsbCloudDb.Model.ProcessMaps;
using AsbCloudWebApi.IntegrationTests.Clients;
using System.Net;
using AsbCloudWebApi.IntegrationTests.Data;
using Xunit;
//using AsbCloudApp.Requests;
//using AsbCloudDb.Model;
//using AsbCloudDb.Model.ProcessMaps;
//using AsbCloudWebApi.IntegrationTests.Clients;
//using System.Net;
//using AsbCloudWebApi.IntegrationTests.Data;
//using Xunit;
namespace AsbCloudWebApi.IntegrationTests.Controllers.ProcessMapPlan;
//namespace AsbCloudWebApi.IntegrationTests.Controllers.ProcessMapPlan;
public class ProcessMapReportDrillingControllerTest : BaseIntegrationTest
{
private IProcessMapReportDrilling client;
//public class ProcessMapReportDrillingControllerTest : BaseIntegrationTest
//{
// private IProcessMapReportDrilling client;
public ProcessMapReportDrillingControllerTest(WebAppFactoryFixture factory)
: base(factory)
{
dbContext.CleanupDbSet<DataSaubStat>();
dbContext.CleanupDbSet<ProcessMapPlanDrilling>();
client = factory.GetAuthorizedHttpClient<IProcessMapReportDrilling>(string.Empty);
}
// public ProcessMapReportDrillingControllerTest(WebAppFactoryFixture factory)
// : base(factory)
// {
// dbContext.CleanupDbSet<DataSaubStat>();
// dbContext.CleanupDbSet<ProcessMapPlanDrilling>();
// client = factory.GetAuthorizedHttpClient<IProcessMapReportDrilling>(string.Empty);
// }
[Fact]
public async Task Get_rtk_report_by_default_request_returns_success()
{
//arrange
var well = dbContext.Wells.First();
// [Fact]
// public async Task Get_rtk_report_by_default_request_returns_success()
// {
// //arrange
// var well = dbContext.Wells.First();
var processMapPlanDrilling = CreateProcessMapPlanDrilling(well.Id);
dbContext.ProcessMapPlanDrilling.Add(processMapPlanDrilling);
// var processMapPlanDrilling = CreateProcessMapPlanDrilling(well.Id);
// dbContext.ProcessMapPlanDrilling.Add(processMapPlanDrilling);
var wellOperation = CreateWellOperation(well.Id);
dbContext.WellOperations.Add(wellOperation);
// var wellOperation = CreateWellOperation(well.Id);
// dbContext.WellOperations.Add(wellOperation);
var dataSaubStats = CreateDataSaubStats(well.IdTelemetry!.Value, wellOperation.IdCategory);
dbContext.DataSaubStat.AddRange(dataSaubStats);
// var dataSaubStats = CreateDataSaubStats(well.IdTelemetry!.Value, wellOperation.IdCategory);
// dbContext.DataSaubStat.AddRange(dataSaubStats);
await dbContext.SaveChangesAsync();
// await dbContext.SaveChangesAsync();
//act
var request = new DataSaubStatRequest();
var response = await client.GetReportAsync(well.Id, request, CancellationToken.None);
// //act
// var request = new DataSaubStatRequest();
// var response = await client.GetReportAsync(well.Id, request, CancellationToken.None);
//assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.NotNull(response.Content);
Assert.Equal(dataSaubStats.Count() - 1, response.Content.Count());
}
// //assert
// Assert.Equal(HttpStatusCode.OK, response.StatusCode);
// Assert.NotNull(response.Content);
// Assert.Equal(dataSaubStats.Count() - 1, response.Content.Count());
// }
[Fact]
public async Task Get_rtk_report_by_parametrize_request_returns_success()
{
//arrange
var well = dbContext.Wells.First();
// [Fact]
// public async Task Get_rtk_report_by_parametrize_request_returns_success()
// {
// //arrange
// var well = dbContext.Wells.First();
var processMapPlanDrilling = CreateProcessMapPlanDrilling(well.Id);
dbContext.ProcessMapPlanDrilling.Add(processMapPlanDrilling);
// var processMapPlanDrilling = CreateProcessMapPlanDrilling(well.Id);
// dbContext.ProcessMapPlanDrilling.Add(processMapPlanDrilling);
var wellOperation = CreateWellOperation(well.Id);
dbContext.WellOperations.Add(wellOperation);
// var wellOperation = CreateWellOperation(well.Id);
// dbContext.WellOperations.Add(wellOperation);
var dataSaubStats = CreateDataSaubStats(well.IdTelemetry!.Value, wellOperation.IdCategory);
dbContext.DataSaubStat.AddRange(dataSaubStats);
// var dataSaubStats = CreateDataSaubStats(well.IdTelemetry!.Value, wellOperation.IdCategory);
// dbContext.DataSaubStat.AddRange(dataSaubStats);
await dbContext.SaveChangesAsync();
// await dbContext.SaveChangesAsync();
var request = new DataSaubStatRequest
{
DeltaAxialLoad = 5,
DeltaPressure = 15,
DeltaRotorTorque = 10
};
// var request = new DataSaubStatRequest
// {
// DeltaAxialLoad = 5,
// DeltaPressure = 15,
// DeltaRotorTorque = 10
// };
//act
var response = await client.GetReportAsync(well.Id, request, CancellationToken.None);
// //act
// var response = await client.GetReportAsync(well.Id, request, CancellationToken.None);
//assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.NotNull(response.Content);
Assert.Single(response.Content);
}
// //assert
// Assert.Equal(HttpStatusCode.OK, response.StatusCode);
// Assert.NotNull(response.Content);
// Assert.Single(response.Content);
// }
[Fact]
public async Task Get_rtk_report_returns_BadRequest()
{
//act
var request = new DataSaubStatRequest()
{
DeltaAxialLoad = 15,
DeltaPressure = 25,
DeltaRotorTorque = 20
};
var response = await client.GetReportAsync(0, request, CancellationToken.None);
// [Fact]
// public async Task Get_rtk_report_returns_BadRequest()
// {
// //act
// var request = new DataSaubStatRequest()
// {
// DeltaAxialLoad = 15,
// DeltaPressure = 25,
// DeltaRotorTorque = 20
// };
// var response = await client.GetReportAsync(0, request, CancellationToken.None);
//assert
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
}
// //assert
// Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
// }
[Fact]
public async Task Export_rtk_report_returns_success()
{
//arrange
var well = dbContext.Wells.First();
// [Fact]
// public async Task Export_rtk_report_returns_success()
// {
// //arrange
// var well = dbContext.Wells.First();
var processMapPlanDrilling = CreateProcessMapPlanDrilling(well.Id);
dbContext.ProcessMapPlanDrilling.Add(processMapPlanDrilling);
// var processMapPlanDrilling = CreateProcessMapPlanDrilling(well.Id);
// dbContext.ProcessMapPlanDrilling.Add(processMapPlanDrilling);
var wellOperation = CreateWellOperation(well.Id);
dbContext.WellOperations.Add(wellOperation);
// var wellOperation = CreateWellOperation(well.Id);
// dbContext.WellOperations.Add(wellOperation);
var dataSaubStats = CreateDataSaubStats(well.IdTelemetry!.Value, wellOperation.IdCategory);
dbContext.DataSaubStat.AddRange(dataSaubStats);
// var dataSaubStats = CreateDataSaubStats(well.IdTelemetry!.Value, wellOperation.IdCategory);
// dbContext.DataSaubStat.AddRange(dataSaubStats);
await dbContext.SaveChangesAsync();
// await dbContext.SaveChangesAsync();
//act
var request = new DataSaubStatRequest();
var response = await client.ExportReportAsync(1, request, CancellationToken.None);
// //act
// var request = new DataSaubStatRequest();
// var response = await client.ExportReportAsync(1, request, CancellationToken.None);
//assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal("application/octet-stream", response.ContentHeaders?.ContentType?.MediaType);
Assert.True(response.ContentHeaders?.ContentLength > 0);
}
// //assert
// Assert.Equal(HttpStatusCode.OK, response.StatusCode);
// Assert.Equal("application/octet-stream", response.ContentHeaders?.ContentType?.MediaType);
// Assert.True(response.ContentHeaders?.ContentLength > 0);
// }
private static WellOperation CreateWellOperation(int idWell) =>
new()
{
CategoryInfo = "CategoryInfo",
Comment = "Comment",
DateStart = DateTimeOffset.UtcNow,
DepthEnd = 1,
DepthStart = 0.6,
DurationHours = 10,
IdCategory = WellOperationCategory.IdSlide,
IdPlan = null,
IdType = WellOperation.IdOperationTypeFact,
IdUser = 1,
IdWell = idWell,
IdWellSectionType = 1,
LastUpdateDate = DateTimeOffset.UtcNow
};
// private static WellOperation CreateWellOperation(int idWell) =>
// new()
// {
// CategoryInfo = "CategoryInfo",
// Comment = "Comment",
// DateStart = DateTimeOffset.UtcNow,
// DepthEnd = 1,
// DepthStart = 0.6,
// DurationHours = 10,
// IdCategory = WellOperationCategory.IdSlide,
// IdPlan = null,
// IdType = WellOperation.IdOperationTypeFact,
// IdUser = 1,
// IdWell = idWell,
// IdWellSectionType = 1,
// LastUpdateDate = DateTimeOffset.UtcNow
// };
private static ProcessMapPlanDrilling CreateProcessMapPlanDrilling(int idWell) =>
new()
{
IdAuthor = 1,
IdEditor = null,
Creation = DateTimeOffset.UtcNow,
Obsolete = null,
IdState = ChangeLogAbstract.IdStateActual,
IdPrevious = null,
// private static ProcessMapPlanDrilling CreateProcessMapPlanDrilling(int idWell) =>
// new()
// {
// IdAuthor = 1,
// IdEditor = null,
// Creation = DateTimeOffset.UtcNow,
// Obsolete = null,
// IdState = ChangeLogAbstract.IdStateActual,
// IdPrevious = null,
IdWell = idWell,
IdWellSectionType = 1,
DepthStart = 0.5,
DepthEnd = 1.5,
// IdWell = idWell,
// IdWellSectionType = 1,
// DepthStart = 0.5,
// DepthEnd = 1.5,
IdMode = 1,
AxialLoadPlan = 2.718281,
AxialLoadLimitMax = 3.1415926,
DeltaPressurePlan = 4,
DeltaPressureLimitMax = 5,
TopDriveTorquePlan = 6,
TopDriveTorqueLimitMax = 7,
TopDriveSpeedPlan = 8,
TopDriveSpeedLimitMax = 9,
FlowPlan = 10,
FlowLimitMax = 11,
RopPlan = 12,
UsageSaub = 13,
UsageSpin = 14,
Comment = "это тестовая запись",
};
// IdMode = 1,
// AxialLoadPlan = 2.718281,
// AxialLoadLimitMax = 3.1415926,
// DeltaPressurePlan = 4,
// DeltaPressureLimitMax = 5,
// TopDriveTorquePlan = 6,
// TopDriveTorqueLimitMax = 7,
// TopDriveSpeedPlan = 8,
// TopDriveSpeedLimitMax = 9,
// FlowPlan = 10,
// FlowLimitMax = 11,
// RopPlan = 12,
// UsageSaub = 13,
// UsageSpin = 14,
// Comment = "это тестовая запись",
// };
private static IEnumerable<DataSaubStat> CreateDataSaubStats(int idTelemetry,
int idCategory) =>
new[]
{
new DataSaubStat
{
AxialLoad = 0,
AxialLoadLimitMax = 10,
AxialLoadSp = 8,
BlockSpeedSp = 50.0,
DateEnd = DateTimeOffset.UtcNow.AddMinutes(40),
DateStart = DateTimeOffset.UtcNow.AddMinutes(30),
DepthEnd = 85.99299621582031,
DepthStart = 85.9260025024414,
EnabledSubsystems = 0,
Flow = 10,
IdCategory = idCategory,
HasOscillation = true,
IdFeedRegulator = 0,
IdTelemetry = idTelemetry,
Pressure = 24,
PressureIdle = 0,
PressureSp = 40,
RotorSpeed = 11.3,
RotorTorque = 1,
RotorTorqueLimitMax = 26.5,
RotorTorqueSp = 5,
Speed = 80.3924560546875
},
new DataSaubStat
{
AxialLoad = 2,
AxialLoadLimitMax = 10.0,
AxialLoadSp = 8,
BlockSpeedSp = 20,
DateEnd = DateTimeOffset.UtcNow.AddMinutes(30),
DateStart = DateTimeOffset.UtcNow.AddMinutes(20),
DepthEnd = 86.28099822998047,
DepthStart = 86.21900177001953,
EnabledSubsystems = 1,
Flow = 20,
HasOscillation = true,
IdCategory = idCategory,
IdFeedRegulator = 1,
IdTelemetry = idTelemetry,
Pressure = 30,
PressureIdle = 20,
PressureSp = 40,
RotorSpeed = 11.251153300212916,
RotorTorque = 7,
RotorTorqueLimitMax = 26.5,
RotorTorqueSp = 9,
Speed = 74.395751953125
},
new DataSaubStat
{
AxialLoad = 4,
AxialLoadLimitMax = 15.0,
AxialLoadSp = 8,
BlockSpeedSp = 110.0,
DateEnd = DateTimeOffset.UtcNow.AddMinutes(20),
DateStart = DateTimeOffset.UtcNow.AddMinutes(10),
DepthEnd = 106.7490005493164,
DepthStart = 106.47899627685547,
EnabledSubsystems = 1,
Flow = 30,
HasOscillation = true,
IdFeedRegulator = 1,
IdTelemetry = idTelemetry,
IdCategory = idCategory,
Pressure = 36,
PressureIdle = 23.0,
PressureSp = 63.0,
RotorSpeed = 11.334207942999628,
RotorTorque = 14,
RotorTorqueLimitMax = 15.0,
RotorTorqueSp = 13,
Speed = 108.001708984375
}
};
}
// private static IEnumerable<DataSaubStat> CreateDataSaubStats(int idTelemetry,
// int idCategory) =>
// new[]
// {
// new DataSaubStat
// {
// AxialLoad = 0,
// AxialLoadLimitMax = 10,
// AxialLoadSp = 8,
// BlockSpeedSp = 50.0,
// DateEnd = DateTimeOffset.UtcNow.AddMinutes(40),
// DateStart = DateTimeOffset.UtcNow.AddMinutes(30),
// DepthEnd = 85.99299621582031,
// DepthStart = 85.9260025024414,
// EnabledSubsystems = 0,
// Flow = 10,
// IdCategory = idCategory,
// HasOscillation = true,
// IdFeedRegulator = 0,
// IdTelemetry = idTelemetry,
// Pressure = 24,
// PressureIdle = 0,
// PressureSp = 40,
// RotorSpeed = 11.3,
// RotorTorque = 1,
// RotorTorqueLimitMax = 26.5,
// RotorTorqueSp = 5,
// Speed = 80.3924560546875
// },
// new DataSaubStat
// {
// AxialLoad = 2,
// AxialLoadLimitMax = 10.0,
// AxialLoadSp = 8,
// BlockSpeedSp = 20,
// DateEnd = DateTimeOffset.UtcNow.AddMinutes(30),
// DateStart = DateTimeOffset.UtcNow.AddMinutes(20),
// DepthEnd = 86.28099822998047,
// DepthStart = 86.21900177001953,
// EnabledSubsystems = 1,
// Flow = 20,
// HasOscillation = true,
// IdCategory = idCategory,
// IdFeedRegulator = 1,
// IdTelemetry = idTelemetry,
// Pressure = 30,
// PressureIdle = 20,
// PressureSp = 40,
// RotorSpeed = 11.251153300212916,
// RotorTorque = 7,
// RotorTorqueLimitMax = 26.5,
// RotorTorqueSp = 9,
// Speed = 74.395751953125
// },
// new DataSaubStat
// {
// AxialLoad = 4,
// AxialLoadLimitMax = 15.0,
// AxialLoadSp = 8,
// BlockSpeedSp = 110.0,
// DateEnd = DateTimeOffset.UtcNow.AddMinutes(20),
// DateStart = DateTimeOffset.UtcNow.AddMinutes(10),
// DepthEnd = 106.7490005493164,
// DepthStart = 106.47899627685547,
// EnabledSubsystems = 1,
// Flow = 30,
// HasOscillation = true,
// IdFeedRegulator = 1,
// IdTelemetry = idTelemetry,
// IdCategory = idCategory,
// Pressure = 36,
// PressureIdle = 23.0,
// PressureSp = 63.0,
// RotorSpeed = 11.334207942999628,
// RotorTorque = 14,
// RotorTorqueLimitMax = 15.0,
// RotorTorqueSp = 13,
// Speed = 108.001708984375
// }
// };
//}

View File

@ -15,9 +15,9 @@ public class ProcessMapPlanRotorController : ProcessMapPlanBaseController<Proces
{
public ProcessMapPlanRotorController(IChangeLogRepository<ProcessMapPlanRotorDto, ProcessMapPlanBaseRequestWithWell> repository,
IWellService wellService,
ProcessMapPlanDrillingParser<ProcessMapPlanRotorDto> parserService,
ProcessMapPlanRotorParser parserService,
ITelemetryService telemetryService,
ProcessMapPlanDrillingExportService processMapPlanExportService)
ProcessMapPlanRotorExportService processMapPlanExportService)
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
{
}

View File

@ -15,9 +15,9 @@ public class ProcessMapPlanSlideController : ProcessMapPlanBaseController<Proces
{
public ProcessMapPlanSlideController(IChangeLogRepository<ProcessMapPlanSlideDto, ProcessMapPlanBaseRequestWithWell> repository,
IWellService wellService,
ProcessMapPlanDrillingParser<ProcessMapPlanSlideDto> parserService,
ProcessMapPlanSlideParser parserService,
ITelemetryService telemetryService,
ProcessMapPlanDrillingExportService processMapPlanExportService)
ProcessMapPlanSlideExportService processMapPlanExportService)
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
{
}

View File

@ -182,7 +182,7 @@ public class WellSectionPlanController : ControllerBase
private async Task CheckIsExistsWellSectionTypeAsync(int idWellSectionType, CancellationToken cancellationToken)
{
_ = await wellSectionRepository.GetOrDefaultAsync(idWellSectionType, cancellationToken)
?? throw new ArgumentInvalidException(nameof(ProcessMapPlanDrillingDto.IdWellSectionType),
?? throw new ArgumentInvalidException(nameof(ProcessMapPlanBaseDto.IdWellSectionType),
$"Тип секции с Id: {idWellSectionType} не найден");
}
}

View File

@ -73,7 +73,7 @@ namespace AsbCloudWebApi.Controllers
/// <returns></returns>
[HttpGet("compositeProcessMap")]
[Permission]
[ProducesResponseType(typeof(IEnumerable<ProcessMapPlanDrillingDto>), (int)System.Net.HttpStatusCode.OK)]
[ProducesResponseType(typeof(IEnumerable<ProcessMapPlanBaseDto>), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> GetCompositeProcessMap(int idWell, CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))