Переработка модели

1. Поправлены сущности
        1. 1. Все типы РТК теперь имеют секцию скважины
        1. 2. Все тип РТК могут иметь комментарий
2. Добавлена новая миграция
3. Поправлены DTO
This commit is contained in:
Степанов Дмитрий 2023-10-12 14:51:57 +05:00
parent b36b1bdd3c
commit 888154dd31
11 changed files with 191 additions and 108 deletions

View File

@ -3,10 +3,8 @@ using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps; namespace AsbCloudApp.Data.ProcessMaps;
/// <summary> /// <inheritdoc/>
/// Базовая Dto для РТК public abstract class ProcessMapPlanBaseDto : IId, IWellRelated
/// </summary>
public abstract class ProcessMapBaseDto : IId, IWellRelated
{ {
/// <inheritdoc/> /// <inheritdoc/>
public int Id { get; set; } public int Id { get; set; }
@ -22,6 +20,12 @@ public abstract class ProcessMapBaseDto : IId, IWellRelated
/// </summary> /// </summary>
public int IdUser { get; set; } public int IdUser { get; set; }
/// <summary>
/// Тип секции
/// </summary>
[Range(1, int.MaxValue, ErrorMessage = "Id секции скважины не может быть меньше 1")]
public int IdWellSectionType { get; set; }
/// <summary> /// <summary>
/// Дата последнего изменения /// Дата последнего изменения
/// </summary> /// </summary>
@ -44,4 +48,9 @@ public abstract class ProcessMapBaseDto : IId, IWellRelated
/// </summary> /// </summary>
[Range(0, 99999.9, ErrorMessage = "Глубина не может быть отрицательной")] [Range(0, 99999.9, ErrorMessage = "Глубина не может быть отрицательной")]
public double DepthEnd { get; set; } public double DepthEnd { get; set; }
/// <summary>
/// Комментарий
/// </summary>
public string? Comment { get; set; }
} }

View File

