diff --git a/AsbCloudApp/Data/PlanFactDto.cs b/AsbCloudApp/Data/PlanFactDto.cs
index 02765309..74c0281b 100644
--- a/AsbCloudApp/Data/PlanFactDto.cs
+++ b/AsbCloudApp/Data/PlanFactDto.cs
@@ -4,7 +4,7 @@
/// DTO объединяющее плановые и фактические значения
///
///
- public class PlanFactDto : PlanFactBase
+ public class PlanFactDto : PlanFactBase
{
}
@@ -15,7 +15,7 @@
///
///
///
- public class PlanFactBase
+ public class PlanFactBase
{
///
/// Плановое значение
@@ -26,10 +26,5 @@
/// Фактическое значение
///
public V? Fact { get; set; }
-
- ///
- /// Фактическое ннб-значение
- ///
- public V? Nnb { get; set; }
}
}
diff --git a/AsbCloudApp/Data/TrajectoryCartesianFactDto.cs b/AsbCloudApp/Data/Trajectory/TrajectoryCartesianFactDto.cs
similarity index 95%
rename from AsbCloudApp/Data/TrajectoryCartesianFactDto.cs
rename to AsbCloudApp/Data/Trajectory/TrajectoryCartesianFactDto.cs
index 64f3291b..c9df8dfd 100644
--- a/AsbCloudApp/Data/TrajectoryCartesianFactDto.cs
+++ b/AsbCloudApp/Data/Trajectory/TrajectoryCartesianFactDto.cs
@@ -1,4 +1,4 @@
-namespace AsbCloudApp.Data
+namespace AsbCloudApp.Data.Trajectory
{
diff --git a/AsbCloudApp/Data/TrajectoryCartesianPlanDto.cs b/AsbCloudApp/Data/Trajectory/TrajectoryCartesianPlanDto.cs
similarity index 83%
rename from AsbCloudApp/Data/TrajectoryCartesianPlanDto.cs
rename to AsbCloudApp/Data/Trajectory/TrajectoryCartesianPlanDto.cs
index ed7755df..923498eb 100644
--- a/AsbCloudApp/Data/TrajectoryCartesianPlanDto.cs
+++ b/AsbCloudApp/Data/Trajectory/TrajectoryCartesianPlanDto.cs
@@ -1,7 +1,7 @@
-namespace AsbCloudApp.Data
+namespace AsbCloudApp.Data.Trajectory
{
///
- /// Визуализация траектории 3D для посторения радиуса цели
+ /// Визуализация траектории 3D для построения радиуса цели
///
public class TrajectoryCartesianPlanDto : TrajectoryCartesianFactDto
{
diff --git a/AsbCloudApp/Data/TrajectoryGeoDto.cs b/AsbCloudApp/Data/Trajectory/TrajectoryGeoDto.cs
similarity index 91%
rename from AsbCloudApp/Data/TrajectoryGeoDto.cs
rename to AsbCloudApp/Data/Trajectory/TrajectoryGeoDto.cs
index 3f36aad6..47563011 100644
--- a/AsbCloudApp/Data/TrajectoryGeoDto.cs
+++ b/AsbCloudApp/Data/Trajectory/TrajectoryGeoDto.cs
@@ -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
{
///
/// Базовая географическая траектория
diff --git a/AsbCloudApp/Data/TrajectoryGeoFactDto.cs b/AsbCloudApp/Data/Trajectory/TrajectoryGeoFactDto.cs
similarity index 67%
rename from AsbCloudApp/Data/TrajectoryGeoFactDto.cs
rename to AsbCloudApp/Data/Trajectory/TrajectoryGeoFactDto.cs
index a78811e4..8ab23fc6 100644
--- a/AsbCloudApp/Data/TrajectoryGeoFactDto.cs
+++ b/AsbCloudApp/Data/Trajectory/TrajectoryGeoFactDto.cs
@@ -1,17 +1,10 @@
-using System;
-
-namespace AsbCloudApp.Data;
+namespace AsbCloudApp.Data.Trajectory;
///
/// Формирование данных по фактической географической траектории
///
public class TrajectoryGeoFactDto : TrajectoryGeoDto
{
- ///
- /// Радиус цели
- ///
- public double? Radius { get; set; }
-
///
/// Комментарии
///
diff --git a/AsbCloudApp/Data/TrajectoryGeoPlanDto.cs b/AsbCloudApp/Data/Trajectory/TrajectoryGeoPlanDto.cs
similarity index 82%
rename from AsbCloudApp/Data/TrajectoryGeoPlanDto.cs
rename to AsbCloudApp/Data/Trajectory/TrajectoryGeoPlanDto.cs
index ba9ffb86..292add96 100644
--- a/AsbCloudApp/Data/TrajectoryGeoPlanDto.cs
+++ b/AsbCloudApp/Data/Trajectory/TrajectoryGeoPlanDto.cs
@@ -1,10 +1,11 @@
using System;
-namespace AsbCloudApp.Data
+
+namespace AsbCloudApp.Data.Trajectory
{
///
/// Формирование данных по плановой географической траектории
///
- public class TrajectoryGeoPlanDto: TrajectoryGeoDto
+ public class TrajectoryGeoPlanDto : TrajectoryGeoDto
{
///
/// Радиус цели
diff --git a/AsbCloudApp/Data/Trajectory/TrajectoryPlanFactDto.cs b/AsbCloudApp/Data/Trajectory/TrajectoryPlanFactDto.cs
new file mode 100644
index 00000000..7176f36f
--- /dev/null
+++ b/AsbCloudApp/Data/Trajectory/TrajectoryPlanFactDto.cs
@@ -0,0 +1,25 @@
+namespace AsbCloudApp.Data.Trajectory
+{
+ ///
+ /// DTO объединяющее плановые и фактические значения траекторий
+ ///
+ ///
+ ///
+ public class TrajectoryPlanFactDto
+ {
+ ///
+ /// Плановое значение
+ ///
+ public T? Plan { get; set; }
+
+ ///
+ /// Фактическое значение
+ ///
+ public V? FactManual { get; set; }
+
+ ///
+ /// Фактическое ннб-значение
+ ///
+ public V? FactNnb { get; set; }
+ }
+}
diff --git a/AsbCloudApp/Repositories/ITrajectoryEditableRepository.cs b/AsbCloudApp/Repositories/ITrajectoryEditableRepository.cs
index 58738f83..f1bf0671 100644
--- a/AsbCloudApp/Repositories/ITrajectoryEditableRepository.cs
+++ b/AsbCloudApp/Repositories/ITrajectoryEditableRepository.cs
@@ -1,4 +1,4 @@
-using AsbCloudApp.Data;
+using AsbCloudApp.Data.Trajectory;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
diff --git a/AsbCloudApp/Repositories/ITrajectoryNnbRepository.cs b/AsbCloudApp/Repositories/ITrajectoryNnbRepository.cs
index 65a3efcc..6f383fea 100644
--- a/AsbCloudApp/Repositories/ITrajectoryNnbRepository.cs
+++ b/AsbCloudApp/Repositories/ITrajectoryNnbRepository.cs
@@ -1,4 +1,4 @@
-using AsbCloudApp.Data;
+using AsbCloudApp.Data.Trajectory;
namespace AsbCloudApp.Repositories
{
diff --git a/AsbCloudApp/Repositories/ITrajectoryRepository.cs b/AsbCloudApp/Repositories/ITrajectoryRepository.cs
index 4202bd0a..ee5df79d 100644
--- a/AsbCloudApp/Repositories/ITrajectoryRepository.cs
+++ b/AsbCloudApp/Repositories/ITrajectoryRepository.cs
@@ -1,4 +1,4 @@
-using AsbCloudApp.Data;
+using AsbCloudApp.Data.Trajectory;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
diff --git a/AsbCloudDb/Migrations/20231115102303_Add_Permissions_For_Trajectory_Fact.cs b/AsbCloudDb/Migrations/20231115102303_Add_Permissions_For_Trajectory_Fact.cs
index 27d98155..c3e87ce6 100644
--- a/AsbCloudDb/Migrations/20231115102303_Add_Permissions_For_Trajectory_Fact.cs
+++ b/AsbCloudDb/Migrations/20231115102303_Add_Permissions_For_Trajectory_Fact.cs
@@ -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);
}
}
}
diff --git a/AsbCloudDb/Migrations/20231115120948_Add_Fact_Trajectory_Table.Designer.cs b/AsbCloudDb/Migrations/20231115120948_Add_Fact_Trajectory_Table.Designer.cs
index 138f115b..ed795ae6 100644
--- a/AsbCloudDb/Migrations/20231115120948_Add_Fact_Trajectory_Table.Designer.cs
+++ b/AsbCloudDb/Migrations/20231115120948_Add_Fact_Trajectory_Table.Designer.cs
@@ -567,7 +567,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
- b.ToTable("t_fact_trajectory");
+ b.ToTable("t_trajectory_fact");
b.HasComment("Загрузка фактической траектории");
});
diff --git a/AsbCloudDb/Migrations/20231115120948_Add_Fact_Trajectory_Table.cs b/AsbCloudDb/Migrations/20231115120948_Add_Fact_Trajectory_Table.cs
index 653c38a5..e61f52c8 100644
--- a/AsbCloudDb/Migrations/20231115120948_Add_Fact_Trajectory_Table.cs
+++ b/AsbCloudDb/Migrations/20231115120948_Add_Fact_Trajectory_Table.cs
@@ -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(type: "integer", nullable: false)
@@ -24,20 +24,19 @@ namespace AsbCloudDb.Migrations
azimuth_geo = table.Column(type: "double precision", nullable: false, comment: "Азимут Географ."),
azimuth_magnetic = table.Column(type: "double precision", nullable: false, comment: "Азимут Магнитный"),
vertical_depth = table.Column(type: "double precision", nullable: false, comment: "Глубина вертикальная"),
- comment = table.Column(type: "text", nullable: true, comment: "Комментарии"),
- radius = table.Column(type: "double precision", nullable: true, comment: "Радиус цели")
+ comment = table.Column(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");
}
}
}
diff --git a/AsbCloudDb/Migrations/20231116094844_Add_Permissions_For_Trajectory_Nnb.cs b/AsbCloudDb/Migrations/20231116094844_Add_Permissions_For_Trajectory_Nnb.cs
deleted file mode 100644
index 506bc8f4..00000000
--- a/AsbCloudDb/Migrations/20231116094844_Add_Permissions_For_Trajectory_Nnb.cs
+++ /dev/null
@@ -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);
- }
- }
-}
diff --git a/AsbCloudDb/Migrations/20231116094844_Add_Permissions_For_Trajectory_Nnb.Designer.cs b/AsbCloudDb/Migrations/20231127114017_Update_t_planned_trajectory.Designer.cs
similarity index 98%
rename from AsbCloudDb/Migrations/20231116094844_Add_Permissions_For_Trajectory_Nnb.Designer.cs
rename to AsbCloudDb/Migrations/20231127114017_Update_t_planned_trajectory.Designer.cs
index ae6055cb..52768caa 100644
--- a/AsbCloudDb/Migrations/20231116094844_Add_Permissions_For_Trajectory_Nnb.Designer.cs
+++ b/AsbCloudDb/Migrations/20231127114017_Update_t_planned_trajectory.Designer.cs
@@ -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("Email")
- .IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("email")
@@ -249,7 +248,6 @@ namespace AsbCloudDb.Migrations
.HasComment("ключ скважины");
b.Property("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("AzimuthGeo")
- .HasColumnType("double precision")
- .HasColumnName("azimuth_geo")
- .HasComment("Азимут Географ.");
-
- b.Property("AzimuthMagnetic")
- .HasColumnType("double precision")
- .HasColumnName("azimuth_magnetic")
- .HasComment("Азимут Магнитный");
-
- b.Property("Comment")
- .HasColumnType("text")
- .HasColumnName("comment")
- .HasComment("Комментарии");
-
- b.Property("IdUser")
- .HasColumnType("integer")
- .HasColumnName("id_user")
- .HasComment("ID пользователя который внес/изменил запись");
-
- b.Property("IdWell")
- .HasColumnType("integer")
- .HasColumnName("id_well")
- .HasComment("ID скважины");
-
- b.Property("Radius")
- .HasColumnType("double precision")
- .HasColumnName("radius")
- .HasComment("Радиус цели");
-
- b.Property("UpdateDate")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("update_date")
- .HasComment("Дата загрузки траектории");
-
- b.Property("VerticalDepth")
- .HasColumnType("double precision")
- .HasColumnName("vertical_depth")
- .HasComment("Глубина вертикальная");
-
- b.Property("WellboreDepth")
- .HasColumnType("double precision")
- .HasColumnName("wellbore_depth")
- .HasComment("Глубина по стволу");
-
- b.Property("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("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("AzimuthGeo")
- .HasColumnType("double precision")
- .HasColumnName("azimuth_geo")
- .HasComment("Азимут Географ.");
-
- b.Property("AzimuthMagnetic")
- .HasColumnType("double precision")
- .HasColumnName("azimuth_magnetic")
- .HasComment("Азимут Магнитный");
-
- b.Property("Comment")
- .HasColumnType("text")
- .HasColumnName("comment")
- .HasComment("Комментарии");
-
- b.Property("IdUser")
- .HasColumnType("integer")
- .HasColumnName("id_user")
- .HasComment("ID пользователя который внес/изменил запись");
-
- b.Property("IdWell")
- .HasColumnType("integer")
- .HasColumnName("id_well")
- .HasComment("ID скважины");
-
- b.Property("Radius")
- .HasColumnType("double precision")
- .HasColumnName("radius")
- .HasComment("Радиус цели");
-
- b.Property("UpdateDate")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("update_date")
- .HasComment("Дата загрузки траектории");
-
- b.Property("VerticalDepth")
- .HasColumnType("double precision")
- .HasColumnName("vertical_depth")
- .HasComment("Глубина вертикальная");
-
- b.Property("WellboreDepth")
- .HasColumnType("double precision")
- .HasColumnName("wellbore_depth")
- .HasComment("Глубина по стволу");
-
- b.Property("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("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("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AzimuthGeo")
+ .HasColumnType("double precision")
+ .HasColumnName("azimuth_geo")
+ .HasComment("Азимут Географ.");
+
+ b.Property("AzimuthMagnetic")
+ .HasColumnType("double precision")
+ .HasColumnName("azimuth_magnetic")
+ .HasComment("Азимут Магнитный");
+
+ b.Property("Comment")
+ .HasColumnType("text")
+ .HasColumnName("comment")
+ .HasComment("Комментарии");
+
+ b.Property("IdUser")
+ .HasColumnType("integer")
+ .HasColumnName("id_user")
+ .HasComment("ID пользователя который внес/изменил запись");
+
+ b.Property("IdWell")
+ .HasColumnType("integer")
+ .HasColumnName("id_well")
+ .HasComment("ID скважины");
+
+ b.Property("UpdateDate")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("update_date")
+ .HasComment("Дата загрузки траектории");
+
+ b.Property("VerticalDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("vertical_depth")
+ .HasComment("Глубина вертикальная");
+
+ b.Property("WellboreDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("wellbore_depth")
+ .HasComment("Глубина по стволу");
+
+ b.Property("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("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AzimuthGeo")
+ .HasColumnType("double precision")
+ .HasColumnName("azimuth_geo")
+ .HasComment("Азимут Географ.");
+
+ b.Property("AzimuthMagnetic")
+ .HasColumnType("double precision")
+ .HasColumnName("azimuth_magnetic")
+ .HasComment("Азимут Магнитный");
+
+ b.Property("Comment")
+ .HasColumnType("text")
+ .HasColumnName("comment")
+ .HasComment("Комментарии");
+
+ b.Property("IdUser")
+ .HasColumnType("integer")
+ .HasColumnName("id_user")
+ .HasComment("ID пользователя который внес/изменил запись");
+
+ b.Property("IdWell")
+ .HasColumnType("integer")
+ .HasColumnName("id_well")
+ .HasComment("ID скважины");
+
+ b.Property("Radius")
+ .HasColumnType("double precision")
+ .HasColumnName("radius")
+ .HasComment("Радиус цели");
+
+ b.Property("UpdateDate")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("update_date")
+ .HasComment("Дата загрузки траектории");
+
+ b.Property("VerticalDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("vertical_depth")
+ .HasComment("Глубина вертикальная");
+
+ b.Property("WellboreDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("wellbore_depth")
+ .HasComment("Глубина по стволу");
+
+ b.Property("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("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")
diff --git a/AsbCloudDb/Migrations/20231127114017_Update_t_planned_trajectory.cs b/AsbCloudDb/Migrations/20231127114017_Update_t_planned_trajectory.cs
new file mode 100644
index 00000000..3175bb9e
--- /dev/null
+++ b/AsbCloudDb/Migrations/20231127114017_Update_t_planned_trajectory.cs
@@ -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);
+ }
+ }
+}
diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs
index 71f6087c..ff169691 100644
--- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs
+++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs
@@ -491,76 +491,6 @@ namespace AsbCloudDb.Migrations
b.HasComment("Drill_test");
});
- modelBuilder.Entity("AsbCloudDb.Model.FactTrajectory", b =>
- {
- b.Property("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("AzimuthGeo")
- .HasColumnType("double precision")
- .HasColumnName("azimuth_geo")
- .HasComment("Азимут Географ.");
-
- b.Property("AzimuthMagnetic")
- .HasColumnType("double precision")
- .HasColumnName("azimuth_magnetic")
- .HasComment("Азимут Магнитный");
-
- b.Property("Comment")
- .HasColumnType("text")
- .HasColumnName("comment")
- .HasComment("Комментарии");
-
- b.Property("IdUser")
- .HasColumnType("integer")
- .HasColumnName("id_user")
- .HasComment("ID пользователя который внес/изменил запись");
-
- b.Property("IdWell")
- .HasColumnType("integer")
- .HasColumnName("id_well")
- .HasComment("ID скважины");
-
- b.Property("Radius")
- .HasColumnType("double precision")
- .HasColumnName("radius")
- .HasComment("Радиус цели");
-
- b.Property("UpdateDate")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("update_date")
- .HasComment("Дата загрузки траектории");
-
- b.Property("VerticalDepth")
- .HasColumnType("double precision")
- .HasColumnName("vertical_depth")
- .HasComment("Глубина вертикальная");
-
- b.Property("WellboreDepth")
- .HasColumnType("double precision")
- .HasColumnName("wellbore_depth")
- .HasComment("Глубина по стволу");
-
- b.Property("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("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("Id")
- .ValueGeneratedOnAdd()
- .HasColumnType("integer")
- .HasColumnName("id");
-
- NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
-
- b.Property("AzimuthGeo")
- .HasColumnType("double precision")
- .HasColumnName("azimuth_geo")
- .HasComment("Азимут Географ.");
-
- b.Property("AzimuthMagnetic")
- .HasColumnType("double precision")
- .HasColumnName("azimuth_magnetic")
- .HasComment("Азимут Магнитный");
-
- b.Property("Comment")
- .HasColumnType("text")
- .HasColumnName("comment")
- .HasComment("Комментарии");
-
- b.Property("IdUser")
- .HasColumnType("integer")
- .HasColumnName("id_user")
- .HasComment("ID пользователя который внес/изменил запись");
-
- b.Property("IdWell")
- .HasColumnType("integer")
- .HasColumnName("id_well")
- .HasComment("ID скважины");
-
- b.Property("Radius")
- .HasColumnType("double precision")
- .HasColumnName("radius")
- .HasComment("Радиус цели");
-
- b.Property("UpdateDate")
- .HasColumnType("timestamp with time zone")
- .HasColumnName("update_date")
- .HasComment("Дата загрузки траектории");
-
- b.Property("VerticalDepth")
- .HasColumnType("double precision")
- .HasColumnName("vertical_depth")
- .HasComment("Глубина вертикальная");
-
- b.Property("WellboreDepth")
- .HasColumnType("double precision")
- .HasColumnName("wellbore_depth")
- .HasComment("Глубина по стволу");
-
- b.Property("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("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("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AzimuthGeo")
+ .HasColumnType("double precision")
+ .HasColumnName("azimuth_geo")
+ .HasComment("Азимут Географ.");
+
+ b.Property("AzimuthMagnetic")
+ .HasColumnType("double precision")
+ .HasColumnName("azimuth_magnetic")
+ .HasComment("Азимут Магнитный");
+
+ b.Property("Comment")
+ .HasColumnType("text")
+ .HasColumnName("comment")
+ .HasComment("Комментарии");
+
+ b.Property("IdUser")
+ .HasColumnType("integer")
+ .HasColumnName("id_user")
+ .HasComment("ID пользователя который внес/изменил запись");
+
+ b.Property("IdWell")
+ .HasColumnType("integer")
+ .HasColumnName("id_well")
+ .HasComment("ID скважины");
+
+ b.Property("UpdateDate")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("update_date")
+ .HasComment("Дата загрузки траектории");
+
+ b.Property("VerticalDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("vertical_depth")
+ .HasComment("Глубина вертикальная");
+
+ b.Property("WellboreDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("wellbore_depth")
+ .HasComment("Глубина по стволу");
+
+ b.Property("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("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AzimuthGeo")
+ .HasColumnType("double precision")
+ .HasColumnName("azimuth_geo")
+ .HasComment("Азимут Географ.");
+
+ b.Property("AzimuthMagnetic")
+ .HasColumnType("double precision")
+ .HasColumnName("azimuth_magnetic")
+ .HasComment("Азимут Магнитный");
+
+ b.Property("Comment")
+ .HasColumnType("text")
+ .HasColumnName("comment")
+ .HasComment("Комментарии");
+
+ b.Property("IdUser")
+ .HasColumnType("integer")
+ .HasColumnName("id_user")
+ .HasComment("ID пользователя который внес/изменил запись");
+
+ b.Property("IdWell")
+ .HasColumnType("integer")
+ .HasColumnName("id_well")
+ .HasComment("ID скважины");
+
+ b.Property("Radius")
+ .HasColumnType("double precision")
+ .HasColumnName("radius")
+ .HasComment("Радиус цели");
+
+ b.Property("UpdateDate")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("update_date")
+ .HasComment("Дата загрузки траектории");
+
+ b.Property("VerticalDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("vertical_depth")
+ .HasComment("Глубина вертикальная");
+
+ b.Property("WellboreDepth")
+ .HasColumnType("double precision")
+ .HasColumnName("wellbore_depth")
+ .HasComment("Глубина по стволу");
+
+ b.Property("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("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")
diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs
index 6b111c96..e6b4b362 100644
--- a/AsbCloudDb/Model/AsbCloudDbContext.cs
+++ b/AsbCloudDb/Model/AsbCloudDbContext.cs
@@ -17,7 +17,7 @@ namespace AsbCloudDb.Model
public virtual DbSet DailyReports => Set ();
public virtual DbSet Deposits => Set();
public virtual DbSet DetectedOperations => Set();
- public virtual DbSet PlannedTrajectories => Set();
+ public virtual DbSet PlannedTrajectories => Set();
public virtual DbSet ProcessMapWellDrillings => Set();
public virtual DbSet ProcessMapWellReams => Set();
public virtual DbSet DrillingProgramParts => Set();
@@ -60,7 +60,7 @@ namespace AsbCloudDb.Model
public virtual DbSet LimitingParameter => Set();
public virtual DbSet TelemetryWirelineRunOut => Set();
- public virtual DbSet FactTrajectories => Set();
+ public virtual DbSet FactTrajectories => Set();
// GTR WITS
public DbSet WitsItemFloat => Set();
diff --git a/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs b/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs
index c21b05c1..4b6bc2c8 100644
--- a/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs
+++ b/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs
@@ -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="Разрешение редактировать фактические траектории"}
};
}
}
diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs
index e985dcbc..f30adffa 100644
--- a/AsbCloudDb/Model/IAsbCloudDbContext.cs
+++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs
@@ -21,7 +21,7 @@ namespace AsbCloudDb.Model
DbSet DailyReports { get; }
DbSet Deposits { get; }
DbSet DetectedOperations { get; }
- DbSet PlannedTrajectories { get; }
+ DbSet PlannedTrajectories { get; }
DbSet ProcessMapWellDrillings { get; }
DbSet ProcessMapWellReams { get; }
DbSet DrillingProgramParts { get; }
@@ -78,7 +78,7 @@ namespace AsbCloudDb.Model
DbSet ManualDirectories { get; }
DbSet Contacts { get; }
DbSet DrillTests { get; }
- DbSet FactTrajectories { get; }
+ DbSet FactTrajectories { get; }
DatabaseFacade Database { get; }
Task RefreshMaterializedViewAsync(string mwName, CancellationToken token);
diff --git a/AsbCloudDb/Model/Trajectory/PlannedTrajectory.cs b/AsbCloudDb/Model/Trajectory/PlannedTrajectory.cs
deleted file mode 100644
index 6f66d977..00000000
--- a/AsbCloudDb/Model/Trajectory/PlannedTrajectory.cs
+++ /dev/null
@@ -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
- {
-
- }
-}
diff --git a/AsbCloudDb/Model/Trajectory/Trajectory.cs b/AsbCloudDb/Model/Trajectory/Trajectory.cs
index 21276e07..7d62ba41 100644
--- a/AsbCloudDb/Model/Trajectory/Trajectory.cs
+++ b/AsbCloudDb/Model/Trajectory/Trajectory.cs
@@ -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!;
diff --git a/AsbCloudDb/Model/Trajectory/FactTrajectory.cs b/AsbCloudDb/Model/Trajectory/TrajectoryFact.cs
similarity index 63%
rename from AsbCloudDb/Model/Trajectory/FactTrajectory.cs
rename to AsbCloudDb/Model/Trajectory/TrajectoryFact.cs
index 793c9fd9..26165da9 100644
--- a/AsbCloudDb/Model/Trajectory/FactTrajectory.cs
+++ b/AsbCloudDb/Model/Trajectory/TrajectoryFact.cs
@@ -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
{
}
}
diff --git a/AsbCloudDb/Model/Trajectory/TrajectoryPlanned.cs b/AsbCloudDb/Model/Trajectory/TrajectoryPlanned.cs
new file mode 100644
index 00000000..20f54025
--- /dev/null
+++ b/AsbCloudDb/Model/Trajectory/TrajectoryPlanned.cs
@@ -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; }
+ }
+}
diff --git a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj
index 500a98cd..3c1998a9 100644
--- a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj
+++ b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj
@@ -17,6 +17,7 @@
+
@@ -35,9 +36,9 @@
-
-
-
+
+
+
diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs
index 167139af..f5e42563 100644
--- a/AsbCloudInfrastructure/DependencyInjection.cs
+++ b/AsbCloudInfrastructure/DependencyInjection.cs
@@ -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();
services.AddTransient();
services.AddTransient();
- //services.AddTransient();
- services.AddTransient();
- services.AddTransient();
- services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
services.AddTransient();
@@ -248,8 +252,8 @@ namespace AsbCloudInfrastructure
services.AddTransient();
services.AddTransient();
services.AddTransient();
- services.AddTransient, TrajectoryEditableRepository>();
- services.AddTransient, TrajectoryEditableRepository>();
+ services.AddTransient, TrajectoryEditableRepository>();
+ services.AddTransient, TrajectoryEditableRepository>();
services.AddTransient();
services.AddTransient();
services.AddTransient();
diff --git a/AsbCloudInfrastructure/Repository/TrajectoryEditableRepository.cs b/AsbCloudInfrastructure/Repository/TrajectoryEditableRepository.cs
index a48312ba..8656039f 100644
--- a/AsbCloudInfrastructure/Repository/TrajectoryEditableRepository.cs
+++ b/AsbCloudInfrastructure/Repository/TrajectoryEditableRepository.cs
@@ -1,4 +1,4 @@
-using AsbCloudApp.Data;
+using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
diff --git a/AsbCloudInfrastructure/Repository/TrajectoryNnbRepository.cs b/AsbCloudInfrastructure/Repository/TrajectoryNnbRepository.cs
index 57095d4e..b131fa19 100644
--- a/AsbCloudInfrastructure/Repository/TrajectoryNnbRepository.cs
+++ b/AsbCloudInfrastructure/Repository/TrajectoryNnbRepository.cs
@@ -1,4 +1,4 @@
-using AsbCloudApp.Data;
+using AsbCloudApp.Data.Trajectory;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
diff --git a/AsbCloudInfrastructure/Services/Trajectory/TrajectoryImportService.cs b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryExportService.cs
similarity index 51%
rename from AsbCloudInfrastructure/Services/Trajectory/TrajectoryImportService.cs
rename to AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryExportService.cs
index 5587789e..5f8b8fdd 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/TrajectoryImportService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryExportService.cs
@@ -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 where T : TrajectoryGeoDto
+ public abstract class TrajectoryExportService where T : TrajectoryGeoDto
{
private readonly IWellService wellService;
private readonly ITrajectoryRepository 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 trajectoryService, IWellService wellService)
+ public TrajectoryExportService(IWellService wellService, ITrajectoryRepository trajectoryService)
{
- this.trajectoryService = trajectoryService;
this.wellService = wellService;
+ this.trajectoryService = trajectoryService;
+ }
+
+ public async Task ExportAsync(int idWell, CancellationToken token)
+ {
+ var trajectorys = await trajectoryService.GetAsync(idWell, token);
+ return MakeExelFileStream(trajectorys);
+ }
+
+ public async Task 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 ExportAsync(int idWell, CancellationToken token)
- {
- var trajectorys = await trajectoryService.GetAsync(idWell, token);
- return MakeExelFileStream(trajectorys);
- }
-
private Stream MakeExelFileStream(IEnumerable 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 GetFileNameAsync(int idWell, CancellationToken token)
- {
- var caption = await wellService.GetWellCaptionByIdAsync(idWell, token);
- return string.Format("{0}_{1}", caption, templateFileName);
- }
-
- public async Task> 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 ParseFileStream(Stream stream)
- {
- using var workbook = new XLWorkbook(stream, XLEventTracking.Disabled);
- return ParseWorkbook(workbook);
- }
-
- private IEnumerable 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 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(count);
- var parseErrors = new List();
- 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;
- }
}
}
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactManualExportService.cs b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactManualExportService.cs
new file mode 100644
index 00000000..3a7ebf12
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactManualExportService.cs
@@ -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
+ {
+ 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 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;
+ }
+ }
+}
+
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactNnbExportService.cs b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactNnbExportService.cs
new file mode 100644
index 00000000..5c34fc21
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryFactNnbExportService.cs
@@ -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
+ {
+ 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;
+ }
+ }
+}
+
diff --git a/AsbCloudInfrastructure/Services/Trajectory/NnbTrajectoryImportService.cs b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryPlannedExportService.cs
similarity index 50%
rename from AsbCloudInfrastructure/Services/Trajectory/NnbTrajectoryImportService.cs
rename to AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryPlannedExportService.cs
index 869de4d7..26160885 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/NnbTrajectoryImportService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/Export/TrajectoryPlannedExportService.cs
@@ -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
+ public class TrajectoryPlannedExportService : TrajectoryExportService
{
- 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 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(),
- ZenithAngle = row.Cell(ColumnZenithAngle).GetCellValue(),
- AzimuthGeo = row.Cell(ColumnAzimuthGeo).GetCellValue(),
- AzimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).GetCellValue(),
- VerticalDepth = row.Cell(ColumnVerticalDepth).GetCellValue(),
- Radius = row.Cell(ColumnRadius).GetCellValue(),
- Comment = row.Cell(ColumnComment).GetCellValue()
- };
-
- return trajectoryRow;
- }
}
+
}
diff --git a/AsbCloudInfrastructure/Services/Trajectory/FactTrajectoryImportService.cs b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryFactManualImportService.cs
similarity index 55%
rename from AsbCloudInfrastructure/Services/Trajectory/FactTrajectoryImportService.cs
rename to AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryFactManualImportService.cs
index defc5207..fb22794e 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/FactTrajectoryImportService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryFactManualImportService.cs
@@ -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
+ public class TrajectoryFactManualImportService : TrajectoryImportService
{
- 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 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(),
AzimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).GetCellValue(),
VerticalDepth = row.Cell(ColumnVerticalDepth).GetCellValue(),
- Radius = row.Cell(ColumnRadius).GetCellValue(),
Comment = row.Cell(ColumnComment).GetCellValue()
};
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryImportService.cs b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryImportService.cs
new file mode 100644
index 00000000..9c357dcb
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryImportService.cs
@@ -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 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> ImportAsync(Stream stream, CancellationToken token)
+ {
+ using var workbook = new XLWorkbook(stream, XLEventTracking.Disabled);
+ var trajectoryRows = ParseFileStream(stream);
+
+ return trajectoryRows;
+ }
+
+
+ private IEnumerable ParseFileStream(Stream stream)
+ {
+ using var workbook = new XLWorkbook(stream, XLEventTracking.Disabled);
+ return ParseWorkbook(workbook);
+ }
+
+ private IEnumerable 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 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(count);
+ var parseErrors = new List();
+ 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;
+ }
+ }
+}
diff --git a/AsbCloudInfrastructure/Services/Trajectory/PlannedTrajectoryImportService.cs b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryPlannedImportService.cs
similarity index 60%
rename from AsbCloudInfrastructure/Services/Trajectory/PlannedTrajectoryImportService.cs
rename to AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryPlannedImportService.cs
index 296a4002..386a9b41 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/PlannedTrajectoryImportService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/Import/TrajectoryPlannedImportService.cs
@@ -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
+ public class TrajectoryPlannedImportService : TrajectoryImportService
{
/*
* 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 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;
- }
}
}
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Templates/FactTrajectoryTemplate.xlsx b/AsbCloudInfrastructure/Services/Trajectory/Templates/FactTrajectoryTemplate.xlsx
deleted file mode 100644
index 219043d6..00000000
Binary files a/AsbCloudInfrastructure/Services/Trajectory/Templates/FactTrajectoryTemplate.xlsx and /dev/null differ
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Templates/NnbTrajectoryTemplate.xlsx b/AsbCloudInfrastructure/Services/Trajectory/Templates/NnbTrajectoryTemplate.xlsx
deleted file mode 100644
index b6bc4bbf..00000000
Binary files a/AsbCloudInfrastructure/Services/Trajectory/Templates/NnbTrajectoryTemplate.xlsx and /dev/null differ
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryFactManualTemplate.xlsx b/AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryFactManualTemplate.xlsx
new file mode 100644
index 00000000..bd93174b
Binary files /dev/null and b/AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryFactManualTemplate.xlsx differ
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryFactNnbTemplate.xlsx b/AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryFactNnbTemplate.xlsx
new file mode 100644
index 00000000..54bd69ae
Binary files /dev/null and b/AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryFactNnbTemplate.xlsx differ
diff --git a/AsbCloudInfrastructure/Services/Trajectory/Templates/PlannedTrajectoryTemplate.xlsx b/AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryPlannedTemplate.xlsx
similarity index 100%
rename from AsbCloudInfrastructure/Services/Trajectory/Templates/PlannedTrajectoryTemplate.xlsx
rename to AsbCloudInfrastructure/Services/Trajectory/Templates/TrajectoryPlannedTemplate.xlsx
diff --git a/AsbCloudInfrastructure/Services/Trajectory/TrajectoryService.cs b/AsbCloudInfrastructure/Services/Trajectory/TrajectoryService.cs
index 3e31523b..ab3d247e 100644
--- a/AsbCloudInfrastructure/Services/Trajectory/TrajectoryService.cs
+++ b/AsbCloudInfrastructure/Services/Trajectory/TrajectoryService.cs
@@ -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
/// ключ скважины
///
///
- public async Task, IEnumerable, IEnumerable>> GetTrajectoryCartesianAsync(int idWell, CancellationToken token)
+ public async Task, IEnumerable>> GetTrajectoryCartesianAsync(int idWell, CancellationToken token)
{
- var result = new PlanFactBase, IEnumerable, IEnumerable>();
+ var result = new TrajectoryPlanFactDto, IEnumerable>();
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;
}
diff --git a/AsbCloudWebApi.Tests/AsbCloudWebApi.Tests.csproj b/AsbCloudWebApi.Tests/AsbCloudWebApi.Tests.csproj
index 4cf2783e..4cb7f7b1 100644
--- a/AsbCloudWebApi.Tests/AsbCloudWebApi.Tests.csproj
+++ b/AsbCloudWebApi.Tests/AsbCloudWebApi.Tests.csproj
@@ -8,6 +8,16 @@
enable
+
+
+
+
+
+
+
+
+
+
diff --git a/AsbCloudWebApi.Tests/Services/Trajectory/Templates/TrajectoryFactManualTemplate.xlsx b/AsbCloudWebApi.Tests/Services/Trajectory/Templates/TrajectoryFactManualTemplate.xlsx
new file mode 100644
index 00000000..bc7aef58
Binary files /dev/null and b/AsbCloudWebApi.Tests/Services/Trajectory/Templates/TrajectoryFactManualTemplate.xlsx differ
diff --git a/AsbCloudWebApi.Tests/Services/Trajectory/Templates/TrajectoryPlannedTemplate.xlsx b/AsbCloudWebApi.Tests/Services/Trajectory/Templates/TrajectoryPlannedTemplate.xlsx
new file mode 100644
index 00000000..42185e1f
Binary files /dev/null and b/AsbCloudWebApi.Tests/Services/Trajectory/Templates/TrajectoryPlannedTemplate.xlsx differ
diff --git a/AsbCloudWebApi.Tests/Services/Trajectory/TrajectoryExportTest.cs b/AsbCloudWebApi.Tests/Services/Trajectory/TrajectoryExportTest.cs
new file mode 100644
index 00000000..ae8c1840
--- /dev/null
+++ b/AsbCloudWebApi.Tests/Services/Trajectory/TrajectoryExportTest.cs
@@ -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 trajectoryPlannedRepository;
+ private readonly TrajectoryPlannedExportService trajectoryPlannedExportService;
+
+ private readonly ITrajectoryEditableRepository 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();
+ trajectoryPlannedRepository = Substitute.For>();
+ trajectoryPlannedExportService = new TrajectoryPlannedExportService(wellService, trajectoryPlannedRepository);
+
+ trajectoryFactManualReposirory = Substitute.For>();
+ trajectoryFactManualExportService = new TrajectoryFactManualExportService(wellService, trajectoryFactManualReposirory);
+
+ trajectoryFactNnbRepository = Substitute.For();
+ 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);
+ }
+ }
+}
diff --git a/AsbCloudWebApi.Tests/Services/Trajectory/TrajectoryImportTest.cs b/AsbCloudWebApi.Tests/Services/Trajectory/TrajectoryImportTest.cs
new file mode 100644
index 00000000..0250cefd
--- /dev/null
+++ b/AsbCloudWebApi.Tests/Services/Trajectory/TrajectoryImportTest.cs
@@ -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());
+ }
+ }
+}
diff --git a/AsbCloudWebApi.Tests/Services/TrajectoryVisualizationServiceTest.cs b/AsbCloudWebApi.Tests/Services/TrajectoryVisualizationServiceTest.cs
index c256e4ab..9a346a3d 100644
--- a/AsbCloudWebApi.Tests/Services/TrajectoryVisualizationServiceTest.cs
+++ b/AsbCloudWebApi.Tests/Services/TrajectoryVisualizationServiceTest.cs
@@ -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;
diff --git a/AsbCloudWebApi/Controllers/Trajectory/NnbTrajectoryController.cs b/AsbCloudWebApi/Controllers/Trajectory/NnbTrajectoryController.cs
deleted file mode 100644
index 72dea0ef..00000000
--- a/AsbCloudWebApi/Controllers/Trajectory/NnbTrajectoryController.cs
+++ /dev/null
@@ -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;
-
-///
-/// Фактическая траектория из ННБ
-///
-[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;
- }
-
- ///
- /// Метод получения всех строк фактических траекторий по id скважины из ННБ
- ///
- /// Id скважины
- /// Токен отмены операции
- ///
- [HttpGet]
- [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
- public async Task GetRowsAsync([FromRoute] int idWell,
- CancellationToken cancellationToken)
- {
- var nnbFactTrajectories = await trajectoryNnbRepository.GetAsync(idWell,
- cancellationToken);
-
- return Ok(nnbFactTrajectories);
- }
-
- ///
- /// Формируем excel файл с текущими строками фактической ннб-траектории
- ///
- /// id скважины
- /// Токен отмены задачи
- /// Запрашиваемый файл
- [HttpGet("export")]
- [ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK, "application/octet-stream")]
- [ProducesResponseType(StatusCodes.Status204NoContent)]
- public async Task 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