From 888154dd319474fb1a75bf5ae39340dda5fff0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 12 Oct 2023 14:51:57 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D0=B0=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Поправлены сущности 1. 1. Все типы РТК теперь имеют секцию скважины 1. 2. Все тип РТК могут иметь комментарий 2. Добавлена новая миграция 3. Поправлены DTO --- ...MapBaseDto.cs => ProcessMapPlanBaseDto.cs} | 17 +- ...to.cs => ProcessMapPlanWellDrillingDto.cs} | 10 +- ...MapDto.cs => ProcessMapPlanWellReamDto.cs} | 4 +- ...012070239_Update_Process_Maps.Designer.cs} | 38 ++++- ... => 20231012070239_Update_Process_Maps.cs} | 160 +++++++++++------- .../AsbCloudDbContextModelSnapshot.cs | 32 +++- AsbCloudDb/Model/AsbCloudDbContext.cs | 4 +- AsbCloudDb/Model/IAsbCloudDbContext.cs | 4 +- .../Model/ProcessMaps/ProcessMapBase.cs | 11 +- ...rocessMap.cs => ProcessMapWellDrilling.cs} | 12 +- ...eamProcessMap.cs => ProcessMapWellReam.cs} | 7 +- 11 files changed, 191 insertions(+), 108 deletions(-) rename AsbCloudApp/Data/ProcessMaps/{ProcessMapBaseDto.cs => ProcessMapPlanBaseDto.cs} (74%) rename AsbCloudApp/Data/ProcessMaps/{WellDrillingProcessMapDto.cs => ProcessMapPlanWellDrillingDto.cs} (85%) rename AsbCloudApp/Data/ProcessMaps/{WellReamProcessMapDto.cs => ProcessMapPlanWellReamDto.cs} (96%) rename AsbCloudDb/Migrations/{20231009093808_Update_ProcessMaps.Designer.cs => 20231012070239_Update_Process_Maps.Designer.cs} (99%) rename AsbCloudDb/Migrations/{20231009093808_Update_ProcessMaps.cs => 20231012070239_Update_Process_Maps.cs} (72%) rename AsbCloudDb/Model/ProcessMaps/{WellDrillingProcessMap.cs => ProcessMapWellDrilling.cs} (84%) rename AsbCloudDb/Model/ProcessMaps/{WellReamProcessMap.cs => ProcessMapWellReam.cs} (85%) diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapBaseDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanBaseDto.cs similarity index 74% rename from AsbCloudApp/Data/ProcessMaps/ProcessMapBaseDto.cs rename to AsbCloudApp/Data/ProcessMaps/ProcessMapPlanBaseDto.cs index d7438901..73e08a58 100644 --- a/AsbCloudApp/Data/ProcessMaps/ProcessMapBaseDto.cs +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanBaseDto.cs @@ -3,10 +3,8 @@ using System.ComponentModel.DataAnnotations; namespace AsbCloudApp.Data.ProcessMaps; -/// -/// Базовая Dto для РТК -/// -public abstract class ProcessMapBaseDto : IId, IWellRelated +/// +public abstract class ProcessMapPlanBaseDto : IId, IWellRelated { /// public int Id { get; set; } @@ -22,6 +20,12 @@ public abstract class ProcessMapBaseDto : IId, IWellRelated /// public int IdUser { get; set; } + /// + /// Тип секции + /// + [Range(1, int.MaxValue, ErrorMessage = "Id секции скважины не может быть меньше 1")] + public int IdWellSectionType { get; set; } + /// /// Дата последнего изменения /// @@ -44,4 +48,9 @@ public abstract class ProcessMapBaseDto : IId, IWellRelated /// [Range(0, 99999.9, ErrorMessage = "Глубина не может быть отрицательной")] public double DepthEnd { get; set; } + + /// + /// Комментарий + /// + public string? Comment { get; set; } } \ No newline at end of file diff --git a/AsbCloudApp/Data/ProcessMaps/WellDrillingProcessMapDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanWellDrillingDto.cs similarity index 85% rename from AsbCloudApp/Data/ProcessMaps/WellDrillingProcessMapDto.cs rename to AsbCloudApp/Data/ProcessMaps/ProcessMapPlanWellDrillingDto.cs index 03bd1135..1f9dd844 100644 --- a/AsbCloudApp/Data/ProcessMaps/WellDrillingProcessMapDto.cs +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanWellDrillingDto.cs @@ -3,9 +3,9 @@ namespace AsbCloudApp.Data.ProcessMaps; /// -/// РТК бурение скважины +/// РТК план бурение скважины /// -public class WellDrillingProcessMapDto : ProcessMapBaseDto +public class ProcessMapPlanWellDrillingDto : ProcessMapPlanBaseDto { /// /// Id режима 0-ручной, 1-ротор, 2 - слайд @@ -13,12 +13,6 @@ public class WellDrillingProcessMapDto : ProcessMapBaseDto [Range(0, 2, ErrorMessage = "Id режима должен быть либо 0-ручной либо, 1-ротор либо 2-слайд")] public int IdMode { get; set; } - /// - /// Тип секции - /// - [Range(1, int.MaxValue, ErrorMessage = "Id секции скважины не может быть меньше 1")] - public int IdWellSectionType { get; set; } - /// /// Нагрузка /// diff --git a/AsbCloudApp/Data/ProcessMaps/WellReamProcessMapDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanWellReamDto.cs similarity index 96% rename from AsbCloudApp/Data/ProcessMaps/WellReamProcessMapDto.cs rename to AsbCloudApp/Data/ProcessMaps/ProcessMapPlanWellReamDto.cs index be19a692..12e9d193 100644 --- a/AsbCloudApp/Data/ProcessMaps/WellReamProcessMapDto.cs +++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanWellReamDto.cs @@ -4,9 +4,9 @@ using System.ComponentModel.DataAnnotations; namespace AsbCloudApp.Data.ProcessMaps; /// -/// РТК проработка скважины +/// РТК план проработка скважины /// -public class WellReamProcessMapDto : ProcessMapBaseDto +public class ProcessMapPlanWellReamDto : ProcessMapPlanBaseDto { /// /// Количество повторений diff --git a/AsbCloudDb/Migrations/20231009093808_Update_ProcessMaps.Designer.cs b/AsbCloudDb/Migrations/20231012070239_Update_Process_Maps.Designer.cs similarity index 99% rename from AsbCloudDb/Migrations/20231009093808_Update_ProcessMaps.Designer.cs rename to AsbCloudDb/Migrations/20231012070239_Update_Process_Maps.Designer.cs index 25df03dd..0d5c7375 100644 --- a/AsbCloudDb/Migrations/20231009093808_Update_ProcessMaps.Designer.cs +++ b/AsbCloudDb/Migrations/20231012070239_Update_Process_Maps.Designer.cs @@ -13,15 +13,15 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace AsbCloudDb.Migrations { [DbContext(typeof(AsbCloudDbContext))] - [Migration("20231009093808_Update_ProcessMaps")] - partial class Update_ProcessMaps + [Migration("20231012070239_Update_Process_Maps")] + partial class Update_Process_Maps { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .UseCollation("Russian_Russia.1251") - .HasAnnotation("ProductVersion", "6.0.22") + .HasAnnotation("ProductVersion", "6.0.23") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack"); @@ -2337,7 +2337,7 @@ namespace AsbCloudDb.Migrations b.HasComment("Загрузка плановой траектории"); }); - modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellDrillingProcessMap", b => + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -2356,6 +2356,11 @@ namespace AsbCloudDb.Migrations .HasColumnName("axial_load_plan") .HasComment("Нагрузка, план"); + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + b.Property("DepthEnd") .HasColumnType("double precision") .HasColumnName("depth_end") @@ -2454,12 +2459,12 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWellSectionType"); - b.ToTable("t_well_drilling_process_map"); + b.ToTable("t_process_map_well_drilling"); b.HasComment("РТК бурение скважины"); }); - modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellReamProcessMap", b => + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -2493,6 +2498,11 @@ namespace AsbCloudDb.Migrations .HasColumnName("id_well") .HasComment("Id скважины"); + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + b.Property("LastUpdate") .HasColumnType("timestamp with time zone") .HasColumnName("last_update") @@ -2549,7 +2559,9 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWell"); - b.ToTable("t_well_ream_process_map"); + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_well_ream"); b.HasComment("РТК проработка скважины"); }); @@ -7970,7 +7982,7 @@ namespace AsbCloudDb.Migrations b.Navigation("Well"); }); - modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellDrillingProcessMap", b => + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b => { b.HasOne("AsbCloudDb.Model.User", "User") .WithMany() @@ -7997,7 +8009,7 @@ namespace AsbCloudDb.Migrations b.Navigation("WellSectionType"); }); - modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellReamProcessMap", b => + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b => { b.HasOne("AsbCloudDb.Model.User", "User") .WithMany() @@ -8011,9 +8023,17 @@ namespace AsbCloudDb.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.Navigation("User"); b.Navigation("Well"); + + b.Navigation("WellSectionType"); }); modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b => diff --git a/AsbCloudDb/Migrations/20231009093808_Update_ProcessMaps.cs b/AsbCloudDb/Migrations/20231012070239_Update_Process_Maps.cs similarity index 72% rename from AsbCloudDb/Migrations/20231009093808_Update_ProcessMaps.cs rename to AsbCloudDb/Migrations/20231012070239_Update_Process_Maps.cs index e330bbde..701b4862 100644 --- a/AsbCloudDb/Migrations/20231009093808_Update_ProcessMaps.cs +++ b/AsbCloudDb/Migrations/20231012070239_Update_Process_Maps.cs @@ -4,7 +4,7 @@ namespace AsbCloudDb.Migrations { - public partial class Update_ProcessMaps : Migration + public partial class Update_Process_Maps : Migration { protected override void Up(MigrationBuilder migrationBuilder) { @@ -64,50 +64,50 @@ namespace AsbCloudDb.Migrations migrationBuilder.RenameTable( name: "t_process_map_wellbore_development", - newName: "t_well_ream_process_map"); + newName: "t_process_map_well_ream"); migrationBuilder.RenameTable( name: "t_process_map", - newName: "t_well_drilling_process_map"); + newName: "t_process_map_well_drilling"); migrationBuilder.RenameIndex( name: "IX_t_process_map_wellbore_development_id_well", - table: "t_well_ream_process_map", - newName: "IX_t_well_ream_process_map_id_well"); + table: "t_process_map_well_ream", + newName: "IX_t_process_map_well_ream_id_well"); migrationBuilder.RenameIndex( name: "IX_t_process_map_wellbore_development_id_user", - table: "t_well_ream_process_map", - newName: "IX_t_well_ream_process_map_id_user"); + table: "t_process_map_well_ream", + newName: "IX_t_process_map_well_ream_id_user"); migrationBuilder.RenameColumn( name: "well_id", - table: "t_well_drilling_process_map", + table: "t_process_map_well_drilling", newName: "id_well"); migrationBuilder.RenameIndex( name: "IX_t_process_map_well_id", - table: "t_well_drilling_process_map", - newName: "IX_t_well_drilling_process_map_id_well"); + table: "t_process_map_well_drilling", + newName: "IX_t_process_map_well_drilling_id_well"); migrationBuilder.RenameIndex( name: "IX_t_process_map_id_wellsection_type", - table: "t_well_drilling_process_map", - newName: "IX_t_well_drilling_process_map_id_wellsection_type"); + table: "t_process_map_well_drilling", + newName: "IX_t_process_map_well_drilling_id_wellsection_type"); migrationBuilder.AlterTable( - name: "t_well_ream_process_map", + name: "t_process_map_well_ream", comment: "РТК проработка скважины", oldComment: "РТК план проработка скважины"); migrationBuilder.AlterTable( - name: "t_well_drilling_process_map", + name: "t_process_map_well_drilling", comment: "РТК бурение скважины", oldComment: "Операции по скважине – РТК"); migrationBuilder.AlterColumn( name: "depth_start", - table: "t_well_ream_process_map", + table: "t_process_map_well_ream", type: "double precision", nullable: false, comment: "Глубина по стволу от, м", @@ -117,7 +117,7 @@ namespace AsbCloudDb.Migrations migrationBuilder.AlterColumn( name: "depth_end", - table: "t_well_ream_process_map", + table: "t_process_map_well_ream", type: "double precision", nullable: false, comment: "Глубина по стволу до, м", @@ -125,9 +125,17 @@ namespace AsbCloudDb.Migrations oldType: "double precision", oldComment: "Окончательная глубина, м"); + migrationBuilder.AddColumn( + name: "id_wellsection_type", + table: "t_process_map_well_ream", + type: "integer", + nullable: false, + defaultValue: 0, + comment: "Тип секции"); + migrationBuilder.AlterColumn( name: "depth_start", - table: "t_well_drilling_process_map", + table: "t_process_map_well_drilling", type: "double precision", nullable: false, comment: "Глубина по стволу от, м", @@ -137,7 +145,7 @@ namespace AsbCloudDb.Migrations migrationBuilder.AlterColumn( name: "depth_end", - table: "t_well_drilling_process_map", + table: "t_process_map_well_drilling", type: "double precision", nullable: false, comment: "Глубина по стволу до, м", @@ -145,111 +153,147 @@ namespace AsbCloudDb.Migrations oldType: "double precision", oldComment: "Глубина окончания интервала"); + migrationBuilder.AddColumn( + name: "comment", + table: "t_process_map_well_drilling", + type: "text", + nullable: true, + comment: "Комментарий"); + migrationBuilder.AddPrimaryKey( - name: "PK_t_well_ream_process_map", - table: "t_well_ream_process_map", + name: "PK_t_process_map_well_ream", + table: "t_process_map_well_ream", column: "id"); migrationBuilder.AddPrimaryKey( - name: "PK_t_well_drilling_process_map", - table: "t_well_drilling_process_map", + name: "PK_t_process_map_well_drilling", + table: "t_process_map_well_drilling", column: "id"); migrationBuilder.CreateIndex( - name: "IX_t_well_drilling_process_map_id_user", - table: "t_well_drilling_process_map", + name: "IX_t_process_map_well_ream_id_wellsection_type", + table: "t_process_map_well_ream", + column: "id_wellsection_type"); + + migrationBuilder.CreateIndex( + name: "IX_t_process_map_well_drilling_id_user", + table: "t_process_map_well_drilling", column: "id_user"); migrationBuilder.AddForeignKey( - name: "FK_t_well_drilling_process_map_t_user_id_user", - table: "t_well_drilling_process_map", + name: "FK_t_process_map_well_drilling_t_user_id_user", + table: "t_process_map_well_drilling", column: "id_user", principalTable: "t_user", principalColumn: "id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( - name: "FK_t_well_drilling_process_map_t_well_id_well", - table: "t_well_drilling_process_map", + name: "FK_t_process_map_well_drilling_t_well_id_well", + table: "t_process_map_well_drilling", column: "id_well", principalTable: "t_well", principalColumn: "id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( - name: "FK_t_well_drilling_process_map_t_well_section_type_id_wellsect~", - table: "t_well_drilling_process_map", + name: "FK_t_process_map_well_drilling_t_well_section_type_id_wellsect~", + table: "t_process_map_well_drilling", column: "id_wellsection_type", principalTable: "t_well_section_type", principalColumn: "id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( - name: "FK_t_well_ream_process_map_t_user_id_user", - table: "t_well_ream_process_map", + name: "FK_t_process_map_well_ream_t_user_id_user", + table: "t_process_map_well_ream", column: "id_user", principalTable: "t_user", principalColumn: "id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( - name: "FK_t_well_ream_process_map_t_well_id_well", - table: "t_well_ream_process_map", + name: "FK_t_process_map_well_ream_t_well_id_well", + table: "t_process_map_well_ream", column: "id_well", principalTable: "t_well", principalColumn: "id", onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_t_process_map_well_ream_t_well_section_type_id_wellsection_~", + table: "t_process_map_well_ream", + column: "id_wellsection_type", + principalTable: "t_well_section_type", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( - name: "FK_t_well_drilling_process_map_t_user_id_user", - table: "t_well_drilling_process_map"); + name: "FK_t_process_map_well_drilling_t_user_id_user", + table: "t_process_map_well_drilling"); migrationBuilder.DropForeignKey( - name: "FK_t_well_drilling_process_map_t_well_id_well", - table: "t_well_drilling_process_map"); + name: "FK_t_process_map_well_drilling_t_well_id_well", + table: "t_process_map_well_drilling"); migrationBuilder.DropForeignKey( - name: "FK_t_well_drilling_process_map_t_well_section_type_id_wellsect~", - table: "t_well_drilling_process_map"); + name: "FK_t_process_map_well_drilling_t_well_section_type_id_wellsect~", + table: "t_process_map_well_drilling"); migrationBuilder.DropForeignKey( - name: "FK_t_well_ream_process_map_t_user_id_user", - table: "t_well_ream_process_map"); + name: "FK_t_process_map_well_ream_t_user_id_user", + table: "t_process_map_well_ream"); migrationBuilder.DropForeignKey( - name: "FK_t_well_ream_process_map_t_well_id_well", - table: "t_well_ream_process_map"); + name: "FK_t_process_map_well_ream_t_well_id_well", + table: "t_process_map_well_ream"); + + migrationBuilder.DropForeignKey( + name: "FK_t_process_map_well_ream_t_well_section_type_id_wellsection_~", + table: "t_process_map_well_ream"); migrationBuilder.DropPrimaryKey( - name: "PK_t_well_ream_process_map", - table: "t_well_ream_process_map"); - - migrationBuilder.DropPrimaryKey( - name: "PK_t_well_drilling_process_map", - table: "t_well_drilling_process_map"); + name: "PK_t_process_map_well_ream", + table: "t_process_map_well_ream"); migrationBuilder.DropIndex( - name: "IX_t_well_drilling_process_map_id_user", - table: "t_well_drilling_process_map"); + name: "IX_t_process_map_well_ream_id_wellsection_type", + table: "t_process_map_well_ream"); + + migrationBuilder.DropPrimaryKey( + name: "PK_t_process_map_well_drilling", + table: "t_process_map_well_drilling"); + + migrationBuilder.DropIndex( + name: "IX_t_process_map_well_drilling_id_user", + table: "t_process_map_well_drilling"); + + migrationBuilder.DropColumn( + name: "id_wellsection_type", + table: "t_process_map_well_ream"); + + migrationBuilder.DropColumn( + name: "comment", + table: "t_process_map_well_drilling"); migrationBuilder.RenameTable( - name: "t_well_ream_process_map", + name: "t_process_map_well_ream", newName: "t_process_map_wellbore_development"); migrationBuilder.RenameTable( - name: "t_well_drilling_process_map", + name: "t_process_map_well_drilling", newName: "t_process_map"); migrationBuilder.RenameIndex( - name: "IX_t_well_ream_process_map_id_well", + name: "IX_t_process_map_well_ream_id_well", table: "t_process_map_wellbore_development", newName: "IX_t_process_map_wellbore_development_id_well"); migrationBuilder.RenameIndex( - name: "IX_t_well_ream_process_map_id_user", + name: "IX_t_process_map_well_ream_id_user", table: "t_process_map_wellbore_development", newName: "IX_t_process_map_wellbore_development_id_user"); @@ -259,12 +303,12 @@ namespace AsbCloudDb.Migrations newName: "well_id"); migrationBuilder.RenameIndex( - name: "IX_t_well_drilling_process_map_id_wellsection_type", + name: "IX_t_process_map_well_drilling_id_wellsection_type", table: "t_process_map", newName: "IX_t_process_map_id_wellsection_type"); migrationBuilder.RenameIndex( - name: "IX_t_well_drilling_process_map_id_well", + name: "IX_t_process_map_well_drilling_id_well", table: "t_process_map", newName: "IX_t_process_map_well_id"); diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index f3eb09ab..d9fdb43b 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -2335,7 +2335,7 @@ namespace AsbCloudDb.Migrations b.HasComment("Загрузка плановой траектории"); }); - modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellDrillingProcessMap", b => + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -2354,6 +2354,11 @@ namespace AsbCloudDb.Migrations .HasColumnName("axial_load_plan") .HasComment("Нагрузка, план"); + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + b.Property("DepthEnd") .HasColumnType("double precision") .HasColumnName("depth_end") @@ -2452,12 +2457,12 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWellSectionType"); - b.ToTable("t_well_drilling_process_map"); + b.ToTable("t_process_map_well_drilling"); b.HasComment("РТК бурение скважины"); }); - modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellReamProcessMap", b => + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -2491,6 +2496,11 @@ namespace AsbCloudDb.Migrations .HasColumnName("id_well") .HasComment("Id скважины"); + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + b.Property("LastUpdate") .HasColumnType("timestamp with time zone") .HasColumnName("last_update") @@ -2547,7 +2557,9 @@ namespace AsbCloudDb.Migrations b.HasIndex("IdWell"); - b.ToTable("t_well_ream_process_map"); + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map_well_ream"); b.HasComment("РТК проработка скважины"); }); @@ -7968,7 +7980,7 @@ namespace AsbCloudDb.Migrations b.Navigation("Well"); }); - modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellDrillingProcessMap", b => + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b => { b.HasOne("AsbCloudDb.Model.User", "User") .WithMany() @@ -7995,7 +8007,7 @@ namespace AsbCloudDb.Migrations b.Navigation("WellSectionType"); }); - modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellReamProcessMap", b => + modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b => { b.HasOne("AsbCloudDb.Model.User", "User") .WithMany() @@ -8009,9 +8021,17 @@ namespace AsbCloudDb.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany() + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.Navigation("User"); b.Navigation("Well"); + + b.Navigation("WellSectionType"); }); modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b => diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index 1863ea6f..8fb290d3 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -17,8 +17,8 @@ namespace AsbCloudDb.Model public virtual DbSet Deposits => Set(); public virtual DbSet DetectedOperations => Set(); public virtual DbSet PlannedTrajectories => Set(); - public virtual DbSet WellDrillingProcessMaps => Set(); - public virtual DbSet WellReamProcessMaps => Set(); + public virtual DbSet ProcessMapWellDrillings => Set(); + public virtual DbSet ProcessMapWellReams => Set(); public virtual DbSet DrillingProgramParts => Set(); public virtual DbSet FileCategories => Set(); public virtual DbSet Files => Set(); diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs index d6ab3bb1..9dd52b6c 100644 --- a/AsbCloudDb/Model/IAsbCloudDbContext.cs +++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs @@ -21,8 +21,8 @@ namespace AsbCloudDb.Model DbSet Deposits { get; } DbSet DetectedOperations { get; } DbSet PlannedTrajectories { get; } - DbSet WellDrillingProcessMaps { get; } - DbSet WellReamProcessMaps { get; } + DbSet ProcessMapWellDrillings { get; } + DbSet ProcessMapWellReams { get; } DbSet DrillingProgramParts { get; } DbSet FileCategories { get; } DbSet Files { get; } diff --git a/AsbCloudDb/Model/ProcessMaps/ProcessMapBase.cs b/AsbCloudDb/Model/ProcessMaps/ProcessMapBase.cs index 73075d6b..e841573b 100644 --- a/AsbCloudDb/Model/ProcessMaps/ProcessMapBase.cs +++ b/AsbCloudDb/Model/ProcessMaps/ProcessMapBase.cs @@ -2,7 +2,6 @@ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; namespace AsbCloudDb.Model.ProcessMaps; @@ -15,6 +14,9 @@ public abstract class ProcessMapBase : IId, IWellRelated [Column("id_well"), Comment("Id скважины")] public int IdWell { get; set; } + [Column("id_wellsection_type"), Comment("Тип секции")] + public int IdWellSectionType { get; set; } + [Column("id_user"), Comment("Id пользователя")] public int IdUser { get; set; } @@ -27,10 +29,15 @@ public abstract class ProcessMapBase : IId, IWellRelated [Column("depth_end"), Comment("Глубина по стволу до, м")] public double DepthEnd { get; set; } - [JsonIgnore] + [Column("comment"), Comment("Комментарий")] + public string? Comment { get; set; } + [ForeignKey(nameof(IdWell))] public virtual Well Well { get; set; } = null!; [ForeignKey(nameof(IdUser))] public virtual User User { get; set; } = null!; + + [ForeignKey(nameof(IdWellSectionType))] + public virtual WellSectionType WellSectionType { get; set; } = null!; } \ No newline at end of file diff --git a/AsbCloudDb/Model/ProcessMaps/WellDrillingProcessMap.cs b/AsbCloudDb/Model/ProcessMaps/ProcessMapWellDrilling.cs similarity index 84% rename from AsbCloudDb/Model/ProcessMaps/WellDrillingProcessMap.cs rename to AsbCloudDb/Model/ProcessMaps/ProcessMapWellDrilling.cs index 9e5cb5ab..d146777e 100644 --- a/AsbCloudDb/Model/ProcessMaps/WellDrillingProcessMap.cs +++ b/AsbCloudDb/Model/ProcessMaps/ProcessMapWellDrilling.cs @@ -1,18 +1,14 @@ using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; namespace AsbCloudDb.Model.ProcessMaps; -[Table("t_well_drilling_process_map"), Comment("РТК бурение скважины")] -public class WellDrillingProcessMap : ProcessMapBase +[Table("t_process_map_well_drilling"), Comment("РТК бурение скважины")] +public class ProcessMapWellDrilling : ProcessMapBase { [Column("id_mode"), Comment("Id режима (1- ротор, 2 слайд)")] public int IdMode { get; set; } - [Column("id_wellsection_type"), Comment("Тип секции")] - public int IdWellSectionType { get; set; } - [Column("axial_load_plan"), Comment("Нагрузка, план")] public double AxialLoadPlan { get; set; } @@ -51,8 +47,4 @@ public class WellDrillingProcessMap : ProcessMapBase [Column("usage_spin"), Comment("Плановый процент использования spin master")] public double UsageSpin { get; set; } - - [JsonIgnore] - [ForeignKey(nameof(IdWellSectionType))] - public virtual WellSectionType WellSectionType { get; set; } = null!; } \ No newline at end of file diff --git a/AsbCloudDb/Model/ProcessMaps/WellReamProcessMap.cs b/AsbCloudDb/Model/ProcessMaps/ProcessMapWellReam.cs similarity index 85% rename from AsbCloudDb/Model/ProcessMaps/WellReamProcessMap.cs rename to AsbCloudDb/Model/ProcessMaps/ProcessMapWellReam.cs index ddf8c406..2673e12b 100644 --- a/AsbCloudDb/Model/ProcessMaps/WellReamProcessMap.cs +++ b/AsbCloudDb/Model/ProcessMaps/ProcessMapWellReam.cs @@ -3,8 +3,8 @@ using Microsoft.EntityFrameworkCore; namespace AsbCloudDb.Model.ProcessMaps; -[Table("t_well_ream_process_map"), Comment("РТК проработка скважины")] -public class WellReamProcessMap : ProcessMapBase +[Table("t_process_map_well_ream"), Comment("РТК проработка скважины")] +public class ProcessMapWellReam : ProcessMapBase { [Column("repeats"), Comment("Количество повторений")] public double Repeats { get; set; } @@ -32,7 +32,4 @@ public class WellReamProcessMap : ProcessMapBase [Column("torque"), Comment("Момент, кН*м")] public double Torque { get; set; } - - [Column("comment"), Comment("Комментарий")] - public string? Comment { get; set; } } \ No newline at end of file