@ -3,9 +3,9 @@
namespace AsbCloudApp.Data.ProcessMaps; namespace AsbCloudApp.Data.ProcessMaps;
/// <summary> /// <summary>
/// РТК бурение скважины /// РТК план бурение скважины
/// </summary> /// </summary>
public class WellDrillingProcessMapDto : ProcessMapBaseDto public class ProcessMapPlanWellDrillingDto : ProcessMapPlanBaseDto
{ {
/// <summary> /// <summary>
/// Id режима 0-ручной, 1-ротор, 2 - слайд /// Id режима 0-ручной, 1-ротор, 2 - слайд
@ -13,12 +13,6 @@ public class WellDrillingProcessMapDto : ProcessMapBaseDto
[Range(0, 2, ErrorMessage = "Id режима должен быть либо 0-ручной либо, 1-ротор либо 2-слайд")] [Range(0, 2, ErrorMessage = "Id режима должен быть либо 0-ручной либо, 1-ротор либо 2-слайд")]
public int IdMode { get; set; } public int IdMode { get; set; }
/// <summary>
/// Тип секции
/// </summary>
[Range(1, int.MaxValue, ErrorMessage = "Id секции скважины не может быть меньше 1")]
public int IdWellSectionType { get; set; }
/// <summary> /// <summary>
/// Нагрузка /// Нагрузка
/// </summary> /// </summary>

View File

@ -4,9 +4,9 @@ using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps; namespace AsbCloudApp.Data.ProcessMaps;
/// <summary> /// <summary>
/// РТК проработка скважины /// РТК план проработка скважины
/// </summary> /// </summary>
public class WellReamProcessMapDto : ProcessMapBaseDto public class ProcessMapPlanWellReamDto : ProcessMapPlanBaseDto
{ {
/// <summary> /// <summary>
/// Количество повторений /// Количество повторений

View File

@ -13,15 +13,15 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations namespace AsbCloudDb.Migrations
{ {
[DbContext(typeof(AsbCloudDbContext))] [DbContext(typeof(AsbCloudDbContext))]
[Migration("20231009093808_Update_ProcessMaps")] [Migration("20231012070239_Update_Process_Maps")]
partial class Update_ProcessMaps partial class Update_Process_Maps
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.UseCollation("Russian_Russia.1251") .UseCollation("Russian_Russia.1251")
.HasAnnotation("ProductVersion", "6.0.22") .HasAnnotation("ProductVersion", "6.0.23")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack"); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
@ -2337,7 +2337,7 @@ namespace AsbCloudDb.Migrations
b.HasComment("Загрузка плановой траектории"); b.HasComment("Загрузка плановой траектории");
}); });
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellDrillingProcessMap", b => modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -2356,6 +2356,11 @@ namespace AsbCloudDb.Migrations
.HasColumnName("axial_load_plan") .HasColumnName("axial_load_plan")
.HasComment("Нагрузка, план"); .HasComment("Нагрузка, план");
b.Property<string>("Comment")
.HasColumnType("text")
.HasColumnName("comment")
.HasComment("Комментарий");
b.Property<double>("DepthEnd") b.Property<double>("DepthEnd")
.HasColumnType("double precision") .HasColumnType("double precision")
.HasColumnName("depth_end") .HasColumnName("depth_end")
@ -2454,12 +2459,12 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellSectionType"); b.HasIndex("IdWellSectionType");
b.ToTable("t_well_drilling_process_map"); b.ToTable("t_process_map_well_drilling");
b.HasComment("РТК бурение скважины"); b.HasComment("РТК бурение скважины");
}); });
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellReamProcessMap", b => modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -2493,6 +2498,11 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_well") .HasColumnName("id_well")
.HasComment("Id скважины"); .HasComment("Id скважины");
b.Property<int>("IdWellSectionType")
.HasColumnType("integer")
.HasColumnName("id_wellsection_type")
.HasComment("Тип секции");
b.Property<DateTimeOffset>("LastUpdate") b.Property<DateTimeOffset>("LastUpdate")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("last_update") .HasColumnName("last_update")
@ -2549,7 +2559,9 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell"); b.HasIndex("IdWell");
b.ToTable("t_well_ream_process_map"); b.HasIndex("IdWellSectionType");
b.ToTable("t_process_map_well_ream");
b.HasComment("РТК проработка скважины"); b.HasComment("РТК проработка скважины");
}); });
@ -7970,7 +7982,7 @@ namespace AsbCloudDb.Migrations
b.Navigation("Well"); b.Navigation("Well");
}); });
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellDrillingProcessMap", b => modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b =>
{ {
b.HasOne("AsbCloudDb.Model.User", "User") b.HasOne("AsbCloudDb.Model.User", "User")
.WithMany() .WithMany()
@ -7997,7 +8009,7 @@ namespace AsbCloudDb.Migrations
b.Navigation("WellSectionType"); b.Navigation("WellSectionType");
}); });
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellReamProcessMap", b => modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b =>
{ {
b.HasOne("AsbCloudDb.Model.User", "User") b.HasOne("AsbCloudDb.Model.User", "User")
.WithMany() .WithMany()
@ -8011,9 +8023,17 @@ namespace AsbCloudDb.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType")
.WithMany()
.HasForeignKey("IdWellSectionType")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User"); b.Navigation("User");
b.Navigation("Well"); b.Navigation("Well");
b.Navigation("WellSectionType");
}); });
modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b => modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>

View File

