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))