diff --git a/AsbCloudApp/Data/TrajectoryGeoFactDto.cs b/AsbCloudApp/Data/TrajectoryGeoFactDto.cs
index 0cd896cc..0880e507 100644
--- a/AsbCloudApp/Data/TrajectoryGeoFactDto.cs
+++ b/AsbCloudApp/Data/TrajectoryGeoFactDto.cs
@@ -5,6 +5,11 @@
///
public abstract class TrajectoryGeoDto
{
+ ///
+ /// Id скважины
+ ///
+ public int IdWell { get; set; }
+
///
/// Глубина по стволу
///
@@ -18,13 +23,33 @@ public abstract class TrajectoryGeoDto
/// Азимут Географ.
///
public double AzimuthGeo { get; set; }
+
+ ///
+ /// Азимут Магнитный
+ ///
+ public double? AzimuthMagnetic { get; set; }
+
+ ///
+ /// Глубина вертикальная
+ ///
+ public double? VerticalDepth { get; set; }
+
+ ///
+ /// Север отн- но устья
+ ///
+ public double? NorthOrifice { get; set; }
+
+ ///
+ /// Восток отн- но устья
+ ///
+ public double? EastOrifice { get; set; }
}
///
/// Формирование данных по фактической географической траектории
///
public class TrajectoryGeoFactDto : TrajectoryGeoDto
-{}
+{ }
diff --git a/AsbCloudApp/Data/TrajectoryGeoPlanDto.cs b/AsbCloudApp/Data/TrajectoryGeoPlanDto.cs
index 9f2b3d33..ca538979 100644
--- a/AsbCloudApp/Data/TrajectoryGeoPlanDto.cs
+++ b/AsbCloudApp/Data/TrajectoryGeoPlanDto.cs
@@ -11,11 +11,6 @@ namespace AsbCloudApp.Data
///
public int Id { get; set; }
- ///
- /// ИД скважины
- ///
- public int IdWell { get; set; }
-
///
/// Дата загрузки
///
@@ -26,31 +21,11 @@ namespace AsbCloudApp.Data
///
public int IdUser { get; set; }
- ///
- /// Азимут Магнитный
- ///
- public double AzimuthMagnetic { get; set; }
-
- ///
- /// Глубина вертикальная
- ///
- public double VerticalDepth { get; set; }
-
///
/// Абсолютная отметка
///
public double AbsoluteMark { get; set; }
- ///
- /// Север отн- но устья
- ///
- public double NorthOrifice { get; set; }
-
- ///
- /// Восток отн- но устья
- ///
- public double EastOrifice { get; set; }
-
///
/// Восток картографический
///
diff --git a/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs b/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs
index 21a1ffff..23cf92a6 100644
--- a/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs
+++ b/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs
@@ -1,5 +1,4 @@
using AsbCloudApp.Data;
-using AsbCloudApp.Exceptions;
using AsbCloudApp.Repositories;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
@@ -20,24 +19,30 @@ namespace AsbCloudInfrastructure.Repository
this.db = db;
this.wellService = wellService;
}
-
+
public async Task> 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();
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
diff --git a/AsbCloudWebApi/Controllers/FactTrajectoryController.cs b/AsbCloudWebApi/Controllers/FactTrajectoryController.cs
new file mode 100644
index 00000000..c17ce3fd
--- /dev/null
+++ b/AsbCloudWebApi/Controllers/FactTrajectoryController.cs
@@ -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;
+
+///
+/// Фактическая траектория
+///
+[Authorize]
+[ApiController]
+[Route("api/well/{idWell}/[controller]")]
+public class FactTrajectoryController : ControllerBase
+{
+ private readonly ITrajectoryFactRepository trajectoryFactRepository;
+
+ public FactTrajectoryController(ITrajectoryFactRepository trajectoryFactRepository)
+ {
+ this.trajectoryFactRepository = trajectoryFactRepository;
+ }
+
+ ///
+ /// Метод получения всех строк траекторий по id скважины
+ ///
+ /// Id скважины
+ /// Токен отмены операции
+ ///
+ [HttpGet]
+ [Route("getRows")]
+ [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)]
+ public async Task GetRowsAsync([FromRoute] int idWell,
+ CancellationToken cancellationToken)
+ {
+ var factTrajectories = await trajectoryFactRepository.GetAsync(idWell,
+ cancellationToken);
+
+ return Ok(factTrajectories);
+ }
+}
\ No newline at end of file