@ -4,7 +4,7 @@
namespace AsbCloudDb.Migrations namespace AsbCloudDb.Migrations
{ {
public partial class Update_ProcessMaps : Migration public partial class Update_Process_Maps : Migration
{ {
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
@ -64,50 +64,50 @@ namespace AsbCloudDb.Migrations
migrationBuilder.RenameTable( migrationBuilder.RenameTable(
name: "t_process_map_wellbore_development", name: "t_process_map_wellbore_development",
newName: "t_well_ream_process_map"); newName: "t_process_map_well_ream");
migrationBuilder.RenameTable( migrationBuilder.RenameTable(
name: "t_process_map", name: "t_process_map",
newName: "t_well_drilling_process_map"); newName: "t_process_map_well_drilling");
migrationBuilder.RenameIndex( migrationBuilder.RenameIndex(
name: "IX_t_process_map_wellbore_development_id_well", name: "IX_t_process_map_wellbore_development_id_well",
table: "t_well_ream_process_map", table: "t_process_map_well_ream",
newName: "IX_t_well_ream_process_map_id_well"); newName: "IX_t_process_map_well_ream_id_well");
migrationBuilder.RenameIndex( migrationBuilder.RenameIndex(
name: "IX_t_process_map_wellbore_development_id_user", name: "IX_t_process_map_wellbore_development_id_user",
table: "t_well_ream_process_map", table: "t_process_map_well_ream",
newName: "IX_t_well_ream_process_map_id_user"); newName: "IX_t_process_map_well_ream_id_user");
migrationBuilder.RenameColumn( migrationBuilder.RenameColumn(
name: "well_id", name: "well_id",
table: "t_well_drilling_process_map", table: "t_process_map_well_drilling",
newName: "id_well"); newName: "id_well");
migrationBuilder.RenameIndex( migrationBuilder.RenameIndex(
name: "IX_t_process_map_well_id", name: "IX_t_process_map_well_id",
table: "t_well_drilling_process_map", table: "t_process_map_well_drilling",
newName: "IX_t_well_drilling_process_map_id_well"); newName: "IX_t_process_map_well_drilling_id_well");
migrationBuilder.RenameIndex( migrationBuilder.RenameIndex(
name: "IX_t_process_map_id_wellsection_type", name: "IX_t_process_map_id_wellsection_type",
table: "t_well_drilling_process_map", table: "t_process_map_well_drilling",
newName: "IX_t_well_drilling_process_map_id_wellsection_type"); newName: "IX_t_process_map_well_drilling_id_wellsection_type");
migrationBuilder.AlterTable( migrationBuilder.AlterTable(
name: "t_well_ream_process_map", name: "t_process_map_well_ream",
comment: "РТК проработка скважины", comment: "РТК проработка скважины",
oldComment: "РТК план проработка скважины"); oldComment: "РТК план проработка скважины");
migrationBuilder.AlterTable( migrationBuilder.AlterTable(
name: "t_well_drilling_process_map", name: "t_process_map_well_drilling",
comment: "РТК бурение скважины", comment: "РТК бурение скважины",
oldComment: "Операции по скважине РТК"); oldComment: "Операции по скважине РТК");
migrationBuilder.AlterColumn<double>( migrationBuilder.AlterColumn<double>(
name: "depth_start", name: "depth_start",
table: "t_well_ream_process_map", table: "t_process_map_well_ream",
type: "double precision", type: "double precision",
nullable: false, nullable: false,
comment: "Глубина по стволу от, м", comment: "Глубина по стволу от, м",
@ -117,7 +117,7 @@ namespace AsbCloudDb.Migrations
migrationBuilder.AlterColumn<double>( migrationBuilder.AlterColumn<double>(
name: "depth_end", name: "depth_end",
table: "t_well_ream_process_map", table: "t_process_map_well_ream",
type: "double precision", type: "double precision",
nullable: false, nullable: false,
comment: "Глубина по стволу до, м", comment: "Глубина по стволу до, м",
@ -125,9 +125,17 @@ namespace AsbCloudDb.Migrations
oldType: "double precision", oldType: "double precision",
oldComment: "Окончательная глубина, м"); oldComment: "Окончательная глубина, м");
migrationBuilder.AddColumn<int>(
name: "id_wellsection_type",
table: "t_process_map_well_ream",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "Тип секции");
migrationBuilder.AlterColumn<double>( migrationBuilder.AlterColumn<double>(
name: "depth_start", name: "depth_start",
table: "t_well_drilling_process_map", table: "t_process_map_well_drilling",
type: "double precision", type: "double precision",
nullable: false, nullable: false,
comment: "Глубина по стволу от, м", comment: "Глубина по стволу от, м",
@ -137,7 +145,7 @@ namespace AsbCloudDb.Migrations
migrationBuilder.AlterColumn<double>( migrationBuilder.AlterColumn<double>(
name: "depth_end", name: "depth_end",
table: "t_well_drilling_process_map", table: "t_process_map_well_drilling",
type: "double precision", type: "double precision",
nullable: false, nullable: false,
comment: "Глубина по стволу до, м", comment: "Глубина по стволу до, м",
@ -145,111 +153,147 @@ namespace AsbCloudDb.Migrations
oldType: "double precision", oldType: "double precision",
oldComment: "Глубина окончания интервала"); oldComment: "Глубина окончания интервала");
migrationBuilder.AddColumn<string>(
name: "comment",
table: "t_process_map_well_drilling",
type: "text",
nullable: true,
comment: "Комментарий");
migrationBuilder.AddPrimaryKey( migrationBuilder.AddPrimaryKey(
name: "PK_t_well_ream_process_map", name: "PK_t_process_map_well_ream",
table: "t_well_ream_process_map", table: "t_process_map_well_ream",
column: "id"); column: "id");
migrationBuilder.AddPrimaryKey( migrationBuilder.AddPrimaryKey(
name: "PK_t_well_drilling_process_map", name: "PK_t_process_map_well_drilling",
table: "t_well_drilling_process_map", table: "t_process_map_well_drilling",
column: "id"); column: "id");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_t_well_drilling_process_map_id_user", name: "IX_t_process_map_well_ream_id_wellsection_type",
table: "t_well_drilling_process_map", 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"); column: "id_user");
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_t_well_drilling_process_map_t_user_id_user", name: "FK_t_process_map_well_drilling_t_user_id_user",
table: "t_well_drilling_process_map", table: "t_process_map_well_drilling",
column: "id_user", column: "id_user",
principalTable: "t_user", principalTable: "t_user",
principalColumn: "id", principalColumn: "id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_t_well_drilling_process_map_t_well_id_well", name: "FK_t_process_map_well_drilling_t_well_id_well",
table: "t_well_drilling_process_map", table: "t_process_map_well_drilling",
column: "id_well", column: "id_well",
principalTable: "t_well", principalTable: "t_well",
principalColumn: "id", principalColumn: "id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_t_well_drilling_process_map_t_well_section_type_id_wellsect~", name: "FK_t_process_map_well_drilling_t_well_section_type_id_wellsect~",
table: "t_well_drilling_process_map", table: "t_process_map_well_drilling",
column: "id_wellsection_type", column: "id_wellsection_type",
principalTable: "t_well_section_type", principalTable: "t_well_section_type",
principalColumn: "id", principalColumn: "id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_t_well_ream_process_map_t_user_id_user", name: "FK_t_process_map_well_ream_t_user_id_user",
table: "t_well_ream_process_map", table: "t_process_map_well_ream",
column: "id_user", column: "id_user",
principalTable: "t_user", principalTable: "t_user",
principalColumn: "id", principalColumn: "id",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey( migrationBuilder.AddForeignKey(
name: "FK_t_well_ream_process_map_t_well_id_well", name: "FK_t_process_map_well_ream_t_well_id_well",
table: "t_well_ream_process_map", table: "t_process_map_well_ream",
column: "id_well", column: "id_well",
principalTable: "t_well", principalTable: "t_well",
principalColumn: "id", principalColumn: "id",
onDelete: ReferentialAction.Cascade); 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) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_t_well_drilling_process_map_t_user_id_user", name: "FK_t_process_map_well_drilling_t_user_id_user",
table: "t_well_drilling_process_map"); table: "t_process_map_well_drilling");
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_t_well_drilling_process_map_t_well_id_well", name: "FK_t_process_map_well_drilling_t_well_id_well",
table: "t_well_drilling_process_map"); table: "t_process_map_well_drilling");
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_t_well_drilling_process_map_t_well_section_type_id_wellsect~", name: "FK_t_process_map_well_drilling_t_well_section_type_id_wellsect~",
table: "t_well_drilling_process_map"); table: "t_process_map_well_drilling");
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_t_well_ream_process_map_t_user_id_user", name: "FK_t_process_map_well_ream_t_user_id_user",
table: "t_well_ream_process_map"); table: "t_process_map_well_ream");
migrationBuilder.DropForeignKey( migrationBuilder.DropForeignKey(
name: "FK_t_well_ream_process_map_t_well_id_well", name: "FK_t_process_map_well_ream_t_well_id_well",
table: "t_well_ream_process_map"); 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( migrationBuilder.DropPrimaryKey(
name: "PK_t_well_ream_process_map", name: "PK_t_process_map_well_ream",
table: "t_well_ream_process_map"); table: "t_process_map_well_ream");
migrationBuilder.DropPrimaryKey(
name: "PK_t_well_drilling_process_map",
table: "t_well_drilling_process_map");
migrationBuilder.DropIndex( migrationBuilder.DropIndex(
name: "IX_t_well_drilling_process_map_id_user", name: "IX_t_process_map_well_ream_id_wellsection_type",
table: "t_well_drilling_process_map"); 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( migrationBuilder.RenameTable(
name: "t_well_ream_process_map", name: "t_process_map_well_ream",
newName: "t_process_map_wellbore_development"); newName: "t_process_map_wellbore_development");
migrationBuilder.RenameTable( migrationBuilder.RenameTable(
name: "t_well_drilling_process_map", name: "t_process_map_well_drilling",
newName: "t_process_map"); newName: "t_process_map");
migrationBuilder.RenameIndex( 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", table: "t_process_map_wellbore_development",
newName: "IX_t_process_map_wellbore_development_id_well"); newName: "IX_t_process_map_wellbore_development_id_well");
migrationBuilder.RenameIndex( 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", table: "t_process_map_wellbore_development",
newName: "IX_t_process_map_wellbore_development_id_user"); newName: "IX_t_process_map_wellbore_development_id_user");
@ -259,12 +303,12 @@ namespace AsbCloudDb.Migrations
newName: "well_id"); newName: "well_id");
migrationBuilder.RenameIndex( 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", table: "t_process_map",
newName: "IX_t_process_map_id_wellsection_type"); newName: "IX_t_process_map_id_wellsection_type");
migrationBuilder.RenameIndex( migrationBuilder.RenameIndex(
name: "IX_t_well_drilling_process_map_id_well", name: "IX_t_process_map_well_drilling_id_well",
table: "t_process_map", table: "t_process_map",
newName: "IX_t_process_map_well_id"); newName: "IX_t_process_map_well_id");

