Merge branch 'dev' into feature/refactoring-daily-report-form

This commit is contained in:
ngfrolov 2023-03-23 11:07:10 +05:00
commit df6c423341
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7
10 changed files with 15916 additions and 80 deletions

View File

@ -0,0 +1,19 @@
namespace AsbCloudApp.Data
{
/// <summary>
/// Плановое значение и максимально допустимое ограничение
/// </summary>
public class PlanLimitDto
{
/// <summary>
/// План
/// </summary>
public double Plan { get; set; }
/// <summary>
/// Максимальное ограничение
/// </summary>
public double LimitMax { get; set; }
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudApp.Data.ProcessMap
{
@ -12,7 +13,7 @@ namespace AsbCloudApp.Data.ProcessMap
public int Id { get; set; }
/// <inheritdoc/>
[Range(1,int.MaxValue, ErrorMessage = "Id скважины не может быть меньше 1")]
[Range(1, int.MaxValue, ErrorMessage = "Id скважины не может быть меньше 1")]
public int IdWell { get; set; }
/// <summary>
@ -20,6 +21,12 @@ namespace AsbCloudApp.Data.ProcessMap
/// </summary>
public int? IdUser { get; set; }
/// <summary>
/// Id режима 1-ротор, 2 - слайд
/// </summary>
[Range(1, 2, ErrorMessage = "Id режима должен быть либо 1-ротор либо 2-слайд")]
public int IdMode { get; set; }
/// <summary>
/// Тип секции
/// </summary>
@ -33,7 +40,7 @@ namespace AsbCloudApp.Data.ProcessMap
/// <summary>
/// Стартовая глубина
/// </summary>
[Range(0,50000,ErrorMessage = "Глубина не может быть отрицательной")]
[Range(0, 50000, ErrorMessage = "Глубина не может быть отрицательной")]
public double DepthStart { get; set; }
/// <summary>
@ -45,31 +52,41 @@ namespace AsbCloudApp.Data.ProcessMap
/// <summary>
/// Нагрузка
/// </summary>
public PlanFactDto AxialLoad { get; set; } = null!;
public PlanLimitDto AxialLoad { get; set; } = null!;
/// <summary>
/// Перепад давления
/// </summary>
public PlanFactDto Pressure { get; set; } = null!;
public PlanLimitDto Pressure { get; set; } = null!;
/// <summary>
/// Момент на ВСП
/// </summary>
public PlanFactDto TopDriveTorque { get; set; } = null!;
public PlanLimitDto TopDriveTorque { get; set; } = null!;
/// <summary>
/// Обороты на ВСП
/// </summary>
public PlanFactDto TopDriveSpeed { get; set; } = null!;
public PlanLimitDto TopDriveSpeed { get; set; } = null!;
/// <summary>
/// Расход
/// </summary>
public PlanFactDto Flow { get; set; } = null!;
public PlanLimitDto Flow { get; set; } = null!;
/// <summary>
/// Плановая механическая скорость, м/ч
/// </summary>
public double RopPlan { get; set; }
/// <summary>
/// Плановый процент использования АКБ
/// </summary>
public double UsageSaub { get; set; }
/// <summary>
/// Плановый процент использования spin master
/// </summary>
public double UsageSpin { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,142 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class edit_ProcessMap_add_LimitMax_and_delete_fact : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "axial_load_fact",
table: "t_process_map");
migrationBuilder.DropColumn(
name: "flow_fact",
table: "t_process_map");
migrationBuilder.DropColumn(
name: "pressure_fact",
table: "t_process_map");
migrationBuilder.DropColumn(
name: "top_drive_speed_fact",
table: "t_process_map");
migrationBuilder.DropColumn(
name: "top_drive_torque_fact",
table: "t_process_map");
migrationBuilder.AddColumn<double>(
name: "axial_load_limit_max",
table: "t_process_map",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Нагрузка, допустимый максимум");
migrationBuilder.AddColumn<double>(
name: "flow_limit_max",
table: "t_process_map",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Расход, допустимый максимум");
migrationBuilder.AddColumn<int>(
name: "id_mode",
table: "t_process_map",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "Id режима (1- ротор, 2 слайд)");
migrationBuilder.AddColumn<double>(
name: "pressure_limit_max",
table: "t_process_map",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Перепад давления, допустимый максимум");
migrationBuilder.AddColumn<double>(
name: "top_drive_speed_limit_max",
table: "t_process_map",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Обороты на ВСП, допустимый максимум");
migrationBuilder.AddColumn<double>(
name: "top_drive_torque_limit_max",
table: "t_process_map",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Момент на ВСП, допустимый максимум");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "axial_load_limit_max",
table: "t_process_map");
migrationBuilder.DropColumn(
name: "flow_limit_max",
table: "t_process_map");
migrationBuilder.DropColumn(
name: "id_mode",
table: "t_process_map");
migrationBuilder.DropColumn(
name: "pressure_limit_max",
table: "t_process_map");
migrationBuilder.DropColumn(
name: "top_drive_speed_limit_max",
table: "t_process_map");
migrationBuilder.DropColumn(
name: "top_drive_torque_limit_max",
table: "t_process_map");
migrationBuilder.AddColumn<double>(
name: "axial_load_fact",
table: "t_process_map",
type: "double precision",
nullable: true,
comment: "Нагрузка, факт");
migrationBuilder.AddColumn<double>(
name: "flow_fact",
table: "t_process_map",
type: "double precision",
nullable: true,
comment: "Расход, факт");
migrationBuilder.AddColumn<double>(
name: "pressure_fact",
table: "t_process_map",
type: "double precision",
nullable: true,
comment: "Перепад давления, факт");
migrationBuilder.AddColumn<double>(
name: "top_drive_speed_fact",
table: "t_process_map",
type: "double precision",
nullable: true,
comment: "Обороты на ВСП, факт");
migrationBuilder.AddColumn<double>(
name: "top_drive_torque_fact",
table: "t_process_map",
type: "double precision",
nullable: true,
comment: "Момент на ВСП, факт");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_Usage_to_ProcessMap : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<double>(
name: "usage_saub",
table: "t_process_map",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Плановый процент использования АКБ");
migrationBuilder.AddColumn<double>(
name: "usage_spin",
table: "t_process_map",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Плановый процент использования spin master");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "usage_saub",
table: "t_process_map");
migrationBuilder.DropColumn(
name: "usage_spin",
table: "t_process_map");
}
}
}

View File

@ -1935,10 +1935,10 @@ namespace AsbCloudDb.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<double?>("AxialLoadFact")
b.Property<double>("AxialLoadLimitMax")
.HasColumnType("double precision")
.HasColumnName("axial_load_fact")
.HasComment("Нагрузка, факт");
.HasColumnName("axial_load_limit_max")
.HasComment("Нагрузка, допустимый максимум");
b.Property<double>("AxialLoadPlan")
.HasColumnType("double precision")
@ -1955,16 +1955,21 @@ namespace AsbCloudDb.Migrations
.HasColumnName("depth_start")
.HasComment("Стартовая глубина");
b.Property<double?>("FlowFact")
b.Property<double>("FlowLimitMax")
.HasColumnType("double precision")
.HasColumnName("flow_fact")
.HasComment("Расход, факт");
.HasColumnName("flow_limit_max")
.HasComment("Расход, допустимый максимум");
b.Property<double>("FlowPlan")
.HasColumnType("double precision")
.HasColumnName("flow_plan")
.HasComment("Расход, план");
b.Property<int>("IdMode")
.HasColumnType("integer")
.HasColumnName("id_mode")
.HasComment("Id режима (1- ротор, 2 слайд)");
b.Property<int>("IdUser")
.HasColumnType("integer")
.HasColumnName("id_user")
@ -1985,10 +1990,10 @@ namespace AsbCloudDb.Migrations
.HasColumnName("last_update")
.HasComment("Дата последнего изменения");
b.Property<double?>("PressureFact")
b.Property<double>("PressureLimitMax")
.HasColumnType("double precision")
.HasColumnName("pressure_fact")
.HasComment("Перепад давления, факт");
.HasColumnName("pressure_limit_max")
.HasComment("Перепад давления, допустимый максимум");
b.Property<double>("PressurePlan")
.HasColumnType("double precision")
@ -2000,26 +2005,36 @@ namespace AsbCloudDb.Migrations
.HasColumnName("rop_plan")
.HasComment("Плановая механическая скорость, м/ч");
b.Property<double?>("TopDriveSpeedFact")
b.Property<double>("TopDriveSpeedLimitMax")
.HasColumnType("double precision")
.HasColumnName("top_drive_speed_fact")
.HasComment("Обороты на ВСП, факт");
.HasColumnName("top_drive_speed_limit_max")
.HasComment("Обороты на ВСП, допустимый максимум");
b.Property<double>("TopDriveSpeedPlan")
.HasColumnType("double precision")
.HasColumnName("top_drive_speed_plan")
.HasComment("Обороты на ВСП, план");
b.Property<double?>("TopDriveTorqueFact")
b.Property<double>("TopDriveTorqueLimitMax")
.HasColumnType("double precision")
.HasColumnName("top_drive_torque_fact")
.HasComment("Момент на ВСП, факт");
.HasColumnName("top_drive_torque_limit_max")
.HasComment("Момент на ВСП, допустимый максимум");
b.Property<double>("TopDriveTorquePlan")
.HasColumnType("double precision")
.HasColumnName("top_drive_torque_plan")
.HasComment("Момент на ВСП, план");
b.Property<double>("UsageSaub")
.HasColumnType("double precision")
.HasColumnName("usage_saub")
.HasComment("Плановый процент использования АКБ");
b.Property<double>("UsageSpin")
.HasColumnType("double precision")
.HasColumnName("usage_spin")
.HasComment("Плановый процент использования spin master");
b.HasKey("Id");
b.HasIndex("IdWell");

View File

@ -19,6 +19,9 @@ namespace AsbCloudDb.Model
[Column("id_user"), Comment("Id пользователя")]
public int IdUser { get; set; }
[Column("id_mode"), Comment("Id режима (1- ротор, 2 слайд)")]
public int IdMode { get; set; }
[Column("id_wellsection_type"), Comment("Тип секции")]
public int IdWellSectionType { get; set; }
@ -34,36 +37,42 @@ namespace AsbCloudDb.Model
[Column("axial_load_plan"), Comment("Нагрузка, план")]
public double AxialLoadPlan { get; set; }
[Column("axial_load_fact"), Comment("Нагрузка, факт")]
public double? AxialLoadFact { get; set; }
[Column("axial_load_limit_max"), Comment("Нагрузка, допустимый максимум")]
public double AxialLoadLimitMax { get; set; }
[Column("pressure_plan"), Comment("Перепад давления, план")]
public double PressurePlan { get; set; }
[Column("pressure_fact"), Comment("Перепад давления, факт")]
public double? PressureFact { get; set; }
[Column("pressure_limit_max"), Comment("Перепад давления, допустимый максимум")]
public double PressureLimitMax { get; set; }
[Column("top_drive_torque_plan"), Comment("Момент на ВСП, план")]
public double TopDriveTorquePlan { get; set; }
[Column("top_drive_torque_fact"), Comment("Момент на ВСП, факт")]
public double? TopDriveTorqueFact { get; set; }
[Column("top_drive_torque_limit_max"), Comment("Момент на ВСП, допустимый максимум")]
public double TopDriveTorqueLimitMax { get; set; }
[Column("top_drive_speed_plan"), Comment("Обороты на ВСП, план")]
public double TopDriveSpeedPlan { get; set; }
[Column("top_drive_speed_fact"), Comment("Обороты на ВСП, факт")]
public double? TopDriveSpeedFact { get; set; }
[Column("top_drive_speed_limit_max"), Comment("Обороты на ВСП, допустимый максимум")]
public double TopDriveSpeedLimitMax { get; set; }
[Column("flow_plan"), Comment("Расход, план")]
public double FlowPlan { get; set; }
[Column("flow_fact"), Comment("Расход, факт")]
public double? FlowFact { get; set; }
[Column("flow_limit_max"), Comment("Расход, допустимый максимум")]
public double FlowLimitMax { get; set; }
[Column("rop_plan"), Comment("Плановая механическая скорость, м/ч")]
public double RopPlan { get; set; }
[Column("usage_saub"), Comment("Плановый процент использования АКБ")]
public double UsageSaub { get; set; }
[Column("usage_spin"), Comment("Плановый процент использования spin master")]
public double UsageSpin { get; set; }
[JsonIgnore]
[ForeignKey(nameof(IdWell))]
public virtual Well Well { get; set; } = null!;

View File

@ -109,29 +109,29 @@ namespace AsbCloudInfrastructure.Repository
{
var dto = entity.Adapt<ProcessMapDto>();
dto.LastUpdate = entity.LastUpdate.ToRemoteDateTime(entity.Well.Timezone.Hours);
dto.AxialLoad = new PlanFactDto
dto.AxialLoad = new PlanLimitDto
{
Fact = entity.AxialLoadFact,
LimitMax = entity.AxialLoadLimitMax,
Plan = entity.AxialLoadPlan
};
dto.Flow = new PlanFactDto
dto.Flow = new PlanLimitDto
{
Fact = entity.FlowFact,
LimitMax = entity.FlowLimitMax,
Plan = entity.FlowPlan
};
dto.Pressure = new PlanFactDto
dto.Pressure = new PlanLimitDto
{
Fact = entity.PressureFact,
LimitMax = entity.PressureLimitMax,
Plan = entity.PressurePlan
};
dto.TopDriveSpeed = new PlanFactDto
dto.TopDriveSpeed = new PlanLimitDto
{
Fact = entity.TopDriveSpeedFact,
LimitMax = entity.TopDriveSpeedLimitMax,
Plan = entity.TopDriveSpeedPlan
};
dto.TopDriveTorque = new PlanFactDto
dto.TopDriveTorque = new PlanLimitDto
{
Fact = entity.TopDriveTorqueFact,
LimitMax = entity.TopDriveTorqueLimitMax,
Plan = entity.TopDriveTorquePlan
};
return dto;
@ -141,19 +141,19 @@ namespace AsbCloudInfrastructure.Repository
{
var entity = dto.Adapt<ProcessMap>();
entity.AxialLoadPlan = dto.AxialLoad.Plan;
entity.AxialLoadFact = dto.AxialLoad.Fact;
entity.AxialLoadLimitMax = dto.AxialLoad.LimitMax;
entity.FlowPlan = dto.Flow.Plan;
entity.FlowFact = dto.Flow.Fact;
entity.FlowLimitMax = dto.Flow.LimitMax;
entity.PressurePlan = dto.Pressure.Plan;
entity.PressureFact = dto.Pressure.Fact;
entity.PressureLimitMax = dto.Pressure.LimitMax;
entity.TopDriveSpeedPlan = dto.TopDriveSpeed.Plan;
entity.TopDriveSpeedFact = dto.TopDriveSpeed.Fact;
entity.TopDriveSpeedLimitMax = dto.TopDriveSpeed.LimitMax;
entity.TopDriveTorquePlan = dto.TopDriveTorque.Plan;
entity.TopDriveTorqueFact = dto.TopDriveTorque.Fact;
entity.TopDriveTorqueLimitMax = dto.TopDriveTorque.LimitMax;
return entity;
}

View File

@ -59,38 +59,7 @@ namespace AsbCloudInfrastructure.Repository
IdWellSectionType = x.IdWellSectionType
});
var processMap = await processMapRepository.GetProcessMapAsync(requests, token);
var result = processMap.Select(x => new ProcessMapDto
{
IdWell = x.IdWell,
IdWellSectionType = x.IdWellSectionType,
RopPlan = x.RopPlan,
DepthStart = x.DepthStart,
DepthEnd = x.DepthEnd,
AxialLoad = new PlanFactDto
{
Plan = x.AxialLoad.Fact ?? x.AxialLoad.Plan,
},
Flow = new PlanFactDto
{
Plan = x.Flow.Fact ?? x.Flow.Plan
},
Pressure = new PlanFactDto
{
Plan = x.Pressure.Fact ?? x.Pressure.Plan
},
TopDriveSpeed = new PlanFactDto
{
Plan = x.TopDriveSpeed.Fact ?? x.TopDriveSpeed.Plan
},
TopDriveTorque = new PlanFactDto
{
Plan = x.TopDriveTorque.Fact ?? x.TopDriveTorque.Plan
},
LastUpdate = DateTime.UtcNow
});
var result = await processMapRepository.GetProcessMapAsync(requests, token);
return result;
}