From b5f71b9816b80e1630cb9a5766c45017a6de081c Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 25 Mar 2024 10:04:06 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BC=D0=B5=D0=BD=D0=B0=20=D1=82=D0=B8?= =?UTF-8?q?=D0=BF=D0=BE=D0=B2=20=D0=B4=D0=B0=D1=82=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?WellOperationPlanDto=20=D0=B8=20=D0=B2=D1=81=D1=91,=20=D1=87?= =?UTF-8?q?=D1=82=D0=BE=20=D1=81=20=D0=BD=D0=B8=D0=BC=20=D1=81=D0=B2=D1=8F?= =?UTF-8?q?=D0=B7=D0=B0=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Data/WellOperationPlanDto.cs | 2 +- AsbCloudApp/Repositories/IWellOperationRepository.cs | 2 +- .../Repository/WellOperationRepository.cs | 10 +++++----- AsbCloudWebApi/Controllers/WellOperationController.cs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/AsbCloudApp/Data/WellOperationPlanDto.cs b/AsbCloudApp/Data/WellOperationPlanDto.cs index 5c1bac9f..365e06f3 100644 --- a/AsbCloudApp/Data/WellOperationPlanDto.cs +++ b/AsbCloudApp/Data/WellOperationPlanDto.cs @@ -21,7 +21,7 @@ namespace AsbCloudApp.Data /// /// дата последней сопоставленной плановой операции /// - public DateTime? DateLastAssosiatedPlanOperation { get; set; } + public DateTimeOffset? DateLastAssosiatedPlanOperation { get; set; } } diff --git a/AsbCloudApp/Repositories/IWellOperationRepository.cs b/AsbCloudApp/Repositories/IWellOperationRepository.cs index dd39ce52..25550557 100644 --- a/AsbCloudApp/Repositories/IWellOperationRepository.cs +++ b/AsbCloudApp/Repositories/IWellOperationRepository.cs @@ -25,7 +25,7 @@ namespace AsbCloudApp.Repositories /// /// /// - Task GetOperationsPlanAsync(int idWell, DateTime? currentDate, CancellationToken token); + Task GetOperationsPlanAsync(int idWell, DateTimeOffset? currentDate, CancellationToken token); /// /// дата/время первой операции по скважине diff --git a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs index 1c3f6fdc..4e494c77 100644 --- a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs +++ b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs @@ -43,7 +43,7 @@ public class WellOperationRepository : IWellOperationRepository .OrderBy(s => s.Order) .Select(s => s.Adapt()); - public async Task GetOperationsPlanAsync(int idWell, DateTime? currentDate, CancellationToken token) + public async Task GetOperationsPlanAsync(int idWell, DateTimeOffset? currentDate, CancellationToken token) { var timezone = wellService.GetTimezone(idWell); var request = new WellOperationRequest() @@ -67,16 +67,16 @@ public class WellOperationRepository : IWellOperationRepository return result; } - private async Task GetDateLastAssosiatedPlanOperationAsync( + private async Task GetDateLastAssosiatedPlanOperationAsync( int idWell, - DateTime? lessThenDate, + DateTimeOffset? lessThenDate, double timeZoneHours, CancellationToken token) { if (lessThenDate is null) return null; - var currentDateOffset = lessThenDate.Value.ToUtcDateTimeOffset(timeZoneHours); + var currentDateOffset = lessThenDate.Value.ToUniversalTime(); var timeZoneOffset = TimeSpan.FromHours(timeZoneHours); var lastFactOperation = await db.WellOperations @@ -90,7 +90,7 @@ public class WellOperationRepository : IWellOperationRepository .ConfigureAwait(false); if (lastFactOperation is not null) - return DateTime.SpecifyKind(lastFactOperation.OperationPlan!.DateStart.UtcDateTime + timeZoneOffset, DateTimeKind.Unspecified); + return lastFactOperation.OperationPlan!.DateStart; return null; } diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index d624e89a..2f2f805b 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -99,7 +99,7 @@ namespace AsbCloudWebApi.Controllers [ProducesResponseType(typeof(WellOperationPlanDto), (int)System.Net.HttpStatusCode.OK)] public async Task GetOperationsPlanAsync( [FromRoute] int idWell, - [FromQuery] DateTime currentDate, + [FromQuery] DateTimeOffset currentDate, CancellationToken token) { if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))