View File

@ -2335,7 +2335,7 @@ namespace AsbCloudDb.Migrations
b.HasComment("Загрузка плановой траектории"); b.HasComment("Загрузка плановой траектории");
}); });
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellDrillingProcessMap", b => modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -2354,6 +2354,11 @@ namespace AsbCloudDb.Migrations
.HasColumnName("axial_load_plan") .HasColumnName("axial_load_plan")
.HasComment("Нагрузка, план"); .HasComment("Нагрузка, план");
b.Property<string>("Comment")
.HasColumnType("text")
.HasColumnName("comment")
.HasComment("Комментарий");
b.Property<double>("DepthEnd") b.Property<double>("DepthEnd")
.HasColumnType("double precision") .HasColumnType("double precision")
.HasColumnName("depth_end") .HasColumnName("depth_end")
@ -2452,12 +2457,12 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellSectionType"); b.HasIndex("IdWellSectionType");
b.ToTable("t_well_drilling_process_map"); b.ToTable("t_process_map_well_drilling");
b.HasComment("РТК бурение скважины"); b.HasComment("РТК бурение скважины");
}); });
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellReamProcessMap", b => modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -2491,6 +2496,11 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_well") .HasColumnName("id_well")
.HasComment("Id скважины"); .HasComment("Id скважины");
b.Property<int>("IdWellSectionType")
.HasColumnType("integer")
.HasColumnName("id_wellsection_type")
.HasComment("Тип секции");
b.Property<DateTimeOffset>("LastUpdate") b.Property<DateTimeOffset>("LastUpdate")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("last_update") .HasColumnName("last_update")
@ -2547,7 +2557,9 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell"); b.HasIndex("IdWell");
b.ToTable("t_well_ream_process_map"); b.HasIndex("IdWellSectionType");
b.ToTable("t_process_map_well_ream");
b.HasComment("РТК проработка скважины"); b.HasComment("РТК проработка скважины");
}); });
@ -7968,7 +7980,7 @@ namespace AsbCloudDb.Migrations
b.Navigation("Well"); b.Navigation("Well");
}); });
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellDrillingProcessMap", b => modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b =>
{ {
b.HasOne("AsbCloudDb.Model.User", "User") b.HasOne("AsbCloudDb.Model.User", "User")
.WithMany() .WithMany()
@ -7995,7 +8007,7 @@ namespace AsbCloudDb.Migrations
b.Navigation("WellSectionType"); b.Navigation("WellSectionType");
}); });
modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.WellReamProcessMap", b => modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b =>
{ {
b.HasOne("AsbCloudDb.Model.User", "User") b.HasOne("AsbCloudDb.Model.User", "User")
.WithMany() .WithMany()
@ -8009,9 +8021,17 @@ namespace AsbCloudDb.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType")
.WithMany()
.HasForeignKey("IdWellSectionType")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User"); b.Navigation("User");
b.Navigation("Well"); b.Navigation("Well");
b.Navigation("WellSectionType");
}); });
modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b => modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>

