diff --git a/AsbCloudInfrastructure/Services/WellOperationService/ScheduleReportService.cs b/AsbCloudInfrastructure/Services/WellOperationService/ScheduleReportService.cs index 1c8b6693..e847179d 100644 --- a/AsbCloudInfrastructure/Services/WellOperationService/ScheduleReportService.cs +++ b/AsbCloudInfrastructure/Services/WellOperationService/ScheduleReportService.cs @@ -12,7 +12,6 @@ using System.Threading.Tasks; namespace AsbCloudInfrastructure.Services.WellOperationService { - public class ScheduleReportService : IScheduleReportService { private readonly IOperationsStatService operationsStatService; @@ -57,27 +56,23 @@ namespace AsbCloudInfrastructure.Services.WellOperationService var plans = tvd .Where(t => t.Plan is not null) .Select(t => t.Plan!) - .OrderBy(t => t.DateStart) - .ToList(); + .OrderBy(t => t.DateStart); FillCurrentScheduleSheet(workbook, plans, sheetNameSchedulePlan); var facts = tvd .Where(t => t.Fact is not null) .Select(t => t.Fact!) - .OrderBy(t => t.DateStart) - .ToList(); + .OrderBy(t => t.DateStart); FillCurrentScheduleSheet(workbook, facts, sheetNameScheduleFact); var predictions = tvd .Where(t => t.Predict is not null) .Select(t => t.Predict!) - .OrderBy(t => t.DateStart) - .ToList(); + .OrderBy(t => t.DateStart); FillCurrentScheduleSheet(workbook, predictions, sheetNameSchedulePrediction); - } - private static void FillCurrentScheduleSheet(XLWorkbook workbook, List tvdList, string sheetName) + private static void FillCurrentScheduleSheet(XLWorkbook workbook, IEnumerable tvdList, string sheetName) { var sheet = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetName); if (sheet is null) @@ -93,22 +88,18 @@ namespace AsbCloudInfrastructure.Services.WellOperationService const int columnDateStart = 7; const int columnDateEnd = 8; - int i = 0; - for (; i < tvdList.Count; i++) + int i = 1; + foreach (var tvdItem in tvdList) { - var tvdItem = tvdList[i]; - if (tvdItem is null) - continue; - - var row = sheet.Row(1 + i + headerRowsCount); - - SetCell(row, columnRowNumber, $"{1 + i}"); + var row = sheet.Row(i + headerRowsCount); + SetCell(row, columnRowNumber, $"{i}"); SetCell(row, columnCaption, $"{tvdItem.CategoryName} {tvdItem.CategoryInfo}".Trim()); SetCell(row, columnWellDepthStart, tvdItem.DepthStart); SetCell(row, columnWellDepthEnd, tvdItem.DepthEnd); SetCell(row, columnDuration, tvdItem.DurationHours); SetCell(row, columnDateStart, tvdItem.DateStart); SetCell(row, columnDateEnd, tvdItem.DateStart.AddHours(tvdItem.DurationHours)); + i++; } } diff --git a/AsbCloudInfrastructure/Services/WellOperationService/ScheduleReportTemplate.xlsx b/AsbCloudInfrastructure/Services/WellOperationService/ScheduleReportTemplate.xlsx index 06926243..7dc25b91 100644 Binary files a/AsbCloudInfrastructure/Services/WellOperationService/ScheduleReportTemplate.xlsx and b/AsbCloudInfrastructure/Services/WellOperationService/ScheduleReportTemplate.xlsx differ