forked from ddrilling/AsbCloudServer
Смена типов дат внутри DailyReportService, ReportService и SheduleController
This commit is contained in:
parent
55938eadcd
commit
db33e82d02
@ -19,7 +19,7 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="workTime"></param>
|
/// <param name="workTime"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<ScheduleDto>> GetAsync(int idWell, DateTime workTime, CancellationToken token);
|
Task<IEnumerable<ScheduleDto>> GetAsync(int idWell, DateTimeOffset workTime, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// получить бурильщика по idWell и времени
|
/// получить бурильщика по idWell и времени
|
||||||
@ -28,7 +28,7 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="workTime"></param>
|
/// <param name="workTime"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTime workTime, CancellationToken token);
|
Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTimeOffset workTime, CancellationToken token);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получить расписание смен
|
/// Получить расписание смен
|
||||||
|
@ -135,7 +135,7 @@ public class DailyReportService : IDailyReportService
|
|||||||
await UpdateSubsystemBlockAsync(dailyReport, cancellationToken);
|
await UpdateSubsystemBlockAsync(dailyReport, cancellationToken);
|
||||||
|
|
||||||
await AddTrajectoryBlockAsync(dailyReport, cancellationToken);
|
await AddTrajectoryBlockAsync(dailyReport, cancellationToken);
|
||||||
await AddScheduleBlockAsync(dailyReport, cancellationToken);
|
await AddScheduleBlockAsync(dailyReport, geDate, cancellationToken);
|
||||||
await AddProcessMapWellDrillingBlockAsync(dailyReport, cancellationToken);
|
await AddProcessMapWellDrillingBlockAsync(dailyReport, cancellationToken);
|
||||||
|
|
||||||
AddFactWellOperationBlock(dailyReport, factWellOperations);
|
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
|
.Select(s => new ScheduleRecordDto
|
||||||
{
|
{
|
||||||
ShiftStart = s.ShiftStart,
|
ShiftStart = s.ShiftStart,
|
||||||
|
@ -87,6 +87,7 @@ public class ReportService : IReportService
|
|||||||
public async Task<IEnumerable<ReportPropertiesDto>> GetAllReportsByWellAsync(int idWell, CancellationToken token)
|
public async Task<IEnumerable<ReportPropertiesDto>> GetAllReportsByWellAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var timezoneOffset = wellService.GetTimezone(idWell).Hours;
|
var timezoneOffset = wellService.GetTimezone(idWell).Hours;
|
||||||
|
var timeSpan = TimeSpan.FromHours(timezoneOffset);
|
||||||
var propertiesQuery = db.ReportProperties.Include(r => r.File)
|
var propertiesQuery = db.ReportProperties.Include(r => r.File)
|
||||||
.Where(p => p.IdWell == idWell)
|
.Where(p => p.IdWell == idWell)
|
||||||
.OrderBy(o => o.File.UploadDate)
|
.OrderBy(o => o.File.UploadDate)
|
||||||
@ -106,12 +107,12 @@ public class ReportService : IReportService
|
|||||||
IdWell = p.File.IdWell,
|
IdWell = p.File.IdWell,
|
||||||
Name = p.File.Name,
|
Name = p.File.Name,
|
||||||
Size = p.File.Size,
|
Size = p.File.Size,
|
||||||
UploadDate = p.File.UploadDate.ToOffset(TimeSpan.FromHours(timezoneOffset)),
|
UploadDate = p.File.UploadDate.ToOffset(timeSpan),
|
||||||
},
|
},
|
||||||
IdWell = p.IdWell,
|
IdWell = p.IdWell,
|
||||||
Date = p.File.UploadDate.ToRemoteDateTime(timezoneOffset),
|
Date = p.File.UploadDate.ToOffset(timeSpan),
|
||||||
Begin = p.Begin.ToRemoteDateTime(timezoneOffset),
|
Begin = p.Begin.ToOffset(timeSpan),
|
||||||
End = p.End.ToRemoteDateTime(timezoneOffset),
|
End = p.End.ToOffset(timeSpan),
|
||||||
Step = p.Step,
|
Step = p.Step,
|
||||||
Format = p.Format == 0 ? ".pdf" : ".las"
|
Format = p.Format == 0 ? ".pdf" : ".las"
|
||||||
});
|
});
|
||||||
|
@ -33,7 +33,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns>бурильщик</returns>
|
/// <returns>бурильщик</returns>
|
||||||
[HttpGet("driller")]
|
[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))
|
if (!await UserHasAccesToWellAsync(idWell, token))
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
Loading…
Reference in New Issue
Block a user