diff --git a/AsbCloudApp/Services/IDrillingParamsService.cs b/AsbCloudApp/Services/IDrillingParamsService.cs new file mode 100644 index 00000000..4192a696 --- /dev/null +++ b/AsbCloudApp/Services/IDrillingParamsService.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AsbCloudApp.Services +{ + public interface IDrillingParamsService + { + + } +} diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index 21ca685c..920d8fac 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -34,6 +34,7 @@ namespace AsbCloudDb.Model public virtual DbSet TelemetryOperations { get; set; } public virtual DbSet WellSectionTypes { get; set; } public virtual DbSet WellTypes { get; set; } + public virtual DbSet DrillParams { get; set; } //var options = new DbContextOptionsBuilder() // .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True") @@ -179,6 +180,19 @@ namespace AsbCloudDb.Model entity.HasIndex(d => d.DateStart); }); + //modelBuilder.Entity(entity => + //{ + // entity.HasOne(r => r.Well) + // .WithOne(w => w.) + // .HasForeignKey(r => r) + // .HasConstraintName("t_relation_company_well_t_well_id_fk"); + + // entity.HasOne(r => r.WellSectionType) + // .WithOne(w => w.RelationCompaniesWells) + // .HasForeignKey(r => r.IdCompany) + // .HasConstraintName("t_relation_company_well_t_company_id_fk"); + //}); + FillData(modelBuilder); } @@ -345,6 +359,17 @@ namespace AsbCloudDb.Model new CompanyType{ Id = 3, Caption = "Сервис автоматизации бурения", }, }); }); + + //modelBuilder.Entity(entity => + //{ + // entity.HasData(new List{ + // new ModeType{ Id = 1, Caption = "Нагрузка" }, + // new ModeType{ Id = 2, Caption = "Дифф. давление" }, + // new ModeType{ Id = 3, Caption = "Момент на ВСП" }, + // new ModeType{ Id = 4, Caption = "Обороты на ВСП" }, + // new ModeType{ Id = 5, Caption = "Расход" } + // }); + //}); } public IQueryable GetWellsForCompany(int idCompany) diff --git a/AsbCloudDb/Model/DrillParams.cs b/AsbCloudDb/Model/DrillParams.cs new file mode 100644 index 00000000..77bd1b47 --- /dev/null +++ b/AsbCloudDb/Model/DrillParams.cs @@ -0,0 +1,82 @@ +using Microsoft.EntityFrameworkCore; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text.Json.Serialization; +#nullable disable + +namespace AsbCloudDb.Model +{ + [Table("t_drill_params"), Comment("Режим бурения в секции (диапазоны параметров бурения)")] + public class DrillParams : IId + { + [Key] + [Column("id")] + public int Id { get; set; } + + [Column("well_id"), Comment("Id скважины")] + public int IdWell { get; set; } + + [Column("wellsection_type_id"), Comment("Id с типом секции скважины")] + public int IdWellSectionType { get; set; } + + [Column("axial_load_min"), Comment("Минимальная нагрузка")] + public double AxialLoadMin { get; set; } + + [Column("axial_load_avg"), Comment("Средняя нагрузка")] + public double AxialLoadAvg { get; set; } + + [Column("axial_load_max"), Comment("Максимальная нагрузка")] + public double AxialLoadMax { get; set; } + + [Column("pressure_min"), Comment("Минимальное давление")] + public double PressureMin { get; set; } + + [Column("pressure_avg"), Comment("Среднее давление")] + public double PressureAvg { get; set; } + + [Column("pressure_max"), Comment("Максимальное давление")] + public double PressureMax { get; set; } + + [Column("depth_start"), Comment("Минимальный момент на ВСП")] + public double DepthStart { get; set; } + + [Column("depth_end"), Comment("Максимальный момент на ВСП")] + public double DepthEnd { get; set; } + + [Column("top_drive_min"), Comment("Минимальный момент на ВСП")] + public double TopDriveTorqueMin { get; set; } + + [Column("top_drive_avg"), Comment("Средний момент на ВСП")] + public double TopDriveTorqueAvg { get; set; } + + [Column("top_drive_max"), Comment("Максимальный момент на ВСП")] + public double TopDriveTorqueMax { get; set; } + + [Column("top_drive_speed_min"), Comment("Минимальные обороты на ВСП")] + public double TopDriveSpeedMin { get; set; } + + [Column("top_drive_speed_avg"), Comment("Средние обороты на ВСП")] + public double TopDriveSpeedAvg { get; set; } + + [Column("top_drive_speed_max"), Comment("Максимальные обороты на ВСП")] + public double TopDriveSpeedMax { get; set; } + + [Column("consumption_min"), Comment("Минимальный расход")] + public double ConsumptionMin { get; set; } + + [Column("consumption_avg"), Comment("Средний расход")] + public double ConsumptionAvg { get; set; } + + [Column("consumption_max"), Comment("Максимальный расход")] + public double ConsumptionMax { get; set; } + + [JsonIgnore] + [ForeignKey(nameof(IdWell))] + public virtual Well Well { get; set; } + + [JsonIgnore] + [ForeignKey(nameof(IdWellSectionType))] + public virtual WellSectionType WellSectionType { get; set; } + } +} diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs index e4547e09..ea27a463 100644 --- a/AsbCloudDb/Model/IAsbCloudDbContext.cs +++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs @@ -32,6 +32,7 @@ namespace AsbCloudDb.Model DbSet Measures { get; set; } DbSet MeasureCategories { get; set; } DbSet TelemetryDataSpin { get; set; } + DbSet DrillParams { get; set; } DatabaseFacade Database { get; } diff --git a/AsbCloudDb/Model/SectionType.cs b/AsbCloudDb/Model/SectionType.cs deleted file mode 100644 index a529d338..00000000 --- a/AsbCloudDb/Model/SectionType.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace AsbCloudDb.Model -{ - public enum SectionType - { - MeanSeaLevel, - MudLine, - ConductorCasing, - SurfaceCasing, - InjectionCasing, - IntermediateCasing, - ProtectiveCasing, - ProductionCasing, - ProductionLiner, - } -} diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 2989e82d..7798dfe7 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -42,6 +42,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); // admin crud services: services.AddTransient, CrudServiceBase>(); diff --git a/AsbCloudInfrastructure/Services/DrillingParamsService.cs b/AsbCloudInfrastructure/Services/DrillingParamsService.cs new file mode 100644 index 00000000..016a340e --- /dev/null +++ b/AsbCloudInfrastructure/Services/DrillingParamsService.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using AsbCloudApp.Services; + +namespace AsbCloudInfrastructure.Services +{ + public class DrillingParamsService : IDrillingParamsService + { + + } +} diff --git a/AsbCloudWebApi/Controllers/DrillingParamsController.cs b/AsbCloudWebApi/Controllers/DrillingParamsController.cs new file mode 100644 index 00000000..2aa1cafa --- /dev/null +++ b/AsbCloudWebApi/Controllers/DrillingParamsController.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using AsbCloudApp.Services; + +namespace AsbCloudWebApi.Controllers +{ + [Route("/mode")] + [ApiController] + public class DrillingParamsController : ControllerBase + { + private readonly IDrillingParamsService modeService; + + public DrillingParamsController(IDrillingParamsService modeService) + { + this.modeService = modeService; + } + } +}