Merge pull request 'Фактические траектории' (#65) from feature/fact_trajectory into dev

Reviewed-on: http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer/pulls/65
This commit is contained in:
Никита Фролов 2023-06-30 17:35:18 +05:00
commit ff951dee06
4 changed files with 80 additions and 32 deletions

View File

@ -5,6 +5,11 @@
/// </summary>
public abstract class TrajectoryGeoDto
{
/// <summary>
/// Id скважины
/// </summary>
public int IdWell { get; set; }
/// <summary>
/// Глубина по стволу
/// </summary>
@ -18,13 +23,33 @@ public abstract class TrajectoryGeoDto
/// Азимут Географ.
/// </summary>
public double AzimuthGeo { get; set; }
/// <summary>
/// Азимут Магнитный
/// </summary>
public double? AzimuthMagnetic { get; set; }
/// <summary>
/// Глубина вертикальная
/// </summary>
public double? VerticalDepth { get; set; }
/// <summary>
/// Север отн- но устья
/// </summary>
public double? NorthOrifice { get; set; }
/// <summary>
/// Восток отн- но устья
/// </summary>
public double? EastOrifice { get; set; }
}
/// <summary>
/// Формирование данных по фактической географической траектории
/// </summary>
public class TrajectoryGeoFactDto : TrajectoryGeoDto
{}
{ }

View File

@ -11,11 +11,6 @@ namespace AsbCloudApp.Data
/// </summary>
public int Id { get; set; }
/// <summary>
/// ИД скважины
/// </summary>
public int IdWell { get; set; }
/// <summary>
/// Дата загрузки
/// </summary>
@ -26,31 +21,11 @@ namespace AsbCloudApp.Data
/// </summary>
public int IdUser { get; set; }
/// <summary>
/// Азимут Магнитный
/// </summary>
public double AzimuthMagnetic { get; set; }
/// <summary>
/// Глубина вертикальная
/// </summary>
public double VerticalDepth { get; set; }
/// <summary>
/// Абсолютная отметка
/// </summary>
public double AbsoluteMark { get; set; }
/// <summary>
/// Север отн- но устья
/// </summary>
public double NorthOrifice { get; set; }
/// <summary>
/// Восток отн- но устья
/// </summary>
public double EastOrifice { get; set; }
/// <summary>
/// Восток картографический
/// </summary>

View File

@ -1,5 +1,4 @@
using AsbCloudApp.Data;
using AsbCloudApp.Exceptions;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
@ -23,21 +22,27 @@ namespace AsbCloudInfrastructure.Repository
public async Task<IEnumerable<TrajectoryGeoFactDto>> GetAsync(int idWell, CancellationToken token)
{
var well = wellService.GetOrDefault(idWell);
if (well is null || well.Timezone is null)
throw new ArgumentInvalidException("idWell doesn`t exist", nameof(idWell));
var well = await wellService.GetOrDefaultAsync(idWell,
token);
if (well is null)
return Enumerable.Empty<TrajectoryGeoFactDto>();
var entities = await db.Record7
.AsNoTracking()
.Where(x => x.IdTelemetry == well.IdTelemetry)
.Where(coord => coord.Deptsvym != null && coord.Svyinc != null && coord.Svyazc != null)
.OrderBy(e => e.Deptsvym)
.Select(x => new { x.Deptsvym, x.Svyinc, x.Svyazc })
.ToArrayAsync(token);
var result = entities
.Select(coord => new TrajectoryGeoFactDto
{
IdWell = idWell,
AzimuthMagnetic = coord.Svymtf,
VerticalDepth = coord.Deptsvyv,
NorthOrifice = coord.Svyns,
EastOrifice = coord.Svyew,
WellboreDepth = coord.Deptsvym!.Value,
ZenithAngle = coord.Svyinc!.Value,
AzimuthGeo = coord.Svyazc!.Value

View File

@ -0,0 +1,43 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using AsbCloudApp.Data;
using AsbCloudApp.Repositories;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace AsbCloudWebApi.Controllers;
/// <summary>
/// Фактическая траектория
/// </summary>
[Authorize]
[ApiController]
[Route("api/well/{idWell}/[controller]")]
public class FactTrajectoryController : ControllerBase
{
private readonly ITrajectoryFactRepository trajectoryFactRepository;
public FactTrajectoryController(ITrajectoryFactRepository trajectoryFactRepository)
{
this.trajectoryFactRepository = trajectoryFactRepository;
}
/// <summary>
/// Метод получения всех строк траекторий по id скважины
/// </summary>
/// <param name="idWell">Id скважины</param>
/// <param name="cancellationToken">Токен отмены операции</param>
/// <returns></returns>
[HttpGet]
[Route("getRows")]
[ProducesResponseType(typeof(IEnumerable<TrajectoryGeoPlanDto>), (int)System.Net.HttpStatusCode.OK)]
public async Task<IActionResult> GetRowsAsync([FromRoute] int idWell,
CancellationToken cancellationToken)
{
var factTrajectories = await trajectoryFactRepository.GetAsync(idWell,
cancellationToken);
return Ok(factTrajectories);
}
}