Сортировка section type

This commit is contained in:
Olga Nemt 2023-07-19 16:39:17 +05:00
parent f02346a24a
commit 82184466f9
10 changed files with 8755 additions and 73 deletions

View File

@ -14,4 +14,9 @@ public class WellSectionTypeDto : IId
/// Название типа секции /// Название типа секции
/// </summary> /// </summary>
public string Caption { get; set; } = null!; public string Caption { get; set; } = null!;
/// <summary>
/// Порядок
/// </summary>
public int Order { get; set; }
} }

View File

@ -22,7 +22,7 @@ namespace AsbCloudApp.Repositories
/// Список секций /// Список секций
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
IDictionary<int, string> GetSectionTypes(); IEnumerable<WellSectionTypeDto> GetSectionTypes();
/// <summary> /// <summary>
/// список плановых операций для сопоставления /// список плановых операций для сопоставления

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,251 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_Order_For_SectionType : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<float>(
name: "order",
table: "t_well_section_type",
type: "real",
nullable: false,
defaultValue: 0f,
comment: "Порядок");
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 1,
column: "order",
value: 4f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 3,
column: "order",
value: 1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 4,
column: "order",
value: 3f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 5,
column: "order",
value: 5f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 6,
column: "order",
value: 6f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 7,
column: "order",
value: 4.1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 8,
column: "order",
value: 0.1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 9,
column: "order",
value: 1.1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 10,
column: "order",
value: 3.1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 11,
column: "order",
value: 5.1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 12,
column: "order",
value: 6.1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 13,
column: "order",
value: 4.2f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 14,
column: "order",
value: 0.2f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 15,
column: "order",
value: 1.2f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 16,
column: "order",
value: 3.2f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 17,
column: "order",
value: 5.2f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 18,
column: "order",
value: 6.2f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 19,
column: "order",
value: 4.3f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 20,
column: "order",
value: 0.3f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 21,
column: "order",
value: 1.3f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 22,
column: "order",
value: 3.3f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 23,
column: "order",
value: 5.3f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 24,
column: "order",
value: 6.3f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 25,
column: "order",
value: 4.4f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 26,
column: "order",
value: 0.4f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 27,
column: "order",
value: 1.4f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 28,
column: "order",
value: 3.4f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 29,
column: "order",
value: 5.4f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 30,
column: "order",
value: 6.4f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 31,
column: "order",
value: 2f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 32,
column: "order",
value: 2.1f);
migrationBuilder.UpdateData(
table: "t_well_section_type",
keyColumn: "id",
keyValue: 33,
column: "order",
value: 2.2f);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "order",
table: "t_well_section_type");
}
}
}

View File

