forked from ddrilling/AsbCloudServer
CS2-94: Added Drilling params controller, service and model
This commit is contained in:
parent
674fe9586c
commit
c962374b6c
13
AsbCloudApp/Services/IDrillingParamsService.cs
Normal file
13
AsbCloudApp/Services/IDrillingParamsService.cs
Normal file
@ -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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -34,6 +34,7 @@ namespace AsbCloudDb.Model
|
||||
public virtual DbSet<WellOperationCategory> TelemetryOperations { get; set; }
|
||||
public virtual DbSet<WellSectionType> WellSectionTypes { get; set; }
|
||||
public virtual DbSet<WellType> WellTypes { get; set; }
|
||||
public virtual DbSet<DrillParams> DrillParams { get; set; }
|
||||
|
||||
//var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
||||
// .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<DrillParams>(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<ModeType>(entity =>
|
||||
//{
|
||||
// entity.HasData(new List<ModeType>{
|
||||
// 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<Well> GetWellsForCompany(int idCompany)
|
||||
|
82
AsbCloudDb/Model/DrillParams.cs
Normal file
82
AsbCloudDb/Model/DrillParams.cs
Normal file
@ -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; }
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ namespace AsbCloudDb.Model
|
||||
DbSet<Measure> Measures { get; set; }
|
||||
DbSet<MeasureCategory> MeasureCategories { get; set; }
|
||||
DbSet<TelemetryDataSpin> TelemetryDataSpin { get; set; }
|
||||
DbSet<DrillParams> DrillParams { get; set; }
|
||||
|
||||
DatabaseFacade Database { get; }
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
namespace AsbCloudDb.Model
|
||||
{
|
||||
public enum SectionType
|
||||
{
|
||||
MeanSeaLevel,
|
||||
MudLine,
|
||||
ConductorCasing,
|
||||
SurfaceCasing,
|
||||
InjectionCasing,
|
||||
IntermediateCasing,
|
||||
ProtectiveCasing,
|
||||
ProductionCasing,
|
||||
ProductionLiner,
|
||||
}
|
||||
}
|
@ -42,6 +42,7 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<IMeasureService, MeasureService>();
|
||||
services.AddTransient<IDrillingProgramService, DrillingProgramService>();
|
||||
services.AddTransient<IDrillingProgramApacheService, DrillingProgramApacheService>();
|
||||
services.AddTransient<IDrillingParamsService, DrillingParamsService>();
|
||||
|
||||
// admin crud services:
|
||||
services.AddTransient<ICrudService<DepositDto>, CrudServiceBase<DepositDto, Deposit>>();
|
||||
|
14
AsbCloudInfrastructure/Services/DrillingParamsService.cs
Normal file
14
AsbCloudInfrastructure/Services/DrillingParamsService.cs
Normal file
@ -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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
22
AsbCloudWebApi/Controllers/DrillingParamsController.cs
Normal file
22
AsbCloudWebApi/Controllers/DrillingParamsController.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user