View File

@ -17,8 +17,8 @@ namespace AsbCloudDb.Model
public virtual DbSet<Deposit> Deposits => Set<Deposit>(); public virtual DbSet<Deposit> Deposits => Set<Deposit>();
public virtual DbSet<DetectedOperation> DetectedOperations => Set<DetectedOperation>(); public virtual DbSet<DetectedOperation> DetectedOperations => Set<DetectedOperation>();
public virtual DbSet<PlannedTrajectory> PlannedTrajectories => Set<PlannedTrajectory>(); public virtual DbSet<PlannedTrajectory> PlannedTrajectories => Set<PlannedTrajectory>();
public virtual DbSet<WellDrillingProcessMap> WellDrillingProcessMaps => Set<WellDrillingProcessMap>(); public virtual DbSet<ProcessMapWellDrilling> ProcessMapWellDrillings => Set<ProcessMapWellDrilling>();
public virtual DbSet<WellReamProcessMap> WellReamProcessMaps => Set<WellReamProcessMap>(); public virtual DbSet<ProcessMapWellReam> ProcessMapWellReams => Set<ProcessMapWellReam>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>(); public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>(); public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>(); public virtual DbSet<FileInfo> Files => Set<FileInfo>();

View File

@ -21,8 +21,8 @@ namespace AsbCloudDb.Model
DbSet<Deposit> Deposits { get; } DbSet<Deposit> Deposits { get; }
DbSet<DetectedOperation> DetectedOperations { get; } DbSet<DetectedOperation> DetectedOperations { get; }
DbSet<PlannedTrajectory> PlannedTrajectories { get; } DbSet<PlannedTrajectory> PlannedTrajectories { get; }
DbSet<WellDrillingProcessMap> WellDrillingProcessMaps { get; } DbSet<ProcessMapWellDrilling> ProcessMapWellDrillings { get; }
DbSet<WellReamProcessMap> WellReamProcessMaps { get; } DbSet<ProcessMapWellReam> ProcessMapWellReams { get; }
DbSet<DrillingProgramPart> DrillingProgramParts { get; } DbSet<DrillingProgramPart> DrillingProgramParts { get; }
DbSet<FileCategory> FileCategories { get; } DbSet<FileCategory> FileCategories { get; }
DbSet<FileInfo> Files { get; } DbSet<FileInfo> Files { get; }