@ -6539,6 +6539,11 @@ namespace AsbCloudDb.Migrations
.HasColumnName("caption") .HasColumnName("caption")
.HasComment("Название"); .HasComment("Название");
b.Property<float>("Order")
.HasColumnType("real")
.HasColumnName("order")
.HasComment("Порядок");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("t_well_section_type"); b.ToTable("t_well_section_type");
@ -6549,167 +6554,200 @@ namespace AsbCloudDb.Migrations
new new
{ {
Id = 1, Id = 1,
Caption = "Пилотный ствол" Caption = "Пилотный ствол",
Order = 4f
}, },
new new
{ {
Id = 2, Id = 2,
Caption = "Направление" Caption = "Направление",
Order = 0f
}, },
new new
{ {
Id = 3, Id = 3,
Caption = "Кондуктор" Caption = "Кондуктор",
Order = 1f
}, },
new new
{ {
Id = 4, Id = 4,
Caption = "Эксплуатационная колонна" Caption = "Эксплуатационная колонна",
Order = 3f
}, },
new new
{ {
Id = 5, Id = 5,
Caption = "Транспортный ствол" Caption = "Транспортный ствол",
Order = 5f
}, },
new new
{ {
Id = 6, Id = 6,
Caption = "Хвостовик" Caption = "Хвостовик",
Order = 6f
}, },
new new
{ {
Id = 7, Id = 7,
Caption = "Пилотный ствол 2" Caption = "Пилотный ствол 2",
Order = 4.1f
}, },
new new
{ {
Id = 8, Id = 8,
Caption = "Направление 2" Caption = "Направление 2",
Order = 0.1f
}, },
new new
{ {
Id = 9, Id = 9,
Caption = "Кондуктор 2" Caption = "Кондуктор 2",
Order = 1.1f
}, },
new new
{ {
Id = 10, Id = 10,
Caption = "Эксплуатационная колонна 2" Caption = "Эксплуатационная колонна 2",
Order = 3.1f
}, },
new new
{ {
Id = 11, Id = 11,
Caption = "Транспортный ствол 2" Caption = "Транспортный ствол 2",
Order = 5.1f
}, },
new new
{ {
Id = 12, Id = 12,
Caption = "Хвостовик 2" Caption = "Хвостовик 2",
Order = 6.1f
}, },
new new
{ {
Id = 13, Id = 13,
Caption = "Пилотный ствол 3" Caption = "Пилотный ствол 3",
Order = 4.2f
}, },
new new
{ {
Id = 14, Id = 14,
Caption = "Направление 3" Caption = "Направление 3",
Order = 0.2f
}, },
new new
{ {
Id = 15, Id = 15,
Caption = "Кондуктор 3" Caption = "Кондуктор 3",
Order = 1.2f
}, },
new new
{ {
Id = 16, Id = 16,
Caption = "Эксплуатационная колонна 3" Caption = "Эксплуатационная колонна 3",
Order = 3.2f
}, },
new new
{ {
Id = 17, Id = 17,
Caption = "Транспортный ствол 3" Caption = "Транспортный ствол 3",
Order = 5.2f
}, },
new new
{ {
Id = 18, Id = 18,
Caption = "Хвостовик 3" Caption = "Хвостовик 3",
Order = 6.2f
}, },
new new
{ {
Id = 19, Id = 19,
Caption = "Пилотный ствол 4" Caption = "Пилотный ствол 4",
Order = 4.3f
}, },
new new
{ {
Id = 20, Id = 20,
Caption = "Направление 4" Caption = "Направление 4",
Order = 0.3f
}, },
new new
{ {
Id = 21, Id = 21,
Caption = "Кондуктор 4" Caption = "Кондуктор 4",
Order = 1.3f
}, },
new new
{ {
Id = 22, Id = 22,
Caption = "Эксплуатационная колонна 4" Caption = "Эксплуатационная колонна 4",
Order = 3.3f
}, },
new new
{ {
Id = 23, Id = 23,
Caption = "Транспортный ствол 4" Caption = "Транспортный ствол 4",
Order = 5.3f
}, },
new new
{ {
Id = 24, Id = 24,
Caption = "Хвостовик 4" Caption = "Хвостовик 4",
Order = 6.3f
}, },
new new
{ {
Id = 25, Id = 25,
Caption = "Пилотный ствол 5" Caption = "Пилотный ствол 5",
Order = 4.4f
}, },
new new
{ {
Id = 26, Id = 26,
Caption = "Направление 5" Caption = "Направление 5",
Order = 0.4f
}, },
new new
{ {
Id = 27, Id = 27,
Caption = "Кондуктор 5" Caption = "Кондуктор 5",
Order = 1.4f
}, },
new new
{ {
Id = 28, Id = 28,
Caption = "Эксплуатационная колонна 5" Caption = "Эксплуатационная колонна 5",
Order = 3.4f
}, },
new new
{ {
Id = 29, Id = 29,
Caption = "Транспортный ствол 5" Caption = "Транспортный ствол 5",
Order = 5.4f
}, },
new new
{ {
Id = 30, Id = 30,
Caption = "Хвостовик 5" Caption = "Хвостовик 5",
Order = 6.4f
}, },
new new
{ {
Id = 31, Id = 31,
Caption = "Техническая колонна" Caption = "Техническая колонна",
Order = 2f
}, },
new new
{ {
Id = 32, Id = 32,
Caption = "Техническая колонна 2" Caption = "Техническая колонна 2",
Order = 2.1f
}, },
new new
{ {
Id = 33, Id = 33,
Caption = "Техническая колонна 3" Caption = "Техническая колонна 3",
Order = 2.2f
}); });
}); });

