From c7c5de563a6ccbcc68d931ad50146e2a0eb969b9 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Tue, 21 Feb 2023 17:16:45 +0500 Subject: [PATCH] =?UTF-8?q?1.=20=D0=A0=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=84=D0=B0=D0=BA=D1=82=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=B8?= =?UTF-8?q?=D1=85=20=D0=B8=20=D0=BF=D0=BB=D0=B0=D0=BD=D0=BE=D0=B2=D1=8B?= =?UTF-8?q?=D1=85=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B9=20(Ge?= =?UTF-8?q?tPageOperationsPlanAsync=20=D0=B8=20GetPageOperationsFactAsync)?= =?UTF-8?q?=202.=20=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BF=D0=BE=D0=BB=D1=83?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=B0=D1=82=D0=B5=D0=B3?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=B8=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B2=20BuildQuery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repository/WellOperationRepository.cs | 5 ++- .../Controllers/WellOperationController.cs | 34 +++++++++++++++++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs index 2467e470..96b23b96 100644 --- a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs +++ b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs @@ -356,7 +356,7 @@ namespace AsbCloudInfrastructure.Repository IdWellSectionType = o.IdWellSectionType, IdCategory = o.IdCategory, - CategoryName = o.WellSectionType.Caption, + CategoryName = o.OperationCategory.Name, WellSectionTypeName = o.WellSectionType.Caption, DateStart = DateTime.SpecifyKind(o.DateStart.UtcDateTime + timeZoneOffset, DateTimeKind.Unspecified), @@ -375,8 +375,7 @@ namespace AsbCloudInfrastructure.Repository .Where(subOp => subOp.IdType == o.IdType) .Where(subOp => subOp.DateStart <= o.DateStart) .Min(subOp => subOp.DateStart)) - .TotalDays, - + .TotalDays }); if (request.SortFields?.Any() == true) diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index 95bbec44..a674b365 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -86,16 +86,18 @@ namespace AsbCloudWebApi.Controllers } /// - /// Отфильтрованный список операций на скважине. Если не применять фильтр, то вернется весь список. Сортированный по глубине затем по дате + /// Отфильтрованный список фактических операций на скважине. + /// Если не применять фильтр, то вернется весь список. Сортированный по глубине затем по дате /// /// id скважины /// /// /// Список операций на скважине [HttpGet] + [Route("fact")] [Permission] [ProducesResponseType(typeof(IEnumerable), (int)System.Net.HttpStatusCode.OK)] - public async Task GetOperationsAsync( + public async Task GetPageOperationsFactAsync( [FromRoute] int idWell, [FromQuery] WellOperationRequestBase request, CancellationToken token) @@ -111,6 +113,34 @@ namespace AsbCloudWebApi.Controllers return Ok(result); } + /// + /// Отфильтрованный список плановых операций на скважине. + /// Если не применять фильтр, то вернется весь список. Сортированный по глубине затем по дате + /// + /// id скважины + /// + /// + /// Список операций на скважине в контейнере для постраничного просмотра + [HttpGet] + [Route("plan")] + [Permission] + [ProducesResponseType(typeof(PaginationContainer), (int)System.Net.HttpStatusCode.OK)] + public async Task GetPageOperationsPlanAsync( + [FromRoute] int idWell, + [FromQuery] WellOperationRequestBase request, + CancellationToken token) + { + if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false)) + return Forbid(); + + var requestToService = new WellOperationRequest(request, idWell); + var result = await operationRepository.GetPageAsync( + requestToService, + token) + .ConfigureAwait(false); + return Ok(result); + } + /// /// Статистика операций по скважине, группированая по категориям ///