nit DailyReport fixes

This commit is contained in:
ngfrolov 2022-10-07 12:50:16 +05:00
parent 0f1b4285f5
commit 01e07a56ac
2 changed files with 4 additions and 3 deletions

View File

@ -162,7 +162,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
sheet.Cell(AddressWatchData[1]) sheet.Cell(AddressWatchData[1])
._SetValue($"{blockDto.WorkTimeSpinMaster}"); ._SetValue($"{blockDto.WorkTimeSpinMaster}");
sheet.Cell(AddressMetreData[1]) sheet.Cell(AddressMetreData[1])
._SetValue($"{blockDto.PenetrationTorkMaster}"); ._SetValue($"{blockDto.PenetrationSpinMaster}");
sheet._Range(AddressWorkSaubData[2], AddressWorkSaubData[2] + (0, 2)) sheet._Range(AddressWorkSaubData[2], AddressWorkSaubData[2] + (0, 2))
._SetValue("Торк Мастер (демпфирование), ч/:"); ._SetValue("Торк Мастер (демпфирование), ч/:");
sheet.Cell(AddressWatchData[2]) sheet.Cell(AddressWatchData[2])

View File

@ -48,7 +48,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
public async Task<DailyReportDto> GetOrGenerateAsync(int idWell, DateTime date, CancellationToken token) public async Task<DailyReportDto> GetOrGenerateAsync(int idWell, DateTime date, CancellationToken token)
{ {
var dateOnly = DateTime.SpecifyKind(date.Date, DateTimeKind.Unspecified); var dateOnly = DateTime.SpecifyKind(date.Date, DateTimeKind.Utc);
var dailyReportDto = await GetAsync(idWell, dateOnly, token); var dailyReportDto = await GetAsync(idWell, dateOnly, token);
if (dailyReportDto is null) if (dailyReportDto is null)
dailyReportDto = await MakeDefaultDailyReportAsync(idWell, dateOnly, token); dailyReportDto = await MakeDefaultDailyReportAsync(idWell, dateOnly, token);
@ -136,7 +136,8 @@ namespace AsbCloudInfrastructure.Services.DailyReport
var entity = await db.DailyReports var entity = await db.DailyReports
.Where(x => x.IdWell == idWell) .Where(x => x.IdWell == idWell)
.OrderByDescending(x => x.StartDate) .OrderByDescending(x => x.StartDate)
.FirstOrDefaultAsync(r => r.StartDate <= dateOffset, token); .FirstOrDefaultAsync(r => r.StartDate.Year <= dateOffset.Year &&
r.StartDate.DayOfYear <= dateOffset.DayOfYear, token);
if (entity is null) if (entity is null)
return new BhaDto(); return new BhaDto();