forked from ddrilling/AsbCloudServer
правки после ревью
This commit is contained in:
parent
04b2fd4a0d
commit
e6329b76da
@ -4,7 +4,7 @@
|
||||
/// DTO объединяющее плановые и фактические значения
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class PlanFactDto<T> : PlanFactBase<T, T, T>
|
||||
public class PlanFactDto<T> : PlanFactBase<T, T>
|
||||
{
|
||||
|
||||
}
|
||||
@ -15,7 +15,7 @@
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="V"></typeparam>
|
||||
/// <typeparam name="K"></typeparam>
|
||||
public class PlanFactBase<T, V, K>
|
||||
public class PlanFactBase<T, V>
|
||||
{
|
||||
/// <summary>
|
||||
/// Плановое значение
|
||||
@ -26,10 +26,5 @@
|
||||
/// Фактическое значение
|
||||
/// </summary>
|
||||
public V? Fact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Фактическое ннб-значение
|
||||
/// </summary>
|
||||
public V? Nnb { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace AsbCloudApp.Data
|
||||
namespace AsbCloudApp.Data.Trajectory
|
||||
{
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace AsbCloudApp.Data
|
||||
namespace AsbCloudApp.Data.Trajectory
|
||||
{
|
||||
/// <summary>
|
||||
/// Визуализация траектории 3D для посторения радиуса цели
|
||||
/// Визуализация траектории 3D для построения радиуса цели
|
||||
/// </summary>
|
||||
public class TrajectoryCartesianPlanDto : TrajectoryCartesianFactDto
|
||||
{
|
@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudApp.Data
|
||||
namespace AsbCloudApp.Data.Trajectory
|
||||
{
|
||||
/// <summary>
|
||||
/// Базовая географическая траектория
|
@ -1,17 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace AsbCloudApp.Data;
|
||||
namespace AsbCloudApp.Data.Trajectory;
|
||||
|
||||
/// <summary>
|
||||
/// Формирование данных по фактической географической траектории
|
||||
/// </summary>
|
||||
public class TrajectoryGeoFactDto : TrajectoryGeoDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Радиус цели
|
||||
/// </summary>
|
||||
public double? Radius { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Комментарии
|
||||
/// </summary>
|
@ -1,10 +1,11 @@
|
||||
using System;
|
||||
namespace AsbCloudApp.Data
|
||||
|
||||
namespace AsbCloudApp.Data.Trajectory
|
||||
{
|
||||
/// <summary>
|
||||
/// Формирование данных по плановой географической траектории
|
||||
/// </summary>
|
||||
public class TrajectoryGeoPlanDto: TrajectoryGeoDto
|
||||
public class TrajectoryGeoPlanDto : TrajectoryGeoDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Радиус цели
|
25
AsbCloudApp/Data/Trajectory/TrajectoryPlanFactDto.cs
Normal file
25
AsbCloudApp/Data/Trajectory/TrajectoryPlanFactDto.cs
Normal file
@ -0,0 +1,25 @@
|
||||
namespace AsbCloudApp.Data.Trajectory
|
||||
{
|
||||
/// <summary>
|
||||
/// DTO объединяющее плановые и фактические значения траекторий
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="V"></typeparam>
|
||||
public class TrajectoryPlanFactDto<T, V>
|
||||
{
|
||||
/// <summary>
|
||||
/// Плановое значение
|
||||
/// </summary>
|
||||
public T? Plan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Фактическое значение
|
||||
/// </summary>
|
||||
public V? FactManual { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Фактическое ннб-значение
|
||||
/// </summary>
|
||||
public V? FactNnb { get; set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
|
||||
namespace AsbCloudApp.Repositories
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -13,8 +13,7 @@ namespace AsbCloudDb.Migrations
|
||||
columns: new[] { "id", "description", "name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 529, "Разрешение просматривать фактические траектории", "FactTrajectory.get" },
|
||||
{ 530, "Разрешение редактировать фактические траектории", "FactTrajectory.edit" }
|
||||
{ 529, "Разрешение просматривать фактические траектории", "FactTrajectory.edit" },
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
@ -23,7 +22,6 @@ namespace AsbCloudDb.Migrations
|
||||
values: new object[,]
|
||||
{
|
||||
{ 529, 1 },
|
||||
{ 530, 1 }
|
||||
});
|
||||
}
|
||||
|
||||
@ -34,20 +32,10 @@ namespace AsbCloudDb.Migrations
|
||||
keyColumns: new[] { "id_permission", "id_user_role" },
|
||||
keyValues: new object[] { 529, 1 });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_relation_user_role_permission",
|
||||
keyColumns: new[] { "id_permission", "id_user_role" },
|
||||
keyValues: new object[] { 530, 1 });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_permission",
|
||||
keyColumn: "id",
|
||||
keyValue: 529);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_permission",
|
||||
keyColumn: "id",
|
||||
keyValue: 530);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_fact_trajectory");
|
||||
b.ToTable("t_trajectory_fact");
|
||||
|
||||
b.HasComment("Загрузка фактической траектории");
|
||||
});
|
||||
|
@ -11,7 +11,7 @@ namespace AsbCloudDb.Migrations
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "t_fact_trajectory",
|
||||
name: "t_trajectory_fact",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
@ -24,20 +24,19 @@ namespace AsbCloudDb.Migrations
|
||||
azimuth_geo = table.Column<double>(type: "double precision", nullable: false, comment: "Азимут Географ."),
|
||||
azimuth_magnetic = table.Column<double>(type: "double precision", nullable: false, comment: "Азимут Магнитный"),
|
||||
vertical_depth = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина вертикальная"),
|
||||
comment = table.Column<string>(type: "text", nullable: true, comment: "Комментарии"),
|
||||
radius = table.Column<double>(type: "double precision", nullable: true, comment: "Радиус цели")
|
||||
comment = table.Column<string>(type: "text", nullable: true, comment: "Комментарии")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_t_fact_trajectory", x => x.id);
|
||||
table.PrimaryKey("PK_t_trajectory_fact", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_t_fact_trajectory_t_user_id_user",
|
||||
name: "FK_t_trajectory_fact_t_user_id_user",
|
||||
column: x => x.id_user,
|
||||
principalTable: "t_user",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_t_fact_trajectory_t_well_id_well",
|
||||
name: "FK_t_trajectory_fact_t_well_id_well",
|
||||
column: x => x.id_well,
|
||||
principalTable: "t_well",
|
||||
principalColumn: "id",
|
||||
@ -46,20 +45,20 @@ namespace AsbCloudDb.Migrations
|
||||
comment: "Загрузка фактической траектории");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_t_fact_trajectory_id_user",
|
||||
table: "t_fact_trajectory",
|
||||
name: "IX_t_trajectory_fact_id_user",
|
||||
table: "t_trajectory_fact",
|
||||
column: "id_user");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_t_fact_trajectory_id_well",
|
||||
table: "t_fact_trajectory",
|
||||
name: "IX_t_trajectory_fact_id_well",
|
||||
table: "t_trajectory_fact",
|
||||
column: "id_well");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "t_fact_trajectory");
|
||||
name: "t_trajectory_fact");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class Add_Permissions_For_Trajectory_Nnb : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
table: "t_permission",
|
||||
columns: new[] { "id", "description", "name" },
|
||||
values: new object[] { 531, "Разрешение просматривать фактические ннб-траектории", "NnbTrajectory.get" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "t_relation_user_role_permission",
|
||||
columns: new[] { "id_permission", "id_user_role" },
|
||||
values: new object[] { 531, 1 });
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_relation_user_role_permission",
|
||||
keyColumns: new[] { "id_permission", "id_user_role" },
|
||||
keyValues: new object[] { 531, 1 });
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "t_permission",
|
||||
keyColumn: "id",
|
||||
keyValue: 531);
|
||||
}
|
||||
}
|
||||
}
|
@ -13,8 +13,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
[DbContext(typeof(AsbCloudDbContext))]
|
||||
[Migration("20231116094844_Add_Permissions_For_Trajectory_Nnb")]
|
||||
partial class Add_Permissions_For_Trajectory_Nnb
|
||||
[Migration("20231127114017_Update_t_planned_trajectory")]
|
||||
partial class Update_t_planned_trajectory
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
@ -223,7 +223,6 @@ namespace AsbCloudDb.Migrations
|
||||
.HasComment("компания");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasColumnName("email")
|
||||
@ -249,7 +248,6 @@ namespace AsbCloudDb.Migrations
|
||||
.HasComment("ключ скважины");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("phone")
|
||||
@ -502,76 +500,6 @@ namespace AsbCloudDb.Migrations
|
||||
b.HasComment("Drill_test");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.FactTrajectory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("AzimuthGeo")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_geo")
|
||||
.HasComment("Азимут Географ.");
|
||||
|
||||
b.Property<double>("AzimuthMagnetic")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_magnetic")
|
||||
.HasComment("Азимут Магнитный");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("comment")
|
||||
.HasComment("Комментарии");
|
||||
|
||||
b.Property<int>("IdUser")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_user")
|
||||
.HasComment("ID пользователя который внес/изменил запись");
|
||||
|
||||
b.Property<int>("IdWell")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well")
|
||||
.HasComment("ID скважины");
|
||||
|
||||
b.Property<double?>("Radius")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("radius")
|
||||
.HasComment("Радиус цели");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdateDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("update_date")
|
||||
.HasComment("Дата загрузки траектории");
|
||||
|
||||
b.Property<double>("VerticalDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("vertical_depth")
|
||||
.HasComment("Глубина вертикальная");
|
||||
|
||||
b.Property<double>("WellboreDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("wellbore_depth")
|
||||
.HasComment("Глубина по стволу");
|
||||
|
||||
b.Property<double>("ZenithAngle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("zenith_angle")
|
||||
.HasComment("Угол зенитный");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdUser");
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_fact_trajectory");
|
||||
|
||||
b.HasComment("Загрузка фактической траектории");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -2498,99 +2426,11 @@ namespace AsbCloudDb.Migrations
|
||||
new
|
||||
{
|
||||
Id = 529,
|
||||
Description = "Разрешение на получение отчетов drill test",
|
||||
Name = "DrillTestReport.get"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 530,
|
||||
Description = "Разрешение просматривать фактические траектории",
|
||||
Name = "FactTrajectory.get"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 531,
|
||||
Description = "Разрешение редактировать фактические траектории",
|
||||
Name = "FactTrajectory.edit"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 532,
|
||||
Description = "Разрешение просматривать фактические ннб-траектории",
|
||||
Name = "NnbTrajectory.get"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("AzimuthGeo")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_geo")
|
||||
.HasComment("Азимут Географ.");
|
||||
|
||||
b.Property<double>("AzimuthMagnetic")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_magnetic")
|
||||
.HasComment("Азимут Магнитный");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("comment")
|
||||
.HasComment("Комментарии");
|
||||
|
||||
b.Property<int>("IdUser")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_user")
|
||||
.HasComment("ID пользователя который внес/изменил запись");
|
||||
|
||||
b.Property<int>("IdWell")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well")
|
||||
.HasComment("ID скважины");
|
||||
|
||||
b.Property<double?>("Radius")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("radius")
|
||||
.HasComment("Радиус цели");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdateDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("update_date")
|
||||
.HasComment("Дата загрузки траектории");
|
||||
|
||||
b.Property<double>("VerticalDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("vertical_depth")
|
||||
.HasComment("Глубина вертикальная");
|
||||
|
||||
b.Property<double>("WellboreDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("wellbore_depth")
|
||||
.HasComment("Глубина по стволу");
|
||||
|
||||
b.Property<double>("ZenithAngle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("zenith_angle")
|
||||
.HasComment("Угол зенитный");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdUser");
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_planned_trajectory");
|
||||
|
||||
b.HasComment("Загрузка плановой траектории");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -4189,21 +4029,6 @@ namespace AsbCloudDb.Migrations
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 529
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 530
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 531
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 532
|
||||
});
|
||||
});
|
||||
|
||||
@ -5310,6 +5135,141 @@ namespace AsbCloudDb.Migrations
|
||||
b.HasComment("Наработка талевого каната");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryFact", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("AzimuthGeo")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_geo")
|
||||
.HasComment("Азимут Географ.");
|
||||
|
||||
b.Property<double>("AzimuthMagnetic")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_magnetic")
|
||||
.HasComment("Азимут Магнитный");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("comment")
|
||||
.HasComment("Комментарии");
|
||||
|
||||
b.Property<int>("IdUser")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_user")
|
||||
.HasComment("ID пользователя который внес/изменил запись");
|
||||
|
||||
b.Property<int>("IdWell")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well")
|
||||
.HasComment("ID скважины");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdateDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("update_date")
|
||||
.HasComment("Дата загрузки траектории");
|
||||
|
||||
b.Property<double>("VerticalDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("vertical_depth")
|
||||
.HasComment("Глубина вертикальная");
|
||||
|
||||
b.Property<double>("WellboreDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("wellbore_depth")
|
||||
.HasComment("Глубина по стволу");
|
||||
|
||||
b.Property<double>("ZenithAngle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("zenith_angle")
|
||||
.HasComment("Угол зенитный");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdUser");
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_trajectory_fact");
|
||||
|
||||
b.HasComment("Загрузка фактической траектории");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlanned", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("AzimuthGeo")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_geo")
|
||||
.HasComment("Азимут Географ.");
|
||||
|
||||
b.Property<double>("AzimuthMagnetic")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_magnetic")
|
||||
.HasComment("Азимут Магнитный");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("comment")
|
||||
.HasComment("Комментарии");
|
||||
|
||||
b.Property<int>("IdUser")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_user")
|
||||
.HasComment("ID пользователя который внес/изменил запись");
|
||||
|
||||
b.Property<int>("IdWell")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well")
|
||||
.HasComment("ID скважины");
|
||||
|
||||
b.Property<double?>("Radius")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("radius")
|
||||
.HasComment("Радиус цели");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdateDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("update_date")
|
||||
.HasComment("Дата загрузки траектории");
|
||||
|
||||
b.Property<double>("VerticalDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("vertical_depth")
|
||||
.HasComment("Глубина вертикальная");
|
||||
|
||||
b.Property<double>("WellboreDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("wellbore_depth")
|
||||
.HasComment("Глубина по стволу");
|
||||
|
||||
b.Property<double>("ZenithAngle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("zenith_angle")
|
||||
.HasComment("Угол зенитный");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdUser");
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_trajectory_planned");
|
||||
|
||||
b.HasComment("Загрузка плановой траектории");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -6111,6 +6071,14 @@ namespace AsbCloudDb.Migrations
|
||||
Name = "Спуск обсадной колонны"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4018,
|
||||
IdParent = 3002,
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Крепление"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 4007,
|
||||
IdParent = 3002,
|
||||
@ -6997,6 +6965,94 @@ namespace AsbCloudDb.Migrations
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Ремонт"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5102,
|
||||
IdParent = 4018,
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Спуск пакера"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5103,
|
||||
IdParent = 4011,
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Запись гамма-каратожа"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5104,
|
||||
IdParent = 4013,
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Шаблонирование спуск БИ"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5105,
|
||||
IdParent = 4018,
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Сборка клин-отклонителя"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5106,
|
||||
IdParent = 4018,
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Ориентирование и посадка клина-отклонителя"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5107,
|
||||
IdParent = 4018,
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Протяжка подъемного патрубка подвески"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5108,
|
||||
IdParent = 4018,
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Подъем клина-отклонителя"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5109,
|
||||
IdParent = 4018,
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Стыковка стингера с хвостовиком основного ствола"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5110,
|
||||
IdParent = 4018,
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Ориентирование и установка стыковочного узла хвостовика"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5111,
|
||||
IdParent = 4001,
|
||||
KeyValueName = "МСП",
|
||||
KeyValueUnits = "м/ч",
|
||||
Name = "Бурение с отбором керна"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 5112,
|
||||
IdParent = 4018,
|
||||
KeyValueName = "dT",
|
||||
KeyValueUnits = "мин",
|
||||
Name = "Работа пакером в обсадной колонне"
|
||||
});
|
||||
});
|
||||
|
||||
@ -8090,25 +8146,6 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.FactTrajectory", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUser")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdWell")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
|
||||
b.Navigation("Well");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer")
|
||||
@ -8321,25 +8358,6 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("Well");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUser")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdWell")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
|
||||
b.Navigation("Well");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "User")
|
||||
@ -8647,6 +8665,44 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryFact", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUser")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdWell")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
|
||||
b.Navigation("Well");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlanned", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUser")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdWell")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
|
||||
b.Navigation("Well");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.User", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Company", "Company")
|
@ -0,0 +1,109 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class Update_t_planned_trajectory : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_t_planned_trajectory_t_user_id_user",
|
||||
table: "t_planned_trajectory");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_t_planned_trajectory_t_well_id_well",
|
||||
table: "t_planned_trajectory");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_t_planned_trajectory",
|
||||
table: "t_planned_trajectory");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "t_planned_trajectory",
|
||||
newName: "t_trajectory_planned");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_t_planned_trajectory_id_well",
|
||||
table: "t_trajectory_planned",
|
||||
newName: "IX_t_trajectory_planned_id_well");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_t_planned_trajectory_id_user",
|
||||
table: "t_trajectory_planned",
|
||||
newName: "IX_t_trajectory_planned_id_user");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_t_trajectory_planned",
|
||||
table: "t_trajectory_planned",
|
||||
column: "id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_t_trajectory_planned_t_user_id_user",
|
||||
table: "t_trajectory_planned",
|
||||
column: "id_user",
|
||||
principalTable: "t_user",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_t_trajectory_planned_t_well_id_well",
|
||||
table: "t_trajectory_planned",
|
||||
column: "id_well",
|
||||
principalTable: "t_well",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_t_trajectory_planned_t_user_id_user",
|
||||
table: "t_trajectory_planned");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_t_trajectory_planned_t_well_id_well",
|
||||
table: "t_trajectory_planned");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_t_trajectory_planned",
|
||||
table: "t_trajectory_planned");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "t_trajectory_planned",
|
||||
newName: "t_planned_trajectory");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_t_trajectory_planned_id_well",
|
||||
table: "t_planned_trajectory",
|
||||
newName: "IX_t_planned_trajectory_id_well");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_t_trajectory_planned_id_user",
|
||||
table: "t_planned_trajectory",
|
||||
newName: "IX_t_planned_trajectory_id_user");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_t_planned_trajectory",
|
||||
table: "t_planned_trajectory",
|
||||
column: "id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_t_planned_trajectory_t_user_id_user",
|
||||
table: "t_planned_trajectory",
|
||||
column: "id_user",
|
||||
principalTable: "t_user",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_t_planned_trajectory_t_well_id_well",
|
||||
table: "t_planned_trajectory",
|
||||
column: "id_well",
|
||||
principalTable: "t_well",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
@ -491,76 +491,6 @@ namespace AsbCloudDb.Migrations
|
||||
b.HasComment("Drill_test");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.FactTrajectory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("AzimuthGeo")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_geo")
|
||||
.HasComment("Азимут Географ.");
|
||||
|
||||
b.Property<double>("AzimuthMagnetic")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_magnetic")
|
||||
.HasComment("Азимут Магнитный");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("comment")
|
||||
.HasComment("Комментарии");
|
||||
|
||||
b.Property<int>("IdUser")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_user")
|
||||
.HasComment("ID пользователя который внес/изменил запись");
|
||||
|
||||
b.Property<int>("IdWell")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well")
|
||||
.HasComment("ID скважины");
|
||||
|
||||
b.Property<double?>("Radius")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("radius")
|
||||
.HasComment("Радиус цели");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdateDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("update_date")
|
||||
.HasComment("Дата загрузки траектории");
|
||||
|
||||
b.Property<double>("VerticalDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("vertical_depth")
|
||||
.HasComment("Глубина вертикальная");
|
||||
|
||||
b.Property<double>("WellboreDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("wellbore_depth")
|
||||
.HasComment("Глубина по стволу");
|
||||
|
||||
b.Property<double>("ZenithAngle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("zenith_angle")
|
||||
.HasComment("Угол зенитный");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdUser");
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_fact_trajectory");
|
||||
|
||||
b.HasComment("Загрузка фактической траектории");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -2487,93 +2417,11 @@ namespace AsbCloudDb.Migrations
|
||||
new
|
||||
{
|
||||
Id = 529,
|
||||
Description = "Разрешение просматривать фактические траектории",
|
||||
Name = "FactTrajectory.get"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 530,
|
||||
Description = "Разрешение редактировать фактические траектории",
|
||||
Name = "FactTrajectory.edit"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 531,
|
||||
Description = "Разрешение просматривать фактические ннб-траектории",
|
||||
Name = "NnbTrajectory.get"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("AzimuthGeo")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_geo")
|
||||
.HasComment("Азимут Географ.");
|
||||
|
||||
b.Property<double>("AzimuthMagnetic")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_magnetic")
|
||||
.HasComment("Азимут Магнитный");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("comment")
|
||||
.HasComment("Комментарии");
|
||||
|
||||
b.Property<int>("IdUser")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_user")
|
||||
.HasComment("ID пользователя который внес/изменил запись");
|
||||
|
||||
b.Property<int>("IdWell")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well")
|
||||
.HasComment("ID скважины");
|
||||
|
||||
b.Property<double?>("Radius")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("radius")
|
||||
.HasComment("Радиус цели");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdateDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("update_date")
|
||||
.HasComment("Дата загрузки траектории");
|
||||
|
||||
b.Property<double>("VerticalDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("vertical_depth")
|
||||
.HasComment("Глубина вертикальная");
|
||||
|
||||
b.Property<double>("WellboreDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("wellbore_depth")
|
||||
.HasComment("Глубина по стволу");
|
||||
|
||||
b.Property<double>("ZenithAngle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("zenith_angle")
|
||||
.HasComment("Угол зенитный");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdUser");
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_planned_trajectory");
|
||||
|
||||
b.HasComment("Загрузка плановой траектории");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -4172,16 +4020,6 @@ namespace AsbCloudDb.Migrations
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 529
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 530
|
||||
},
|
||||
new
|
||||
{
|
||||
IdUserRole = 1,
|
||||
IdPermission = 531
|
||||
});
|
||||
});
|
||||
|
||||
@ -5288,6 +5126,141 @@ namespace AsbCloudDb.Migrations
|
||||
b.HasComment("Наработка талевого каната");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryFact", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("AzimuthGeo")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_geo")
|
||||
.HasComment("Азимут Географ.");
|
||||
|
||||
b.Property<double>("AzimuthMagnetic")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_magnetic")
|
||||
.HasComment("Азимут Магнитный");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("comment")
|
||||
.HasComment("Комментарии");
|
||||
|
||||
b.Property<int>("IdUser")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_user")
|
||||
.HasComment("ID пользователя который внес/изменил запись");
|
||||
|
||||
b.Property<int>("IdWell")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well")
|
||||
.HasComment("ID скважины");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdateDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("update_date")
|
||||
.HasComment("Дата загрузки траектории");
|
||||
|
||||
b.Property<double>("VerticalDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("vertical_depth")
|
||||
.HasComment("Глубина вертикальная");
|
||||
|
||||
b.Property<double>("WellboreDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("wellbore_depth")
|
||||
.HasComment("Глубина по стволу");
|
||||
|
||||
b.Property<double>("ZenithAngle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("zenith_angle")
|
||||
.HasComment("Угол зенитный");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdUser");
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_trajectory_fact");
|
||||
|
||||
b.HasComment("Загрузка фактической траектории");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlanned", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("AzimuthGeo")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_geo")
|
||||
.HasComment("Азимут Географ.");
|
||||
|
||||
b.Property<double>("AzimuthMagnetic")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("azimuth_magnetic")
|
||||
.HasComment("Азимут Магнитный");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("comment")
|
||||
.HasComment("Комментарии");
|
||||
|
||||
b.Property<int>("IdUser")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_user")
|
||||
.HasComment("ID пользователя который внес/изменил запись");
|
||||
|
||||
b.Property<int>("IdWell")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id_well")
|
||||
.HasComment("ID скважины");
|
||||
|
||||
b.Property<double?>("Radius")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("radius")
|
||||
.HasComment("Радиус цели");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdateDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("update_date")
|
||||
.HasComment("Дата загрузки траектории");
|
||||
|
||||
b.Property<double>("VerticalDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("vertical_depth")
|
||||
.HasComment("Глубина вертикальная");
|
||||
|
||||
b.Property<double>("WellboreDepth")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("wellbore_depth")
|
||||
.HasComment("Глубина по стволу");
|
||||
|
||||
b.Property<double>("ZenithAngle")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("zenith_angle")
|
||||
.HasComment("Угол зенитный");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdUser");
|
||||
|
||||
b.HasIndex("IdWell");
|
||||
|
||||
b.ToTable("t_trajectory_planned");
|
||||
|
||||
b.HasComment("Загрузка плановой траектории");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -8164,25 +8137,6 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.FactTrajectory", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUser")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdWell")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
|
||||
b.Navigation("Well");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer")
|
||||
@ -8395,25 +8349,6 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("Well");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUser")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdWell")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
|
||||
b.Navigation("Well");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "User")
|
||||
@ -8721,6 +8656,44 @@ namespace AsbCloudDb.Migrations
|
||||
b.Navigation("Telemetry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryFact", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUser")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdWell")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
|
||||
b.Navigation("Well");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.Trajectory.TrajectoryPlanned", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUser")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdWell")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
|
||||
b.Navigation("Well");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AsbCloudDb.Model.User", b =>
|
||||
{
|
||||
b.HasOne("AsbCloudDb.Model.Company", "Company")
|
||||
|
@ -17,7 +17,7 @@ namespace AsbCloudDb.Model
|
||||
public virtual DbSet<DailyReport.DailyReport> DailyReports => Set <DailyReport.DailyReport >();
|
||||
public virtual DbSet<Deposit> Deposits => Set<Deposit>();
|
||||
public virtual DbSet<DetectedOperation> DetectedOperations => Set<DetectedOperation>();
|
||||
public virtual DbSet<PlannedTrajectory> PlannedTrajectories => Set<PlannedTrajectory>();
|
||||
public virtual DbSet<TrajectoryPlanned> PlannedTrajectories => Set<TrajectoryPlanned>();
|
||||
public virtual DbSet<ProcessMapWellDrilling> ProcessMapWellDrillings => Set<ProcessMapWellDrilling>();
|
||||
public virtual DbSet<ProcessMapWellReam> ProcessMapWellReams => Set<ProcessMapWellReam>();
|
||||
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
|
||||
@ -60,7 +60,7 @@ namespace AsbCloudDb.Model
|
||||
public virtual DbSet<LimitingParameter> LimitingParameter => Set<LimitingParameter>();
|
||||
|
||||
public virtual DbSet<TelemetryWirelineRunOut> TelemetryWirelineRunOut => Set<TelemetryWirelineRunOut>();
|
||||
public virtual DbSet<FactTrajectory> FactTrajectories => Set<FactTrajectory>();
|
||||
public virtual DbSet<TrajectoryFact> FactTrajectories => Set<TrajectoryFact>();
|
||||
|
||||
// GTR WITS
|
||||
public DbSet<WitsItemFloat> WitsItemFloat => Set<WitsItemFloat>();
|
||||
|
@ -162,9 +162,7 @@
|
||||
new() { Id = 527, Name = "Manual.delete", Description = "Разрешение на удаление инструкций"},
|
||||
new (){ Id = 528, Name="WellContact.delete", Description="Разрешение на удаление контакта"},
|
||||
|
||||
new (){ Id = 529, Name="FactTrajectory.get", Description="Разрешение просматривать фактические траектории"},
|
||||
new (){ Id = 530, Name="FactTrajectory.edit", Description="Разрешение редактировать фактические траектории"},
|
||||
new (){ Id = 531, Name="NnbTrajectory.get", Description="Разрешение просматривать фактические ннб-траектории"},
|
||||
new (){ Id = 529, Name="FactTrajectory.edit", Description="Разрешение редактировать фактические траектории"}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace AsbCloudDb.Model
|
||||
DbSet<DailyReport.DailyReport> DailyReports { get; }
|
||||
DbSet<Deposit> Deposits { get; }
|
||||
DbSet<DetectedOperation> DetectedOperations { get; }
|
||||
DbSet<PlannedTrajectory> PlannedTrajectories { get; }
|
||||
DbSet<TrajectoryPlanned> PlannedTrajectories { get; }
|
||||
DbSet<ProcessMapWellDrilling> ProcessMapWellDrillings { get; }
|
||||
DbSet<ProcessMapWellReam> ProcessMapWellReams { get; }
|
||||
DbSet<DrillingProgramPart> DrillingProgramParts { get; }
|
||||
@ -78,7 +78,7 @@ namespace AsbCloudDb.Model
|
||||
DbSet<ManualDirectory> ManualDirectories { get; }
|
||||
DbSet<Contact> Contacts { get; }
|
||||
DbSet<DrillTest> DrillTests { get; }
|
||||
DbSet<FactTrajectory> FactTrajectories { get; }
|
||||
DbSet<TrajectoryFact> FactTrajectories { get; }
|
||||
DatabaseFacade Database { get; }
|
||||
|
||||
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);
|
||||
|
@ -1,13 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AsbCloudDb.Model.Trajectory
|
||||
{
|
||||
[Table("t_planned_trajectory"), Comment("Загрузка плановой траектории")]
|
||||
public class PlannedTrajectory : Trajectory
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AsbCloudDb.Model.Trajectory
|
||||
{
|
||||
public class Trajectory : IId, IWellRelated
|
||||
public abstract class Trajectory : IId, IWellRelated
|
||||
{
|
||||
[Column("id"), Key]
|
||||
public int Id { get; set; }
|
||||
@ -37,9 +37,6 @@ namespace AsbCloudDb.Model.Trajectory
|
||||
[Column("comment"), Comment("Комментарии")]
|
||||
public string? Comment { get; set; }
|
||||
|
||||
[Column("radius"), Comment("Радиус цели")]
|
||||
public double? Radius { get; set; }
|
||||
|
||||
[ForeignKey(nameof(IdWell))]
|
||||
public virtual Well Well { get; set; } = null!;
|
||||
|
||||
|
@ -3,8 +3,8 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AsbCloudDb.Model.Trajectory
|
||||
{
|
||||
[Table("t_fact_trajectory"), Comment("Загрузка фактической траектории")]
|
||||
public class FactTrajectory : Trajectory
|
||||
[Table("t_trajectory_fact"), Comment("Загрузка фактической траектории")]
|
||||
public class TrajectoryFact : Trajectory
|
||||
{
|
||||
}
|
||||
}
|
12
AsbCloudDb/Model/Trajectory/TrajectoryPlanned.cs
Normal file
12
AsbCloudDb/Model/Trajectory/TrajectoryPlanned.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AsbCloudDb.Model.Trajectory
|
||||
{
|
||||
[Table("t_trajectory_planned"), Comment("Загрузка плановой траектории")]
|
||||
public class TrajectoryPlanned : Trajectory
|
||||
{
|
||||
[Column("radius"), Comment("Радиус цели")]
|
||||
public double? Radius { get; set; }
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@
|
||||
<None Remove="Services\Trajectory\FactTrajectoryTemplate.xlsx" />
|
||||
<None Remove="Services\Trajectory\NnbTrajectoryTemplate.xlsx" />
|
||||
<None Remove="Services\Trajectory\PlannedTrajectoryTemplate.xlsx" />
|
||||
<None Remove="Services\Trajectory\Templates\TrajectoryFactNnbTemplate.xlsx" />
|
||||
<None Remove="Services\WellOperationService\ScheduleReportTemplate.xlsx" />
|
||||
<None Remove="Services\WellOperationService\WellOperationImportTemplate.xlsx" />
|
||||
<None Remove="Services\DailyReport\DailyReportBlocks\" />
|
||||
@ -35,9 +36,9 @@
|
||||
<EmbeddedResource Include="Services\DetectOperations\DetectOperations.xlsx" />
|
||||
<EmbeddedResource Include="Services\DailyReport\DailyReportTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\DrillTestReport\DrillTestReportTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\Trajectory\Templates\FactTrajectoryTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\Trajectory\Templates\NnbTrajectoryTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\Trajectory\Templates\PlannedTrajectoryTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\Trajectory\Templates\TrajectoryFactNnbTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\Trajectory\Templates\TrajectoryFactManualTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\Trajectory\Templates\TrajectoryPlannedTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\WellOperationService\ScheduleReportTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\AutoGeneratedDailyReports\AutogeneratedDailyReportTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\WellOperationImport\Files\WellOperationImportTemplate.xlsx" />
|
||||
|
@ -6,6 +6,7 @@ using AsbCloudApp.Data.Manuals;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using AsbCloudApp.Data.SAUB;
|
||||
using AsbCloudApp.Data.Subsystems;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Data.WellOperationImport.Options;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
@ -33,6 +34,8 @@ using AsbCloudInfrastructure.Services.ProcessMaps.WellDrilling;
|
||||
using AsbCloudInfrastructure.Services.SAUB;
|
||||
using AsbCloudInfrastructure.Services.Subsystems;
|
||||
using AsbCloudInfrastructure.Services.Trajectory;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Export;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Import;
|
||||
using AsbCloudInfrastructure.Services.WellOperationImport;
|
||||
using AsbCloudInfrastructure.Services.WellOperationImport.FileParser;
|
||||
using AsbCloudInfrastructure.Services.WellOperationService;
|
||||
@ -182,10 +185,11 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<IWellService, WellService>();
|
||||
services.AddTransient<IWellOperationImportService, WellOperationImportService>();
|
||||
services.AddTransient<IProcessMapReportWellDrillingExportService, ProcessMapReportWellDrillingExportService>();
|
||||
//services.AddTransient<IPlannedTrajectoryImportService, PlannedTrajectoryImportService>();
|
||||
services.AddTransient<PlannedTrajectoryImportService>();
|
||||
services.AddTransient<FactTrajectoryImportService>();
|
||||
services.AddTransient<NnbTrajectoryImportService>();
|
||||
services.AddTransient<TrajectoryPlannedExportService>();
|
||||
services.AddTransient<TrajectoryFactManualExportService>();
|
||||
services.AddTransient<TrajectoryFactNnbExportService>();
|
||||
services.AddTransient<TrajectoryPlannedImportService>();
|
||||
services.AddTransient<TrajectoryFactManualImportService>();
|
||||
services.AddTransient<IWellOperationRepository, WellOperationRepository>();
|
||||
services.AddTransient<IDailyReportService, DailyReportService>();
|
||||
services.AddTransient<IDetectedOperationService, DetectedOperationService>();
|
||||
@ -248,8 +252,8 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
|
||||
services.AddTransient<ITelemetryWirelineRunOutRepository, TelemetryWirelineRunOutRepository>();
|
||||
services.AddTransient<IWellFinalDocumentsRepository, WellFinalDocumentsRepository>();
|
||||
services.AddTransient<ITrajectoryEditableRepository<TrajectoryGeoPlanDto>, TrajectoryEditableRepository<PlannedTrajectory, TrajectoryGeoPlanDto>>();
|
||||
services.AddTransient<ITrajectoryEditableRepository<TrajectoryGeoFactDto>, TrajectoryEditableRepository<FactTrajectory, TrajectoryGeoFactDto>>();
|
||||
services.AddTransient<ITrajectoryEditableRepository<TrajectoryGeoPlanDto>, TrajectoryEditableRepository<TrajectoryPlanned, TrajectoryGeoPlanDto>>();
|
||||
services.AddTransient<ITrajectoryEditableRepository<TrajectoryGeoFactDto>, TrajectoryEditableRepository<TrajectoryFact, TrajectoryGeoFactDto>>();
|
||||
services.AddTransient<ITrajectoryNnbRepository, TrajectoryNnbRepository>();
|
||||
services.AddTransient<IFaqRepository, FaqRepository>();
|
||||
services.AddTransient<ISlipsStatService, SlipsStatService>();
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using ClosedXML.Excel;
|
||||
@ -9,31 +9,41 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
namespace AsbCloudInfrastructure.Services.Trajectory.Export
|
||||
{
|
||||
public abstract class TrajectoryImportService<T> where T : TrajectoryGeoDto
|
||||
public abstract class TrajectoryExportService<T> where T : TrajectoryGeoDto
|
||||
{
|
||||
private readonly IWellService wellService;
|
||||
|
||||
private readonly ITrajectoryRepository<T> trajectoryService;
|
||||
protected abstract void AddCoordinatesToRow(IXLRow row, T trajectory);
|
||||
protected abstract T ParseRow(IXLRow row);
|
||||
public abstract string templateFileName { get; set; }
|
||||
public abstract string usingTemplateFile { get; set; }
|
||||
public abstract string sheetNamePlannedTrajectory { get; set; }
|
||||
public abstract string sheetTrajectory { get; set; }
|
||||
public abstract int headerRowsCount { get; set; }
|
||||
public abstract int ColumnWellboreDepth { get; set; }
|
||||
public abstract int ColumnZenithAngle { get; set; }
|
||||
public abstract int ColumnAzimuthGeo { get; set; }
|
||||
public abstract int ColumnAzimuthMagnetic { get; set; }
|
||||
public abstract int ColumnVerticalDepth { get; set; }
|
||||
public abstract int ColumnRadius { get; set; }
|
||||
public abstract int ColumnComment { get; set; }
|
||||
|
||||
public TrajectoryImportService(ITrajectoryRepository<T> trajectoryService, IWellService wellService)
|
||||
public TrajectoryExportService(IWellService wellService, ITrajectoryRepository<T> trajectoryService)
|
||||
{
|
||||
this.trajectoryService = trajectoryService;
|
||||
this.wellService = wellService;
|
||||
this.trajectoryService = trajectoryService;
|
||||
}
|
||||
|
||||
public async Task<Stream> ExportAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var trajectorys = await trajectoryService.GetAsync(idWell, token);
|
||||
return MakeExelFileStream(trajectorys);
|
||||
}
|
||||
|
||||
public async Task<string> GetFileNameAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var caption = await wellService.GetWellCaptionByIdAsync(idWell, token);
|
||||
return string.Format("{0}_{1}", caption, templateFileName);
|
||||
}
|
||||
|
||||
public Stream GetTemplateFile()
|
||||
@ -45,12 +55,6 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
return stream;
|
||||
}
|
||||
|
||||
public async Task<Stream> ExportAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var trajectorys = await trajectoryService.GetAsync(idWell, token);
|
||||
return MakeExelFileStream(trajectorys);
|
||||
}
|
||||
|
||||
private Stream MakeExelFileStream(IEnumerable<T> trajectories)
|
||||
{
|
||||
using Stream ecxelTemplateStream = GetTemplateFile();
|
||||
@ -66,9 +70,9 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
{
|
||||
if (trajectories.Any())
|
||||
{
|
||||
var sheet = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetNamePlannedTrajectory);
|
||||
var sheet = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetTrajectory);
|
||||
if (sheet is null)
|
||||
throw new FileFormatException($"Лист с именем {sheetNamePlannedTrajectory} отсутствует, либо имеет некорректное название");
|
||||
throw new FileFormatException($"Лист с именем {sheetTrajectory} отсутствует, либо имеет некорректное название");
|
||||
AddTrajecoryToSheet(sheet, trajectories);
|
||||
}
|
||||
}
|
||||
@ -82,75 +86,5 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
AddCoordinatesToRow(row, rowList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string> GetFileNameAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var caption = await wellService.GetWellCaptionByIdAsync(idWell, token);
|
||||
return string.Format("{0}_{1}", caption, templateFileName);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<T>> ImportAsync(int idWell, int idUser, Stream stream, CancellationToken token)
|
||||
{
|
||||
using var workbook = new XLWorkbook(stream, XLEventTracking.Disabled);
|
||||
var trajectoryRows = ParseFileStream(stream);
|
||||
foreach (var row in trajectoryRows)
|
||||
{
|
||||
row.IdWell = idWell;
|
||||
row.IdUser = idUser;
|
||||
}
|
||||
|
||||
return trajectoryRows;
|
||||
}
|
||||
|
||||
|
||||
private IEnumerable<T> ParseFileStream(Stream stream)
|
||||
{
|
||||
using var workbook = new XLWorkbook(stream, XLEventTracking.Disabled);
|
||||
return ParseWorkbook(workbook);
|
||||
}
|
||||
|
||||
private IEnumerable<T> ParseWorkbook(IXLWorkbook workbook)
|
||||
{
|
||||
var sheetTrajectory = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetNamePlannedTrajectory);
|
||||
if (sheetTrajectory is null)
|
||||
throw new FileFormatException($"Книга excel не содержит листа {sheetNamePlannedTrajectory}.");
|
||||
var trajectoryRows = ParseSheet(sheetTrajectory);
|
||||
return trajectoryRows;
|
||||
}
|
||||
|
||||
private IEnumerable<T> ParseSheet(IXLWorksheet sheet)
|
||||
{
|
||||
if (sheet.RangeUsed().RangeAddress.LastAddress.ColumnNumber < 7)
|
||||
throw new FileFormatException($"Лист {sheet.Name} содержит меньшее количество столбцов.");
|
||||
|
||||
var count = sheet.RowsUsed().Count() - headerRowsCount;
|
||||
|
||||
if (count > 1024)
|
||||
throw new FileFormatException($"Лист {sheet.Name} содержит слишком большое количество строк.");
|
||||
|
||||
if (count <= 0)
|
||||
throw new FileFormatException($"Лист {sheet.Name} некорректного формата либо пустой");
|
||||
|
||||
var trajectoryRows = new List<T>(count);
|
||||
var parseErrors = new List<string>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var row = sheet.Row(1 + i + headerRowsCount);
|
||||
try
|
||||
{
|
||||
var trajectoryRow = ParseRow(row);
|
||||
trajectoryRows.Add(trajectoryRow);
|
||||
}
|
||||
catch (FileFormatException ex)
|
||||
{
|
||||
parseErrors.Add(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
if (parseErrors.Any())
|
||||
throw new FileFormatException(string.Join("\r\n", parseErrors));
|
||||
|
||||
return trajectoryRows;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using ClosedXML.Excel;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.Trajectory.Export
|
||||
{
|
||||
|
||||
public class TrajectoryFactManualExportService : TrajectoryExportService<TrajectoryGeoFactDto>
|
||||
{
|
||||
public override string templateFileName { get; set; } = "TrajectoryFactManualTemplate.xlsx";
|
||||
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
|
||||
public override string sheetTrajectory { get; set; } = "Фактическая траектория";
|
||||
public override int headerRowsCount { get; set; } = 2;
|
||||
public override int ColumnWellboreDepth { get; set; } = 1;
|
||||
public override int ColumnZenithAngle { get; set; } = 2;
|
||||
public override int ColumnAzimuthGeo { get; set; } = 3;
|
||||
public override int ColumnAzimuthMagnetic { get; set; } = 4;
|
||||
public override int ColumnVerticalDepth { get; set; } = 5;
|
||||
public override int ColumnComment { get; set; } = 6;
|
||||
|
||||
public TrajectoryFactManualExportService(
|
||||
IWellService wellService,
|
||||
ITrajectoryEditableRepository<TrajectoryGeoFactDto> factTrajectoryService)
|
||||
: base(wellService, factTrajectoryService)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoFactDto trajectory)
|
||||
{
|
||||
row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth;
|
||||
row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle;
|
||||
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
|
||||
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
|
||||
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
|
||||
row.Cell(ColumnComment).Value = trajectory.Comment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using ClosedXML.Excel;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.Trajectory.Export
|
||||
{
|
||||
|
||||
public class TrajectoryFactNnbExportService : TrajectoryExportService<TrajectoryGeoFactDto>
|
||||
{
|
||||
public override string templateFileName { get; set; } = "TrajectoryFactNnbTemplate.xlsx";
|
||||
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
|
||||
public override string sheetTrajectory { get; set; } = "Фактическая ннб-траектория";
|
||||
public override int headerRowsCount { get; set; } = 2;
|
||||
public override int ColumnWellboreDepth { get; set; } = 1;
|
||||
public override int ColumnZenithAngle { get; set; } = 2;
|
||||
public override int ColumnAzimuthGeo { get; set; } = 3;
|
||||
public override int ColumnAzimuthMagnetic { get; set; } = 4;
|
||||
public override int ColumnVerticalDepth { get; set; } = 5;
|
||||
public override int ColumnComment { get; set; } = 6;
|
||||
|
||||
public TrajectoryFactNnbExportService(
|
||||
IWellService wellService,
|
||||
ITrajectoryNnbRepository nnbTrajectoryService)
|
||||
: base(wellService, nnbTrajectoryService)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoFactDto trajectory)
|
||||
{
|
||||
row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth;
|
||||
row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle;
|
||||
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
|
||||
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
|
||||
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
|
||||
row.Cell(ColumnComment).Value = trajectory.Comment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +1,35 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using ClosedXML.Excel;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
namespace AsbCloudInfrastructure.Services.Trajectory.Export
|
||||
{
|
||||
|
||||
public class NnbTrajectoryImportService : TrajectoryImportService<TrajectoryGeoFactDto>
|
||||
public class TrajectoryPlannedExportService : TrajectoryExportService<TrajectoryGeoPlanDto>
|
||||
{
|
||||
public override string templateFileName { get; set; } = "NnbTrajectoryTemplate.xlsx";
|
||||
/*
|
||||
* password for PlannedTrajectoryTemplate.xlsx is Drill2022
|
||||
*/
|
||||
public override string templateFileName { get; set; } = "TrajectoryPlannedTemplate.xlsx";
|
||||
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
|
||||
public override string sheetNamePlannedTrajectory { get; set; } = "Фактическая ннб-траектория";
|
||||
public override string sheetTrajectory { get; set; } = "Плановая траектория";
|
||||
public override int headerRowsCount { get; set; } = 2;
|
||||
public override int ColumnWellboreDepth { get; set; } = 1;
|
||||
public override int ColumnZenithAngle { get; set; } = 2;
|
||||
public override int ColumnAzimuthGeo { get; set; } = 3;
|
||||
public override int ColumnAzimuthMagnetic { get; set; } = 4;
|
||||
public override int ColumnVerticalDepth { get; set; } = 5;
|
||||
public override int ColumnRadius { get; set; } = 6;
|
||||
public int ColumnRadius { get; set; } = 6;
|
||||
public override int ColumnComment { get; set; } = 7;
|
||||
|
||||
public NnbTrajectoryImportService(
|
||||
public TrajectoryPlannedExportService(
|
||||
IWellService wellService,
|
||||
ITrajectoryNnbRepository nnbTrajectoryService)
|
||||
: base(nnbTrajectoryService, wellService)
|
||||
ITrajectoryEditableRepository<TrajectoryGeoPlanDto> plannedTrajectoryService)
|
||||
: base(wellService, plannedTrajectoryService)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoFactDto trajectory)
|
||||
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoPlanDto trajectory)
|
||||
{
|
||||
row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth;
|
||||
row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle;
|
||||
@ -38,22 +39,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
row.Cell(ColumnRadius).Value = trajectory.Radius;
|
||||
row.Cell(ColumnComment).Value = trajectory.Comment;
|
||||
}
|
||||
|
||||
protected override TrajectoryGeoFactDto ParseRow(IXLRow row)
|
||||
{
|
||||
var trajectoryRow = new TrajectoryGeoFactDto
|
||||
{
|
||||
WellboreDepth = row.Cell(ColumnWellboreDepth).GetCellValue<double>(),
|
||||
ZenithAngle = row.Cell(ColumnZenithAngle).GetCellValue<double>(),
|
||||
AzimuthGeo = row.Cell(ColumnAzimuthGeo).GetCellValue<double>(),
|
||||
AzimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).GetCellValue<double>(),
|
||||
VerticalDepth = row.Cell(ColumnVerticalDepth).GetCellValue<double>(),
|
||||
Radius = row.Cell(ColumnRadius).GetCellValue<double>(),
|
||||
Comment = row.Cell(ColumnComment).GetCellValue<string?>()
|
||||
};
|
||||
|
||||
return trajectoryRow;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using ClosedXML.Excel;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
namespace AsbCloudInfrastructure.Services.Trajectory.Import
|
||||
{
|
||||
|
||||
public class FactTrajectoryImportService : TrajectoryImportService<TrajectoryGeoFactDto>
|
||||
public class TrajectoryFactManualImportService : TrajectoryImportService<TrajectoryGeoFactDto>
|
||||
{
|
||||
public override string templateFileName { get; set; } = "FactTrajectoryTemplate.xlsx";
|
||||
public override string templateFileName { get; set; } = "TrajectoryFactManualTemplate.xlsx";
|
||||
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
|
||||
public override string sheetNamePlannedTrajectory { get; set; } = "Фактическая траектория";
|
||||
public override int headerRowsCount { get; set; } = 2;
|
||||
@ -17,28 +17,13 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
public override int ColumnAzimuthGeo { get; set; } = 3;
|
||||
public override int ColumnAzimuthMagnetic { get; set; } = 4;
|
||||
public override int ColumnVerticalDepth { get; set; } = 5;
|
||||
public override int ColumnRadius { get; set; } = 6;
|
||||
public override int ColumnComment { get; set; } = 7;
|
||||
public override int ColumnComment { get; set; } = 6;
|
||||
|
||||
public FactTrajectoryImportService(
|
||||
IWellService wellService,
|
||||
ITrajectoryEditableRepository<TrajectoryGeoFactDto> factTrajectoryService)
|
||||
: base(factTrajectoryService, wellService)
|
||||
public TrajectoryFactManualImportService() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoFactDto trajectory)
|
||||
{
|
||||
row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth;
|
||||
row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle;
|
||||
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
|
||||
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
|
||||
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
|
||||
row.Cell(ColumnRadius).Value = trajectory.Radius;
|
||||
row.Cell(ColumnComment).Value = trajectory.Comment;
|
||||
}
|
||||
|
||||
protected override TrajectoryGeoFactDto ParseRow(IXLRow row)
|
||||
{
|
||||
var trajectoryRow = new TrajectoryGeoFactDto
|
||||
@ -48,7 +33,6 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
AzimuthGeo = row.Cell(ColumnAzimuthGeo).GetCellValue<double>(),
|
||||
AzimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).GetCellValue<double>(),
|
||||
VerticalDepth = row.Cell(ColumnVerticalDepth).GetCellValue<double>(),
|
||||
Radius = row.Cell(ColumnRadius).GetCellValue<double>(),
|
||||
Comment = row.Cell(ColumnComment).GetCellValue<string?>()
|
||||
};
|
||||
|
@ -0,0 +1,92 @@
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using ClosedXML.Excel;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.Trajectory.Import
|
||||
{
|
||||
public abstract class TrajectoryImportService<T> where T : TrajectoryGeoDto
|
||||
{
|
||||
private readonly IWellService wellService;
|
||||
|
||||
protected abstract T ParseRow(IXLRow row);
|
||||
public abstract string templateFileName { get; set; }
|
||||
public abstract string usingTemplateFile { get; set; }
|
||||
public abstract string sheetNamePlannedTrajectory { get; set; }
|
||||
public abstract int headerRowsCount { get; set; }
|
||||
public abstract int ColumnWellboreDepth { get; set; }
|
||||
public abstract int ColumnZenithAngle { get; set; }
|
||||
public abstract int ColumnAzimuthGeo { get; set; }
|
||||
public abstract int ColumnAzimuthMagnetic { get; set; }
|
||||
public abstract int ColumnVerticalDepth { get; set; }
|
||||
public abstract int ColumnComment { get; set; }
|
||||
|
||||
public TrajectoryImportService()
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<T>> ImportAsync(Stream stream, CancellationToken token)
|
||||
{
|
||||
using var workbook = new XLWorkbook(stream, XLEventTracking.Disabled);
|
||||
var trajectoryRows = ParseFileStream(stream);
|
||||
|
||||
return trajectoryRows;
|
||||
}
|
||||
|
||||
|
||||
private IEnumerable<T> ParseFileStream(Stream stream)
|
||||
{
|
||||
using var workbook = new XLWorkbook(stream, XLEventTracking.Disabled);
|
||||
return ParseWorkbook(workbook);
|
||||
}
|
||||
|
||||
private IEnumerable<T> ParseWorkbook(IXLWorkbook workbook)
|
||||
{
|
||||
var sheetTrajectory = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetNamePlannedTrajectory);
|
||||
if (sheetTrajectory is null)
|
||||
throw new FileFormatException($"Книга excel не содержит листа {sheetNamePlannedTrajectory}.");
|
||||
var trajectoryRows = ParseSheet(sheetTrajectory);
|
||||
return trajectoryRows;
|
||||
}
|
||||
|
||||
private IEnumerable<T> ParseSheet(IXLWorksheet sheet)
|
||||
{
|
||||
if (sheet.RangeUsed().RangeAddress.LastAddress.ColumnNumber < 6)
|
||||
throw new FileFormatException($"Лист {sheet.Name} содержит меньшее количество столбцов.");
|
||||
|
||||
var count = sheet.RowsUsed().Count() - headerRowsCount;
|
||||
|
||||
if (count > 1024)
|
||||
throw new FileFormatException($"Лист {sheet.Name} содержит слишком большое количество строк.");
|
||||
|
||||
if (count <= 0)
|
||||
throw new FileFormatException($"Лист {sheet.Name} некорректного формата либо пустой");
|
||||
|
||||
var trajectoryRows = new List<T>(count);
|
||||
var parseErrors = new List<string>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var row = sheet.Row(1 + i + headerRowsCount);
|
||||
try
|
||||
{
|
||||
var trajectoryRow = ParseRow(row);
|
||||
trajectoryRows.Add(trajectoryRow);
|
||||
}
|
||||
catch (FileFormatException ex)
|
||||
{
|
||||
parseErrors.Add(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
if (parseErrors.Any())
|
||||
throw new FileFormatException(string.Join("\r\n", parseErrors));
|
||||
|
||||
return trajectoryRows;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,16 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Services;
|
||||
using ClosedXML.Excel;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
namespace AsbCloudInfrastructure.Services.Trajectory.Import
|
||||
{
|
||||
|
||||
public class PlannedTrajectoryImportService : TrajectoryImportService<TrajectoryGeoPlanDto>
|
||||
public class TrajectoryPlannedImportService : TrajectoryImportService<TrajectoryGeoPlanDto>
|
||||
{
|
||||
/*
|
||||
* password for PlannedTrajectoryTemplate.xlsx is Drill2022
|
||||
*/
|
||||
public override string templateFileName { get; set; } = "PlannedTrajectoryTemplate.xlsx";
|
||||
public override string templateFileName { get; set; } = "TrajectoryPlannedTemplate.xlsx";
|
||||
public override string usingTemplateFile { get; set; } = "AsbCloudInfrastructure.Services.Trajectory.Templates";
|
||||
public override string sheetNamePlannedTrajectory { get; set; } = "Плановая траектория";
|
||||
public override int headerRowsCount { get; set; } = 2;
|
||||
@ -20,13 +19,10 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
public override int ColumnAzimuthGeo { get; set; } = 3;
|
||||
public override int ColumnAzimuthMagnetic { get; set; } = 4;
|
||||
public override int ColumnVerticalDepth { get; set; } = 5;
|
||||
public override int ColumnRadius { get; set; } = 6;
|
||||
public int ColumnRadius { get; set; } = 6;
|
||||
public override int ColumnComment { get; set; } = 7;
|
||||
|
||||
public PlannedTrajectoryImportService(
|
||||
IWellService wellService,
|
||||
ITrajectoryEditableRepository<TrajectoryGeoPlanDto> plannedTrajectoryService)
|
||||
: base(plannedTrajectoryService, wellService)
|
||||
public TrajectoryPlannedImportService() : base()
|
||||
{
|
||||
}
|
||||
|
||||
@ -45,17 +41,6 @@ namespace AsbCloudInfrastructure.Services.Trajectory
|
||||
|
||||
return trajectoryRow;
|
||||
}
|
||||
|
||||
protected override void AddCoordinatesToRow(IXLRow row, TrajectoryGeoPlanDto trajectory)
|
||||
{
|
||||
row.Cell(ColumnWellboreDepth).Value = trajectory.WellboreDepth;
|
||||
row.Cell(ColumnZenithAngle).Value = trajectory.ZenithAngle;
|
||||
row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo;
|
||||
row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic;
|
||||
row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth;
|
||||
row.Cell(ColumnRadius).Value = trajectory.Radius;
|
||||
row.Cell(ColumnComment).Value = trajectory.Comment;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -144,13 +144,13 @@ public class TrajectoryService
|
||||
/// <param name="idWell">ключ скважины</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PlanFactBase<IEnumerable<TrajectoryCartesianPlanDto>, IEnumerable<TrajectoryCartesianFactDto>, IEnumerable<TrajectoryCartesianFactDto>>> GetTrajectoryCartesianAsync(int idWell, CancellationToken token)
|
||||
public async Task<TrajectoryPlanFactDto<IEnumerable<TrajectoryCartesianPlanDto>, IEnumerable<TrajectoryCartesianFactDto>>> GetTrajectoryCartesianAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var result = new PlanFactBase<IEnumerable<TrajectoryCartesianPlanDto>, IEnumerable<TrajectoryCartesianFactDto>, IEnumerable<TrajectoryCartesianFactDto>>();
|
||||
var result = new TrajectoryPlanFactDto<IEnumerable<TrajectoryCartesianPlanDto>, IEnumerable<TrajectoryCartesianFactDto>>();
|
||||
|
||||
result.Plan = await trajectoryPlanService.GetAsync(idWell, token);
|
||||
result.Fact = await trajectoryFactService.GetAsync(idWell, token);
|
||||
result.Nnb = await trajectoryNnbService.GetAsync(idWell, token);
|
||||
result.FactManual = await trajectoryFactService.GetAsync(idWell, token);
|
||||
result.FactNnb = await trajectoryNnbService.GetAsync(idWell, token);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -8,6 +8,16 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Services\Trajectory\PlannedTrajectoryTemplate.xlsx" />
|
||||
<None Remove="Services\Trajectory\Templates\TrajectoryFactManualTemplate.xlsx" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Services\Trajectory\Templates\TrajectoryFactManualTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\Trajectory\Templates\TrajectoryPlannedTemplate.xlsx" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.8" />
|
||||
|
Binary file not shown.
Binary file not shown.
128
AsbCloudWebApi.Tests/Services/Trajectory/TrajectoryExportTest.cs
Normal file
128
AsbCloudWebApi.Tests/Services/Trajectory/TrajectoryExportTest.cs
Normal file
@ -0,0 +1,128 @@
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Export;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace AsbCloudWebApi.Tests.Services.Trajectory
|
||||
{
|
||||
public class TrajectoryExportTest
|
||||
{
|
||||
private IWellService wellService;
|
||||
private readonly ITrajectoryEditableRepository<TrajectoryGeoPlanDto> trajectoryPlannedRepository;
|
||||
private readonly TrajectoryPlannedExportService trajectoryPlannedExportService;
|
||||
|
||||
private readonly ITrajectoryEditableRepository<TrajectoryGeoFactDto> trajectoryFactManualReposirory;
|
||||
private readonly TrajectoryFactManualExportService trajectoryFactManualExportService;
|
||||
|
||||
private readonly ITrajectoryNnbRepository trajectoryFactNnbRepository;
|
||||
private readonly TrajectoryFactNnbExportService trajectoryFactNnbExportService;
|
||||
|
||||
private readonly int idWell = 4;
|
||||
|
||||
private readonly TrajectoryGeoPlanDto[] trajectoryPlannedRows = new TrajectoryGeoPlanDto[2] {
|
||||
new TrajectoryGeoPlanDto() {
|
||||
Id = 1,
|
||||
AzimuthGeo = 1,
|
||||
AzimuthMagnetic = 2,
|
||||
Comment = "комментарий",
|
||||
IdUser = 1,
|
||||
IdWell = 4,
|
||||
Radius = 3,
|
||||
UpdateDate = DateTime.Now,
|
||||
VerticalDepth = 100,
|
||||
WellboreDepth = 100,
|
||||
ZenithAngle = 10
|
||||
},
|
||||
new TrajectoryGeoPlanDto() {
|
||||
Id = 2,
|
||||
AzimuthGeo = 1,
|
||||
AzimuthMagnetic = 2,
|
||||
Comment = "комментарий",
|
||||
IdUser = 1,
|
||||
IdWell = 4,
|
||||
Radius = 3,
|
||||
UpdateDate = DateTime.Now,
|
||||
VerticalDepth = 100,
|
||||
WellboreDepth = 100,
|
||||
ZenithAngle = 10
|
||||
},
|
||||
};
|
||||
|
||||
private readonly TrajectoryGeoFactDto[] trajectoryFactRows = new TrajectoryGeoFactDto[2] {
|
||||
new TrajectoryGeoFactDto() {
|
||||
Id = 1,
|
||||
AzimuthGeo = 1,
|
||||
AzimuthMagnetic = 2,
|
||||
Comment = "комментарий",
|
||||
IdUser = 1,
|
||||
IdWell = 4,
|
||||
UpdateDate = DateTime.Now,
|
||||
VerticalDepth = 100,
|
||||
WellboreDepth = 100,
|
||||
ZenithAngle = 10
|
||||
},
|
||||
new TrajectoryGeoFactDto() {
|
||||
Id = 2,
|
||||
AzimuthGeo = 1,
|
||||
AzimuthMagnetic = 2,
|
||||
Comment = "комментарий",
|
||||
IdUser = 1,
|
||||
IdWell = 4,
|
||||
UpdateDate = DateTime.Now,
|
||||
VerticalDepth = 100,
|
||||
WellboreDepth = 100,
|
||||
ZenithAngle = 10
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
public TrajectoryExportTest()
|
||||
{
|
||||
wellService = Substitute.For<IWellService>();
|
||||
trajectoryPlannedRepository = Substitute.For<ITrajectoryEditableRepository<TrajectoryGeoPlanDto>>();
|
||||
trajectoryPlannedExportService = new TrajectoryPlannedExportService(wellService, trajectoryPlannedRepository);
|
||||
|
||||
trajectoryFactManualReposirory = Substitute.For<ITrajectoryEditableRepository<TrajectoryGeoFactDto>>();
|
||||
trajectoryFactManualExportService = new TrajectoryFactManualExportService(wellService, trajectoryFactManualReposirory);
|
||||
|
||||
trajectoryFactNnbRepository = Substitute.For<ITrajectoryNnbRepository>();
|
||||
trajectoryFactNnbExportService = new TrajectoryFactNnbExportService(wellService, trajectoryFactNnbRepository);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Export_trajectory_planned()
|
||||
{
|
||||
trajectoryPlannedRepository.GetAsync(idWell, CancellationToken.None)
|
||||
.Returns(trajectoryPlannedRows);
|
||||
|
||||
var stream = await trajectoryPlannedExportService.ExportAsync(idWell, CancellationToken.None);
|
||||
Assert.True(stream.Length > 0);
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Export_trajectory_fact_manual()
|
||||
{
|
||||
trajectoryFactManualReposirory.GetAsync(idWell, CancellationToken.None)
|
||||
.Returns(trajectoryFactRows);
|
||||
|
||||
var stream = await trajectoryFactManualExportService.ExportAsync(idWell, CancellationToken.None);
|
||||
Assert.True(stream.Length > 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Export_trajectory_fact_nnb()
|
||||
{
|
||||
trajectoryFactNnbRepository.GetAsync(idWell, CancellationToken.None)
|
||||
.Returns(trajectoryFactRows);
|
||||
|
||||
var stream = await trajectoryFactNnbExportService.ExportAsync(idWell, CancellationToken.None);
|
||||
Assert.True(stream.Length > 0);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services.Trajectory;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Import;
|
||||
using NSubstitute;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace AsbCloudWebApi.Tests.Services.Trajectory
|
||||
{
|
||||
public class TrajectoryImportTest
|
||||
{
|
||||
private readonly TrajectoryPlannedImportService trajectoryPlannedImportService;
|
||||
private readonly TrajectoryFactManualImportService trajectoryFactManualImportService;
|
||||
|
||||
private string usingTemplateFile = "AsbCloudWebApi.Tests.Services.Trajectory.Templates";
|
||||
|
||||
public TrajectoryImportTest()
|
||||
{
|
||||
trajectoryPlannedImportService = new TrajectoryPlannedImportService();
|
||||
trajectoryFactManualImportService = new TrajectoryFactManualImportService();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Import_trajectory_planned()
|
||||
{
|
||||
var stream = System.Reflection.Assembly.GetExecutingAssembly()
|
||||
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryPlannedTemplate.xlsx");
|
||||
|
||||
if (stream is null)
|
||||
Assert.Fail("Файла для импорта не существует");
|
||||
|
||||
var trajectoryRows = await trajectoryPlannedImportService.ImportAsync(stream, CancellationToken.None);
|
||||
|
||||
Assert.Equal(3, trajectoryRows.Count());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Import_trajectory_fact_manual()
|
||||
{
|
||||
var stream = System.Reflection.Assembly.GetExecutingAssembly()
|
||||
.GetManifestResourceStream($"{usingTemplateFile}.TrajectoryFactManualTemplate.xlsx");
|
||||
|
||||
if (stream is null)
|
||||
Assert.Fail("Файла для импорта не существует");
|
||||
|
||||
var trajectoryRows = await trajectoryFactManualImportService.ImportAsync(stream, CancellationToken.None);
|
||||
|
||||
Assert.Equal(4, trajectoryRows.Count());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudInfrastructure.Services.Trajectory;
|
||||
using Moq;
|
||||
@ -50,7 +50,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
var service = new TrajectoryService(mockPlan.Object, mockFact.Object, mockNnb.Object);
|
||||
var result = await service.GetTrajectoryCartesianAsync(1, CancellationToken.None);
|
||||
Assert.Equal(plannedTrajectory.Length, result.Plan?.Count());
|
||||
Assert.Equal(actualTrajectory.Length, result.Fact?.Count());
|
||||
Assert.Equal(actualTrajectory.Length, result.FactManual?.Count());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -82,7 +82,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
var service = new TrajectoryService(mockPlan.Object, mockFact.Object, mockNnb.Object);
|
||||
var result = await service.GetTrajectoryCartesianAsync(1, CancellationToken.None);
|
||||
var lastPointPlan = result.Plan!.Last();
|
||||
var lastPointFact = result.Fact!.Last();
|
||||
var lastPointFact = result.FactManual!.Last();
|
||||
|
||||
Assert.Equal(0d, lastPointPlan.X, 0.1d);
|
||||
Assert.Equal(-50d, lastPointPlan.Y, 0.1d);
|
||||
@ -116,7 +116,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
var service = new TrajectoryService(mockPlanned.Object, mockFactual.Object, mockNnb.Object);
|
||||
var result = await service.GetTrajectoryCartesianAsync(1, CancellationToken.None);
|
||||
var lastPointPlan = result.Plan!.Last();
|
||||
var lastPointFact = result.Fact!.Last();
|
||||
var lastPointFact = result.FactManual!.Last();
|
||||
var tolerancePlan = 0.001d;
|
||||
var toleranceFact = 0.001d;
|
||||
|
||||
|
@ -1,80 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services;
|
||||
using AsbCloudInfrastructure.Services.Trajectory;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers.Trajectory;
|
||||
|
||||
/// <summary>
|
||||
/// Фактическая траектория из ННБ
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/well/{idWell}/[controller]")]
|
||||
public class NnbTrajectoryController : ControllerBase
|
||||
{
|
||||
private readonly ITrajectoryNnbRepository trajectoryNnbRepository;
|
||||
private readonly NnbTrajectoryImportService factNnbTrajectoryImportService;
|
||||
private readonly IWellService wellService;
|
||||
|
||||
public NnbTrajectoryController(
|
||||
ITrajectoryNnbRepository trajectoryNnbRepository,
|
||||
NnbTrajectoryImportService factNnbTrajectoryImportService,
|
||||
IWellService wellService)
|
||||
{
|
||||
this.trajectoryNnbRepository = trajectoryNnbRepository;
|
||||
this.factNnbTrajectoryImportService = factNnbTrajectoryImportService;
|
||||
this.wellService = wellService;
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод получения всех строк фактических траекторий по id скважины из ННБ
|
||||
/// </summary>
|
||||
/// <param name="idWell">Id скважины</param>
|
||||
/// <param name="cancellationToken">Токен отмены операции</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<TrajectoryGeoFactDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetRowsAsync([FromRoute] int idWell,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var nnbFactTrajectories = await trajectoryNnbRepository.GetAsync(idWell,
|
||||
cancellationToken);
|
||||
|
||||
return Ok(nnbFactTrajectories);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Формируем excel файл с текущими строками фактической ннб-траектории
|
||||
/// </summary>
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet("export")]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public async Task<IActionResult> ExportAsync([FromRoute] int idWell, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
var stream = await factNnbTrajectoryImportService.ExportAsync(idWell, token);
|
||||
var fileName = await factNnbTrajectoryImportService.GetFileNameAsync(idWell, token);
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
}
|
||||
|
||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
||||
idWell, token).ConfigureAwait(false);
|
||||
}
|
||||
}
|
@ -1,12 +1,10 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services.Trajectory;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Export;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -21,35 +19,21 @@ namespace AsbCloudWebApi.Controllers.Trajectory
|
||||
public abstract class TrajectoryController<Tdto> : ControllerBase
|
||||
where Tdto : TrajectoryGeoDto
|
||||
{
|
||||
protected string fileName;
|
||||
protected abstract string fileName { get; set; }
|
||||
|
||||
private readonly IWellService wellService;
|
||||
private readonly TrajectoryImportService<Tdto> trajectoryImportService;
|
||||
private readonly ITrajectoryEditableRepository<Tdto> trajectoryRepository;
|
||||
private readonly TrajectoryExportService<Tdto> trajectoryExportService;
|
||||
private readonly ITrajectoryRepository<Tdto> trajectoryRepository;
|
||||
|
||||
public TrajectoryController(IWellService wellService,
|
||||
TrajectoryImportService<Tdto> trajectoryImportService,
|
||||
ITrajectoryEditableRepository<Tdto> trajectoryRepository)
|
||||
TrajectoryExportService<Tdto> trajectoryExportService,
|
||||
ITrajectoryRepository<Tdto> trajectoryRepository)
|
||||
{
|
||||
this.trajectoryImportService = trajectoryImportService;
|
||||
this.trajectoryExportService = trajectoryExportService;
|
||||
this.wellService = wellService;
|
||||
this.trajectoryRepository = trajectoryRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает excel шаблон для заполнения строк траектории
|
||||
/// </summary>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet("template")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public IActionResult GetTemplate()
|
||||
{
|
||||
var stream = trajectoryImportService.GetTemplateFile();
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Формируем excel файл с текущими строками траектории
|
||||
/// </summary>
|
||||
@ -64,57 +48,11 @@ namespace AsbCloudWebApi.Controllers.Trajectory
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
var stream = await trajectoryImportService.ExportAsync(idWell, token);
|
||||
var fileName = await trajectoryImportService.GetFileNameAsync(idWell, token);
|
||||
var stream = await trajectoryExportService.ExportAsync(idWell, token);
|
||||
var fileName = await trajectoryExportService.GetFileNameAsync(idWell, token);
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Импортирует координаты из excel (xlsx) файла
|
||||
/// </summary>
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="files">Коллекция из одного файла xlsx</param>
|
||||
/// <param name="deleteBeforeImport">Удалить операции перед импортом, если фал валидный</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>количество успешно записанных строк в БД</returns>
|
||||
[HttpPost("import/{deleteBeforeImport}")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), (int)System.Net.HttpStatusCode.BadRequest)]
|
||||
public async Task<IActionResult> ImportAsync(int idWell,
|
||||
[FromForm] IFormFileCollection files,
|
||||
bool deleteBeforeImport,
|
||||
CancellationToken token)
|
||||
{
|
||||
int? idUser = User.GetUserId();
|
||||
if (!idUser.HasValue)
|
||||
return Forbid();
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
if (files.Count < 1)
|
||||
return this.ValidationBadRequest(nameof(files), "нет файла");
|
||||
var file = files[0];
|
||||
if (Path.GetExtension(file.FileName).ToLower() != ".xlsx")
|
||||
return this.ValidationBadRequest(nameof(files), "Требуется xlsx файл.");
|
||||
using Stream stream = file.OpenReadStream();
|
||||
|
||||
try
|
||||
{
|
||||
var trajectoryRows = await trajectoryImportService.ImportAsync(idWell, idUser.Value, stream, token);
|
||||
|
||||
if (deleteBeforeImport)
|
||||
await trajectoryRepository.DeleteByIdWellAsync(idWell, token);
|
||||
|
||||
var rowsCount = await trajectoryRepository.AddRangeAsync(trajectoryRows, token);
|
||||
|
||||
return Ok(rowsCount);
|
||||
}
|
||||
catch (FileFormatException ex)
|
||||
{
|
||||
return this.ValidationBadRequest(nameof(files), ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получаем список всех строк координат траектории (для клиента)
|
||||
/// </summary>
|
||||
@ -123,7 +61,7 @@ namespace AsbCloudWebApi.Controllers.Trajectory
|
||||
/// <returns>Список добавленных координат траектории</returns>
|
||||
[HttpGet]
|
||||
//[ProducesResponseType(typeof(IEnumerable<Tdto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public virtual async Task<IActionResult> GetAsync([FromRoute] int idWell, CancellationToken token)
|
||||
public async Task<IActionResult> GetAsync([FromRoute] int idWell, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
token).ConfigureAwait(false))
|
||||
@ -132,100 +70,6 @@ namespace AsbCloudWebApi.Controllers.Trajectory
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавить одну новую строчку координат для плановой траектории
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns>количество успешно записанных строк в БД</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> AddAsync(int idWell, [FromBody] Tdto row,
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
var idUser = User.GetUserId();
|
||||
if (!idUser.HasValue)
|
||||
return Forbid();
|
||||
row.IdUser = idUser.Value;
|
||||
row.IdWell = idWell;
|
||||
var result = await trajectoryRepository.AddAsync(row, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавить массив строчек координат для плановой траектории
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="rows"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns>количество успешно записанных строк в БД</returns>
|
||||
[HttpPost("range")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> AddRangeAsync(int idWell, [FromBody] IEnumerable<Tdto> rows,
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
int? idUser = User.GetUserId();
|
||||
if (!idUser.HasValue)
|
||||
return Forbid();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
item.IdUser = idUser.Value;
|
||||
item.IdWell = idWell;
|
||||
}
|
||||
var result = await trajectoryRepository.AddRangeAsync(rows, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Изменить выбранную строку с координатами
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="idRow"></param>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns>количество успешно обновленных строк в БД</returns>
|
||||
[HttpPut("{idRow}")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateAsync(int idWell, int idRow,
|
||||
[FromBody] Tdto row, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
int? idUser = User.GetUserId();
|
||||
if (!idUser.HasValue)
|
||||
return Forbid();
|
||||
row.Id = idRow;
|
||||
row.IdUser = idUser.Value;
|
||||
row.IdWell = idWell;
|
||||
var result = await trajectoryRepository.UpdateAsync(row, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удалить выбранную строку с координатами
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="idRow"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns>количество успешно удаленных строк из БД</returns>
|
||||
[HttpDelete("{idRow}")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteAsync(int idWell, int idRow, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
var result = await trajectoryRepository.DeleteRangeAsync(new int[] { idRow }, token);
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
protected async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
int? idCompany = User.GetCompanyId();
|
||||
|
@ -0,0 +1,206 @@
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Export;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Import;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers.Trajectory
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Плановые и фактические траектории (загрузка и хранение)
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public abstract class TrajectoryEditableController<Tdto> : TrajectoryController<Tdto>
|
||||
where Tdto : TrajectoryGeoDto
|
||||
{
|
||||
protected override string fileName { get; set; }
|
||||
|
||||
private readonly TrajectoryImportService<Tdto> trajectoryImportService;
|
||||
private readonly TrajectoryExportService<Tdto> trajectoryExportService;
|
||||
private readonly ITrajectoryEditableRepository<Tdto> trajectoryRepository;
|
||||
|
||||
public TrajectoryEditableController(IWellService wellService,
|
||||
TrajectoryImportService<Tdto> trajectoryImportService,
|
||||
TrajectoryExportService<Tdto> trajectoryExportService,
|
||||
ITrajectoryEditableRepository<Tdto> trajectoryRepository)
|
||||
: base(
|
||||
wellService,
|
||||
trajectoryExportService,
|
||||
trajectoryRepository)
|
||||
{
|
||||
this.trajectoryImportService = trajectoryImportService;
|
||||
this.trajectoryExportService = trajectoryExportService;
|
||||
this.trajectoryRepository = trajectoryRepository;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает excel шаблон для заполнения строк траектории
|
||||
/// </summary>
|
||||
/// <returns>Запрашиваемый файл</returns>
|
||||
[HttpGet("template")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
public IActionResult GetTemplate()
|
||||
{
|
||||
var stream = trajectoryExportService.GetTemplateFile();
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Импортирует координаты из excel (xlsx) файла
|
||||
/// </summary>
|
||||
/// <param name="idWell">id скважины</param>
|
||||
/// <param name="files">Коллекция из одного файла xlsx</param>
|
||||
/// <param name="deleteBeforeImport">Удалить операции перед импортом, если фал валидный</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns>количество успешно записанных строк в БД</returns>
|
||||
[HttpPost("import/{deleteBeforeImport}")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), (int)System.Net.HttpStatusCode.BadRequest)]
|
||||
public async Task<IActionResult> ImportAsync(int idWell,
|
||||
[FromForm] IFormFileCollection files,
|
||||
bool deleteBeforeImport,
|
||||
CancellationToken token)
|
||||
{
|
||||
int? idUser = User.GetUserId();
|
||||
if (!idUser.HasValue)
|
||||
return Forbid();
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
if (files.Count < 1)
|
||||
return this.ValidationBadRequest(nameof(files), "нет файла");
|
||||
var file = files[0];
|
||||
if (Path.GetExtension(file.FileName).ToLower() != ".xlsx")
|
||||
return this.ValidationBadRequest(nameof(files), "Требуется xlsx файл.");
|
||||
using Stream stream = file.OpenReadStream();
|
||||
|
||||
try
|
||||
{
|
||||
var trajectoryRows = await trajectoryImportService.ImportAsync(stream, token);
|
||||
foreach (var row in trajectoryRows)
|
||||
{
|
||||
row.IdWell = idWell;
|
||||
row.IdUser = idUser.Value;
|
||||
}
|
||||
|
||||
if (deleteBeforeImport)
|
||||
await trajectoryRepository.DeleteByIdWellAsync(idWell, token);
|
||||
|
||||
var rowsCount = await trajectoryRepository.AddRangeAsync(trajectoryRows, token);
|
||||
|
||||
return Ok(rowsCount);
|
||||
}
|
||||
catch (FileFormatException ex)
|
||||
{
|
||||
return this.ValidationBadRequest(nameof(files), ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Добавить одну новую строчку координат для плановой траектории
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns>количество успешно записанных строк в БД</returns>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> AddAsync(int idWell, [FromBody] Tdto row,
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
var idUser = User.GetUserId();
|
||||
if (!idUser.HasValue)
|
||||
return Forbid();
|
||||
row.IdUser = idUser.Value;
|
||||
row.IdWell = idWell;
|
||||
var result = await trajectoryRepository.AddAsync(row, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавить массив строчек координат для плановой траектории
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="rows"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns>количество успешно записанных строк в БД</returns>
|
||||
[HttpPost("range")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> AddRangeAsync(int idWell, [FromBody] IEnumerable<Tdto> rows,
|
||||
CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
int? idUser = User.GetUserId();
|
||||
if (!idUser.HasValue)
|
||||
return Forbid();
|
||||
foreach (var item in rows)
|
||||
{
|
||||
item.IdUser = idUser.Value;
|
||||
item.IdWell = idWell;
|
||||
}
|
||||
var result = await trajectoryRepository.AddRangeAsync(rows, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Изменить выбранную строку с координатами
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="idRow"></param>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns>количество успешно обновленных строк в БД</returns>
|
||||
[HttpPut("{idRow}")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateAsync(int idWell, int idRow,
|
||||
[FromBody] Tdto row, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
int? idUser = User.GetUserId();
|
||||
if (!idUser.HasValue)
|
||||
return Forbid();
|
||||
row.Id = idRow;
|
||||
row.IdUser = idUser.Value;
|
||||
row.IdWell = idWell;
|
||||
var result = await trajectoryRepository.UpdateAsync(row, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удалить выбранную строку с координатами
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="idRow"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns>количество успешно удаленных строк из БД</returns>
|
||||
[HttpDelete("{idRow}")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DeleteAsync(int idWell, int idRow, CancellationToken token)
|
||||
{
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
var result = await trajectoryRepository.DeleteRangeAsync(new int[] { idRow }, token);
|
||||
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services.Trajectory;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Export;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Import;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers.Trajectory;
|
||||
@ -11,14 +12,17 @@ namespace AsbCloudWebApi.Controllers.Trajectory;
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/well/{idWell}/[controller]")]
|
||||
public class FactTrajectoryController : TrajectoryController<TrajectoryGeoFactDto>
|
||||
public class TrajectoryFactManualController : TrajectoryEditableController<TrajectoryGeoFactDto>
|
||||
{
|
||||
public FactTrajectoryController(IWellService wellService,
|
||||
FactTrajectoryImportService factTrajectoryImportService,
|
||||
protected override string fileName { get; set; }
|
||||
public TrajectoryFactManualController(IWellService wellService,
|
||||
TrajectoryFactManualImportService factTrajectoryImportService,
|
||||
TrajectoryFactManualExportService factTrajectoryExportService,
|
||||
ITrajectoryEditableRepository<TrajectoryGeoFactDto> trajectoryFactRepository)
|
||||
: base(
|
||||
wellService,
|
||||
factTrajectoryImportService,
|
||||
factTrajectoryExportService,
|
||||
trajectoryFactRepository)
|
||||
{
|
||||
fileName = "ЕЦП_шаблон_файла_фактическая_траектория.xlsx";
|
@ -0,0 +1,30 @@
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Export;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers.Trajectory;
|
||||
|
||||
/// <summary>
|
||||
/// Фактическая траектория из ННБ
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/well/{idWell}/[controller]")]
|
||||
public class TrajectoryFactNnbController : TrajectoryController<TrajectoryGeoFactDto>
|
||||
{
|
||||
protected override string fileName { get; set; }
|
||||
public TrajectoryFactNnbController(
|
||||
ITrajectoryNnbRepository trajectoryNnbRepository,
|
||||
TrajectoryFactNnbExportService trajectoryExportService,
|
||||
IWellService wellService)
|
||||
: base(
|
||||
wellService,
|
||||
trajectoryExportService,
|
||||
trajectoryNnbRepository)
|
||||
{
|
||||
fileName = "ЕЦП_шаблон_файла_фактическая_ннб_траектория.xlsx";
|
||||
}
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.Trajectory;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services.Trajectory;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Import;
|
||||
using AsbCloudInfrastructure.Services.Trajectory.Export;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
@ -15,17 +17,19 @@ namespace AsbCloudWebApi.Controllers.Trajectory
|
||||
/// </summary>
|
||||
[Route("api/well/{idWell}/plannedTrajectory")]
|
||||
[ApiController]
|
||||
public class PlannedTrajectoryController : TrajectoryController<TrajectoryGeoPlanDto>
|
||||
public class TrajectoryPlannedController : TrajectoryEditableController<TrajectoryGeoPlanDto>
|
||||
{
|
||||
private readonly TrajectoryService trajectoryVisualizationService;
|
||||
|
||||
public PlannedTrajectoryController(IWellService wellService,
|
||||
PlannedTrajectoryImportService plannedTrajectoryImportService,
|
||||
public TrajectoryPlannedController(IWellService wellService,
|
||||
TrajectoryPlannedImportService plannedTrajectoryImportService,
|
||||
TrajectoryPlannedExportService plannedTrajectoryExportService,
|
||||
ITrajectoryEditableRepository<TrajectoryGeoPlanDto> plannedTrajectoryRepository,
|
||||
TrajectoryService trajectoryVisualizationService)
|
||||
: base(
|
||||
wellService,
|
||||
plannedTrajectoryImportService,
|
||||
plannedTrajectoryExportService,
|
||||
plannedTrajectoryRepository)
|
||||
{
|
||||
fileName = "ЕЦП_шаблон_файла_плановая_траектория.xlsx";
|
||||
@ -39,10 +43,10 @@ namespace AsbCloudWebApi.Controllers.Trajectory
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("trajectoryCartesianPlanFact")]
|
||||
[ProducesResponseType(typeof(PlanFactBase<IEnumerable<TrajectoryCartesianPlanDto>, IEnumerable<TrajectoryCartesianFactDto>, IEnumerable<TrajectoryCartesianFactDto>>), (int)System.Net.HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(TrajectoryPlanFactDto<IEnumerable<TrajectoryCartesianPlanDto>, IEnumerable<TrajectoryCartesianFactDto>>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetTrajectoryCartesianPlanFactAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
if (!await base.CanUserAccessToWellAsync(idWell,
|
||||
if (!await CanUserAccessToWellAsync(idWell,
|
||||
token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
Loading…
Reference in New Issue
Block a user