конечный вариант

-выставлено выравнивание строк
-корректировка модели блока SAUB
This commit is contained in:
IvanovEugeniy 2022-07-06 15:04:03 +05:00
parent c5785fbb5f
commit 6bce8ee4e0
7 changed files with 52 additions and 27 deletions

View File

@ -2,17 +2,17 @@
namespace AsbCloudApp.Data.DailyReport
{
public class DailyReportSaubDto
public class DailyReportSaubDto
{
/// <summary>
/// Режимы бурения в роторе
/// </summary>
public IEnumerable<string> RotorDrillingModes { get; set; }
public string RotorDrillingModes { get; set; }
/// <summary>
/// режимы бурения в слайде
/// </summary>
public IEnumerable<string> SlideDrillingModes { get; set; }
public string SlideDrillingModes { get; set; }
/// <summary>
/// Количество метров пробуренных в роторе за отчетный период

View File

@ -7,12 +7,12 @@ namespace AsbCloudDb.Model.DailyReportDB
/// <summary>
/// Режимы бурения в роторе
/// </summary>
public IEnumerable<string>? RotorDrillingModes { get; set; }
public string? RotorDrillingModes { get; set; }
/// <summary>
/// режимы бурения в слайде
/// </summary>
public IEnumerable<string>? SlideDrillingModes { get; set; }
public string? SlideDrillingModes { get; set; }
/// <summary>
/// Количество метров пробуренных в роторе за отчетный период

View File

@ -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("БЕЗМЕТРАЖНЫЕ РАБОТЫ");
.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))

View File

@ -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)

View File

@ -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)

View File

@ -8,10 +8,17 @@ namespace AsbCloudInfrastructure.Services.DailyReport
public static IXLRange _SetValue(this IXLRange range, object value)
{
var mergedRange = range.Merge();
mergedRange.Style.SetAllBorders()
.Alignment.WrapText = true; ;
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,18 +51,37 @@ 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;

View File

@ -105,7 +105,6 @@ namespace AsbCloudWebApi.Controllers
var stream = await dailyReportService.MakeReportAsync(idWell, date, token);
if (stream != null)
{
var fileName = $"Суточный рапорт по скважине {well.Caption} куст {well.Cluster}.xlsx";
return File(stream, "application/octet-stream", fileName);
}