Refactor WellOperation WellDepth split to DepthStart and DepthEnd.

Fix other services to use new model.
This commit is contained in:
Фролов 2021-10-08 11:30:06 +05:00
parent eac35cd3e9
commit 4fe570f3e9
13 changed files with 5111 additions and 221 deletions

View File

@ -23,12 +23,29 @@ namespace AsbCloudApp.Data
/// </summary>
public int IdType { get; set; }
public double WellDepth { get; set; }
/// <summary>
/// Глубина на начало операции, м
/// </summary>
public double DepthStart { get; set; }
public DateTime StartDate { get; set; }
/// <summary>
/// Глубина после завершения операции, м
/// </summary>
public double DepthEnd { get; set; }
/// <summary>
/// Дата начала операции
/// </summary>
public DateTime DateStart { get; set; }
/// <summary>
/// Продолжительность, часы
/// </summary>
public double DurationHours { get; set; }
/// <summary>
/// Полезный комментарий
/// </summary>
public string Comment { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_WellOperation_WellDepth_to_WellDepthEnd : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "depth",
table: "t_well_operation",
newName: "depth_end");
migrationBuilder.RenameColumn(
name: "date",
table: "t_well_operation",
newName: "date_start");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_depth",
table: "t_well_operation",
newName: "IX_t_well_operation_depth_end");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_date",
table: "t_well_operation",
newName: "IX_t_well_operation_date_start");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "depth_end",
table: "t_well_operation",
newName: "depth");
migrationBuilder.RenameColumn(
name: "date_start",
table: "t_well_operation",
newName: "date");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_depth_end",
table: "t_well_operation",
newName: "IX_t_well_operation_depth");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_date_start",
table: "t_well_operation",
newName: "IX_t_well_operation_date");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_WellOperation_WellDepthStart : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<double>(
name: "duration_hours",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Продолжительность, часы",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Продолжительность в часах");
migrationBuilder.AlterColumn<double>(
name: "depth_end",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина забоя после завершения операции, м",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина, на которой производилась операция");
migrationBuilder.AddColumn<double>(
name: "depth_start",
table: "t_well_operation",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Глубина забоя на начало операции, м");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "depth_start",
table: "t_well_operation");
migrationBuilder.AlterColumn<double>(
name: "duration_hours",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Продолжительность в часах",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Продолжительность, часы");
migrationBuilder.AlterColumn<double>(
name: "depth_end",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина, на которой производилась операция",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина забоя после завершения операции, м");
}
}
}

View File

@ -1475,10 +1475,15 @@ namespace AsbCloudDb.Migrations
.HasColumnName("comment")
.HasComment("Комментарий");
b.Property<DateTime>("DateStart")
.HasColumnType("timestamp without time zone")
.HasColumnName("date_start")
.HasComment("Дата начала операции");
b.Property<double>("DurationHours")
.HasColumnType("double precision")
.HasColumnName("duration_hours")
.HasComment("Продолжительность в часах");
.HasComment("Продолжительность, часы");
b.Property<int>("IdCategory")
.HasColumnType("integer")
@ -1500,27 +1505,27 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_well_section_type")
.HasComment("Id тип секции скважины");
b.Property<DateTime>("StartDate")
.HasColumnType("timestamp without time zone")
.HasColumnName("date")
.HasComment("Дата начала операции");
b.Property<double>("WellDepth")
b.Property<double>("WellDepthEnd")
.HasColumnType("double precision")
.HasColumnName("depth")
.HasComment("Глубина, на которой производилась операция");
.HasColumnName("depth_end")
.HasComment("Глубина забоя после завершения операции, м");
b.Property<double>("WellDepthStart")
.HasColumnType("double precision")
.HasColumnName("depth_start")
.HasComment("Глубина забоя на начало операции, м");
b.HasKey("Id");
b.HasIndex("DateStart");
b.HasIndex("IdCategory");
b.HasIndex("IdWell");
b.HasIndex("IdWellSectionType");
b.HasIndex("StartDate");
b.HasIndex("WellDepth");
b.HasIndex("WellDepthEnd");
b.ToTable("t_well_operation");

View File

@ -175,8 +175,8 @@ namespace AsbCloudDb.Model
modelBuilder.Entity<WellOperation>(entity =>
{
entity.HasIndex(d => d.WellDepth);
entity.HasIndex(d => d.StartDate);
entity.HasIndex(d => d.DepthEnd);
entity.HasIndex(d => d.DateStart);
});
FillData(modelBuilder);

