From 9723ee3b9e9f3296806168d8914f9f786660e479 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 18 Mar 2024 10:05:20 +0500 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BC=D0=B5=D0=BD=D0=B0=20=D1=82?= =?UTF-8?q?=D0=B8=D0=BF=D0=B0=20=D0=B4=D0=B0=D1=82=20=D0=B2=20WellOperatio?= =?UTF-8?q?nRequestBase=20=D1=81=20=20DateTime=20=D0=BD=D0=B0=20DateTimeOf?= =?UTF-8?q?fset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Requests/WellOperationRequest.cs | 6 ++-- .../Repository/WellOperationRepository.cs | 28 +++++++++---------- .../DailyReport/DailyReportService.cs | 4 +-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/AsbCloudApp/Requests/WellOperationRequest.cs b/AsbCloudApp/Requests/WellOperationRequest.cs index 1d190018..b2e0fc26 100644 --- a/AsbCloudApp/Requests/WellOperationRequest.cs +++ b/AsbCloudApp/Requests/WellOperationRequest.cs @@ -11,12 +11,12 @@ namespace AsbCloudApp.Requests /// /// фильтр по дате начала операции /// - public DateTime? GeDate { get; set; } + public DateTimeOffset? GeDate { get; set; } /// /// фильтр по дате окончания операции /// - public DateTime? LtDate { get; set; } + public DateTimeOffset? LeDate { get; set; } /// /// фильтр. Больше или равно глубины скважины на начало операции. @@ -60,7 +60,7 @@ namespace AsbCloudApp.Requests GeDepth = request.GeDepth; LeDepth = request.LeDepth; GeDate = request.GeDate; - LtDate = request.LtDate; + LeDate = request.LeDate; OperationCategoryIds = request.OperationCategoryIds; OperationType = request.OperationType; diff --git a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs index 329d2502..c75ab4fd 100644 --- a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs +++ b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs @@ -57,7 +57,7 @@ public class WellOperationRepository : IWellOperationRepository .ToArrayAsync(token); var dateLastAssosiatedPlanOperation = await GetDateLastAssosiatedPlanOperationAsync(idWell, currentDate, timezone.Hours, token); - + var result = new WellOperationPlanDto() { WellOperationsPlan = dtos.Select(Convert), @@ -199,9 +199,9 @@ public class WellOperationRepository : IWellOperationRepository { var query = BuildQuery(request) .AsNoTracking(); - + var dtos = await query.ToArrayAsync(token); - + return dtos.Select(Convert); } @@ -222,7 +222,7 @@ public class WellOperationRepository : IWellOperationRepository CancellationToken token) { var query = BuildQuery(request); - + var result = new PaginationContainer { Skip = request.Skip ?? 0, @@ -390,7 +390,7 @@ public class WellOperationRepository : IWellOperationRepository { var timezone = wellService.GetTimezone(request.IdWell); var timeZoneOffset = timezone.Hours; - + var query = db.WellOperations .Include(s => s.WellSectionType) .Include(s => s.OperationCategory) @@ -413,14 +413,14 @@ public class WellOperationRepository : IWellOperationRepository if (request.GeDate.HasValue) { - var geDateOffset = request.GeDate.Value.ToUtcDateTimeOffset(timeZoneOffset); - query = query.Where(e => e.DateStart >= geDateOffset); + //var geDateOffset = request.GeDate.Value.ToUtcDateTimeOffset(timeZoneOffset); + query = query.Where(e => e.DateStart >= request.GeDate); } - if (request.LtDate.HasValue) + if (request.LeDate.HasValue) { - var ltDateOffset = request.LtDate.Value.ToUtcDateTimeOffset(timeZoneOffset); - query = query.Where(e => e.DateStart < ltDateOffset); + //var leDateOffset = request.LeDate.Value.ToUtcDateTimeOffset(timeZoneOffset); + query = query.Where(e => e.DateStart <= request.LeDate); } var currentWellOperations = db.WellOperations @@ -468,7 +468,7 @@ public class WellOperationRepository : IWellOperationRepository { dtos = dtos.SortBy(request.SortFields); } - + dtos = dtos .OrderBy(e => e.DateStart) .ThenBy(e => e.DepthEnd) @@ -533,7 +533,7 @@ public class WellOperationRepository : IWellOperationRepository var timezoneOffset = TimeSpan.FromHours(timezone.Hours); var dtoWithRemoteDateTime = dto.Adapt(); - + dtoWithRemoteDateTime.DateStart = dto.DateStart.ToOffset(TimeSpan.FromHours(timezoneOffset.Hours)); dtoWithRemoteDateTime.LastUpdateDate = dto.LastUpdateDate?.ToOffset(TimeSpan.FromHours(timezoneOffset.Hours)); @@ -605,11 +605,11 @@ public class WellOperationRepository : IWellOperationRepository var geDateUtc = geDate.Value.ToUniversalTime(); query = query.Where(e => e.DateStart >= geDateUtc); } - + var groups = await query .GroupBy(o => new { o.IdWell, o.IdType }) .Select(g => new{ - MaxDate = g.Max(o => o.DateStart), + MaxDate = g.Max(o => o.DateStart), g.Key.IdWell, g.Key.IdType, }) diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs index 43fb0abf..6a4cfba5 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs @@ -114,7 +114,7 @@ public class DailyReportService : IDailyReportService IdWell = idWell, OperationType = WellOperation.IdOperationTypeFact, GeDate = geDate, - LtDate = ltDate + LeDate = ltDate }; var factWellOperations = (await wellOperationRepository.GetAsync(factOperationRequest, cancellationToken)) @@ -191,7 +191,7 @@ public class DailyReportService : IDailyReportService IdWell = idWell, OperationType = WellOperation.IdOperationTypeFact, GeDate = geDateFactWellOperation, - LtDate = ltDateFactWellOperation + LeDate = ltDateFactWellOperation }; var factWellOperations = await wellOperationRepository.GetAsync(factWellOperationRequest, cancellationToken);