forked from ddrilling/AsbCloudServer
Merge branch 'DrillingModes' into dev
This commit is contained in:
commit
4168e63dad
45
AsbCloudApp/Data/DrillParamsDto.cs
Normal file
45
AsbCloudApp/Data/DrillParamsDto.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
namespace AsbCloudApp.Data
|
||||||
|
{
|
||||||
|
public class DrillParamsDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int IdWell { get; set; }
|
||||||
|
|
||||||
|
public string WellSectionTypeName { get; set; }
|
||||||
|
|
||||||
|
public double DepthStart { get; set; }
|
||||||
|
|
||||||
|
public double DepthEnd { get; set; }
|
||||||
|
|
||||||
|
public double AxialLoadMin { get; set; }
|
||||||
|
|
||||||
|
public double AxialLoadAvg { get; set; }
|
||||||
|
|
||||||
|
public double AxialLoadMax { get; set; }
|
||||||
|
|
||||||
|
public double PressureMin { get; set; }
|
||||||
|
|
||||||
|
public double PressureAvg { get; set; }
|
||||||
|
|
||||||
|
public double PressureMax { get; set; }
|
||||||
|
|
||||||
|
public double TopDriveTorqueMin { get; set; }
|
||||||
|
|
||||||
|
public double TopDriveTorqueAvg { get; set; }
|
||||||
|
|
||||||
|
public double TopDriveTorqueMax { get; set; }
|
||||||
|
|
||||||
|
public double TopDriveSpeedMin { get; set; }
|
||||||
|
|
||||||
|
public double TopDriveSpeedAvg { get; set; }
|
||||||
|
|
||||||
|
public double TopDriveSpeedMax { get; set; }
|
||||||
|
|
||||||
|
public double ConsumptionMin { get; set; }
|
||||||
|
|
||||||
|
public double ConsumptionAvg { get; set; }
|
||||||
|
|
||||||
|
public double ConsumptionMax { get; set; }
|
||||||
|
}
|
||||||
|
}
|
19
AsbCloudApp/Services/IDrillParamsService.cs
Normal file
19
AsbCloudApp/Services/IDrillParamsService.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using AsbCloudApp.Data;
|
||||||
|
|
||||||
|
namespace AsbCloudApp.Services
|
||||||
|
{
|
||||||
|
public interface IDrillParamsService
|
||||||
|
{
|
||||||
|
Task<DrillParamsDto> GetDefaultDrillParamsAsync(int idWell, double startDepth,
|
||||||
|
double endDepth, CancellationToken token = default);
|
||||||
|
|
||||||
|
// Task<IEnumerable<DrillParamsDto>>GetDrillParamsAsync(int idWell,
|
||||||
|
// DrillParamsDto drillParamsDto, CancellationToken token = default);
|
||||||
|
|
||||||
|
Task<int> SaveDrillParamsAsync(int idWell, DrillParamsDto drillParamsDto,
|
||||||
|
CancellationToken token = default);
|
||||||
|
}
|
||||||
|
}
|
@ -34,6 +34,7 @@ namespace AsbCloudDb.Model
|
|||||||
public virtual DbSet<WellOperationCategory> WellOperationCategories { get; set; }
|
public virtual DbSet<WellOperationCategory> WellOperationCategories { get; set; }
|
||||||
public virtual DbSet<WellSectionType> WellSectionTypes { get; set; }
|
public virtual DbSet<WellSectionType> WellSectionTypes { get; set; }
|
||||||
public virtual DbSet<WellType> WellTypes { get; set; }
|
public virtual DbSet<WellType> WellTypes { get; set; }
|
||||||
|
public virtual DbSet<DrillParams> DrillParams { get; set; }
|
||||||
|
|
||||||
//var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
//var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
||||||
// .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
// .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
||||||
@ -179,6 +180,20 @@ namespace AsbCloudDb.Model
|
|||||||
entity.HasIndex(d => d.DateStart);
|
entity.HasIndex(d => d.DateStart);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<DrillParams>(entity =>
|
||||||
|
{
|
||||||
|
// entity.HasOne(d => d.Well)
|
||||||
|
// .WithOne(p => p.)
|
||||||
|
// .HasForeignKey<Well>(d => d.IdTelemetry)
|
||||||
|
// .OnDelete(DeleteBehavior.SetNull)
|
||||||
|
// .HasConstraintName("t_well_t_telemetry_id_fk");
|
||||||
|
|
||||||
|
entity.HasOne(r => r.WellSectionType)
|
||||||
|
.WithMany(w => w.DrillParamsCollection)
|
||||||
|
.HasForeignKey(r => r.IdWellSectionType)
|
||||||
|
.HasConstraintName("t_drill_params_t_well_section_type_id_fk");
|
||||||
|
});
|
||||||
|
|
||||||
FillData(modelBuilder);
|
FillData(modelBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,6 +360,17 @@ namespace AsbCloudDb.Model
|
|||||||
new CompanyType{ Id = 3, Caption = "Сервис автоматизации бурения", },
|
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)
|
public IQueryable<Well> GetWellsForCompany(int idCompany)
|
||||||
|
80
AsbCloudDb/Model/DrillParams.cs
Normal file
80
AsbCloudDb/Model/DrillParams.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
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("depth_start"), Comment("Стартовая глубина")]
|
||||||
|
public double DepthStart { get; set; }
|
||||||
|
|
||||||
|
[Column("depth_end"), Comment("Глубина окончания интервала")]
|
||||||
|
public double DepthEnd { get; set; }
|
||||||
|
|
||||||
|
[Column("id_wellsection_type"), 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("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<Measure> Measures { get; set; }
|
||||||
DbSet<MeasureCategory> MeasureCategories { get; set; }
|
DbSet<MeasureCategory> MeasureCategories { get; set; }
|
||||||
DbSet<TelemetryDataSpin> TelemetryDataSpin { get; set; }
|
DbSet<TelemetryDataSpin> TelemetryDataSpin { get; set; }
|
||||||
|
DbSet<DrillParams> DrillParams { get; set; }
|
||||||
|
|
||||||
DatabaseFacade Database { get; }
|
DatabaseFacade Database { get; }
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
namespace AsbCloudDb.Model
|
|
||||||
{
|
|
||||||
public enum SectionType
|
|
||||||
{
|
|
||||||
MeanSeaLevel,
|
|
||||||
MudLine,
|
|
||||||
ConductorCasing,
|
|
||||||
SurfaceCasing,
|
|
||||||
InjectionCasing,
|
|
||||||
IntermediateCasing,
|
|
||||||
ProtectiveCasing,
|
|
||||||
ProductionCasing,
|
|
||||||
ProductionLiner,
|
|
||||||
}
|
|
||||||
}
|
|
@ -21,5 +21,9 @@ namespace AsbCloudDb.Model
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[InverseProperty(nameof(WellOperation.WellSectionType))]
|
[InverseProperty(nameof(WellOperation.WellSectionType))]
|
||||||
public virtual ICollection<WellOperation> WellOperations { get; set; }
|
public virtual ICollection<WellOperation> WellOperations { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
[InverseProperty(nameof(DrillParams.WellSectionType))]
|
||||||
|
public virtual ICollection<DrillParams> DrillParamsCollection { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ namespace AsbCloudInfrastructure
|
|||||||
services.AddTransient<IMeasureService, MeasureService>();
|
services.AddTransient<IMeasureService, MeasureService>();
|
||||||
services.AddTransient<IDrillingProgramService, DrillingProgramService>();
|
services.AddTransient<IDrillingProgramService, DrillingProgramService>();
|
||||||
services.AddTransient<IDrillingProgramApacheService, DrillingProgramApacheService>();
|
services.AddTransient<IDrillingProgramApacheService, DrillingProgramApacheService>();
|
||||||
|
services.AddTransient<IDrillParamsService, DrillParamsService>();
|
||||||
|
|
||||||
// admin crud services:
|
// admin crud services:
|
||||||
services.AddTransient<ICrudService<DepositDto>, CrudServiceBase<DepositDto, Deposit>>();
|
services.AddTransient<ICrudService<DepositDto>, CrudServiceBase<DepositDto, Deposit>>();
|
||||||
|
118
AsbCloudInfrastructure/Services/DrillParamsService.cs
Normal file
118
AsbCloudInfrastructure/Services/DrillParamsService.cs
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Services;
|
||||||
|
using AsbCloudDb.Model;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Mapster;
|
||||||
|
|
||||||
|
namespace AsbCloudInfrastructure.Services
|
||||||
|
{
|
||||||
|
public class DrillParamsService : IDrillParamsService
|
||||||
|
{
|
||||||
|
private readonly IAsbCloudDbContext db;
|
||||||
|
private readonly ITelemetryService telemetryService;
|
||||||
|
|
||||||
|
public DrillParamsService(IAsbCloudDbContext db, ITelemetryService telemetryService)
|
||||||
|
{
|
||||||
|
this.db = db;
|
||||||
|
this.telemetryService = telemetryService;
|
||||||
|
}
|
||||||
|
public async Task<DrillParamsDto> GetDefaultDrillParamsAsync(int idWell, double startDepth,
|
||||||
|
double endDepth, CancellationToken token = default)
|
||||||
|
{
|
||||||
|
var idTelemetry = telemetryService.GetIdTelemetryByIdWell(idWell);
|
||||||
|
|
||||||
|
if (idTelemetry is null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var axialLoads = await GetDrillParamsQuery(idWell, startDepth, endDepth,
|
||||||
|
(telemetry) => telemetry.AxialLoad, token);
|
||||||
|
|
||||||
|
var pressures = await GetDrillParamsQuery(idWell, startDepth, endDepth,
|
||||||
|
(telemetry) => telemetry.Pressure, token);
|
||||||
|
|
||||||
|
// var topDriveTorques = await (from telemetry in db.TelemetryDataSaub
|
||||||
|
// where telemetry.IdTelemetry == idTelemetry &&
|
||||||
|
// telemetry.WellDepth >= startDepth &&
|
||||||
|
// telemetry.WellDepth <= endDepth
|
||||||
|
// group telemetry.Pressure by true into g
|
||||||
|
// select new { Min = g.Min(), Avg = g.Average(), Max = g.Max() })
|
||||||
|
// .DefaultIfEmpty()
|
||||||
|
// .FirstOrDefaultAsync(token);
|
||||||
|
//
|
||||||
|
// var topDriveSpeeds = await (from telemetry in db.TelemetryDataSaub
|
||||||
|
// where telemetry.IdTelemetry == idTelemetry &&
|
||||||
|
// telemetry.WellDepth >= startDepth &&
|
||||||
|
// telemetry.WellDepth <= endDepth
|
||||||
|
// group telemetry.Pressure by true into g
|
||||||
|
// select new { Min = g.Min(), Avg = g.Average(), Max = g.Max() })
|
||||||
|
// .DefaultIfEmpty()
|
||||||
|
// .FirstOrDefaultAsync(token);
|
||||||
|
|
||||||
|
// var consumptions = await (from telemetry in db.TelemetryDataSaub
|
||||||
|
// where telemetry.IdTelemetry == idTelemetry &&
|
||||||
|
// telemetry.WellDepth >= startDepth &&
|
||||||
|
// telemetry.WellDepth <= endDepth
|
||||||
|
// group telemetry.Pressure by true into g
|
||||||
|
// select new { Min = g.Min(), Avg = g.Average(), Max = g.Max() })
|
||||||
|
// .DefaultIfEmpty()
|
||||||
|
// .FirstOrDefaultAsync(token);
|
||||||
|
|
||||||
|
var drillParamsDto = new DrillParamsDto()
|
||||||
|
{
|
||||||
|
IdWell = idWell,
|
||||||
|
DepthStart = startDepth,
|
||||||
|
DepthEnd = endDepth,
|
||||||
|
AxialLoadMin = axialLoads.Min,
|
||||||
|
AxialLoadAvg = axialLoads.Avg,
|
||||||
|
AxialLoadMax = axialLoads.Max,
|
||||||
|
PressureMin = pressures.Min,
|
||||||
|
PressureAvg = pressures.Avg,
|
||||||
|
PressureMax = pressures.Max,
|
||||||
|
// TopDriveTorqueMin = topDriveTorques.Min ?? 0,
|
||||||
|
// TopDriveTorqueAvg = topDriveTorques.Avg ?? 0,
|
||||||
|
// TopDriveTorqueMax = topDriveTorques.Max ?? 0,
|
||||||
|
// TopDriveSpeedMin = topDriveSpeeds.Min ?? 0,
|
||||||
|
// TopDriveSpeedAvg = topDriveSpeeds.Avg ?? 0,
|
||||||
|
// TopDriveSpeedMax = topDriveSpeeds.Max ?? 0,
|
||||||
|
// ConsumptionMin = consumptions.Min ?? 0,
|
||||||
|
// ConsumptionAvg = consumptions.Avg ?? 0,
|
||||||
|
// ConsumptionMax = consumptions.Max ?? 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
return drillParamsDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<int> SaveDrillParamsAsync(int idWell, DrillParamsDto drillParamsDto,
|
||||||
|
CancellationToken token = default)
|
||||||
|
{
|
||||||
|
var entity = drillParamsDto.Adapt<DrillParams>();
|
||||||
|
|
||||||
|
db.DrillParams.Add(entity);
|
||||||
|
|
||||||
|
return db.SaveChangesAsync(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<(double Min, double Avg, double Max)> GetDrillParamsQuery(int idTelemetry,
|
||||||
|
double startDepth, double endDepth, Func<TelemetryDataSaub, double?> func,
|
||||||
|
CancellationToken token = default)
|
||||||
|
{
|
||||||
|
var res = await (from telemetry in db.TelemetryDataSaub
|
||||||
|
where telemetry.IdTelemetry == idTelemetry &&
|
||||||
|
telemetry.WellDepth >= startDepth &&
|
||||||
|
telemetry.WellDepth <= endDepth
|
||||||
|
group telemetry by telemetry.IdTelemetry into g
|
||||||
|
select new { Min = g.Min(func), Avg = g.Average(func), Max = g.Max(func) })
|
||||||
|
.DefaultIfEmpty()
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstOrDefaultAsync(token)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
return (res.Min ?? 0, res.Avg ?? 0, res.Max ?? 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
137
AsbCloudWebApi/Controllers/DrillParamsController.cs
Normal file
137
AsbCloudWebApi/Controllers/DrillParamsController.cs
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Services;
|
||||||
|
|
||||||
|
namespace AsbCloudWebApi.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Контроллер для режимов бурения
|
||||||
|
/// </summary>
|
||||||
|
[Route("/drillParams")]
|
||||||
|
[ApiController]
|
||||||
|
public class DrillParamsController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IDrillParamsService drillParamsService;
|
||||||
|
|
||||||
|
public DrillParamsController(IDrillParamsService drillParamsService)
|
||||||
|
{
|
||||||
|
this.drillParamsService = drillParamsService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращает автоматически расчитанные значения для режимов бурения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="idWell"> id скважины </param>
|
||||||
|
/// <param name="startDepth"> Стартовая глубина </param>
|
||||||
|
/// <param name="endDepth"> Конечная глубина </param>
|
||||||
|
/// <param name="token"> Токен отмены задачи </param>
|
||||||
|
/// <returns> Значения по умолчанию для режимов бурения </returns>
|
||||||
|
[HttpGet("idWell/autoParams")]
|
||||||
|
[ProducesResponseType(typeof(DrillParamsDto), (int) System.Net.HttpStatusCode.OK)]
|
||||||
|
public async Task<IActionResult> GetDefaultDrillParamsAsync(int idWell, double startDepth,
|
||||||
|
double endDepth, CancellationToken token = default)
|
||||||
|
{
|
||||||
|
var idCompany = User.GetCompanyId();
|
||||||
|
|
||||||
|
if (idCompany is null)
|
||||||
|
return Forbid();
|
||||||
|
|
||||||
|
var dto = await drillParamsService.GetDefaultDrillParamsAsync(idWell, startDepth, endDepth, token);
|
||||||
|
|
||||||
|
return Ok(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// Возвращает значения для режимов бурения gj ctrwbzv yf crdf;byt
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="idWell"> id скважины </param>
|
||||||
|
// /// <param name="token"> Токен отмены задачи </param>
|
||||||
|
// /// <returns> Список параметров для режимов бурения на скважине </returns>
|
||||||
|
// [HttpGet("idWell")]
|
||||||
|
// [ProducesResponseType(typeof(IEnumerable<DrillParamsDto>), (int) System.Net.HttpStatusCode.OK)]
|
||||||
|
// public async Task<IActionResult> GetDrillParamsAsync(int idWell,
|
||||||
|
// CancellationToken token = default)
|
||||||
|
// {
|
||||||
|
// var idCompany = User.GetCompanyId();
|
||||||
|
//
|
||||||
|
// if (idCompany is null)
|
||||||
|
// return Forbid();
|
||||||
|
//
|
||||||
|
// var dto = await drillParamsService.GetDrillParamsAsync(idWell, token);
|
||||||
|
//
|
||||||
|
// return Ok(dto);
|
||||||
|
// }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Сохраняет значения для режимов бурения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="idWell"> id скважины </param>
|
||||||
|
/// <param name="drillParamsDto"> Параметры режимов бурений для секции</param>
|
||||||
|
/// <param name="token"> Токен отмены задачи </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("idWell")]
|
||||||
|
[ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||||
|
public async Task<IActionResult> SaveDrillParamsAsync(int idWell,
|
||||||
|
DrillParamsDto drillParamsDto, CancellationToken token = default)
|
||||||
|
{
|
||||||
|
var idCompany = User.GetCompanyId();
|
||||||
|
|
||||||
|
if (idCompany is null)
|
||||||
|
return Forbid();
|
||||||
|
|
||||||
|
var result = await drillParamsService.SaveDrillParamsAsync(idWell,
|
||||||
|
drillParamsDto, token);
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// Изменяет значения для режимов бурения
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="idWell"> id скважины </param>
|
||||||
|
// /// <param name="drillParamsDto"> Параметры режимов бурений для секции</param>
|
||||||
|
// /// <param name="token"> Токен отмены задачи </param>
|
||||||
|
// /// <returns></returns>
|
||||||
|
// [HttpPut("idWell")]
|
||||||
|
// [ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||||
|
// public async Task<IActionResult> EditDrillParamsAsync(int idWell,
|
||||||
|
// DrillParamsDto drillParamsDto, CancellationToken token = default)
|
||||||
|
// {
|
||||||
|
// var idCompany = User.GetCompanyId();
|
||||||
|
//
|
||||||
|
// if (idCompany is null)
|
||||||
|
// return Forbid();
|
||||||
|
//
|
||||||
|
// var result = await drillParamsService.EditDrillParamsAsync(idWell,
|
||||||
|
// drillParamsDto, token);
|
||||||
|
//
|
||||||
|
// return Ok(result);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// Удаляет значения для режимов бурения
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="idWell"> id скважины </param>
|
||||||
|
// /// <param name="drillParamsDto"> Параметры режимов бурений для секции</param>
|
||||||
|
// /// <param name="token"> Токен отмены задачи </param>
|
||||||
|
// /// <returns></returns>
|
||||||
|
// [HttpDelete("idWell")]
|
||||||
|
// [ProducesResponseType(typeof(int), (int) System.Net.HttpStatusCode.OK)]
|
||||||
|
// public async Task<IActionResult> DeleteDrillParamsAsync(int idWell,
|
||||||
|
// DrillParamsDto drillParamsDto, CancellationToken token = default)
|
||||||
|
// {
|
||||||
|
// var idCompany = User.GetCompanyId();
|
||||||
|
//
|
||||||
|
// if (idCompany is null)
|
||||||
|
// return Forbid();
|
||||||
|
//
|
||||||
|
// var result = await drillParamsService.DeleteDrillParamsAsync(idWell,
|
||||||
|
// drillParamsDto, token);
|
||||||
|
//
|
||||||
|
// return Ok(result);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user