View File

@ -4,44 +4,44 @@
{ {
public override WellSectionType[] GetData() => new WellSectionType[] public override WellSectionType[] GetData() => new WellSectionType[]
{ {
new (){ Id = 1, Caption = "Пилотный ствол"}, new (){ Id = 1, Caption = "Пилотный ствол", Order = 4},
new (){ Id = 2, Caption = "Направление"}, new (){ Id = 2, Caption = "Направление", Order = 0},
new (){ Id = 3, Caption = "Кондуктор"}, new (){ Id = 3, Caption = "Кондуктор", Order = 1},
new (){ Id = 4, Caption = "Эксплуатационная колонна"}, new (){ Id = 4, Caption = "Эксплуатационная колонна", Order = 3},
new (){ Id = 5, Caption = "Транспортный ствол"}, new (){ Id = 5, Caption = "Транспортный ствол", Order = 5},
new (){ Id = 6, Caption = "Хвостовик"}, new (){ Id = 6, Caption = "Хвостовик", Order = 6},
new (){ Id = 7, Caption = "Пилотный ствол 2"}, new (){ Id = 7, Caption = "Пилотный ствол 2", Order = 4.1f},
new (){ Id = 8, Caption = "Направление 2"}, new (){ Id = 8, Caption = "Направление 2", Order = 0.1f},
new (){ Id = 9, Caption = "Кондуктор 2"}, new (){ Id = 9, Caption = "Кондуктор 2", Order = 1.1f},
new (){ Id = 10, Caption = "Эксплуатационная колонна 2"}, new (){ Id = 10, Caption = "Эксплуатационная колонна 2", Order = 3.1f},
new (){ Id = 11, Caption = "Транспортный ствол 2"}, new (){ Id = 11, Caption = "Транспортный ствол 2", Order = 5.1f},
new (){ Id = 12, Caption = "Хвостовик 2"}, new (){ Id = 12, Caption = "Хвостовик 2", Order = 6.1f},
new (){ Id = 13, Caption = "Пилотный ствол 3"}, new (){ Id = 13, Caption = "Пилотный ствол 3", Order = 4.2f},
new (){ Id = 14, Caption = "Направление 3"}, new (){ Id = 14, Caption = "Направление 3", Order = 0.2f},
new (){ Id = 15, Caption = "Кондуктор 3"}, new (){ Id = 15, Caption = "Кондуктор 3", Order = 1.2f},
new (){ Id = 16, Caption = "Эксплуатационная колонна 3"}, new (){ Id = 16, Caption = "Эксплуатационная колонна 3", Order = 3.2f},
new (){ Id = 17, Caption = "Транспортный ствол 3"}, new (){ Id = 17, Caption = "Транспортный ствол 3", Order = 5.2f},
new (){ Id = 18, Caption = "Хвостовик 3"}, new (){ Id = 18, Caption = "Хвостовик 3", Order = 6.2f},
new (){ Id = 19, Caption = "Пилотный ствол 4"}, new (){ Id = 19, Caption = "Пилотный ствол 4", Order = 4.3f},
new (){ Id = 20, Caption = "Направление 4"}, new (){ Id = 20, Caption = "Направление 4", Order = 0.3f},
new (){ Id = 21, Caption = "Кондуктор 4"}, new (){ Id = 21, Caption = "Кондуктор 4", Order = 1.3f},
new (){ Id = 22, Caption = "Эксплуатационная колонна 4"}, new (){ Id = 22, Caption = "Эксплуатационная колонна 4", Order = 3.3f},
new (){ Id = 23, Caption = "Транспортный ствол 4"}, new (){ Id = 23, Caption = "Транспортный ствол 4", Order = 5.3f},
new (){ Id = 24, Caption = "Хвостовик 4"}, new (){ Id = 24, Caption = "Хвостовик 4", Order = 6.3f},
new (){ Id = 25, Caption = "Пилотный ствол 5"}, new (){ Id = 25, Caption = "Пилотный ствол 5", Order = 4.4f},
new (){ Id = 26, Caption = "Направление 5"}, new (){ Id = 26, Caption = "Направление 5", Order = 0.4f},
new (){ Id = 27, Caption = "Кондуктор 5"}, new (){ Id = 27, Caption = "Кондуктор 5", Order = 1.4f},
new (){ Id = 28, Caption = "Эксплуатационная колонна 5"}, new (){ Id = 28, Caption = "Эксплуатационная колонна 5", Order = 3.4f},
new (){ Id = 29, Caption = "Транспортный ствол 5"}, new (){ Id = 29, Caption = "Транспортный ствол 5", Order = 5.4f},
new (){ Id = 30, Caption = "Хвостовик 5"}, new (){ Id = 30, Caption = "Хвостовик 5", Order = 6.4f},
new (){ Id = 31, Caption = "Техническая колонна"}, new (){ Id = 31, Caption = "Техническая колонна", Order = 2},
new (){ Id = 32, Caption = "Техническая колонна 2"}, new (){ Id = 32, Caption = "Техническая колонна 2", Order = 2.1f},
new (){ Id = 33, Caption = "Техническая колонна 3"}, new (){ Id = 33, Caption = "Техническая колонна 3", Order = 2.2f},
}; };
} }
} }

