diff --git a/AsbCloudApp/Data/DailyReport/DailyReportSaubDto.cs b/AsbCloudApp/Data/DailyReport/DailyReportSaubDto.cs
index b4d3481b..0af94d00 100644
--- a/AsbCloudApp/Data/DailyReport/DailyReportSaubDto.cs
+++ b/AsbCloudApp/Data/DailyReport/DailyReportSaubDto.cs
@@ -2,17 +2,17 @@
namespace AsbCloudApp.Data.DailyReport
{
- public class DailyReportSaubDto
+ public class DailyReportSaubDto
{
///
/// Режимы бурения в роторе
///
- public IEnumerable RotorDrillingModes { get; set; }
+ public string RotorDrillingModes { get; set; }
///
/// режимы бурения в слайде
///
- public IEnumerable SlideDrillingModes { get; set; }
+ public string SlideDrillingModes { get; set; }
///
/// Количество метров пробуренных в роторе за отчетный период
diff --git a/AsbCloudDb/Model/DailyReportDB/DailyReportSaub.cs b/AsbCloudDb/Model/DailyReportDB/DailyReportSaub.cs
index a45fd7a8..208a4094 100644
--- a/AsbCloudDb/Model/DailyReportDB/DailyReportSaub.cs
+++ b/AsbCloudDb/Model/DailyReportDB/DailyReportSaub.cs
@@ -7,12 +7,12 @@ namespace AsbCloudDb.Model.DailyReportDB
///
/// Режимы бурения в роторе
///
- public IEnumerable? RotorDrillingModes { get; set; }
+ public string? RotorDrillingModes { get; set; }
///
/// режимы бурения в слайде
///
- public IEnumerable? SlideDrillingModes { get; set; }
+ public string? SlideDrillingModes { get; set; }
///
/// Количество метров пробуренных в роторе за отчетный период
diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs
index 35e1b6b4..0ab435ca 100644
--- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs
+++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs
@@ -67,11 +67,11 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
public override void Draw(IXLWorksheet sheet)
{
-
sheet.Range(AddressDimensionTitle.RowNumber, AddressDimensionTitle.ColumnNumber,
AddressDimensionTitle.RowNumber, AddressDimensionTitle.ColumnNumber + 1)
- .Merge()
- .SetValue("БЕЗМЕТРАЖНЫЕ РАБОТЫ");
+ .Merge()
+ .Style.Alignment.SetWrapText(true);
+ sheet.Cell(AddressDimensionTitle.RowNumber, AddressDimensionTitle.ColumnNumber)._ValueNoBorder("БЕЗМЕТРАЖНЫЕ РАБОТЫ",true);
sheet._Range(AddressPreparationTitle, AddressPreparationTitle + (0, 2))
._SetValue("Подготовка ствола скв. к наращиванию");
sheet._Range(AddressExtensionTitle, AddressExtensionTitle + (0, 2))
diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs
index b91351d3..0497909b 100644
--- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs
+++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs
@@ -110,7 +110,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
private string FormulaSinking(CellAddress sinkingDrilling, CellAddress sinkingSlide, CellAddress slaughterEnd, CellAddress slaughterBegin)
{
- return string.Format($"=IF(({{0}}+{{1}})<>({{2}}-{{3}}),\"ОШИБКА\",({{0}}+{{1}}))", sinkingSlide.ToString(), sinkingDrilling.ToString(),
+ return string.Format("=IF(({0}+{1})<>({2}-{3}),\"ОШИБКА\",({0}+{1}))", sinkingSlide.ToString(), sinkingDrilling.ToString(),
slaughterEnd.ToString(), slaughterBegin.ToString());
}
private string FormulaWatch(CellAddress cellSinkingDrill, CellAddress cellSinkingSlide)
diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs
index 694d9c95..41816758 100644
--- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs
+++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs
@@ -97,17 +97,17 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
.Merge()
.SetValue("БАЛАНС ВРЕМЕНИ");
sheet.Cell(AddressDrilling)
- ._SetValue("Бурение");
+ ._SetValue("Бурение", true);
sheet.Cell(AddressFlushing)
- ._SetValue("Промывка");
+ ._SetValue("Промывка", true);
sheet.Cell(AddressBuilding)
- ._SetValue("Наращивание");
+ ._SetValue("Наращивание", true);
sheet.Cell(AddressElaboration)
- ._SetValue("Проработка");
+ ._SetValue("Проработка", true);
sheet.Cell(AddressExtension)
- ._SetValue("Расширка");
+ ._SetValue("Расширка", true);
sheet.Cell(AddressRepair)
- ._SetValue("Ремонт");
+ ._SetValue("Ремонт", true);
sheet.Cell(AddressDrillingValue)
._SetValue($"{blockDto.Drilling}");
sheet.Cell(AddressFlushingValue)
diff --git a/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs b/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs
index b493e4f3..ff079b14 100644
--- a/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs
+++ b/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs
@@ -7,11 +7,18 @@ namespace AsbCloudInfrastructure.Services.DailyReport
{
public static IXLRange _SetValue(this IXLRange range, object value)
{
- var mergedRange = range.Merge();
- mergedRange.Style.SetAllBorders()
- .Alignment.WrapText = true; ;
+ var mergedRange = range.Merge();
mergedRange.FirstCell()._SetValue(value);
-
+ var colWidth = mergedRange.FirstCell().WorksheetColumn().Width;
+ var maxCharsToWrap = colWidth / (0.05d * mergedRange.FirstCell().Style.Font.FontSize);
+ if (value is string valueString && valueString.Length > maxCharsToWrap)
+ {
+ var row = mergedRange.FirstCell().WorksheetRow();
+ var baseHeight = row.Height;
+ row.Height = 0.45d * baseHeight * Math.Ceiling(1d + valueString.Length / maxCharsToWrap);
+ }
+ mergedRange.Style.SetAllBorders()
+ .Alignment.SetWrapText(true);
return mergedRange;
}
@@ -36,7 +43,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
return cell;
}
- public static IXLCell _SetValue(this IXLCell cell, string value, bool adaptRowHeight = false, int noBorder = 0)
+ public static IXLCell _SetValue(this IXLCell cell, string value, bool adaptRowHeight = false)
{
cell.Value = value;
cell.Style
@@ -44,23 +51,42 @@ namespace AsbCloudInfrastructure.Services.DailyReport
.Alignment.WrapText = true;
cell.Value = value;
-
if (adaptRowHeight)
{
var colWidth = cell.WorksheetColumn().Width;
- var maxCharsToWrap = 88;
+ var maxCharsToWrap = colWidth / (0.1d * cell.Style.Font.FontSize);
if (value.Length > maxCharsToWrap)
{
var row = cell.WorksheetRow();
var baseHeight = row.Height;
- row.Height = 0.82d * baseHeight * Math.Ceiling(1d + value.Length / maxCharsToWrap);
+ row.Height = 0.52d * baseHeight * Math.Ceiling(1d + value.Length / maxCharsToWrap);
}
-
}
return cell;
}
-
+
+ public static IXLCell _ValueNoBorder(this IXLCell cell, string value, bool adaptRowHeight = false)
+ {
+ cell.Value = value;
+ cell.Style.Alignment.WrapText = true;
+
+ cell.Value = value;
+ if (adaptRowHeight)
+ {
+ var colWidth = cell.WorksheetColumn().Width;
+ var maxCharsToWrap = colWidth / (0.1d * cell.Style.Font.FontSize);
+ if (value.Length > maxCharsToWrap)
+ {
+ var row = cell.WorksheetRow();
+ var baseHeight = row.Height;
+ row.Height = 0.52d * baseHeight * Math.Ceiling(1d + value.Length / maxCharsToWrap);
+ }
+ }
+
+ return cell;
+ }
+
diff --git a/AsbCloudWebApi/Controllers/DailyReportController.cs b/AsbCloudWebApi/Controllers/DailyReportController.cs
index 7aec2106..03e63f48 100644
--- a/AsbCloudWebApi/Controllers/DailyReportController.cs
+++ b/AsbCloudWebApi/Controllers/DailyReportController.cs
@@ -105,8 +105,7 @@ namespace AsbCloudWebApi.Controllers
var stream = await dailyReportService.MakeReportAsync(idWell, date, token);
if (stream != null)
{
-
- var fileName = $"Суточный рапорт по скважине {well.Caption} куст {well.Cluster}.xlsx";
+ var fileName = $"Суточный рапорт по скважине {well.Caption} куст {well.Cluster}.xlsx";
return File(stream, "application/octet-stream", fileName);
}
else