View File

@ -25,13 +25,16 @@ namespace AsbCloudDb.Model
[Column("id_type"), Comment("0 = План или 1 = Факт")]
public int IdType { get; set; }
[Column("depth"), Comment("Глубина, на которой производилась операция")]
public double WellDepth { get; set; }
[Column("depth_start"), Comment("Глубина на начало операции, м")]
public double DepthStart { get; set; }
[Column("date"), Comment("Дата начала операции")]
public DateTime StartDate { get; set; }
[Column("depth_end"), Comment("Глубина после завершения операции, м")]
public double DepthEnd { get; set; }
[Column("duration_hours"), Comment("Продолжительность в часах")]
[Column("date_start"), Comment("Дата начала операции")]
public DateTime DateStart { get; set; }
[Column("duration_hours"), Comment("Продолжительность, часы")]
public double DurationHours { get; set; }
[Column("category_info"), Comment("Доп. информация к выбраной категории")]

View File

@ -82,91 +82,91 @@ namespace AsbCloudDevOperations
);
demoContext.WellOperations.AddRange(
new WellOperation { Id = 64049, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 15:30"), DurationHours = 3.5 },
new WellOperation { Id = 31502, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 1.16666666666667 },
new WellOperation { Id = 1531, IdWell = 5, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 44572, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 05:00"), DurationHours = 3.5 },
new WellOperation { Id = 44514, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 19:00"), DurationHours = 3.5 },
new WellOperation { Id = 53383, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 3431, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 15:40"), DurationHours = 3.5 },
new WellOperation { Id = 21460, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 01:10"), DurationHours = 3.5 },
new WellOperation { Id = 30464, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 12:30"), DurationHours = 3.5 },
new WellOperation { Id = 73111, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 13:00"), DurationHours = 3.5 },
new WellOperation { Id = 81351, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 05:10"), DurationHours = 3.5 },
new WellOperation { Id = 24480, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 22:30"), DurationHours = 3.5 },
new WellOperation { Id = 19101, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 21:30"), DurationHours = 3.5 },
new WellOperation { Id = 34738, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 02:30"), DurationHours = 3.5 },
new WellOperation { Id = 37606, IdWell = 5, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 71293, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 22:40"), DurationHours = 3.5 },
new WellOperation { Id = 91696, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 18:30"), DurationHours = 3.5 },
new WellOperation { Id = 77916, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 11:00"), DurationHours = 3.5 },
new WellOperation { Id = 93585, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 42016, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 90466, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 09:10"), DurationHours = 3.5 },
new WellOperation { Id = 15914, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-27 01:30"), DurationHours = 3.5 },
new WellOperation { Id = 63469, IdWell = 4, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 23659, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 06:00"), DurationHours = 3.5 },
new WellOperation { Id = 93508, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 23:00"), DurationHours = 3.5 },
new WellOperation { Id = 74346, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 3139, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-24 22:10"), DurationHours = 3.5 },
new WellOperation { Id = 11429, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 14542, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 21:00"), DurationHours = 3.5 },
new WellOperation { Id = 70906, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 82194, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 02:00"), DurationHours = 3.5 },
new WellOperation { Id = 13578, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 08:00"), DurationHours = 3.5 },
new WellOperation { Id = 57798, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 14:30"), DurationHours = 3.5 },
new WellOperation { Id = 37277, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-25 00:30"), DurationHours = 3.5 },
new WellOperation { Id = 23233, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 07:30"), DurationHours = 3.5 },
new WellOperation { Id = 26075, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 8230, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-26 12:40"), DurationHours = 3.5 },
new WellOperation { Id = 26414, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 15:00"), DurationHours = 3.5 },
new WellOperation { Id = 92747, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 22:00"), DurationHours = 3.5 },
new WellOperation { Id = 89559, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-25 19:10"), DurationHours = 3.5 },
new WellOperation { Id = 99336, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 08:10"), DurationHours = 3.5 },
new WellOperation { Id = 80943, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 04:00"), DurationHours = 3.5 },
new WellOperation { Id = 11934, IdWell = 1, IdWellSectionType = 1, IdCategory = 1006, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 08:10"), DurationHours = 2.33333333333333 },
new WellOperation { Id = 88089, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 11:40"), DurationHours = 3.5 },
new WellOperation { Id = 57116, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 18:00"), DurationHours = 3.5 },
new WellOperation { Id = 57561, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 72783, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 01:40"), DurationHours = 3.5 },
new WellOperation { Id = 75549, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 60717, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 21171, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 13547, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 83361, IdWell = 5, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 58676, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 46864, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 16:00"), DurationHours = 3.5 },
new WellOperation { Id = 95276, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 18:40"), DurationHours = 3.5 },
new WellOperation { Id = 33478, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 3.5 },
new WellOperation { Id = 85086, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 09:30"), DurationHours = 3.5 },
new WellOperation { Id = 38808, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 05:30"), DurationHours = 3.5 },
new WellOperation { Id = 60045, IdWell = 5, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 82773, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 38025, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 08:40"), DurationHours = 3.5 },
new WellOperation { Id = 8312, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 02:10"), DurationHours = 3.5 },
new WellOperation { Id = 84440, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 19:30"), DurationHours = 3.5 },
new WellOperation { Id = 78963, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 05:40"), DurationHours = 3.5 },
new WellOperation { Id = 39690, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 88719, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 64890, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 15:10"), DurationHours = 3.5 },
new WellOperation { Id = 95476, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 04:30"), DurationHours = 3.5 },
new WellOperation { Id = 78257, IdWell = 4, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 41260, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 09:00"), DurationHours = 3.5 },
new WellOperation { Id = 41055, IdWell = 5, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 47051, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 04:40"), DurationHours = 3.5 },
new WellOperation { Id = 14068, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 12:10"), DurationHours = 3.5 },
new WellOperation { Id = 96039, IdWell = 4, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 34668, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 43146, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 15263, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 20802, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 81320, IdWell = 4, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 43902, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 62958, IdWell = 4, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 74174, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 76347, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 01:00"), DurationHours = 3.5 },
new WellOperation { Id = 51329, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 76341, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 11:30"), DurationHours = 3.5 }
new WellOperation { Id = 64049, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-02 15:30"), DurationHours = 3.5 },
new WellOperation { Id = 31502, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 1.16666666666667 },
new WellOperation { Id = 1531, IdWell = 5, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 44572, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-08-27 05:00"), DurationHours = 3.5 },
new WellOperation { Id = 44514, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-02 19:00"), DurationHours = 3.5 },
new WellOperation { Id = 53383, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 3431, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 15:40"), DurationHours = 3.5 },
new WellOperation { Id = 21460, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 01:10"), DurationHours = 3.5 },
new WellOperation { Id = 30464, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-03 12:30"), DurationHours = 3.5 },
new WellOperation { Id = 73111, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-04 13:00"), DurationHours = 3.5 },
new WellOperation { Id = 81351, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, DepthEnd = 1110, DateStart = DateTime.Parse("2021-08-25 05:10"), DurationHours = 3.5 },
new WellOperation { Id = 24480, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-02 22:30"), DurationHours = 3.5 },
new WellOperation { Id = 19101, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 21:30"), DurationHours = 3.5 },
new WellOperation { Id = 34738, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-04 02:30"), DurationHours = 3.5 },
new WellOperation { Id = 37606, IdWell = 5, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 71293, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 22:40"), DurationHours = 3.5 },
new WellOperation { Id = 91696, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 18:30"), DurationHours = 3.5 },
new WellOperation { Id = 77916, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 11:00"), DurationHours = 3.5 },
new WellOperation { Id = 93585, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 42016, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 90466, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-26 09:10"), DurationHours = 3.5 },
new WellOperation { Id = 15914, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-27 01:30"), DurationHours = 3.5 },
new WellOperation { Id = 63469, IdWell = 4, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 23659, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-04 06:00"), DurationHours = 3.5 },
new WellOperation { Id = 93508, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 23:00"), DurationHours = 3.5 },
new WellOperation { Id = 74346, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 3139, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1110, DateStart = DateTime.Parse("2021-08-24 22:10"), DurationHours = 3.5 },
new WellOperation { Id = 11429, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 14542, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 21:00"), DurationHours = 3.5 },
new WellOperation { Id = 70906, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 82194, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 02:00"), DurationHours = 3.5 },
new WellOperation { Id = 13578, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 08:00"), DurationHours = 3.5 },
new WellOperation { Id = 57798, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 14:30"), DurationHours = 3.5 },
new WellOperation { Id = 37277, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-25 00:30"), DurationHours = 3.5 },
new WellOperation { Id = 23233, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 07:30"), DurationHours = 3.5 },
new WellOperation { Id = 26075, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 8230, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-26 12:40"), DurationHours = 3.5 },
new WellOperation { Id = 26414, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 15:00"), DurationHours = 3.5 },
new WellOperation { Id = 92747, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 22:00"), DurationHours = 3.5 },
new WellOperation { Id = 89559, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-25 19:10"), DurationHours = 3.5 },
new WellOperation { Id = 99336, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 08:10"), DurationHours = 3.5 },
new WellOperation { Id = 80943, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 04:00"), DurationHours = 3.5 },
new WellOperation { Id = 11934, IdWell = 1, IdWellSectionType = 1, IdCategory = 1006, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 08:10"), DurationHours = 2.33333333333333 },
new WellOperation { Id = 88089, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 11:40"), DurationHours = 3.5 },
new WellOperation { Id = 57116, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-25 18:00"), DurationHours = 3.5 },
new WellOperation { Id = 57561, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 72783, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, DepthEnd = 1110, DateStart = DateTime.Parse("2021-08-25 01:40"), DurationHours = 3.5 },
new WellOperation { Id = 75549, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 60717, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 21171, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 13547, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 83361, IdWell = 5, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 58676, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 46864, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 16:00"), DurationHours = 3.5 },
new WellOperation { Id = 95276, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 18:40"), DurationHours = 3.5 },
new WellOperation { Id = 33478, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 3.5 },
new WellOperation { Id = 85086, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-04 09:30"), DurationHours = 3.5 },
new WellOperation { Id = 38808, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 05:30"), DurationHours = 3.5 },
new WellOperation { Id = 60045, IdWell = 5, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 82773, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 38025, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 08:40"), DurationHours = 3.5 },
new WellOperation { Id = 8312, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-26 02:10"), DurationHours = 3.5 },
new WellOperation { Id = 84440, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1400, DateStart = DateTime.Parse("2021-09-03 19:30"), DurationHours = 3.5 },
new WellOperation { Id = 78963, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-26 05:40"), DurationHours = 3.5 },
new WellOperation { Id = 39690, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 88719, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 64890, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 15:10"), DurationHours = 3.5 },
new WellOperation { Id = 95476, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 04:30"), DurationHours = 3.5 },
new WellOperation { Id = 78257, IdWell = 4, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 },
new WellOperation { Id = 41260, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, DepthEnd = 1500, DateStart = DateTime.Parse("2021-09-03 09:00"), DurationHours = 3.5 },
new WellOperation { Id = 41055, IdWell = 5, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 47051, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 04:40"), DurationHours = 3.5 },
new WellOperation { Id = 14068, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 1, DepthEnd = 1300, DateStart = DateTime.Parse("2021-08-25 12:10"), DurationHours = 3.5 },
new WellOperation { Id = 96039, IdWell = 4, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 34668, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 43146, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 15263, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 },
new WellOperation { Id = 20802, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 81320, IdWell = 4, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 },
new WellOperation { Id = 43902, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, DepthEnd = 1100, DateStart = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 },
new WellOperation { Id = 62958, IdWell = 4, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, DepthEnd = 1000, DateStart = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 },
new WellOperation { Id = 74174, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, DepthEnd = 800, DateStart = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 },
new WellOperation { Id = 76347, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 01:00"), DurationHours = 3.5 },
new WellOperation { Id = 51329, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, DepthEnd = 1400, DateStart = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 },
new WellOperation { Id = 76341, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, DepthEnd = 1250, DateStart = DateTime.Parse("2021-08-26 11:30"), DurationHours = 3.5 }
);
int res = demoContext.SaveChanges();

View File

@ -0,0 +1,2 @@
Проект имитации панелей оператора.
Посылает телеметрию на бэк.

View File

@ -0,0 +1,37 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ClosedXML.Excel;
using AsbCloudApp.Data;
namespace AsbCloudInfrastructure.Services
{
public class WellOperationImportService
{
private const string sheetNamePlan = "План";
private const string sheetNameFact = "Факт";
public IEnumerable<WellOperationDto> ParseFile(string excelFilePath)
{
if (!File.Exists(excelFilePath))
throw new FileNotFoundException($"Файл {excelFilePath} не найден.");
using var sourceExcelWorkbook = new XLWorkbook(excelFilePath, XLEventTracking.Disabled);
var sheetPlan = sourceExcelWorkbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetNamePlan);
if (sheetPlan is null)
throw new FileFormatException($"Файл {excelFilePath} не не содержит листа {sheetNamePlan}.");
var sheetFact = sourceExcelWorkbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetNameFact);
if (sheetFact is null)
throw new FileFormatException($"Файл {excelFilePath} не не содержит листа {sheetNameFact}.");
var wellOperations = new List<WellOperationDto>();
return wellOperations;
}
}
}

View File

@ -25,7 +25,8 @@ namespace AsbCloudInfrastructure.Services
public IEnumerable<WellOperationCategoryDto> GetCategories()
{
var operationTypes = cachedOperationCategories.Where()
var operationTypes = cachedOperationCategories
//.Where(oc => oc.Code > 999)
.Distinct().OrderBy(o => o.Name);
var result = operationTypes.Adapt<WellOperationCategoryDto>();
@ -60,16 +61,16 @@ namespace AsbCloudInfrastructure.Services
query = query.Where(e => operationCategoryIds.Contains(e.IdCategory));
if (minDepth != double.MinValue)
query = query.Where(e => e.WellDepth >= minDepth);
query = query.Where(e => e.DepthEnd >= minDepth);
if (maxDepth != double.MaxValue)
query = query.Where(e => e.WellDepth <= maxDepth);
query = query.Where(e => e.DepthEnd <= maxDepth);
if (begin != default)
query = query.Where(e => e.StartDate >= begin);
query = query.Where(e => e.DateStart >= begin);
if (end != default)
query = query.Where(e => e.StartDate <= end);
query = query.Where(e => e.DateStart <= end);
var result = new PaginationContainer<WellOperationDto>
{
@ -79,8 +80,8 @@ namespace AsbCloudInfrastructure.Services
};
query = query
.OrderBy(e => e.WellDepth)
.ThenBy(e => e.StartDate)
.OrderBy(e => e.DateStart)
.ThenBy(e => e.DepthEnd)
.ThenBy(e => e.Id);
if (skip > 0)

View File

@ -12,31 +12,6 @@ using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services
{
class OperationParams
{
public OperationParams() { }
public OperationParams(WellOperation operation)
{
Id = operation.Id;
IdWellSectionType = operation.IdWellSectionType;
IdCategory = operation.IdCategory;
Start = operation.StartDate;
WellDepth = operation.WellDepth;
DeltaDepth = 0;
Hours = operation.DurationHours;
}
public int IdWellSectionType { get; }
public int IdCategory { get; }
public int Id { get; }
public DateTime Start { get; }
public double WellDepth { get; set; }
public double DeltaDepth { get; set; }
public double Hours { get; set; }
}
class Race
{
public DateTime StartDate { get; set; }
@ -49,7 +24,7 @@ namespace AsbCloudInfrastructure.Services
public double DeltaHoursTimeNoNpt => (EndDate - StartDate).TotalHours - NonProductiveHours;
public double Speed => DeltaDepth / (DeltaHoursTimeNoNpt + double.Epsilon);
public List<OperationParams> Operations { get; internal set; }
public List<WellOperation> Operations { get; internal set; }
}
public class WellOperationsStatService : IWellOperationsStatService
@ -90,8 +65,8 @@ namespace AsbCloudInfrastructure.Services
var operations = wells
.SelectMany(w => w.WellOperations)
.OrderBy(o => o.StartDate)
.ThenBy(o => o.WellDepth);
.OrderBy(o => o.DateStart)
.ThenBy(o => o.DepthEnd);
var cluster = await cacheCluster.FirstOrDefaultAsync(c => c.Id == idCluster, token);
@ -119,8 +94,8 @@ namespace AsbCloudInfrastructure.Services
{
var operations = await db.WellOperations
.Where(o => o.IdWell == idWell)
.OrderBy(o => o.StartDate) // ускорит дальнейшие сортировки
.ThenBy(o => o.WellDepth)
.OrderBy(o => o.DateStart) // ускорит дальнейшие сортировки
.ThenBy(o => o.DepthEnd)
.AsNoTracking()
.ToListAsync(token);
@ -171,12 +146,12 @@ namespace AsbCloudInfrastructure.Services
.ToDictionary(s => s.Id);
var sections = new List<StatSectionDto>(sectionTypes.Count);
var operationsPlan = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypePlan));
var operationsFact = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypeFact));
var operationsPlan = operations.Where(o => o.IdType == idOperationTypePlan);
var operationsFact = operations.Where(o => o.IdType == idOperationTypeFact);
foreach ((var id, var sectionType) in sectionTypes)
{
StatSectionDto section = new StatSectionDto
var section = new StatSectionDto
{
Id = id,
Caption = sectionType.Caption,
@ -190,8 +165,8 @@ namespace AsbCloudInfrastructure.Services
private static PlanFactBase<StatOperationsDto> GetStat(IEnumerable<WellOperation> operations)
{
var operationsPlan = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypePlan));
var operationsFact = MakeOperationsExt(operations.Where(o => o.IdType == idOperationTypeFact));
var operationsPlan = operations.Where(o => o.IdType == idOperationTypePlan);
var operationsFact = operations.Where(o => o.IdType == idOperationTypeFact);
var section = new PlanFactBase<StatOperationsDto>
{
Plan = CalcStat(operationsPlan),
@ -200,17 +175,17 @@ namespace AsbCloudInfrastructure.Services
return section;
}
private static StatOperationsDto CalcSectionStat(IEnumerable<OperationParams> operations, int idSectionType)
private static StatOperationsDto CalcSectionStat(IEnumerable<WellOperation> operations, int idSectionType)
{
var sectionOperations = operations
.Where(o => o.IdWellSectionType == idSectionType)
.OrderBy(o => o.Start)
.ThenBy(o => o.WellDepth);
.OrderBy(o => o.DateStart)
.ThenBy(o => o.DepthStart);
return CalcStat(sectionOperations);
}
private static StatOperationsDto CalcStat(IEnumerable<OperationParams> operations)
private static StatOperationsDto CalcStat(IEnumerable<WellOperation> operations)
{
if (!operations.Any())
return null;
@ -219,10 +194,10 @@ namespace AsbCloudInfrastructure.Services
var section = new StatOperationsDto
{
Start = operations.First().Start,
End = operations.Max(o => (o.Start.AddHours(o.Hours))),
WellDepthStart = operations.Min(o => o.WellDepth),
WellDepthEnd = operations.Max(o => o.WellDepth),
Start = operations.First().DateStart,
End = operations.Max(o => (o.DateStart.AddHours(o.DurationHours))),
WellDepthStart = operations.Min(o => o.DepthStart),
WellDepthEnd = operations.Max(o => o.DepthStart),
Rop = CalcROP(operations),
RouteSpeed = CalcAvgRaceSpeed(races),
BhaDownSpeed = CalcBhaDownSpeed(races),
@ -230,42 +205,43 @@ namespace AsbCloudInfrastructure.Services
CasingDownSpeed = CalcCasingDownSpeed(operations),
NonProductiveHours = operations
.Where(o => o.IdCategory == idOperationNonProductiveTime)
.Sum(o => o.Hours),
.Sum(o => o.DurationHours),
};
return section;
}
private static double CalcROP(IEnumerable<OperationParams> operationsProps)
private static double CalcROP(IEnumerable<WellOperation> operationsProps)
{
var drillingOperations = operationsProps.Where(o => o.IdCategory == idOperationDrilling);
var dDepth = 0d;
var dHours = 0d;
foreach (var operation in drillingOperations)
{
dDepth += operation.DeltaDepth;
dHours += operation.Hours;
var deltaDepth = operation.DepthEnd - operation.DepthStart;
dDepth += deltaDepth;
dHours += operation.DurationHours;
}
return dDepth / (dHours + double.Epsilon);
}
private static double CalcCasingDownSpeed(IEnumerable<OperationParams> operationsProps)
private static double CalcCasingDownSpeed(IEnumerable<WellOperation> operationsProps)
{
var ops = operationsProps.Where(o => o.IdCategory == idOperationCasingDown);
var depth = 0d;
var dHours = 0d;
foreach (var operation in ops)
{
depth += operation.WellDepth;
dHours += operation.Hours;
depth += operation.DepthStart;
dHours += operation.DurationHours;
}
return depth / (dHours + double.Epsilon);
}
private static IEnumerable<Race> GetCompleteRaces(IEnumerable<OperationParams> operations)
private static IEnumerable<Race> GetCompleteRaces(IEnumerable<WellOperation> operations)
{
var races = new List<Race>();
var iterator = operations
.OrderBy(o => o.Start)
.OrderBy(o => o.DateStart)
.GetEnumerator();
while (iterator.MoveNext())
{
@ -273,20 +249,20 @@ namespace AsbCloudInfrastructure.Services
{
var race = new Race
{
StartDate = iterator.Current.Start.AddHours(iterator.Current.Hours),
StartWellDepth = iterator.Current.WellDepth,
Operations = new List<OperationParams>(4),
StartDate = iterator.Current.DateStart.AddHours(iterator.Current.DurationHours),
StartWellDepth = iterator.Current.DepthStart,
Operations = new List<WellOperation>(10),
};
while (iterator.MoveNext())
{
if (iterator.Current.IdCategory == idOperationNonProductiveTime)
{
race.NonProductiveHours += iterator.Current.Hours;
race.NonProductiveHours += iterator.Current.DurationHours;
}
if (iterator.Current.IdCategory == idOperationBhaDisassembly)
{
race.EndDate = iterator.Current.Start;
race.EndWellDepth = iterator.Current.WellDepth;
race.EndDate = iterator.Current.DateStart;
race.EndWellDepth = iterator.Current.DepthStart;
races.Add(race);
break;
}
@ -319,7 +295,7 @@ namespace AsbCloudInfrastructure.Services
for (var i = 0; i < race.Operations.Count; i++)
{
if (race.Operations[i].IdCategory == idOperationBhaDown)
dHours += race.Operations[i].Hours;
dHours += race.Operations[i].DurationHours;
if (race.Operations[i].IdCategory == idOperationDrilling)
break;
}
@ -337,7 +313,7 @@ namespace AsbCloudInfrastructure.Services
for (var i = race.Operations.Count - 1; i > 0; i--)
{
if (race.Operations[i].IdCategory == idOperationBhaUp)
dHours += race.Operations[i].Hours;
dHours += race.Operations[i].DurationHours;
if (race.Operations[i].IdCategory == idOperationDrilling)
break;
}
@ -351,21 +327,21 @@ namespace AsbCloudInfrastructure.Services
.Include(o => o.OperationCategory)
.Include(o => o.WellSectionType)
.Where(o => o.IdWell == idWell)
.OrderBy(o => o.StartDate)
.ThenBy(o => o.WellDepth)
.OrderBy(o => o.DateStart)
.ThenBy(o => o.DepthEnd)
.AsNoTracking()
.ToListAsync(token)
.ConfigureAwait(false);
var wellOperationsPlan = wellOperations
.Where(o => o.IdType == idOperationTypePlan)
.OrderBy(o => o.StartDate)
.ThenBy(o => o.WellDepth);
.OrderBy(o => o.DateStart)
.ThenBy(o => o.DepthEnd);
var wellOperationsFact = wellOperations
.Where(o => o.IdType == idOperationTypeFact)
.OrderBy(o => o.StartDate)
.ThenBy(o => o.WellDepth);
.OrderBy(o => o.DateStart)
.ThenBy(o => o.DepthEnd);
var sectionsIds = wellOperations
.Select(o => o.IdWellSectionType)
@ -384,8 +360,8 @@ namespace AsbCloudInfrastructure.Services
var planFactPredict = new PlanFactPredictBase<WellOperationDto>
{
Plan = item.Item1?.Adapt<WellOperationDto, WellOperation>(WellOperationDtoMutation),
Fact = item.Item2?.Adapt<WellOperationDto, WellOperation>(WellOperationDtoMutation),
Plan = item.Item1?.Adapt(WellOperationDtoMutation),
Fact = item.Item2?.Adapt(WellOperationDtoMutation),
Predict = null,
};
@ -400,9 +376,12 @@ namespace AsbCloudInfrastructure.Services
return tvd;
var lastMatchPlan = merged[iLastMatch].Item1;
var lastMatchPlanOperationEnd = lastMatchPlan.StartDate.AddHours(lastMatchPlan.DurationHours);
var lastMatchFact = merged[iLastMatch].Item2;
var startOffset = lastMatchFact.StartDate.AddHours(lastMatchFact.DurationHours) - lastMatchPlanOperationEnd;
var lastMatchPlanOperationEnd = lastMatchPlan.DateStart.AddHours(lastMatchPlan.DurationHours);
//var lastMatchFact = merged[iLastMatch].Item2;
//var lastMatchFactDateEnd = lastMatchFact.DateStart.AddHours(lastMatchFact.DurationHours);
var lastFact = merged[iLastFact].Item2;
var lastFactDateEnd = lastFact.DateStart.AddHours(lastFact.DurationHours);
var startOffset = lastFactDateEnd - lastMatchPlanOperationEnd;
for (int i = iLastMatch + 1; i < merged.Count; i++)
{
@ -410,13 +389,13 @@ namespace AsbCloudInfrastructure.Services
continue;
tvd[i].Predict = merged[i].Item1.Adapt<WellOperationDto>();
tvd[i].Predict.IdType = 2;
tvd[i].Predict.StartDate = tvd[i].Predict.StartDate + startOffset;
tvd[i].Predict.DateStart = tvd[i].Predict.DateStart + startOffset;
}
return tvd;
}
private List<Tuple<WellOperation, WellOperation>> MergeArraysBySections(
IEnumerable<int> sectionsIds,
IEnumerable<int> sectionsIds,
IOrderedEnumerable<WellOperation> wellOperationsPlan,
IOrderedEnumerable<WellOperation> wellOperationsFact)
{
@ -443,7 +422,7 @@ namespace AsbCloudInfrastructure.Services
m.Add(new Tuple<WellOperation, WellOperation>(item1, item2));
static bool Compare(WellOperation item1, WellOperation item2) =>
item1.IdCategory == item2.IdCategory && Math.Abs(item1.WellDepth - item2.WellDepth) < (30d + 0.005d*(item1.WellDepth + item2.WellDepth));
item1.IdCategory == item2.IdCategory && Math.Abs(item1.DepthEnd - item2.DepthEnd) < (30d + 0.005d * (item1.DepthEnd + item2.DepthEnd));
int i1 = 0;
int i2 = 0;
@ -460,14 +439,14 @@ namespace AsbCloudInfrastructure.Services
Add(a1[i1++], a2[i2++]);
else
{
int nextI1 = Array.FindIndex<WellOperation>(a1, i1, (item) => Compare(item, a2[i2]));
int nextI2 = Array.FindIndex<WellOperation>(a2, i2, (item) => Compare(item, a1[i1]));
int nextI1 = Array.FindIndex(a1, i1, (item) => Compare(item, a2[i2]));
int nextI2 = Array.FindIndex(a2, i2, (item) => Compare(item, a1[i1]));
bool deltaI1_Lt_deltaI2 = (nextI1 - i1) < (nextI2 - i2);
if (nextI1 == -1 && nextI2 == -1)
{
if (a1[i1].WellDepth < a2[i2].WellDepth)
if (a1[i1].DepthEnd < a2[i2].DepthEnd)
{
Add(a1[i1++], null);
}
@ -512,36 +491,5 @@ namespace AsbCloudInfrastructure.Services
dest.CategoryName = source.OperationCategory?.Name;
dest.WellSectionTypeName = source.WellSectionType?.Caption;
};
private static IEnumerable<OperationParams> MakeOperationsExt(IEnumerable<WellOperation> operations)
{
var ops = new List<OperationParams>();
if (operations.Any())
{
var sortedOperations = operations
.OrderBy(o => o.StartDate)
.ThenBy(o => o.WellDepth);
var count = operations.Count();
ops = new List<OperationParams>(count);
var item = operations.ElementAt(0);
var wellDepth = item.WellDepth;
var pre = new OperationParams(item);
var current = new OperationParams(item);
for (int i = 1; i < count; i++)
{
item = operations.ElementAt(i);
current = new OperationParams(item) { WellDepth = Helper.Max(wellDepth, item.WellDepth) };
pre.DeltaDepth = current.WellDepth - wellDepth;
wellDepth = current.WellDepth;
pre.Hours = (current.Start - pre.Start).TotalHours;
ops.Add(pre);
pre = current;
}
ops.Add(current);
}
return ops;
}
}
}