diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportDto.cs
index cad747c8..2d54b453 100644
--- a/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportDto.cs
+++ b/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportDto.cs
@@ -1,27 +1,10 @@
-using System;
-
namespace AsbCloudApp.Data.AutogeneratedDailyReport;
///
/// DTO авто-сгенерированного суточного отчёта
///
-public class AutoGeneratedDailyReportDto
+public class AutoGeneratedDailyReportDto : AutoGeneratedDailyReportInfoDto
{
- ///
- /// Дата формирования отчёта
- ///
- public DateOnly ReportDate { get; set; }
-
- ///
- /// Название файла
- ///
- public string FileName { get; set; } = null!;
-
- ///
- /// Размер файла
- ///
- public int FileSize { get; set; }
-
///
/// Блок заголовка
///
diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportInfoDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportInfoDto.cs
new file mode 100644
index 00000000..0034879a
--- /dev/null
+++ b/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportInfoDto.cs
@@ -0,0 +1,25 @@
+using System;
+
+namespace AsbCloudApp.Data.AutogeneratedDailyReport;
+
+///
+/// Базовая информация о суточном отчёте
+///
+public class AutoGeneratedDailyReportInfoDto
+{
+ ///
+ /// Дата формирования отчёта
+ ///
+ public DateOnly ReportDate { get; set; }
+
+ ///
+ /// Название файла
+ ///
+ public string FileName { get; set; } = null!;
+
+ ///
+ /// Размер файла
+ ///
+ public int FileSize { get; set; }
+
+}
\ No newline at end of file
diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/HeadBlockDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/HeadBlockDto.cs
index 125cd80a..43ff5246 100644
--- a/AsbCloudApp/Data/AutogeneratedDailyReport/HeadBlockDto.cs
+++ b/AsbCloudApp/Data/AutogeneratedDailyReport/HeadBlockDto.cs
@@ -1,5 +1,3 @@
-using System;
-
namespace AsbCloudApp.Data.AutogeneratedDailyReport;
///
@@ -10,12 +8,12 @@ public class HeadBlockDto
///
/// Название скважины
///
- public string WellName { get; set; } = null!;
+ public string Well { get; set; } = null!;
///
/// Название куста
///
- public string ClusterName { get; set; } = null!;
+ public string Cluster { get; set; } = null!;
///
/// Заказчик
@@ -26,24 +24,14 @@ public class HeadBlockDto
/// Месторождение
///
public string Deposit { get; set; } = null!;
-
- ///
- /// Начальная дата
- ///
- public DateOnly From { get; set; }
-
- ///
- /// Конечная дата
- ///
- public DateOnly To => From.AddDays(1);
///
/// Глубина забоя на дату начала интервала
///
- public double WellDepthIntervalStartDate { get; set; }
+ public double DepthFrom { get; set; }
///
/// Глубина забоя на дату окончания интервала
///
- public double WellDepthIntervalFinishDate { get; set; }
+ public double DepthTo { get; set; }
}
\ No newline at end of file
diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/LimitingParameterRecordDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/LimitingParameterRecordDto.cs
index 7dc87b05..e62b32d9 100644
--- a/AsbCloudApp/Data/AutogeneratedDailyReport/LimitingParameterRecordDto.cs
+++ b/AsbCloudApp/Data/AutogeneratedDailyReport/LimitingParameterRecordDto.cs
@@ -8,10 +8,10 @@ public class LimitingParameterRecordDto
///
/// Время использования, мин
///
- public double TotalHours { get; set; }
+ public double Hours { get; set; }
///
- /// Проходка
+ /// Проходка, м
///
public double Depth { get; set; }
diff --git a/AsbCloudApp/Services/AutoGeneratedDailyReports/IAutoGeneratedDailyReportService.cs b/AsbCloudApp/Services/AutoGeneratedDailyReports/IAutoGeneratedDailyReportService.cs
index b5a4d5ee..16cdaed6 100644
--- a/AsbCloudApp/Services/AutoGeneratedDailyReports/IAutoGeneratedDailyReportService.cs
+++ b/AsbCloudApp/Services/AutoGeneratedDailyReports/IAutoGeneratedDailyReportService.cs
@@ -20,7 +20,7 @@ public interface IAutoGeneratedDailyReportService
///
///
///
- Task> GetListAsync(int idWell,
+ Task> GetListAsync(int idWell,
AutoGeneratedDailyReportRequest request,
CancellationToken cancellationToken);
diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs
index 89f94c43..ba50a6d4 100644
--- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs
+++ b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs
@@ -48,17 +48,18 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
this.autoGeneratedDailyReportMakerService = autoGeneratedDailyReportMakerService;
}
- public async Task> GetListAsync(int idWell,
+ public async Task> GetListAsync(int idWell,
AutoGeneratedDailyReportRequest request,
CancellationToken cancellationToken)
{
- var result = new PaginationContainer
+ var result = new PaginationContainer
{
Skip = request.Skip ?? 0,
Take = request.Take ?? 10,
+ Items = Enumerable.Empty()
};
- var reports = new List();
+ var reports = new List();
var well = await wellService.GetOrDefaultAsync(idWell, cancellationToken)
?? throw new ArgumentInvalidException("Скважина не найдена", nameof(idWell));
@@ -75,8 +76,9 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
{
var startDate = new DateTime(request.StartDate.Value.Year, request.StartDate.Value.Month,
request.StartDate.Value.Day);
-
- datesRange.From = startDate;
+
+ if(startDate.Date >= datesRange.From.Date)
+ datesRange.From = startDate;
}
if (request.FinishDate.HasValue)
@@ -84,11 +86,14 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
var finishDate = new DateTime(request.FinishDate.Value.Year, request.FinishDate.Value.Month,
request.FinishDate.Value.Day);
- datesRange.To = finishDate;
+ if (finishDate.Date <= datesRange.To.Date)
+ datesRange.To = finishDate;
}
-
- for (var dateFrom = datesRange.From; dateFrom <= datesRange.To; dateFrom = dateFrom.AddDays(1))
+
+ for (int day = result.Skip; (day - result.Skip) < result.Take && (datesRange.From.AddDays(day)) <= datesRange.To; day++)
{
+ var dateFrom = datesRange.From.AddDays(day);
+
reports.Add(new AutoGeneratedDailyReportDto
{
FileName = string.Format(fileNameTemplate, well.Caption, well.Cluster, DateOnly.FromDateTime(dateFrom)),
@@ -96,9 +101,10 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
FileSize = GetFileSize() / 1024,
});
}
-
- result.Items = reports.Skip(result.Skip).Take(result.Take);
+ result.Items = reports;
+ result.Count = reports.Count;
+
return result;
}
@@ -143,13 +149,12 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
return new HeadBlockDto
{
- From = reportDate,
Customer = customer?.Caption ?? string.Empty,
Deposit = well.Deposit ?? string.Empty,
- ClusterName = well.Cluster ?? string.Empty,
- WellName = well.Caption,
- WellDepthIntervalStartDate = factOperations.FirstOrDefault()?.DepthStart ?? 0.00,
- WellDepthIntervalFinishDate = factOperations.LastOrDefault()?.DepthEnd ?? 0.00
+ Cluster = well.Cluster ?? string.Empty,
+ Well = well.Caption,
+ DepthFrom = factOperations.FirstOrDefault()?.DepthStart ?? 0.00,
+ DepthTo = factOperations.LastOrDefault()?.DepthEnd ?? 0.00
};
}
@@ -186,7 +191,7 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
return limitingParameterStats.Select(l => new LimitingParameterRecordDto
{
NameFeedRegulator = l.NameFeedRegulator,
- TotalHours = l.TotalMinutes,
+ Hours = l.TotalMinutes,
PercentDepth = l.Depth / sumDepths,
Depth = l.Depth,
});
@@ -235,7 +240,7 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
private int GetFileSize()
{
- const int fileSizeTemplate = 8192;
+ const int fileSizeTemplate = 10240;
return new Random().Next(1, 8193) + fileSizeTemplate;
}
diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/HeadExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/HeadExcelBlockWriter.cs
index b3ef2fa5..dad6bf35 100644
--- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/HeadExcelBlockWriter.cs
+++ b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/HeadExcelBlockWriter.cs
@@ -22,13 +22,13 @@ public class HeadExcelBlockWriter : IExcelBlockWriter
{
sheet.Cell(customerCell.Item1, customerCell.Item2).Value = report.Head.Customer;
sheet.Cell(depositCell.Item1, depositCell.Item2).Value = report.Head.Deposit;
- sheet.Cell(clusterCell.Item1, clusterCell.Item2).Value = report.Head.ClusterName;
- sheet.Cell(wellCell.Item1, wellCell.Item2).Value = report.Head.WellName;
+ sheet.Cell(clusterCell.Item1, clusterCell.Item2).Value = report.Head.Cluster;
+ sheet.Cell(wellCell.Item1, wellCell.Item2).Value = report.Head.Well;
- sheet.Cell(dateRow, dateFromColumn).Value = report.Head.From;
- sheet.Cell(dateRow, dateFromToColumn).Value = report.Head.To;
+ sheet.Cell(dateRow, dateFromColumn).Value = report.ReportDate;
+ sheet.Cell(dateRow, dateFromToColumn).Value = report.ReportDate.AddDays(1);
- sheet.Cell(depthRow, depthFromColumn).Value = report.Head.WellDepthIntervalStartDate;
- sheet.Cell(depthRow, depthToColumn).Value = report.Head.WellDepthIntervalFinishDate;
+ sheet.Cell(depthRow, depthFromColumn).Value = report.Head.DepthFrom;
+ sheet.Cell(depthRow, depthToColumn).Value = report.Head.DepthTo;
}
}
\ No newline at end of file
diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/LimitingParameterExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/LimitingParameterExcelBlockWriter.cs
index 3fd7b311..8e99e755 100644
--- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/LimitingParameterExcelBlockWriter.cs
+++ b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/LimitingParameterExcelBlockWriter.cs
@@ -24,7 +24,7 @@ public class LimitingParameterExcelBlockWriter : IExcelBlockWriter
row.Cell(columnNameFeedRegulator).Value = report.LimitingParameters[i].NameFeedRegulator;
row.Cell(columnDepth).Value = report.LimitingParameters[i].Depth;
- row.Cell(columnTotalHours).Value = report.LimitingParameters[i].TotalHours;
+ row.Cell(columnTotalHours).Value = report.LimitingParameters[i].Hours;
row.Cell(columnPercentDepth).Value = report.LimitingParameters[i].PercentDepth;
}
}
diff --git a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs
index 7c090aa7..0ef6c6da 100644
--- a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs
+++ b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs
@@ -65,8 +65,8 @@ public class AutoGeneratedDailyReportController : ControllerBase
///
///
[HttpGet]
- [ProducesResponseType(typeof(PaginationContainer), (int)HttpStatusCode.OK)]
- public async Task GetListAsync([FromRoute][Required] int idWell,
+ [ProducesResponseType(typeof(PaginationContainer), (int)HttpStatusCode.OK)]
+ public async Task GetListAsync([FromRoute][Required] int idWell,
[FromQuery] AutoGeneratedDailyReportRequest request,
CancellationToken cancellationToken)
{