View File

@ -2,7 +2,6 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace AsbCloudDb.Model.ProcessMaps; namespace AsbCloudDb.Model.ProcessMaps;
@ -15,6 +14,9 @@ public abstract class ProcessMapBase : IId, IWellRelated
[Column("id_well"), Comment("Id скважины")] [Column("id_well"), Comment("Id скважины")]
public int IdWell { get; set; } public int IdWell { get; set; }
[Column("id_wellsection_type"), Comment("Тип секции")]
public int IdWellSectionType { get; set; }
[Column("id_user"), Comment("Id пользователя")] [Column("id_user"), Comment("Id пользователя")]
public int IdUser { get; set; } public int IdUser { get; set; }
@ -27,10 +29,15 @@ public abstract class ProcessMapBase : IId, IWellRelated
[Column("depth_end"), Comment("Глубина по стволу до, м")] [Column("depth_end"), Comment("Глубина по стволу до, м")]
public double DepthEnd { get; set; } public double DepthEnd { get; set; }
[JsonIgnore] [Column("comment"), Comment("Комментарий")]
public string? Comment { get; set; }
[ForeignKey(nameof(IdWell))] [ForeignKey(nameof(IdWell))]
public virtual Well Well { get; set; } = null!; public virtual Well Well { get; set; } = null!;
[ForeignKey(nameof(IdUser))] [ForeignKey(nameof(IdUser))]
public virtual User User { get; set; } = null!; public virtual User User { get; set; } = null!;
[ForeignKey(nameof(IdWellSectionType))]
public virtual WellSectionType WellSectionType { get; set; } = null!;
} }

