diff --git a/AsbCloudApp/Data/PlannedTrajectoryDto.cs b/AsbCloudApp/Data/PlannedTrajectoryDto.cs
index 65976d36..d6aa97cc 100644
--- a/AsbCloudApp/Data/PlannedTrajectoryDto.cs
+++ b/AsbCloudApp/Data/PlannedTrajectoryDto.cs
@@ -7,6 +7,11 @@ namespace AsbCloudApp.Data
///
public class PlannedTrajectoryDto
{
+ ///
+ /// ИД строки с координатами
+ ///
+ public int Id { get; set; }
+
///
/// ИД скважины
///
@@ -14,7 +19,7 @@ namespace AsbCloudApp.Data
///
/// Дата загрузки
///
- public DateTimeOffset Date { get; set; }
+ public DateTimeOffset UpdateDate { get; set; }
///
/// ИД пользователя
///
diff --git a/AsbCloudApp/Services/IPlannedTrajectoryImportService.cs b/AsbCloudApp/Services/IPlannedTrajectoryImportService.cs
index 0ed24a34..4b8f214b 100644
--- a/AsbCloudApp/Services/IPlannedTrajectoryImportService.cs
+++ b/AsbCloudApp/Services/IPlannedTrajectoryImportService.cs
@@ -1,30 +1,31 @@
using System.IO;
-
namespace AsbCloudApp.Services
{
+#nullable enable
///
/// Сервис загрузки и обработки плановой траектории из файла
///
public interface IPlannedTrajectoryImportService
{
///
- /// шаблон для заполнения плановой траектории
+ /// скачать шаблон для заполнения плановой траектории
///
///
Stream GetTemplateFile();
///
- /// загрузить строки плановой траектории в .xlsx
+ /// загрузить текущую плановую траекторию в .xlsx
///
///
///
- Stream ExportRows(int idWell);
+ Stream Export(int idWell);
///
- /// закгрузить из excel координаты плановой траектории
+ /// импортировать из excel плановую траекторию
///
///
///
///
- /// Очистить старые перед импортом (если файл проходит валидацию)
+ /// Очистить старые координаты перед импортом (если файл проходит валидацию)
void Import(int idWell, int idUser, Stream stream, bool deleteWellOperationsBeforeImport = false);
}
+#nullable disable
}
diff --git a/AsbCloudApp/Services/IPlannedTrajectoryService.cs b/AsbCloudApp/Services/IPlannedTrajectoryService.cs
index f4b5f9c4..fec54105 100644
--- a/AsbCloudApp/Services/IPlannedTrajectoryService.cs
+++ b/AsbCloudApp/Services/IPlannedTrajectoryService.cs
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
+#nullable enable
///
/// CRUD для работы с плановой траекторией из клиента
///
@@ -17,7 +18,7 @@ namespace AsbCloudApp.Services
///
///
///
- Task> GetCoordinates(int idWell, CancellationToken token);
+ Task?> GetCoordinatesAsync(int idWell, CancellationToken token);
///
/// Добавить строки с координатами
@@ -43,11 +44,12 @@ namespace AsbCloudApp.Services
CancellationToken token);
///
- /// Удалить строку с координатами
+ /// Удалить строки с координатами
///
///
///
///
- Task DeleteAsync(IEnumerable ids, CancellationToken token);
+ Task DeleteRangeAsync(IEnumerable ids, CancellationToken token);
}
+#nullable disable
}
diff --git a/AsbCloudInfrastructure/Services/PlannedTrajectoryService/PlannedTrajectoryImportService.cs b/AsbCloudInfrastructure/Services/PlannedTrajectoryService/PlannedTrajectoryImportService.cs
index 7ce5d848..65d29c54 100644
--- a/AsbCloudInfrastructure/Services/PlannedTrajectoryService/PlannedTrajectoryImportService.cs
+++ b/AsbCloudInfrastructure/Services/PlannedTrajectoryService/PlannedTrajectoryImportService.cs
@@ -11,6 +11,7 @@ using System.Linq;
namespace AsbCloudInfrastructure.Services.PlannedTrajectory
{
+#nullable enable
public class PlannedTrajectoryImportService : IPlannedTrajectoryImportService
{
/*
@@ -51,7 +52,7 @@ namespace AsbCloudInfrastructure.Services.PlannedTrajectory
return stream;
}
- public Stream ExportRows(int idWell)
+ public Stream Export(int idWell)
{
var plannedTrajectorys = db.PlannedTrajectorys
.Where(o => o.IdWell == idWell)
@@ -252,5 +253,6 @@ namespace AsbCloudInfrastructure.Services.PlannedTrajectory
return trajectoryRow;
}
}
+#nullable disable
}
diff --git a/AsbCloudInfrastructure/Services/PlannedTrajectoryService/PlannedTrajectoryService.cs b/AsbCloudInfrastructure/Services/PlannedTrajectoryService/PlannedTrajectoryService.cs
index 60338d0b..53a5f188 100644
--- a/AsbCloudInfrastructure/Services/PlannedTrajectoryService/PlannedTrajectoryService.cs
+++ b/AsbCloudInfrastructure/Services/PlannedTrajectoryService/PlannedTrajectoryService.cs
@@ -38,7 +38,7 @@ namespace AsbCloudInfrastructure.Services.PlannedTrajectory
.ConfigureAwait(false);
}
- public async Task DeleteAsync(IEnumerable ids, CancellationToken token)
+ public async Task DeleteRangeAsync(IEnumerable ids, CancellationToken token)
{
var query = db.PlannedTrajectorys.Where(e => ids.Contains(e.Id));
db.PlannedTrajectorys.RemoveRange(query);
@@ -46,16 +46,16 @@ namespace AsbCloudInfrastructure.Services.PlannedTrajectory
.ConfigureAwait(false);
}
- public async Task?> GetCoordinates(int idWell, CancellationToken token)
+ public async Task?> GetCoordinatesAsync(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 query = db.PlannedTrajectorys
- .Where(x => x.IdWell == idWell);
+ .Where(x => x.IdWell == idWell);
var entities = await query
.OrderBy(e => e.LoadDate)
- .ToListAsync(token);
+ .ToListAsync(token);
var result = entities
.Select(r => Convert(r));
return result;
diff --git a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs
index 0e442ad4..5fdc0482 100644
--- a/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs
+++ b/AsbCloudWebApi/Controllers/PlannedTrajectoryController.cs
@@ -40,7 +40,7 @@ namespace AsbCloudWebApi.Controllers
[Route("template")]
[AllowAnonymous]
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
- public IActionResult GetTamplate()
+ public IActionResult GetTemplate()
{
var stream = plannedTrajectoryImportService.GetTemplateFile();
var fileName = "ЕЦП_шаблон_файла_плановая_траектория.xlsx";
@@ -68,7 +68,7 @@ namespace AsbCloudWebApi.Controllers
idWell, token).ConfigureAwait(false))
return Forbid();
- var stream = plannedTrajectoryImportService.ExportRows(idWell);
+ var stream = plannedTrajectoryImportService.Export(idWell);
var fileName = await wellService.GetWellCaptionByIdAsync(idWell, token) + "_plannedTrajectory.xlsx";
return File(stream, "application/octet-stream", fileName);
}
@@ -82,7 +82,7 @@ namespace AsbCloudWebApi.Controllers
/// Токен отмены задачи
///
[HttpPost]
- //[Permission]
+ [Permission]
[Route("import/{options}")]
public async Task ImportAsync(int idWell,
[FromForm] IFormFileCollection files,
@@ -145,7 +145,7 @@ namespace AsbCloudWebApi.Controllers
idWell, token).ConfigureAwait(false))
return Forbid();
- var result = plannedTrajectoryService.GetCoordinates(idWell,token);
+ var result = plannedTrajectoryService.GetCoordinatesAsync(idWell,token);
return Ok(result);
}
@@ -208,7 +208,7 @@ namespace AsbCloudWebApi.Controllers
token).ConfigureAwait(false))
return Forbid();
- var result = await plannedTrajectoryService.DeleteAsync(new int[] { idRow }, token)
+ var result = await plannedTrajectoryService.DeleteRangeAsync(new int[] { idRow }, token)
.ConfigureAwait(false);
return Ok(result);