diff --git a/AsbCloudApp/Data/DailyReport/DailyReportBhaDto.cs b/AsbCloudApp/Data/DailyReport/DailyReportBhaDto.cs index 3347e01f..bc55e29f 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportBhaDto.cs +++ b/AsbCloudApp/Data/DailyReport/DailyReportBhaDto.cs @@ -1,5 +1,4 @@ -using System; -namespace AsbCloudApp.Data.DailyReport +namespace AsbCloudApp.Data.DailyReport { public class DailyReportBhaDto { diff --git a/AsbCloudApp/Data/DailyReport/DailyReportDimensionlessDto.cs b/AsbCloudApp/Data/DailyReport/DailyReportDimensionlessDto.cs index 39fae88d..2f8235ba 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportDimensionlessDto.cs +++ b/AsbCloudApp/Data/DailyReport/DailyReportDimensionlessDto.cs @@ -1,5 +1,4 @@ -using System; -namespace AsbCloudApp.Data.DailyReport +namespace AsbCloudApp.Data.DailyReport { public class DailyReportDimensionlessDto { diff --git a/AsbCloudApp/Data/DailyReport/DailyReportSaubDto.cs b/AsbCloudApp/Data/DailyReport/DailyReportSaubDto.cs index c5ea8559..b4d3481b 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportSaubDto.cs +++ b/AsbCloudApp/Data/DailyReport/DailyReportSaubDto.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace AsbCloudApp.Data.DailyReport { diff --git a/AsbCloudApp/Data/DailyReport/DailyReportSignDto.cs b/AsbCloudApp/Data/DailyReport/DailyReportSignDto.cs index 974e939c..49963fe9 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportSignDto.cs +++ b/AsbCloudApp/Data/DailyReport/DailyReportSignDto.cs @@ -1,5 +1,4 @@ -using System; -namespace AsbCloudApp.Data.DailyReport +namespace AsbCloudApp.Data.DailyReport { public class DailyReportSignDto { diff --git a/AsbCloudApp/Data/DailyReport/DailyReportTimeBalanceDto.cs b/AsbCloudApp/Data/DailyReport/DailyReportTimeBalanceDto.cs index f4c597f1..94695a9e 100644 --- a/AsbCloudApp/Data/DailyReport/DailyReportTimeBalanceDto.cs +++ b/AsbCloudApp/Data/DailyReport/DailyReportTimeBalanceDto.cs @@ -1,5 +1,4 @@ -using System; -namespace AsbCloudApp.Data.DailyReport +namespace AsbCloudApp.Data.DailyReport { public class DailyReportTimeBalanceDto { diff --git a/AsbCloudDb/Migrations/20220705090646_Remove_DailyReportData.cs b/AsbCloudDb/Migrations/20220705090646_Remove_DailyReportData.cs index 955b3589..7be421cd 100644 --- a/AsbCloudDb/Migrations/20220705090646_Remove_DailyReportData.cs +++ b/AsbCloudDb/Migrations/20220705090646_Remove_DailyReportData.cs @@ -8,7 +8,7 @@ namespace AsbCloudDb.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.Sql("DELETE FROM [t_daily_report]", true); + migrationBuilder.Sql("DELETE FROM t_daily_report", true); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/AsbCloudDb/Model/DailyReportDB/DailyReportSaub.cs b/AsbCloudDb/Model/DailyReportDB/DailyReportSaub.cs index b0c13528..a45fd7a8 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 IEnumerable? RotorDrillingModes { get; set; } /// /// режимы бурения в слайде /// - public IEnumerable SlideDrillingModes { get; set; } + public IEnumerable? SlideDrillingModes { get; set; } /// /// Количество метров пробуренных в роторе за отчетный период diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs index e1c5a7bb..35e1b6b4 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs @@ -68,8 +68,10 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks public override void Draw(IXLWorksheet sheet) { - sheet._Range(AddressDimensionTitle, AddressDimensionTitle + (0, 1)) - ._SetValue("БЕЗМЕТРАЖНЫЕ РАБОТЫ"); + sheet.Range(AddressDimensionTitle.RowNumber, AddressDimensionTitle.ColumnNumber, + AddressDimensionTitle.RowNumber, AddressDimensionTitle.ColumnNumber + 1) + .Merge() + .SetValue("БЕЗМЕТРАЖНЫЕ РАБОТЫ"); sheet._Range(AddressPreparationTitle, AddressPreparationTitle + (0, 2)) ._SetValue("Подготовка ствола скв. к наращиванию"); sheet._Range(AddressExtensionTitle, AddressExtensionTitle + (0, 2)) diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs index 32ae732c..324b70bb 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs @@ -85,10 +85,12 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks } public override void Draw(IXLWorksheet sheet) - { + { sheet._Range(AddressTitle, AddressTitle + (0, 7)) ._SetValue($"Суточная сводка бурения скважины: {blockDto.WellName}, куст: {blockDto.ClusterName}") - .Style.SetH1(); + + .Style.SetH1(); + sheet._Range(AddressCustomer, AddressCustomer + (0, 7)) ._SetValue($"Заказчик: {blockDto.Customer}") .Style.SetH1(); @@ -108,10 +110,11 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks sheet._Range(AddressPeriodTableHeadArray[3], AddressPeriodTableHeadArray[3] + (0, 1)) ._SetValue("До"); sheet._Range(AddressPeriodTableDataArray[0], AddressPeriodTableDataArray[0] + (0, 1)) - ._SetValue($"{blockDto.ReportDate}"); - sheet._Range(AddressPeriodTableDataArray[1], AddressPeriodTableDataArray[1] + (0, 1)); + ._SetValue($"{blockDto.ReportDate}"); + sheet._Range(AddressPeriodTableDataArray[1], AddressPeriodTableDataArray[1] + (0, 1))._SetValue(""); sheet.Cell(AddressPeriodTableDataArray[1]) - .SetFormulaA1(string.Format("{0}-1", AddressPeriodTableDataArray[0].ToString())); + .SetFormulaA1(string.Format("{0}-1", AddressPeriodTableDataArray[0].ToString())) + .Style.DateFormat.Format= "DD.MM.YYYY HH:MM:SS"; sheet._Range(AddressPeriodTableDataArray[2], AddressPeriodTableDataArray[2] + (0, 1)) ._SetValue($"{blockDto.WellDepthIntervalStartDate}"); sheet._Range(AddressPeriodTableDataArray[3], AddressPeriodTableDataArray[3] + (0, 1)) diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs index db0b892e..b91351d3 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs @@ -41,8 +41,9 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks public override CellAddress AddressBlockBegin { get; } public override CellAddress AddressBlockEnd { get; } - public SaubBlock(CellAddress addressBlockBegin, DailyReportSaubDto blockDto) + public SaubBlock(CellAddress addressBlockBegin, DailyReportSaubDto blockDto, HeadBlock headBlock) { + this.headBlock = headBlock; AddressBlockBegin = addressBlockBegin.Copy(); this.blockDto = blockDto; AddressRotorDrilling = addressBlockBegin + (1, 0); @@ -109,9 +110,13 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks private string FormulaSinking(CellAddress sinkingDrilling, CellAddress sinkingSlide, CellAddress slaughterEnd, CellAddress slaughterBegin) { - return string.Format($"=IF(({{0}}+{{1}})<>({{2}}-{{3}});\"ОШИБКА\";({{4}}+{{5}}))", sinkingSlide.ToString(), sinkingDrilling.ToString() - , slaughterEnd.ToString(), slaughterBegin.ToString(), - 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) + { + return string.Format("={0}+{1}", + cellSinkingDrill.ToString(), cellSinkingSlide.ToString()); } public override void Draw(IXLWorksheet sheet) @@ -134,7 +139,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks ._SetValue($"{blockDto.PenetrationInRotor}"); sheet._Range(AddressDrillingTableData[1], AddressDrillingTableData[1] + (0, 1)) ._SetValue($"{blockDto.NumberDrillingHours}"); - sheet._Range(AddressDrillingTableData[2], AddressDrillingTableData[2] + (0, 1)); + sheet._Range(AddressDrillingTableData[2], AddressDrillingTableData[2] + (0, 1))._SetValue(""); sheet.Cell(AddressDrillingTableData[2]) .SetFormulaA1(FormulaMechanicalSpeed(AddressDrillingTableData[0], AddressDrillingTableData[1])).Style.SetAllBorders(); sheet._Range(AddressDrillingTableData[3], AddressDrillingTableData[3] + (0, 1)) @@ -153,7 +158,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks ._SetValue($"{blockDto.PenetrationInSlide}"); sheet._Range(AddressSlideTableData[1], AddressSlideTableData[1] + (0, 1)) ._SetValue($"{blockDto.DrillingTimeInRotor}"); - sheet._Range(AddressSlideTableData[2], AddressSlideTableData[2] + (0, 1)); + sheet._Range(AddressSlideTableData[2], AddressSlideTableData[2] + (0, 1))._SetValue(""); sheet.Cell(AddressSlideTableData[2]) .SetFormulaA1(FormulaMechanicalSpeed(AddressSlideTableData[0], AddressSlideTableData[1])).Style.SetAllBorders(); sheet._Range(AddressSlideTableData[3], AddressSlideTableData[3] + (0, 1)) @@ -168,14 +173,13 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks ._SetValue("Часы бурения"); sheet._Range(AddressTotalTableHead[2], AddressTotalTableHead[2] + (0, 1)) ._SetValue("Мех. скорость"); - var formulaWatch = string.Format("={0}+{1}", - AddressDrillingTableData[1].ToString(), AddressSlideTableData[1].ToString()); - sheet._Range(AddressTotalTableData[0], AddressTotalTableData[0] + (0, 1)); + + sheet._Range(AddressTotalTableData[0], AddressTotalTableData[0] + (0, 1))._SetValue(""); sheet.Cell(AddressTotalTableData[0]) - .SetFormulaA1(formulaWatch).Style.SetAllBorders(); - sheet._Range(AddressTotalTableData[1], AddressTotalTableData[1] + (0, 1)); + .SetFormulaA1(FormulaSinking(AddressDrillingTableData[0], AddressSlideTableData[0], headBlock.AddressPeriodTableDataArray[3], headBlock.AddressPeriodTableDataArray[2])); + sheet._Range(AddressTotalTableData[1], AddressTotalTableData[1] + (0, 1))._SetValue(""); sheet.Cell(AddressTotalTableData[1]) - .SetFormulaA1(formulaWatch).Style.SetAllBorders(); + .SetFormulaA1(FormulaWatch(AddressDrillingTableData[1], AddressSlideTableData[1])); sheet._Range(AddressTotalTableData[2], AddressTotalTableData[2] + (0, 1)) ._SetValue(""); sheet._Range(AddressTotalTableData[3], AddressTotalTableData[3] + (0, 1)) @@ -208,10 +212,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks ._SetValue("Проходка за секцию"); sheet._Range(SectionPenetrationTotalValue, SectionPenetrationTotalValue + (0, 3)) ._SetValue($"{blockDto.SectionPenetrationTotal}"); - - CellAddress test = AddressExtensionsCount + (0, 3); - - sheet._Range(AddressExtensionsCount, test) + sheet._Range(AddressExtensionsCount, AddressExtensionsCount + (0, 3)) ._SetValue("Кол- во наращиваний"); sheet._Range(AddressExtensionsCountValue, AddressExtensionsCountValue + (0, 3)) ._SetValue($"{blockDto.ExtensionsCount}"); @@ -221,7 +222,6 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks ._SetValue($"{blockDto.DeviationFromTVD}"); sheet._Range(DeclinesReasonsROP, DeclinesReasonsROP + (1, 7)) ._SetValue($"Примечание: {blockDto.DeclinesReasonsROP}"); - } } } diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs index b110abaa..94aefd7c 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs @@ -19,22 +19,30 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks AddressBlockBegin = addressBlockBegin.Copy(); this.blockDto = blockDto; AddressDrillMasterHead = addressBlockBegin + (3, 0); - AddressDrillMaster = AddressDrillMasterHead + (0, 6); + AddressDrillMaster = AddressDrillMasterHead + (0, 5); AddressSupervisorHead = AddressDrillMasterHead + (2, 0); - AddressSupervisor = AddressSupervisorHead + (0, 6); + AddressSupervisor = AddressSupervisorHead + (0, 5); AddressBlockEnd = AddressSupervisor + (0,1); } public override void Draw(IXLWorksheet sheet) { - sheet._Range(AddressDrillMasterHead, AddressDrillMasterHead + (0, 2)) - ._SetValue("Мастер буровой "); - sheet._Range(AddressDrillMaster, AddressDrillMaster + (0, 2)) - ._SetValue($"{blockDto.DrillingMaster}"); - sheet._Range(AddressSupervisorHead, AddressSupervisorHead + (0, 2)) - ._SetValue("Супервайзер "); - sheet._Range(AddressSupervisor, AddressSupervisor + (0, 2)) - ._SetValue($"{blockDto.Supervisor}"); + sheet.Range(AddressDrillMasterHead.RowNumber, AddressDrillMasterHead.ColumnNumber + , AddressDrillMasterHead.RowNumber, AddressDrillMasterHead.ColumnNumber + 2) + .Merge() + .SetValue("Мастер буровой "); + sheet.Range(AddressDrillMaster.RowNumber, AddressDrillMaster.ColumnNumber + , AddressDrillMaster.RowNumber, AddressDrillMaster.ColumnNumber + 2) + .Merge() + .SetValue($"{blockDto.DrillingMaster}"); + sheet.Range(AddressSupervisorHead.RowNumber, AddressSupervisorHead.ColumnNumber + , AddressSupervisorHead.RowNumber, AddressSupervisorHead.ColumnNumber + 2) + .Merge() + .SetValue("Супервайзер "); + sheet.Range(AddressSupervisor.RowNumber, AddressSupervisor.ColumnNumber + , AddressSupervisor.RowNumber, AddressSupervisor.ColumnNumber + 2) + .Merge() + .SetValue($"{blockDto.Supervisor}"); } } diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs index 76498934..694d9c95 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs @@ -52,50 +52,50 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks AddressBlockBegin = addressBlockBegin.Copy(); this.blockDto = blockDto; AddressTitle = addressBlockBegin + (1, 3); - AddressDrilling = addressBlockBegin + (4, 1); - AddressFlushing = addressBlockBegin + (5, 1); - AddressBuilding = addressBlockBegin + (6, 1); - AddressElaboration = addressBlockBegin + (7, 1); - AddressExtension = addressBlockBegin + (8, 1); - AddressRepair = addressBlockBegin + (9, 1); - AddressDrillingValue = addressBlockBegin + (4, 2); - AddressFlushingValue = addressBlockBegin + (5, 2); - AddressBuildingValue = addressBlockBegin + (6, 2); - AddressElaborationValue = addressBlockBegin + (7, 2); - AddressExtensionValue = addressBlockBegin + (8, 2); - AddressRepairValue = addressBlockBegin + (9, 2); - AddressKnbk = addressBlockBegin + (4, 3); - AddressSpo = addressBlockBegin + (5, 3); - AddressPzr = addressBlockBegin + (6, 3); - AddressPvo = addressBlockBegin + (7, 3); - AddressPgr = addressBlockBegin + (8, 3); - AddressGis = addressBlockBegin + (9, 3); - AddressKnbkValue = addressBlockBegin + (4, 4); - AddressSpoValue = addressBlockBegin + (5, 4); - AddressPzrValue = addressBlockBegin + (6, 4); - AddressPvoValue = addressBlockBegin + (7, 4); - AddressPgrValue = addressBlockBegin + (8, 4); - AddressGisValue = addressBlockBegin + (9, 4); - AddressOzc = addressBlockBegin + (4, 5); - AddressEngineeringWorks = addressBlockBegin + (5, 5); - AddressTakingMeasure = addressBlockBegin + (6, 5); - AddressCementing = addressBlockBegin + (7, 5); - AddressSimple = addressBlockBegin + (8, 5); - AddressNpv = addressBlockBegin + (9, 5); - AddressOzcValue = addressBlockBegin + (4, 6); - AddressEngineeringWorksValue = addressBlockBegin + (5, 6); - AddressTakingMeasureValue = addressBlockBegin + (6, 6); - AddressCementingValue = addressBlockBegin + (7, 6); - AddressSimpleValue = addressBlockBegin + (8, 6); - AddressNpvValue = addressBlockBegin + (9, 6); + AddressDrilling = addressBlockBegin + (2, 1); + AddressFlushing = addressBlockBegin + (3, 1); + AddressBuilding = addressBlockBegin + (4, 1); + AddressElaboration = addressBlockBegin + (5, 1); + AddressExtension = addressBlockBegin + (6, 1); + AddressRepair = addressBlockBegin + (7, 1); + AddressDrillingValue = addressBlockBegin + (2, 2); + AddressFlushingValue = addressBlockBegin + (3, 2); + AddressBuildingValue = addressBlockBegin + (4, 2); + AddressElaborationValue = addressBlockBegin + (5, 2); + AddressExtensionValue = addressBlockBegin + (6, 2); + AddressRepairValue = addressBlockBegin + (7, 2); + AddressKnbk = addressBlockBegin + (2, 3); + AddressSpo = addressBlockBegin + (3, 3); + AddressPzr = addressBlockBegin + (4, 3); + AddressPvo = addressBlockBegin + (5, 3); + AddressPgr = addressBlockBegin + (6, 3); + AddressGis = addressBlockBegin + (7, 3); + AddressKnbkValue = addressBlockBegin + (2, 4); + AddressSpoValue = addressBlockBegin + (3, 4); + AddressPzrValue = addressBlockBegin + (4, 4); + AddressPvoValue = addressBlockBegin + (5, 4); + AddressPgrValue = addressBlockBegin + (6, 4); + AddressGisValue = addressBlockBegin + (7, 4); + AddressOzc = addressBlockBegin + (2, 5); + AddressEngineeringWorks = addressBlockBegin + (3, 5); + AddressTakingMeasure = addressBlockBegin + (4, 5); + AddressCementing = addressBlockBegin + (5, 5); + AddressSimple = addressBlockBegin + (6, 5); + AddressNpv = addressBlockBegin + (7, 5); + AddressOzcValue = addressBlockBegin + (2, 6); + AddressEngineeringWorksValue = addressBlockBegin + (3, 6); + AddressTakingMeasureValue = addressBlockBegin + (4, 6); + AddressCementingValue = addressBlockBegin + (5, 6); + AddressSimpleValue = addressBlockBegin + (6, 6); + AddressNpvValue = addressBlockBegin + (7, 6); AddressBlockEnd = AddressNpvValue; } public override void Draw(IXLWorksheet sheet) { - - sheet._Range(AddressTitle, AddressTitle + (0, 1)) - ._SetValue("БАЛАНС ВРЕМЕНИ"); + sheet.Range(AddressTitle.RowNumber, AddressTitle.ColumnNumber, AddressTitle.RowNumber, AddressTitle.ColumnNumber + 1) + .Merge() + .SetValue("БАЛАНС ВРЕМЕНИ"); sheet.Cell(AddressDrilling) ._SetValue("Бурение"); sheet.Cell(AddressFlushing) diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs index 8085b11b..70670293 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs @@ -19,32 +19,32 @@ namespace AsbCloudInfrastructure.Services.DailyReport private void FillExampleBlocks(XLWorkbook workbook, DailyReportDto dto) { var sheet = workbook.Worksheets.Add(dto.Head.ReportDate.ToString("dd.MM.yyyy")); - var addressStart = new CellAddress(sheet, 1, 1); + var addressStart = new CellAddress(sheet, 2, 2); var blockHeader = new HeadBlock(addressStart, dto.Head); addressStart = blockHeader.AddressBlockEnd + (1, 0); - addressStart.ColumnNumber = 1; + addressStart.ColumnNumber = 2; var blockBha = new BhaBlock(addressStart, dto.Bha); addressStart = blockBha.AddressBlockEnd + (1, 0); - addressStart.ColumnNumber = 1; + addressStart.ColumnNumber = 2; var timeBalance = new TimeBalanceBlock(addressStart, dto.TimeBalance); addressStart = timeBalance.AddressBlockEnd + (1, 0); - addressStart.ColumnNumber = 1; + addressStart.ColumnNumber = 2; var blockDimensionless = new DimensionlessBlock(addressStart, dto.Dimensionless); addressStart = blockDimensionless.AddressBlockEnd + (1, 0); - addressStart.ColumnNumber = 1; - var blockSaub = new SaubBlock(addressStart, dto.Saub); + addressStart.ColumnNumber = 2; + var blockSaub = new SaubBlock(addressStart, dto.Saub, blockHeader); addressStart = blockSaub.AddressBlockEnd + (1, 0); blockDimensionless.SaubBlock = blockSaub; - addressStart.ColumnNumber = 1; + addressStart.ColumnNumber = 2; var blockSign = new SignBlock(addressStart, dto.Sign); addressStart = blockSign.AddressBlockEnd + (1, 0); - addressStart.ColumnNumber = 1; + addressStart.ColumnNumber = 2; blockHeader.Draw(sheet); blockBha.Draw(sheet); timeBalance.Draw(sheet); blockDimensionless.Draw(sheet); blockSaub.Draw(sheet); - blockSign.Draw(sheet); + blockSign.Draw(sheet); } } } diff --git a/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs b/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs index e114eb26..b493e4f3 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/XLExtentions.cs @@ -7,9 +7,11 @@ namespace AsbCloudInfrastructure.Services.DailyReport { public static IXLRange _SetValue(this IXLRange range, object value) { - var mergedRange = range.Merge(); + var mergedRange = range.Merge(); + mergedRange.Style.SetAllBorders() + .Alignment.WrapText = true; ; mergedRange.FirstCell()._SetValue(value); - mergedRange.Style.SetAllBorders(); + return mergedRange; } @@ -34,7 +36,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport return cell; } - public static IXLCell _SetValue(this IXLCell cell, string value, bool adaptRowHeight = false) + public static IXLCell _SetValue(this IXLCell cell, string value, bool adaptRowHeight = false, int noBorder = 0) { cell.Value = value; cell.Style @@ -45,18 +47,22 @@ namespace AsbCloudInfrastructure.Services.DailyReport if (adaptRowHeight) { - var colWidth = cell.WorksheetColumn().Width; - var maxCharsToWrap = colWidth / (0.1d * cell.Style.Font.FontSize); // TODO: Подобрать коэффициент - if(value.Length > maxCharsToWrap) + var colWidth = cell.WorksheetColumn().Width; + var maxCharsToWrap = 88; + if (value.Length > maxCharsToWrap) { var row = cell.WorksheetRow(); var baseHeight = row.Height; row.Height = 0.82d * baseHeight * Math.Ceiling(1d + value.Length / maxCharsToWrap); } + } return cell; } + + + public static IXLCell _SetValue(this IXLCell cell, DateTime value, string dateFormat = "DD.MM.YYYY HH:MM:SS") { @@ -122,5 +128,6 @@ namespace AsbCloudInfrastructure.Services.DailyReport /// public static IXLRange _Range(this IXLWorksheet sheet, CellAddress begin, CellAddress end) => sheet.Range(begin.RowNumber, begin.ColumnNumber, end.RowNumber, end.ColumnNumber); + } }