diff --git a/AsbCloudApp/Services/IScheduleService.cs b/AsbCloudApp/Services/IScheduleService.cs index 5a28b4c2..81c0d385 100644 --- a/AsbCloudApp/Services/IScheduleService.cs +++ b/AsbCloudApp/Services/IScheduleService.cs @@ -19,7 +19,7 @@ namespace AsbCloudApp.Services /// /// /// - Task> GetAsync(int idWell, DateTime workTime, CancellationToken token); + Task> GetAsync(int idWell, DateTimeOffset workTime, CancellationToken token); /// /// получить бурильщика по idWell и времени @@ -28,7 +28,7 @@ namespace AsbCloudApp.Services /// /// /// - Task GetOrDefaultDrillerAsync(int idWell, DateTime workTime, CancellationToken token); + Task GetOrDefaultDrillerAsync(int idWell, DateTimeOffset workTime, CancellationToken token); /// /// Получить расписание смен diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs index a188426e..7570a95f 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs @@ -135,7 +135,7 @@ public class DailyReportService : IDailyReportService await UpdateSubsystemBlockAsync(dailyReport, cancellationToken); await AddTrajectoryBlockAsync(dailyReport, cancellationToken); - await AddScheduleBlockAsync(dailyReport, cancellationToken); + await AddScheduleBlockAsync(dailyReport, geDate, cancellationToken); await AddProcessMapWellDrillingBlockAsync(dailyReport, cancellationToken); AddFactWellOperationBlock(dailyReport, factWellOperations); @@ -315,11 +315,9 @@ public class DailyReportService : IDailyReportService }; } - private async Task AddScheduleBlockAsync(DailyReportDto dailyReport, CancellationToken cancellationToken) + private async Task AddScheduleBlockAsync(DailyReportDto dailyReport, DateTimeOffset workDate, CancellationToken cancellationToken) { - var workDate = dailyReport.Date.ToDateTime(TimeOnly.MinValue, DateTimeKind.Unspecified); - - dailyReport.ScheduleBlock = (await scheduleRepository.GetAsync(dailyReport.IdWell, workDate, cancellationToken)) + dailyReport.ScheduleBlock = (await scheduleRepository.GetAsync(dailyReport.IdWell, workDate, cancellationToken)) .Select(s => new ScheduleRecordDto { ShiftStart = s.ShiftStart, diff --git a/AsbCloudInfrastructure/Services/ReportService.cs b/AsbCloudInfrastructure/Services/ReportService.cs index 04d7c63b..4d321525 100644 --- a/AsbCloudInfrastructure/Services/ReportService.cs +++ b/AsbCloudInfrastructure/Services/ReportService.cs @@ -87,6 +87,7 @@ public class ReportService : IReportService public async Task> GetAllReportsByWellAsync(int idWell, CancellationToken token) { var timezoneOffset = wellService.GetTimezone(idWell).Hours; + var timeSpan = TimeSpan.FromHours(timezoneOffset); var propertiesQuery = db.ReportProperties.Include(r => r.File) .Where(p => p.IdWell == idWell) .OrderBy(o => o.File.UploadDate) @@ -106,12 +107,12 @@ public class ReportService : IReportService IdWell = p.File.IdWell, Name = p.File.Name, Size = p.File.Size, - UploadDate = p.File.UploadDate.ToOffset(TimeSpan.FromHours(timezoneOffset)), + UploadDate = p.File.UploadDate.ToOffset(timeSpan), }, IdWell = p.IdWell, - Date = p.File.UploadDate.ToRemoteDateTime(timezoneOffset), - Begin = p.Begin.ToRemoteDateTime(timezoneOffset), - End = p.End.ToRemoteDateTime(timezoneOffset), + Date = p.File.UploadDate.ToOffset(timeSpan), + Begin = p.Begin.ToOffset(timeSpan), + End = p.End.ToOffset(timeSpan), Step = p.Step, Format = p.Format == 0 ? ".pdf" : ".las" }); diff --git a/AsbCloudWebApi/Controllers/ScheduleController.cs b/AsbCloudWebApi/Controllers/ScheduleController.cs index a8c73d30..cc56a296 100644 --- a/AsbCloudWebApi/Controllers/ScheduleController.cs +++ b/AsbCloudWebApi/Controllers/ScheduleController.cs @@ -33,7 +33,7 @@ namespace AsbCloudWebApi.Controllers /// /// бурильщик [HttpGet("driller")] - public async Task> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token) + public async Task> GetDrillerAsync(int idWell, DateTimeOffset workTime, CancellationToken token) { if (!await UserHasAccesToWellAsync(idWell, token)) return Forbid();