2023-10-09 17:16:02 +05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading;
|
2023-10-12 16:03:34 +05:00
|
|
|
|
using System.Threading.Tasks;
|
2023-10-09 17:16:02 +05:00
|
|
|
|
using AsbCloudApp.Data.ProcessMaps;
|
|
|
|
|
using AsbCloudApp.Repositories;
|
|
|
|
|
using AsbCloudApp.Requests;
|
|
|
|
|
using AsbCloudApp.Services;
|
2023-10-12 16:03:34 +05:00
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2023-10-09 17:16:02 +05:00
|
|
|
|
|
|
|
|
|
namespace AsbCloudWebApi.Controllers.SAUB;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Данные РТК для SAUB
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ApiController]
|
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
|
public class TelemetryProcessMapController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
private readonly ITelemetryService telemetryService;
|
2023-10-12 16:03:34 +05:00
|
|
|
|
private readonly IProcessMapPlanRepository<ProcessMapPlanWellDrillingDto> processMapPlanWellDrillingRepository;
|
|
|
|
|
private readonly IProcessMapPlanRepository<ProcessMapPlanWellReamDto> processMapPlanWellReamRepository;
|
2023-10-09 17:16:02 +05:00
|
|
|
|
|
2023-10-12 16:03:34 +05:00
|
|
|
|
public TelemetryProcessMapController(ITelemetryService telemetryService,
|
|
|
|
|
IProcessMapPlanRepository<ProcessMapPlanWellDrillingDto> processMapPlanWellDrillingRepository,
|
|
|
|
|
IProcessMapPlanRepository<ProcessMapPlanWellReamDto> processMapPlanWellReamRepository)
|
2023-10-09 17:16:02 +05:00
|
|
|
|
{
|
2023-10-12 16:03:34 +05:00
|
|
|
|
this.telemetryService = telemetryService;
|
|
|
|
|
this.processMapPlanWellDrillingRepository = processMapPlanWellDrillingRepository;
|
|
|
|
|
this.processMapPlanWellReamRepository = processMapPlanWellReamRepository;
|
2023-10-09 17:16:02 +05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение РТК бурение по Uid телеметрии
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="uid">Уникальный Id телеметрии</param>
|
|
|
|
|
/// <param name="updateFrom">Дата с которой требуется получить РТК</param>
|
|
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
|
|
/// <returns></returns>
|
2023-10-13 09:39:47 +05:00
|
|
|
|
[HttpGet("processMapPlanWellDrilling")]
|
2023-10-12 16:03:34 +05:00
|
|
|
|
[ProducesResponseType(typeof(IEnumerable<ProcessMapPlanWellDrillingDto>), StatusCodes.Status200OK)]
|
2023-10-09 17:16:02 +05:00
|
|
|
|
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
2023-10-13 09:39:47 +05:00
|
|
|
|
public async Task<IActionResult> GetProcessMapPlanWellDrillingByUidAsync(string uid, DateTime updateFrom, CancellationToken cancellationToken)
|
2023-10-09 17:16:02 +05:00
|
|
|
|
{
|
|
|
|
|
var idWell = telemetryService.GetIdWellByTelemetryUid(uid);
|
|
|
|
|
|
2023-10-12 16:03:34 +05:00
|
|
|
|
if (!idWell.HasValue)
|
|
|
|
|
return this.ValidationBadRequest(nameof(uid), $"Wrong uid {uid}");
|
|
|
|
|
|
|
|
|
|
var wellDrillingProcessMaps = await processMapPlanWellDrillingRepository.GetAsync(new[] { new ProcessMapPlanRequest
|
|
|
|
|
{
|
|
|
|
|
IdWell = idWell.Value,
|
|
|
|
|
UpdateFrom = updateFrom
|
|
|
|
|
}}, cancellationToken);
|
2023-10-09 17:16:02 +05:00
|
|
|
|
|
2023-10-12 16:03:34 +05:00
|
|
|
|
return Ok(wellDrillingProcessMaps);
|
2023-10-09 17:16:02 +05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение РТК проработки по Uid телеметрии
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="uid">Уникальный Id телеметрии</param>
|
|
|
|
|
/// <param name="updateFrom">Дата с которой требуется получить РТК</param>
|
|
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
|
|
/// <returns></returns>
|
2023-10-13 09:39:47 +05:00
|
|
|
|
[HttpGet("processMapPlanWellReam")]
|
2023-10-12 16:03:34 +05:00
|
|
|
|
[ProducesResponseType(typeof(IEnumerable<ProcessMapPlanWellReamDto>), StatusCodes.Status200OK)]
|
2023-10-09 17:16:02 +05:00
|
|
|
|
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
2023-10-13 09:39:47 +05:00
|
|
|
|
public async Task<IActionResult> GetProcessMapPlanWellReamByUidAsync(string uid, DateTime updateFrom,
|
2023-10-12 16:03:34 +05:00
|
|
|
|
CancellationToken cancellationToken)
|
2023-10-09 17:16:02 +05:00
|
|
|
|
{
|
|
|
|
|
var idWell = telemetryService.GetIdWellByTelemetryUid(uid);
|
|
|
|
|
|
2023-10-12 16:03:34 +05:00
|
|
|
|
if (!idWell.HasValue)
|
|
|
|
|
return this.ValidationBadRequest(nameof(uid), $"Wrong uid {uid}");
|
2023-10-09 17:16:02 +05:00
|
|
|
|
|
2023-10-12 16:03:34 +05:00
|
|
|
|
var wellReamProcessMaps = await processMapPlanWellReamRepository.GetAsync(new[] { new ProcessMapPlanRequest
|
|
|
|
|
{
|
|
|
|
|
IdWell = idWell.Value,
|
|
|
|
|
UpdateFrom = updateFrom
|
|
|
|
|
}}, cancellationToken);
|
2023-10-09 17:16:02 +05:00
|
|
|
|
|
2023-10-12 16:03:34 +05:00
|
|
|
|
return Ok(wellReamProcessMaps);
|
2023-10-09 17:16:02 +05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|