Смена типов дат внутри DailyReportService, ReportService и SheduleController

This commit is contained in:
Olga Nemt 2024-03-25 09:36:57 +05:00
parent 55938eadcd
commit db33e82d02
4 changed files with 11 additions and 12 deletions

View File

@ -19,7 +19,7 @@ namespace AsbCloudApp.Services
/// <param name="workTime"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<ScheduleDto>> GetAsync(int idWell, DateTime workTime, CancellationToken token);
Task<IEnumerable<ScheduleDto>> GetAsync(int idWell, DateTimeOffset workTime, CancellationToken token);
/// <summary>
/// получить бурильщика по idWell и времени
@ -28,7 +28,7 @@ namespace AsbCloudApp.Services
/// <param name="workTime"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTime workTime, CancellationToken token);
Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTimeOffset workTime, CancellationToken token);
/// <summary>
/// Получить расписание смен

View File

@ -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,

View File

@ -87,6 +87,7 @@ public class ReportService : IReportService
public async Task<IEnumerable<ReportPropertiesDto>> 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"
});

View File

@ -33,7 +33,7 @@ namespace AsbCloudWebApi.Controllers
/// <param name="token"></param>
/// <returns>бурильщик</returns>
[HttpGet("driller")]
public async Task<ActionResult<DrillerDto?>> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token)
public async Task<ActionResult<DrillerDto?>> GetDrillerAsync(int idWell, DateTimeOffset workTime, CancellationToken token)
{
if (!await UserHasAccesToWellAsync(idWell, token))
return Forbid();