Добавлено заполнение блока с фактическими операциями при формировании фиктивного списка суточных отчётов

This commit is contained in:
Степанов Дмитрий 2023-11-27 11:20:10 +05:00
parent b5985b0fd8
commit 71c9be6a73

View File

@ -152,6 +152,7 @@ public class DailyReportService : IDailyReportService
var dailyReports = new List<DailyReportDto>(); var dailyReports = new List<DailyReportDto>();
var existingDailyReports = await dailyReportRepository.GetAsync(idWell, request, cancellationToken); var existingDailyReports = await dailyReportRepository.GetAsync(idWell, request, cancellationToken);
var factWellOperations = await GetFactWellOperationsAsync(idWell, null, cancellationToken);
if (request.GeDate.HasValue) if (request.GeDate.HasValue)
{ {
@ -201,19 +202,16 @@ public class DailyReportService : IDailyReportService
void AddDailyReport(DateTime date) void AddDailyReport(DateTime date)
{ {
var existingDailyReport = existingDailyReports.FirstOrDefault(d => d.IdWell == idWell && d.Date == date); var dailyReport = existingDailyReports.FirstOrDefault(d => d.IdWell == idWell && d.Date == date)
?? new DailyReportDto
if (existingDailyReport is not null)
{
dailyReports.Add(existingDailyReport);
return;
}
dailyReports.Add(new DailyReportDto
{ {
Date = date, Date = date,
IdWell = idWell IdWell = idWell
}); };
AddFactWellOperationBlock(dailyReport, factWellOperations.Where(o => o.DateStart >= date && o.DateStart <= date.AddDays(1)));
dailyReports.Add(dailyReport);
} }
} }