View File

@ -17,6 +17,9 @@ namespace AsbCloudDb.Model
[StringLength(255)] [StringLength(255)]
public string Caption { get; set; } = string.Empty; public string Caption { get; set; } = string.Empty;
[Column("order"), Comment("Порядок")]
public float Order { get; set; }
[JsonIgnore] [JsonIgnore]
[InverseProperty(nameof(WellOperation.WellSectionType))] [InverseProperty(nameof(WellOperation.WellSectionType))]
public virtual ICollection<WellOperation> WellOperations { get; set; } = null!; public virtual ICollection<WellOperation> WellOperations { get; set; } = null!;

View File

@ -57,10 +57,13 @@ namespace AsbCloudInfrastructure.Repository
} }
/// <inheritdoc/> /// <inheritdoc/>
public IDictionary<int, string> GetSectionTypes() public IEnumerable<WellSectionTypeDto> GetSectionTypes() =>
=> memoryCache memoryCache
.GetOrCreateBasic(db.Set<WellSectionType>()) .GetOrCreateBasic(db.Set<WellSectionType>())
.ToDictionary(s => s.Id, s => s.Caption); .OrderBy(s => s.Order)
.Select(s => s.Adapt<WellSectionTypeDto>());
public async Task<WellOperationPlanDto> GetOperationsPlanAsync(int idWell, DateTime? currentDate, CancellationToken token) public async Task<WellOperationPlanDto> GetOperationsPlanAsync(int idWell, DateTime? currentDate, CancellationToken token)
{ {

View File

@ -64,7 +64,9 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
if (telemetryIndexStart < 0) if (telemetryIndexStart < 0)
return Enumerable.Empty<ProcessMapReportDto>(); return Enumerable.Empty<ProcessMapReportDto>();
IDictionary<int, string> sectionTypes = wellOperationRepository.GetSectionTypes(); IDictionary<int, string> sectionTypes = wellOperationRepository
.GetSectionTypes()
.ToDictionary(s => s.Id, s => s.Caption);
foreach (var interval in processMapIntervals) foreach (var interval in processMapIntervals)
{ {

View File

@ -43,7 +43,7 @@ namespace AsbCloudWebApi.Controllers
[HttpGet] [HttpGet]
[Route("sectionTypes")] [Route("sectionTypes")]
[Permission] [Permission]
[ProducesResponseType(typeof(IDictionary<int, string>), (int)System.Net.HttpStatusCode.OK)] [ProducesResponseType(typeof(IEnumerable<WellSectionTypeDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult GetSectionTypes() public IActionResult GetSectionTypes()
{ {
var result = operationRepository.GetSectionTypes(); var result = operationRepository.GetSectionTypes();