View File

@ -1,18 +1,14 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace AsbCloudDb.Model.ProcessMaps; namespace AsbCloudDb.Model.ProcessMaps;
[Table("t_well_drilling_process_map"), Comment("РТК бурение скважины")] [Table("t_process_map_well_drilling"), Comment("РТК бурение скважины")]
public class WellDrillingProcessMap : ProcessMapBase public class ProcessMapWellDrilling : ProcessMapBase
{ {
[Column("id_mode"), Comment("Id режима (1- ротор, 2 слайд)")] [Column("id_mode"), Comment("Id режима (1- ротор, 2 слайд)")]
public int IdMode { get; set; } public int IdMode { get; set; }
[Column("id_wellsection_type"), Comment("Тип секции")]
public int IdWellSectionType { get; set; }
[Column("axial_load_plan"), Comment("Нагрузка, план")] [Column("axial_load_plan"), Comment("Нагрузка, план")]
public double AxialLoadPlan { get; set; } public double AxialLoadPlan { get; set; }
@ -51,8 +47,4 @@ public class WellDrillingProcessMap : ProcessMapBase
[Column("usage_spin"), Comment("Плановый процент использования spin master")] [Column("usage_spin"), Comment("Плановый процент использования spin master")]
public double UsageSpin { get; set; } public double UsageSpin { get; set; }
[JsonIgnore]
[ForeignKey(nameof(IdWellSectionType))]
public virtual WellSectionType WellSectionType { get; set; } = null!;
} }

View File

@ -3,8 +3,8 @@ using Microsoft.EntityFrameworkCore;
namespace AsbCloudDb.Model.ProcessMaps; namespace AsbCloudDb.Model.ProcessMaps;
[Table("t_well_ream_process_map"), Comment("РТК проработка скважины")] [Table("t_process_map_well_ream"), Comment("РТК проработка скважины")]
public class WellReamProcessMap : ProcessMapBase public class ProcessMapWellReam : ProcessMapBase
{ {
[Column("repeats"), Comment("Количество повторений")] [Column("repeats"), Comment("Количество повторений")]
public double Repeats { get; set; } public double Repeats { get; set; }
@ -32,7 +32,4 @@ public class WellReamProcessMap : ProcessMapBase
[Column("torque"), Comment("Момент, кН*м")] [Column("torque"), Comment("Момент, кН*м")]
public double Torque { get; set; } public double Torque { get; set; }
[Column("comment"), Comment("Комментарий")]
public string? Comment { get; set; }
} }