From 6570647bec5b624c1f3723219c0f00e81cc29495 Mon Sep 17 00:00:00 2001 From: IvanovEugeniy Date: Wed, 22 Jun 2022 23:26:04 +0500 Subject: [PATCH] new generate report with style --- .../DailyReport/DailyReportMakerExcel.cs | 1051 ++++++++++------- ConsoleApp1/Program.cs | 441 ++++++- 2 files changed, 1005 insertions(+), 487 deletions(-) diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs index 919682d3..dda6edd9 100644 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs +++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs @@ -30,24 +30,43 @@ namespace AsbCloudInfrastructure.Services.DailyReport return $"{convertColumn}{row}"; } + private string FormulaBhaBlock((int row, int col) tuple) + { + return $"IF({converteCellCoordinate(tuple.row, true, tuple.col - 1)}>0,({converteCellCoordinate(tuple.row, true, tuple.col - 1)}-{converteCellCoordinate(tuple.row, true, tuple.col - 2)})*24, \"\")"; + } + + private string FormulaMechanicalSpeed((int row, int col) tuple) + { + return $"=IF({converteCellCoordinate(tuple.row, true, tuple.col - 2)}>0," + + $"{converteCellCoordinate(tuple.row, true, tuple.col - 4)}/{converteCellCoordinate(tuple.row, true, tuple.col - 2)},0)"; + } + + private string FormulaDrillingWatch((int row, int col) tuple) + { + return $"=IF({converteCellCoordinate(tuple.row - 8, true, tuple.col)}+" + + $"{converteCellCoordinate(tuple.row - 4, true, tuple.col)}"; + } + + private string FormulaSinking((int row, int col) tuple) + { + return $"=IF(({converteCellCoordinate(tuple.row - 4, true, tuple.col)}+{converteCellCoordinate(tuple.row - 8, true, tuple.col)})" + + $"<>({converteCellCoordinate(tuple.row - 54, true, tuple.col + 6)}-{converteCellCoordinate(tuple.row - 54, true, tuple.col + 4)}),\"ОШИБКА\"" + + $",{converteCellCoordinate(tuple.row - 4, true, tuple.col)}+{converteCellCoordinate(tuple.row - 8, true, tuple.col)})"; + } + public void FillSheet6blocks(XLWorkbook workbook, DailyReportHeadDto blockHead, DailyReportBhaDto blockBha, DailyReportDimensionlessDto blockDimensionless, DailyReportSaubDto blockSaub, DailyReportSignDto blockSign) { - var sheet = workbook.Worksheets.First(); - sheet.Name = blockHead.ReportDate.ToString("dd.MM.yyyy"); + var sheet = workbook.Worksheets.Add(blockHead.ReportDate.ToString("dd.MM.yyyy")); + sheet.Style.Font.FontName = "TimesNewRoman"; + sheet.Style.Font.FontSize = 10; var tuple = (row: 3, column: 3); - tuple = (AddBlockHead1(sheet, blockHead,(tuple.row,tuple.column)).row , AddBlockHead1(sheet, blockHead, (tuple.row, tuple.column)).column); - - - AddBlockBha(sheet, blockBha); - AddBlockTimeBalance(sheet); - AddBlockDimensionless(sheet, blockDimensionless); - AddBlockSaub(sheet, blockSaub); - AddBlockSign(sheet, blockSign); - - - } - // + tuple = AddBlockBha(sheet, blockBha, tuple); + tuple = AddBlockTimeBalance(sheet, tuple); + tuple = AddBlockDimensionless(sheet, blockDimensionless, tuple); + tuple = AddBlockSaub(sheet, blockSaub, tuple); + tuple = AddBlockSign(sheet, blockSign, tuple); + } private (int row, int column) AddBlockHead1(IXLWorksheet sheet, DailyReportHeadDto blockDto, (int row, int column) tupleStart) { @@ -55,7 +74,6 @@ namespace AsbCloudInfrastructure.Services.DailyReport sheet.Cell(tuple.row, tuple.column).Value = $"Суточная сводка бурения скважины: {blockDto.WellName}, куст: {blockDto.ClusterName}"; sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge(); - //4 tuple.row += 1; sheet.Cell(tuple.row, tuple.column).Value = $"Заказчик: {blockDto.Customer}"; @@ -66,520 +84,639 @@ namespace AsbCloudInfrastructure.Services.DailyReport sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge(); tuple.row += 2; //7,3 - sheet.Cell(tuple.row, tuple.column).Value = "Отчетный период"; sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Отчетный период"); tuple.column += 4; - sheet.Cell(tuple.row, tuple.column).Value = "Забой за отчетный период, м"; sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + sheet.Cell(tuple.row, tuple.column + 3).Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, "Забой за отчетный период, м"); tuple.column = tupleStart.column; tuple.row += 1; //8,3 - - sheet.Cell(tuple.row, tuple.column).Value = "От (дата, время)"; sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); - + SetCell(sheet.Row(tuple.row), tuple.column, "От (дата, время)"); tuple.column += 2; //8,5 - sheet.Cell(tuple.row, tuple.column).Value = "До (дата, время)"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "До (дата, время)"); tuple.column += 2; //8,7 - sheet.Cell(tuple.row, tuple.column).Value = "От"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "От"); tuple.column += 2; //8,9 - sheet.Cell(tuple.row, tuple.column).Value = "До"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "До"); + sheet.Cell(tuple.row, tuple.column + 1).Style.Border.RightBorder = XLBorderStyleValues.Thin; tuple.column = tupleStart.column; tuple.row += 1; //9,3 - - - sheet.Cell(tuple.row, tuple.column).Value = $"{blockDto.ReportDate}"; - sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column+2).Merge(); + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.ReportDate}"); tuple.column += 2; //согласно формуле в шаблоне - ячейка С9 - sheet.Cell(tuple.row, tuple.column).FormulaA1 = $"={converteCellCoordinate(tuple.row , true, tuple.column)}-1"; - sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column).FormulaA1 = $"={converteCellCoordinate(tuple.row, true, tuple.column - 2)}-1"; + SetDateTime(sheet.Cell(tuple.row, tuple.column)); tuple.column += 2; - sheet.Cell(tuple.row, tuple.column).Value = $"{blockDto.WellDepthIntervalStartDate}"; - sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.WellDepthIntervalStartDate}"); tuple.column += 2; - sheet.Cell(tuple.row, tuple.column).Value = $"{blockDto.WellDepthIntervalFinishDate}"; - sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.WellDepthIntervalFinishDate}"); tuple.column = tupleStart.column; - tuple.row += 2; //11,3 + tuple.row += 2; //11,3 + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge().Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, "Данные по траектории скважины на конец суток"); + tuple.column = tupleStart.column; + tuple.row += 1;//12 + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Глубина по стволу"); + tuple.column += 2; //12,5 + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Глубина по вертикали"); + tuple.column += 2; //12,7 + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Зенитный угол"); + tuple.column += 2; //12,9 + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge().Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, "Азимут"); + tuple.column = tupleStart.column; + tuple.row += 1; //13,3 + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.BottomholeDepth}"); + tuple.column += 2; - sheet.Cell(tuple.Item1 + 8, tuple.Item2).Value = "Данные по траектории скважины на конец суток"; - sheet.Range(tuple.Item1 + 8, tuple.Item2, tuple.Item1 + 8, tuple.Item2+7).Merge(); - sheet.Cell(tuple.Item1 + 9, tuple.Item2).Value = "Глубина по стволу"; - sheet.Range(tuple.Item1 + 9, tuple.Item2, tuple.Item1 + 9, tuple.Item2+1).Merge(); - sheet.Cell(13, 3).Value = $"{blockDto.BottomholeDepth}"; - sheet.Range(13, 3, 13, 4).Merge(); - sheet.Cell(12, 5).Value = "Глубина по вертикали"; - sheet.Range(12, 5, 12, 6).Merge(); - sheet.Cell(13, 5).Value = $"{blockDto.VerticalDepth}"; - sheet.Range(13, 5, 13, 6).Merge(); - sheet.Cell(12, 7).Value = "Зенитный угол"; - sheet.Range(12, 7, 12, 8).Merge(); - sheet.Cell(13, 7).Value = $"{blockDto.ZenithAngle}"; - sheet.Range(13, 7, 13, 8).Merge(); - sheet.Cell(12, 9).Value = "Азимут"; - sheet.Range(12, 9, 12, 10).Merge(); - sheet.Cell(13, 9).Value = $"{blockDto.AzimuthAngle}"; - sheet.Range(13, 9, 13, 10).Merge(); - sheet.Cell(15, 3).Value = "Бурильщик 1 смена"; - sheet.Range(15, 3, 15, 4).Merge(); - sheet.Cell(15, 5).Value = $"{blockDto.FirstDriller}"; - sheet.Range(15, 6, 15, 7).Merge(); - sheet.Cell(16, 3).Value = "Бурильщик 2 смена"; - sheet.Range(16, 3, 16, 4).Merge(); - sheet.Cell(16, 5).Value = $"{blockDto.SecondDriller}"; - sheet.Range(16, 6, 16, 7).Merge(); + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.VerticalDepth}"); + tuple.column += 2; - sheet.Cell(18, 3).Value = "Работа модулей САУБ:"; - sheet.Range(18, 3, 15, 5).Merge(); - sheet.Cell(18, 6).Value = "Часов:"; - sheet.Cell(18, 7).Value = "Метров:"; - sheet.Cell(19, 3).Value = "АПД (автоматическая подача долота), ч/м:"; - sheet.Range(19, 3, 19, 5).Merge(); - sheet.Cell(19, 6).Value = $"{blockDto.WorkTimeSAUB}"; - sheet.Cell(19, 7).Value = $"{blockDto.PenetrationSAUB}"; - - sheet.Cell(20, 3).Value = "Спин Мастер (осцилляция),ч/м:"; - sheet.Range(20, 3, 20, 5).Merge(); - sheet.Cell(20, 6).Value = $"{blockDto.WorkTimeSpinMaster}"; - sheet.Cell(20, 7).Value = $"{blockDto.PenetrationSpinMaster}"; - - sheet.Cell(21, 3).Value = "Торк Мастер (демпфирование), ч/:"; - sheet.Range(21, 3, 21, 5).Merge(); - sheet.Cell(21, 6).Value = $"{blockDto.WorkTimeTorkMaster}"; - sheet.Cell(21, 7).Value = $"{blockDto.PenetrationTorkMaster}"; - - sheet.Cell(22, 3).Value = "МСЕ, колличество запусков, раз:"; - sheet.Range(22, 3, 22, 5).Merge(); - sheet.Cell(22, 6).Value = $"{blockDto.CountLaunchesMSE}"; - sheet.Range(22, 6, 22, 7).Merge(); - - return (tuple.row, tuple.column); + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.ZenithAngle}"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge().Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.AzimuthAngle}"); + tuple.column = tupleStart.column; + tuple.row += 2; //15,3 + sheet.Cell(tuple.row, tuple.column).Value = "Бурильщик 1 смена"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + tuple.column += 2; + sheet.Cell(tuple.row, tuple.column).Value = $"{blockDto.FirstDriller}"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + tuple.row += 1; + tuple.column = tupleStart.column; + sheet.Cell(tuple.row, tuple.column).Value = "Бурильщик 2 смена"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + tuple.column += 2; + sheet.Cell(tuple.row, tuple.column).Value = $"{blockDto.SecondDriller}"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + tuple.row += 2; + tuple.column = tupleStart.column; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Работа модулей САУБ:"); + tuple.column += 3; + SetCell(sheet.Row(tuple.row), tuple.column, "Часов:"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, "Метров:").Style.Border.RightBorder = XLBorderStyleValues.Thin; + tuple.row += 1; + tuple.column = tupleStart.column; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "АПД (автоматическая подача долота), ч/м:"); + tuple.column += 3; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.WorkTimeSAUB}"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.PenetrationSAUB}").Style.Border.RightBorder = XLBorderStyleValues.Thin; + tuple.row += 1; + tuple.column = tupleStart.column; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Спин Мастер (осцилляция),ч/м:"); + tuple.column += 3; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.WorkTimeSpinMaster}"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.PenetrationSpinMaster}").Style.Border.RightBorder = XLBorderStyleValues.Thin; + tuple.row += 1; + tuple.column = tupleStart.column; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Торк Мастер (демпфирование), ч/:"); + tuple.column += 3; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.WorkTimeTorkMaster}"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.PenetrationTorkMaster}").Style.Border.RightBorder = XLBorderStyleValues.Thin; + tuple.row += 1; + tuple.column = tupleStart.column; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "МСЕ, колличество запусков, раз:"); + tuple.column += 3; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge().Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.CountLaunchesMSE}"); + tuple.column += 2; + return tuple; } - // - private void AddBlockHead(IXLWorksheet sheet, DailyReportHeadDto blockDto) + private (int row, int column) AddBlockBha(IXLWorksheet sheet, DailyReportBhaDto blockDto, (int row, int column) tupleStart) { - sheet.Cell(3, 3).Value = - $"Суточная сводка бурения скважины №{blockDto.WellName}, куст: {blockDto.ClusterName}"; - sheet.Cell(4, 3).Value = - $"Заказчик: {blockDto.Customer}"; - sheet.Cell(5, 3).Value = - $"Подрядчик: {blockDto.Contractor}"; - sheet.Cell(7, 3).Value = "Отчетный период"; - sheet.Range(7, 3, 7, 6).Merge(); - sheet.Cell(7, 7).Value = "Забой за отчетный период, м"; - sheet.Range(7, 7, 7, 10).Merge(); - sheet.Cell(8, 3).Value = "От (дата, время)"; - sheet.Range(8, 3, 8, 4).Merge(); - sheet.Cell(9, 3).Value = $"{blockDto.ReportDate}"; - sheet.Range(9, 3, 9, 4).Merge(); - sheet.Cell(8, 5).Value = "До (дата, время)"; - sheet.Range(8, 5, 8, 6).Merge(); - sheet.Cell(9, 5).Value = "=C9+1"; - sheet.Range(9, 5, 9, 6).Merge(); - sheet.Cell(8, 7).Value = "От"; - sheet.Range(8, 7, 8, 8).Merge(); - sheet.Cell(9, 7).Value = $"{blockDto.WellDepthIntervalStartDate}"; - sheet.Range(9, 7, 9, 8).Merge(); - sheet.Cell(8, 9).Value = "До"; - sheet.Range(8, 9, 8, 10).Merge(); - sheet.Cell(9, 9).Value = $"{blockDto.WellDepthIntervalFinishDate}"; - sheet.Range(9, 9, 9, 10).Merge(); - sheet.Cell(11, 3).Value = "Данные по траектории скважины на конец суток"; - sheet.Range(11, 3, 11, 10).Merge(); - sheet.Cell(12, 3).Value = "Глубина по стволу"; - sheet.Range(12, 3, 12, 4).Merge(); - sheet.Cell(13, 3).Value = $"{blockDto.BottomholeDepth}"; - sheet.Range(13, 3, 13, 4).Merge(); - sheet.Cell(12, 5).Value = "Глубина по вертикали"; - sheet.Range(12, 5, 12, 6).Merge(); - sheet.Cell(13, 5).Value = $"{blockDto.VerticalDepth}"; - sheet.Range(13, 5, 13, 6).Merge(); - sheet.Cell(12, 7).Value = "Зенитный угол"; - sheet.Range(12, 7, 12, 8).Merge(); - sheet.Cell(13, 7).Value = $"{blockDto.ZenithAngle}"; - sheet.Range(13, 7, 13, 8).Merge(); - sheet.Cell(12, 9).Value = "Азимут"; - sheet.Range(12, 9, 12, 10).Merge(); - sheet.Cell(13, 9).Value = $"{blockDto.AzimuthAngle}"; - sheet.Range(13, 9, 13, 10).Merge(); - sheet.Cell(15, 3).Value = "Бурильщик 1 смена"; - sheet.Range(15, 3, 15, 4).Merge(); - sheet.Cell(15, 5).Value = $"{blockDto.FirstDriller}"; - sheet.Range(15, 6, 15, 7).Merge(); - sheet.Cell(16, 3).Value = "Бурильщик 2 смена"; - sheet.Range(16, 3, 16, 4).Merge(); - sheet.Cell(16, 5).Value = $"{blockDto.SecondDriller}"; - sheet.Range(16, 6, 16, 7).Merge(); + tupleStart.column = 3; + tupleStart.row += 1; + var tuple = (row: tupleStart.row, column: tupleStart.column); - sheet.Cell(18, 3).Value = "Работа модулей САУБ:"; - sheet.Range(18, 3, 15, 5).Merge(); - sheet.Cell(18, 6).Value = "Часов:"; - sheet.Cell(18, 7).Value = "Метров:"; - sheet.Cell(19, 3).Value = "АПД (автоматическая подача долота), ч/м:"; - sheet.Range(19, 3, 19, 5).Merge(); - sheet.Cell(19, 6).Value = $"{blockDto.WorkTimeSAUB}"; - sheet.Cell(19, 7).Value = $"{blockDto.PenetrationSAUB}"; + - sheet.Cell(20, 3).Value = "Спин Мастер (осцилляция),ч/м:"; - sheet.Range(20, 3, 20, 5).Merge(); - sheet.Cell(20, 6).Value = $"{blockDto.WorkTimeSpinMaster}"; - sheet.Cell(20, 7).Value = $"{blockDto.PenetrationSpinMaster}"; - sheet.Cell(21, 3).Value = "Торк Мастер (демпфирование), ч/:"; - sheet.Range(21, 3, 21, 5).Merge(); - sheet.Cell(21, 6).Value = $"{blockDto.WorkTimeTorkMaster}"; - sheet.Cell(21, 7).Value = $"{blockDto.PenetrationTorkMaster}"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge().Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.BHADescription}"); + tuple.row += 2; - sheet.Cell(22, 3).Value = "МСЕ, колличество запусков, раз:"; - sheet.Range(22, 3, 22, 5).Merge(); - sheet.Cell(22, 6).Value = $"{blockDto.CountLaunchesMSE}"; - sheet.Range(22, 6, 22, 7).Merge(); + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 4).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Выполняемые операции в отчетный период, комментарии:"); + tuple.column += 5; - } + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Продолжительность, ч. "); + tuple.column += 2; + SetCell(sheet.Row(tuple.row), tuple.column, "Итого").Style.Border.RightBorder = XLBorderStyleValues.Thin; + tuple.column = tupleStart.column; + tuple.row += 1; - private void AddBlockBha(IXLWorksheet sheet, DailyReportBhaDto blockDto) - { - sheet.Cell(24, 3).Value = - $"{blockDto.BHADescription}"; - sheet.Range(24, 3, 24, 10).Merge(); - sheet.Cell(26, 3).Value = - "Выполняемые операции в отчетный период, комментарии:"; - sheet.Range(26, 3, 26, 7).Merge(); - sheet.Cell(26, 8).Value = "Продолжительность, ч. "; - sheet.Range(26, 8, 26, 9).Merge(); - sheet.Cell(26, 10).Value = "Итого"; - sheet.Cell(27, 3).Value = - "Бурение с наращиваниями в инт. 2195-2763м."; - sheet.Range(27, 3, 27, 7).Merge(); - sheet.Cell(27, 8).Value = ""; - sheet.Cell(27, 9).Value = ""; - sheet.Cell(27, 10).Value = "=IF(I27>0;(I27-H27)*24;\"\")"; - sheet.Cell(28, 3).Value = - "Промывка."; - sheet.Range(28, 3, 28, 7).Merge(); - sheet.Cell(28, 8).Value = ""; - sheet.Cell(28, 9).Value = ""; - sheet.Cell(28, 10).Value = "=IF(I28>0;(I28-H28)*24;\"\")"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 4).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Бурение с наращиваниями в инт. 2195-2763м."); + tuple.column += 5; - sheet.Cell(29, 3).Value = - "Подъем КНБК в инт. 2763-2442м."; - sheet.Range(29, 3, 29, 7).Merge(); - sheet.Cell(29, 8).Value = ""; - sheet.Cell(29, 9).Value = ""; - sheet.Cell(29, 10).Value = "=IF(I29>0;(I29-H29)*24;\"\")"; + SetCell(sheet.Row(tuple.row), tuple.column, "17:00:00"); + tuple.column += 1; - sheet.Cell(30, 3).Value = - "Спуск КНБК в инт. 2442-2763м."; - sheet.Range(30, 3, 30, 7).Merge(); - sheet.Cell(30, 8).Value = ""; - sheet.Cell(30, 9).Value = ""; - sheet.Cell(30, 10).Value = "=IF(I30>0;(I30-H30)*24;\"\")"; + SetCell(sheet.Row(tuple.row), tuple.column, "17:30:00"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column) + .FormulaR1C1 = FormulaBhaBlock(tuple); + tuple.column = tupleStart.column; + tuple.row += 1; - sheet.Cell(27, 3).Value = - "Бурение с наращиваниями в инт. 2763-2850м."; - sheet.Range(31, 3, 31, 7).Merge(); - sheet.Cell(31, 8).Value = ""; - sheet.Cell(31, 9).Value = ""; - sheet.Cell(31, 10).Value = "=IF(I31>0;(I31-H31)*24;\"\")"; + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 4).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Промывка."); + tuple.column += 5; + + SetCell(sheet.Row(tuple.row), tuple.column, "17:00:00"); + tuple.column += 1; + + SetCell(sheet.Row(tuple.row), tuple.column, "17:30:00"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column) + .FormulaR1C1 = FormulaBhaBlock(tuple); + tuple.column = tupleStart.column; + tuple.row += 1; + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 4).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Подъем КНБК в инт. 2763-2442м."); + tuple.column += 5; + + SetCell(sheet.Row(tuple.row), tuple.column, "17:00:00"); + tuple.column += 1; + + SetCell(sheet.Row(tuple.row), tuple.column, "17:30:00"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column) + .FormulaR1C1 = FormulaBhaBlock(tuple); + tuple.column = tupleStart.column; + tuple.row += 1; + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 4).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Спуск КНБК в инт. 2442-2763м."); + tuple.column += 5; + + SetCell(sheet.Row(tuple.row), tuple.column, "17:00:00"); + tuple.column += 1; + + SetCell(sheet.Row(tuple.row), tuple.column, "17:30:00"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column) + .FormulaR1C1 = FormulaBhaBlock(tuple); + tuple.column = tupleStart.column; + tuple.row += 1; + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 4).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Бурение с наращиваниями в инт. 2763-2850м."); + tuple.column += 5; + + SetCell(sheet.Row(tuple.row), tuple.column, "17:00:00"); + tuple.column += 1; + + SetCell(sheet.Row(tuple.row), tuple.column, "17:30:00"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column) + .FormulaR1C1 = FormulaBhaBlock(tuple); + + return tuple; } - private void AddBlockTimeBalance(IXLWorksheet sheet) + private (int row, int column) AddBlockTimeBalance(IXLWorksheet sheet, (int row, int column) tupleStart) { - sheet.Cell(33, 6).Value = + tupleStart.column = 4; + tupleStart.row += 2; + var tuple = (row: tupleStart.row, column: tupleStart.column); + + sheet.Cell(tuple.row, tuple.column + 2).Value = "БАЛАНС ВРЕМЕНИ"; - sheet.Range(33, 6, 33, 7).Merge(); + sheet.Range(tuple.row, tuple.column + 2, tuple.row, tuple.column + 3).Merge(); + tuple.row += 1; - sheet.Cell(34, 4).Value = - "Бурение"; - sheet.Cell(34, 5).Value = - ""; - sheet.Cell(34, 6).Value = - "КНБК"; - sheet.Cell(34, 7).Value = - ""; - sheet.Cell(34, 8).Value = - "ОЗЦ"; - sheet.Cell(34, 9).Value = - ""; - sheet.Cell(35, 4).Value = - "Промывка"; - sheet.Cell(35, 5).Value = - ""; - sheet.Cell(35, 6).Value = - "СПО"; - sheet.Cell(35, 7).Value = - ""; - sheet.Cell(35, 8).Value = - "Тех. работы"; - sheet.Cell(35, 9).Value = - ""; + SetCell(sheet.Row(tuple.row), tuple.column, "Бурение"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, "КНБК"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, "ОЗЦ"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column = tupleStart.column; + tuple.row += 1; - sheet.Cell(36, 4).Value = - "Наращивание"; - sheet.Cell(36, 5).Value = - ""; - sheet.Cell(36, 6).Value = - "ПЗР"; - sheet.Cell(36, 7).Value = - ""; - sheet.Cell(36, 8).Value = - "Снятие замера"; - sheet.Cell(36, 9).Value = - ""; + SetCell(sheet.Row(tuple.row), tuple.column, "Промывка"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, "СПО"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, "Тех. работы"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column = tupleStart.column; + tuple.row += 1; - sheet.Cell(37, 4).Value = - "Проработка"; - sheet.Cell(37, 5).Value = - ""; - sheet.Cell(37, 6).Value = - "ПВО"; - sheet.Cell(37, 7).Value = - ""; - sheet.Cell(37, 8).Value = - "Цементирование"; - sheet.Cell(37, 9).Value = - ""; + SetCell(sheet.Row(tuple.row), tuple.column, "Наращивание"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, "ПЗР"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, "Снятие замера"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column = tupleStart.column; + tuple.row += 1; - sheet.Cell(38, 4).Value = - "Расширка"; - sheet.Cell(38, 5).Value = - ""; - sheet.Cell(38, 6).Value = - "ПГР"; - sheet.Cell(38, 7).Value = - ""; - sheet.Cell(38, 8).Value = - "Простой"; - sheet.Cell(38, 9).Value = - ""; + SetCell(sheet.Row(tuple.row), tuple.column, "Расширка"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, "ПГР"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, "Простой"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column = tupleStart.column; + tuple.row += 1; - sheet.Cell(39, 4).Value = - "Ремонт "; - sheet.Cell(39, 5).Value = - ""; - sheet.Cell(39, 6).Value = - "ГИС"; - sheet.Cell(39, 7).Value = - ""; - sheet.Cell(39, 8).Value = - "НПВ"; - sheet.Cell(39, 9).Value = - ""; + SetCell(sheet.Row(tuple.row), tuple.column, "Ремонт"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, "ГИС"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, "НПВ"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + return tuple; } - private void AddBlockDimensionless(IXLWorksheet sheet, DailyReportDimensionlessDto blockDto) + private (int row, int column) AddBlockDimensionless(IXLWorksheet sheet, DailyReportDimensionlessDto blockDto, (int row, int column) tupleStart) { - sheet.Cell(41, 6).Value = + tupleStart.column = 4; + tupleStart.row += 2; + var tuple = (row: tupleStart.row, column: tupleStart.column); + + sheet.Cell(tuple.row, tuple.column).Value = "БЕЗМЕТРАЖНЫЕ РАБОТЫ"; - sheet.Range(41, 6, 41, 7).Merge(); + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 5).Merge(); + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Подготовка ствола скв. к наращиванию"); + tuple.column += 3; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge().Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, "Наращивание"); + tuple.row += 1; + tuple.column = tupleStart.column; - sheet.Cell(42, 4).Value = - "Подготовка ствола скв. к наращиванию"; - sheet.Range(42, 4, 42, 6).Merge(); - sheet.Cell(42, 7).Value = - "Наращивание"; - sheet.Range(42, 7, 42, 9).Merge(); + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Норматив на одну операцию, (мин):"); + tuple.column += 2; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.StandardTimeBarrelPreparation}"); + tuple.column += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Норматив на одну операцию, (мин):"); + tuple.column += 2; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.StandardTimeExtension}"); + tuple.column = tupleStart.column; + tuple.row += 1; - sheet.Cell(43, 4).Value = - "Норматив на одну операцию, (мин):"; - sheet.Range(43, 4, 43, 5).Merge(); - sheet.Cell(43, 6).Value = - $"{blockDto.StandardTimeBarrelPreparation}"; - sheet.Cell(43, 7).Value = - "Норматив на одну операцию, (мин):"; - sheet.Range(43, 7, 43, 8).Merge(); - sheet.Cell(43, 9).Value = - $"{blockDto.StandardTimeExtension}"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Проработка при бур, план (ч):"); + tuple.column += 2; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column).FormulaA1 = $"{converteCellCoordinate(tuple.row - 1, true, tuple.column)}/60*{converteCellCoordinate(tuple.row + 28, true, tuple.column + 1)}"; + tuple.column += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Наращивание, план (ч):"); + tuple.column += 2; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column).FormulaA1 = $"{converteCellCoordinate(tuple.row - 1, true, tuple.column)}/60*{converteCellCoordinate(tuple.row + 28, true, tuple.column - 2)}"; + tuple.column = tupleStart.column; + tuple.row += 1; - sheet.Cell(44, 4).Value = - "Проработка при бур, план (ч):"; - sheet.Range(44, 4, 44, 5).Merge(); - sheet.Cell(44, 6).Value = - "=F43/60*G72"; - sheet.Cell(44, 7).Value = - "Наращивание, план (ч):"; - sheet.Range(44, 7, 44, 8).Merge(); - sheet.Cell(44, 9).Value = - "=I43/60*G72"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Проработка при бур, факт (ч):"); + tuple.column += 2; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.ActualTimeBarrelPreparation}"); + tuple.column += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Наращивание, факт (ч):"); + tuple.column += 2; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.ActualTimeExtension}"); + tuple.column = tupleStart.column; + tuple.row += 1; - sheet.Cell(45, 4).Value = - "Проработка при бур, факт (ч):"; - sheet.Range(45, 4, 45, 5).Merge(); - sheet.Cell(45, 6).Value = - $"{blockDto.ActualTimeBarrelPreparation}"; - sheet.Cell(45, 7).Value = - "Наращивание, факт (ч):"; - sheet.Range(45, 7, 45, 8).Merge(); - sheet.Cell(45, 9).Value = - $"{blockDto.ActualTimeExtension}"; - sheet.Cell(46, 4).Value = - "Превышение плановых норм, (ч):"; - sheet.Range(46, 4, 46, 5).Merge(); - sheet.Cell(46, 6).Value = - "=F45-F44"; - sheet.Cell(46, 7).Value = - "Превышение плановых норм, (ч):"; - sheet.Range(46, 7, 46, 8).Merge(); - sheet.Cell(46, 9).Value = - "=I45-I44"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Превышение плановых норм, (ч):"); + tuple.column += 2; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column).FormulaA1 = $"{converteCellCoordinate(tuple.row - 1, true, tuple.column)}-{converteCellCoordinate(tuple.row - 2, true, tuple.column)}"; + tuple.column += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Превышение плановых норм, (ч):"); + tuple.column += 2; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column).FormulaA1 = $"{converteCellCoordinate(tuple.row - 1, true, tuple.column)}-{converteCellCoordinate(tuple.row - 2, true, tuple.column)}"; + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row + 1, tuple.column + 2).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, "Краткие причины: доп проработки при переходе из слайда в ротор, в середине свечи."); + tuple.column += 3; + sheet.Range(tuple.row, tuple.column, tuple.row + 1, tuple.column + 2).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, "Краткие причины: нехватка пальцев на обоих руках у первого помощника бурильщика."); + tuple.column += 2; + return tuple; + } + + private (int row, int column) AddBlockSaub(IXLWorksheet sheet, DailyReportSaubDto blockDto, (int row, int column) tupleStart) + { - sheet.Cell(47, 4).Value = - "Краткие причины: доп проработки при переходе из слайда в ротор, в середине свечи."; - sheet.Range(47, 4, 48, 6).Merge(); + tupleStart.row += 2; + tupleStart.column = 3; + var tuple = (row: tupleStart.row, column: tupleStart.column); - sheet.Cell(47, 7).Value = - "Краткие причины: нехватка пальцев на обоих руках у первого помощника бурильщика."; - sheet.Range(47, 7, 48, 9).Merge(); + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"Бурение в роторе : {blockDto.RotorDrillingModes}"); + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"Бурение в слайде : {blockDto.SlideDrillingModes}"); + tuple.row += 2; + + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, "Бурение в роторе (за отчетный период) с использование САУБ-1"); + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Проходка"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Часы бурения"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Мех. скорость"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Среднее диф. Давление") + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.PenetrationInRotor}"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.NumberDrillingHours}"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column).FormulaA1 = FormulaMechanicalSpeed(tuple); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.AVGDiffDropRotor}") + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + tuple.column = tupleStart.column; + tuple.row += 2; + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, "Бурение в слайде (за отчетный период) с использование САУБ-1"); + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Проходка"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Часы бурения"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Мех. скорость"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, "Среднее диф. Давление"); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.PenetrationInSlide}"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.DrillingTimeInRotor}"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column).FormulaA1 = FormulaMechanicalSpeed(tuple); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.AVGDiffPressureSlide}"); + tuple.column = tupleStart.column; + tuple.row += 2; + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 5).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Итого за отчетный период, использование САУБ-1"); + tuple.column += 6; + sheet.Range(tuple.row, tuple.column, tuple.row + 1, tuple.column + 1).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, "Плановая мех скорость"); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Проходка"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Часы бурения"); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Мех. скорость"); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column).FormulaA1 = FormulaSinking(tuple); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, ""); + sheet.Cell(tuple.row, tuple.column).FormulaA1 = FormulaDrillingWatch(tuple); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column += 2; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.SectionROPPlan}"); + tuple.column = tupleStart.column; + tuple.row += 2; + + + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Увеличение мех скорости за секцию %"); + tuple.column += 4; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Увеличение мех скорости за сутки %"); + tuple.column += 4; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Сокращение времени бурения за секцию, ч"); + tuple.column += 4; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Ротор / слайд, %"); + tuple.column += 4; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "МСП за секцию м/ч."); + tuple.column += 4; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, ""); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Время бурения за секцию"); + tuple.column += 4; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.SectionDrillingTimeTotal}"); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Проходка за секцию"); + tuple.column += 4; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.SectionPenetrationTotal}"); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Кол- во наращиваний"); + tuple.column += 4; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.ExtensionsCount}"); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row), tuple.column, "Отклонение от ГГД +/-, сут"); + tuple.column += 4; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.DeviationFromTVD}"); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row), tuple.column, $"Примечание: {blockDto.DeclinesReasonsROP}"); + tuple.column += 7; + return tuple; } - //private (int,int) AddBlockSaub(IXLWorksheet sheet, Tuple startRow, DailyReportBlock5 blockDto) - private void AddBlockSaub(IXLWorksheet sheet, DailyReportSaubDto blockDto) + private (int row, int column) AddBlockSign(IXLWorksheet sheet, DailyReportSignDto blockDto, (int row, int column) tupleStart) { - - sheet.Cell(50, 3).Value = - $"Бурение в роторе : {blockDto.RotorDrillingModes}"; - sheet.Range(50, 4, 50, 10).Merge(); - sheet.Cell(50, 3).Value = - $"Бурение в слайде : {blockDto.SlideDrillingModes}"; - sheet.Range(50, 4, 50, 10).Merge(); - - - sheet.Cell(53, 3).Value = "Бурение в роторе (за отчетный период) с использование САУБ-1"; - sheet.Range(53, 3, 53, 10).Merge(); - sheet.Cell(54, 3).Value = "Проходка"; - sheet.Range(54, 3, 54, 4).Merge(); - sheet.Cell(55, 3).Value = $"{blockDto.PenetrationInRotor}"; - sheet.Range(55, 3, 55, 4).Merge(); - sheet.Cell(54, 5).Value = "Часы бурения"; - sheet.Range(54, 5, 54, 6).Merge(); - sheet.Cell(55, 5).Value = $"{blockDto.NumberDrillingHours}"; - sheet.Range(55, 5, 55, 6).Merge(); - sheet.Cell(54, 7).Value = "Мех. скорость"; - sheet.Range(54, 7, 54, 8).Merge(); - sheet.Cell(55, 7).Value = "=IF(E55>0;C55/E55;0)"; - sheet.Range(55, 7, 55, 8).Merge(); - sheet.Cell(54, 9).Value = "Среднее диф. Давление"; - sheet.Range(54, 9, 54, 10).Merge(); - sheet.Cell(55, 9).Value = $"{blockDto.AVGDiffDropRotor}"; - sheet.Range(55, 9, 55, 10).Merge(); - - sheet.Cell(57, 3).Value = "Бурение в слайде (за отчетный период) с использование САУБ-1"; - sheet.Range(57, 3, 57, 10).Merge(); - sheet.Cell(58, 3).Value = "Проходка"; - sheet.Range(58, 3, 58, 4).Merge(); - sheet.Cell(59, 3).Value = $"{blockDto.PenetrationInSlide}"; - sheet.Range(59, 3, 59, 4).Merge(); - sheet.Cell(58, 5).Value = "Часы бурения"; - sheet.Range(58, 5, 58, 6).Merge(); - sheet.Cell(59, 5).Value = $"{blockDto.DrillingTimeInRotor}"; - sheet.Range(59, 5, 59, 6).Merge(); - sheet.Cell(58, 7).Value = "Мех. скорость"; - sheet.Range(58, 7, 58, 8).Merge(); - sheet.Cell(59, 7).Value = "=IF(E59>0;C59/E59;0)"; - sheet.Range(59, 7, 59, 8).Merge(); - sheet.Cell(58, 9).Value = "Среднее диф. Давление"; - sheet.Range(58, 9, 58, 10).Merge(); - sheet.Cell(59, 9).Value = $"{blockDto.AVGDiffPressureSlide}"; - sheet.Range(59, 9, 59, 10).Merge(); - - sheet.Cell(61, 3).Value = "Итого за отчетный период, использование САУБ-1"; - sheet.Range(61, 3, 61, 8).Merge(); - sheet.Cell(62, 3).Value = "Проходка"; - sheet.Range(62, 3, 62, 4).Merge(); - sheet.Cell(63, 3).Value = "=IF((C59+C55)<>(I9-G9);\"ОШИБКА\";C55+C59)"; - sheet.Range(63, 3, 63, 4).Merge(); - sheet.Cell(62, 5).Value = "Часы бурения"; - sheet.Range(62, 5, 62, 6).Merge(); - sheet.Cell(63, 5).Value = "=E55+E59"; - sheet.Range(63, 5, 63, 6).Merge(); - sheet.Cell(62, 7).Value = "Мех. скорость"; - sheet.Range(62, 7, 62, 8).Merge(); - sheet.Cell(63, 7).Value = ""; - sheet.Range(63, 7, 63, 8).Merge(); - sheet.Cell(61, 9).Value = "Плановая мех скорость"; - sheet.Range(61, 9, 62, 10).Merge(); - sheet.Cell(63, 9).Value = $"{blockDto.SectionROPPlan}"; - sheet.Range(63, 9, 63, 10).Merge(); - - - sheet.Cell(65, 3).Value = "Увеличение мех скорости за секцию %"; - sheet.Range(65, 3, 65, 6).Merge(); - sheet.Cell(65, 7).Value = ""; - sheet.Range(65, 7, 65, 10).Merge(); - sheet.Cell(66, 3).Value = "Увеличение мех скорости за сутки %"; - sheet.Range(66, 3, 66, 6).Merge(); - sheet.Cell(66, 7).Value = ""; - sheet.Range(66, 7, 66, 10).Merge(); - sheet.Cell(67, 3).Value = "Сокращение времени бурения за секцию, ч"; - sheet.Range(67, 3, 67, 6).Merge(); - sheet.Cell(67, 7).Value = ""; - sheet.Range(67, 7, 67, 10).Merge(); - sheet.Cell(68, 3).Value = "Ротор / слайд, %"; - sheet.Range(68, 3, 68, 6).Merge(); - sheet.Cell(68, 7).Value = ""; - sheet.Range(68, 7, 68, 10).Merge(); - sheet.Cell(69, 3).Value = "МСП за секцию м/ч."; - sheet.Range(69, 3, 69, 6).Merge(); - sheet.Cell(69, 7).Value = ""; - sheet.Range(69, 7, 69, 10).Merge(); - - sheet.Cell(70, 3).Value = "Время бурения за секцию"; - sheet.Range(70, 3, 70, 6).Merge(); - sheet.Cell(70, 7).Value = $"{blockDto.SectionDrillingTimeTotal}"; - sheet.Range(70, 7, 70, 10).Merge(); - - sheet.Cell(71, 3).Value = "Проходка за секцию"; - sheet.Range(71, 3, 71, 6).Merge(); - sheet.Cell(71, 7).Value = $"{blockDto.SectionPenetrationTotal}"; - sheet.Range(71, 7, 71, 10).Merge(); - - sheet.Cell(72, 3).Value = "Кол- во наращиваний"; - sheet.Range(72, 3, 72, 6).Merge(); - sheet.Cell(72, 7).Value = $"{blockDto.ExtensionsCount}"; - sheet.Range(72, 7, 72, 10).Merge(); - - sheet.Cell(73, 3).Value = "Отклонение от ГГД +/-, сут"; - sheet.Range(73, 3, 73, 6).Merge(); - sheet.Cell(73, 7).Value = $"{blockDto.DeviationFromTVD}"; - sheet.Range(73, 7, 73, 10).Merge(); - - sheet.Cell(74, 3).Value = $"Примечание: {blockDto.DeclinesReasonsROP}"; - sheet.Range(74, 3, 75, 10).Merge(); - - } - - private void AddBlockSign(IXLWorksheet sheet, DailyReportSignDto blockDto) - { - sheet.Cell(78, 3).Value = + tupleStart.row += 2; + tupleStart.column = 3; + var tuple = (row: tupleStart.row, column: tupleStart.column); + sheet.Cell(tuple.row,tuple.column).Value = "Мастер буровой "; - sheet.Range(78, 3, 78, 4).Merge(); - sheet.Cell(78, 9).Value = + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + sheet.Cell(tuple.row, tuple.column+5).Value = $"{blockDto.DrillingMaster}"; - sheet.Range(78, 9, 78, 10).Merge(); - - sheet.Cell(80, 3).Value = + sheet.Range(tuple.row, tuple.column + 5, tuple.row, tuple.column + 1).Merge(); + tuple.column = tupleStart.column; + tuple.row += 2; + sheet.Cell(tuple.row, tuple.column).Value = "Супервайзер "; - sheet.Range(80, 3, 80, 4).Merge(); - sheet.Cell(80, 9).Value = + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + sheet.Cell(tuple.row, tuple.column + 5).Value = $"{blockDto.Supervisor}"; - sheet.Range(80, 9, 80, 10).Merge(); + sheet.Range(tuple.row, tuple.column + 5, tuple.row, tuple.column + 1).Merge(); + + return tuple; } diff --git a/ConsoleApp1/Program.cs b/ConsoleApp1/Program.cs index c26c57f6..61cbf11e 100644 --- a/ConsoleApp1/Program.cs +++ b/ConsoleApp1/Program.cs @@ -27,8 +27,14 @@ namespace ConsoleApp1 WellDepthIntervalStartDate= 26.5, BottomholeDepth= 66.6 }; + var block2 = new DailyReportBhaDto() + { + BHADescription="sadasdasdasdasdasdjlaskjdaksjdlasdlalskdklj" + }; - var ms = MakeReportFromBlocks(block); + var block3 = new DailyReportSaubDto(); + + var ms = MakeReportFromBlocks(block,block3); //File.Create("", MakeReportFromBlocks(block)); using var file = new FileStream("file.xlsx", FileMode.Create, System.IO.FileAccess.Write); byte[] bytes = new byte[ms.Length]; @@ -37,10 +43,10 @@ namespace ConsoleApp1 ms.Close(); } - public static Stream MakeReportFromBlocks(DailyReportHeadDto blockHead) + public static Stream MakeReportFromBlocks(DailyReportHeadDto blockHead, DailyReportSaubDto blockD) { using var workbook = new XLWorkbook(); - FillSheet6blocks(workbook, blockHead); + FillSheet6blocks(workbook, blockHead, blockD); MemoryStream memoryStream = new MemoryStream(); workbook.SaveAs(memoryStream, new SaveOptions { }); memoryStream.Seek(0, SeekOrigin.Begin); @@ -54,27 +60,105 @@ namespace ConsoleApp1 return $"{convertColumn}{row}"; } - public static void FillSheet6blocks(XLWorkbook workbook, DailyReportHeadDto blockHead) + private static string FormulaMechanicalSpeed((int row, int col) tuple) + { + return $"=IF({converteCellCoordinate(tuple.row,true,tuple.col-2)}>0," + + $"{converteCellCoordinate(tuple.row,true,tuple.col-4)}/{converteCellCoordinate(tuple.row,true,tuple.col-2)},0)"; + } + + private static string FormulaDrillingWatch((int row, int col) tuple) + { + return $"=IF({converteCellCoordinate(tuple.row - 8,true,tuple.col)}+" + + $"{converteCellCoordinate(tuple.row - 4,true,tuple.col)}"; + } + + private static string FormulaSinking((int row, int col) tuple) + { + return $"=IF(({converteCellCoordinate(tuple.row - 4,true,tuple.col)}+{converteCellCoordinate(tuple.row - 8,true,tuple.col)})" + + $"<>({converteCellCoordinate(tuple.row - 54,true,tuple.col + 6)}-{converteCellCoordinate(tuple.row - 54,true,tuple.col + 4)}),\"ОШИБКА\"" + + $",{converteCellCoordinate(tuple.row - 4,true,tuple.col)}+{converteCellCoordinate(tuple.row - 8,true,tuple.col)})"; + + //return $"=IF({converteCellCoordinate(tuple.row - 8,true,tuple.col)}+" + + // $"{converteCellCoordinate(tuple.row - 4,true,tuple.col)}"; + } + + public static void FillSheet6blocks(XLWorkbook workbook, DailyReportHeadDto blockHead, DailyReportSaubDto blockD) { var sheet = workbook.Worksheets.Add(blockHead.ReportDate.ToString("dd.MM.yyyy")); //sheet.Name = blockHead.ReportDate.ToString("dd.MM.yyyy"); var tuple = (row: 3, column: 3); - + sheet.Style.Font.FontName = "TimesNewRoman"; + sheet.Style.Font.FontSize = 10; + tuple = (AddBlockHead1(sheet, blockHead, (tuple.row, tuple.column)).row, AddBlockHead1(sheet, blockHead, (tuple.row, tuple.column)).column); - //sheet.Columns().AdjustToContents(); + AddBlockBha(sheet, blockD, tuple); + //sheet.Columns().AdjustToContents(8,9); + //sheet.Rows().AdjustToContents(3,21); + + } // + private static IXLStyle SetBorder(IXLStyle style) + { + style.Border.RightBorder = XLBorderStyleValues.Thin; + style.Border.LeftBorder = XLBorderStyleValues.Thin; + style.Border.TopBorder = XLBorderStyleValues.Thin; + style.Border.BottomBorder = XLBorderStyleValues.Thin; + style.Border.InsideBorder = XLBorderStyleValues.Thin; + return style; + } + + private static IXLCell SetDateTime(IXLCell cell) + { + cell.DataType = XLDataType.DateTime; + cell.Style.DateFormat.Format = "DD.MM.YYYY HH:MM:SS"; + return cell; + } + + private static IXLCell SetNumber(IXLCell cell) + { + cell.DataType = XLDataType.Number; + cell.Style.NumberFormat.Format = "0.00"; + return cell; + } + + private static IXLCell SetCell(IXLRow row, int colunm, object value, int maxChartsToWrap = 88) + { + var cell = row.Cell(colunm); + cell.Value = value; + + SetBorder(cell.Style); + cell.Style.Alignment.WrapText = true; + + + if (value is string valueString && valueString.Length > maxChartsToWrap) + { + var baseHeight = row.Height; + row.Height = 0.82d * baseHeight * Math.Ceiling(1d + valueString.Length / maxChartsToWrap); + } + + if (value is DateTime) + { + SetDateTime(cell); + } + else if (value is IFormattable) + { + SetNumber(cell); + } + + return cell; + } + private static (int row, int column) AddBlockHead1(IXLWorksheet sheet, DailyReportHeadDto blockDto, (int row, int column) tupleStart) { var tuple = (row: tupleStart.row, column: tupleStart.column); sheet.Cell(tuple.row, tuple.column).Value = $"Суточная сводка бурения скважины: {blockDto.WellName}, куст: {blockDto.ClusterName}"; - sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge(); - //4 - tuple.row += 1; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge(); + tuple.row += 1; sheet.Cell(tuple.row, tuple.column).Value = $"Заказчик: {blockDto.Customer}"; sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge(); @@ -84,51 +168,348 @@ namespace ConsoleApp1 sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge(); tuple.row += 2; //7,3 - sheet.Cell(tuple.row, tuple.column).Value = "Отчетный период"; sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Отчетный период"); tuple.column += 4; - sheet.Cell(tuple.row, tuple.column).Value = "Забой за отчетный период, м"; sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge(); + sheet.Cell(tuple.row, tuple.column+3).Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, "Забой за отчетный период, м"); tuple.column = tupleStart.column; tuple.row += 1; //8,3 - - sheet.Cell(tuple.row, tuple.column).Value = "От (дата, время)"; sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); - + SetCell(sheet.Row(tuple.row),tuple.column, "От (дата, время)"); tuple.column += 2; //8,5 - sheet.Cell(tuple.row, tuple.column).Value = "До (дата, время)"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "До (дата, время)"); tuple.column += 2; //8,7 - sheet.Cell(tuple.row, tuple.column).Value = "От"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "От"); tuple.column += 2; //8,9 - sheet.Cell(tuple.row, tuple.column).Value = "До"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "До"); + sheet.Cell(tuple.row, tuple.column+1).Style.Border.RightBorder = XLBorderStyleValues.Thin; tuple.column = tupleStart.column; tuple.row += 1; //9,3 + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.ReportDate}"); + tuple.column += 2; - - sheet.Cell(tuple.row, tuple.column).Value = $"{blockDto.ReportDate}"; - sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + //согласно формуле в шаблоне - ячейка С9 + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, ""); + sheet.Cell(tuple.row,tuple.column).FormulaA1 = $"={converteCellCoordinate(tuple.row, true, tuple.column - 2)}-1"; + SetDateTime(sheet.Cell(tuple.row,tuple.column)); tuple.column += 2; - //согласно формуле в шаблоне - ячейка С9 - sheet.Cell(tuple.row, tuple.column).FormulaA1 = $"={converteCellCoordinate(tuple.row, true, tuple.column-2)}-1"; - sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.WellDepthIntervalStartDate}"); tuple.column += 2; - sheet.Cell(tuple.row, tuple.column).Value = $"{blockDto.WellDepthIntervalStartDate}"; - sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); - tuple.column += 2; - sheet.Cell(tuple.row, tuple.column).Value = $"{blockDto.WellDepthIntervalFinishDate}"; - sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.WellDepthIntervalFinishDate}"); tuple.column = tupleStart.column; - tuple.row += 2; //11,3 + tuple.row += 2; //11,3 + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge().Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, "Данные по траектории скважины на конец суток"); + tuple.column = tupleStart.column; + tuple.row += 1;//12 + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Глубина по стволу"); + tuple.column += 2; //12,5 + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Глубина по вертикали"); + tuple.column += 2; //12,7 + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Зенитный угол"); + tuple.column += 2; //12,9 + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge().Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, "Азимут"); + tuple.column = tupleStart.column; + tuple.row += 1; //13,3 + + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.BottomholeDepth}"); + tuple.column += 2; + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.VerticalDepth}"); + tuple.column += 2; + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.ZenithAngle}"); + tuple.column += 2; + + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge().Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.AzimuthAngle}"); + tuple.column = tupleStart.column; + tuple.row += 2; //15,3 - return (tuple.Item1, tuple.Item2); + sheet.Cell(tuple.row, tuple.column).Value = "Бурильщик 1 смена"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + tuple.column += 2; + sheet.Cell(tuple.row, tuple.column).Value = $"{blockDto.FirstDriller}"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + tuple.row += 1; + tuple.column = tupleStart.column; + sheet.Cell(tuple.row, tuple.column).Value = "Бурильщик 2 смена"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + tuple.column += 2; + sheet.Cell(tuple.row, tuple.column).Value = $"{blockDto.SecondDriller}"; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge(); + tuple.row += 2; + tuple.column = tupleStart.column; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column,"Работа модулей САУБ:"); + tuple.column += 3; + SetCell(sheet.Row(tuple.row),tuple.column,"Часов:"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row),tuple.column, "Метров:").Style.Border.RightBorder = XLBorderStyleValues.Thin; + tuple.row += 1; + tuple.column = tupleStart.column; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column,"АПД (автоматическая подача долота), ч/м:"); + tuple.column += 3; + SetCell(sheet.Row(tuple.row),tuple.column,$"{blockDto.WorkTimeSAUB}"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.PenetrationSAUB}").Style.Border.RightBorder = XLBorderStyleValues.Thin; + tuple.row += 1; + tuple.column = tupleStart.column; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column,"Спин Мастер (осцилляция),ч/м:"); + tuple.column += 3; + SetCell(sheet.Row(tuple.row),tuple.column,$"{blockDto.WorkTimeSpinMaster}"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.PenetrationSpinMaster}").Style.Border.RightBorder = XLBorderStyleValues.Thin; + tuple.row += 1; + tuple.column = tupleStart.column; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column,"Торк Мастер (демпфирование), ч/:"); + tuple.column += 3; + SetCell(sheet.Row(tuple.row),tuple.column,$"{blockDto.WorkTimeTorkMaster}"); + tuple.column += 1; + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.PenetrationTorkMaster}").Style.Border.RightBorder = XLBorderStyleValues.Thin; + tuple.row += 1; + tuple.column = tupleStart.column; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 2).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column,"МСЕ, колличество запусков, раз:"); + tuple.column += 3; + sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge().Style.Border.RightBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.CountLaunchesMSE}"); + tuple.column+=2; + return tuple; + } + private static (int row, int column) AddBlockBha(IXLWorksheet sheet, DailyReportSaubDto blockDto, (int row, int column) tupleStart) + { + tupleStart.row += 2; + tupleStart.column = 3; + var tuple = (row: tupleStart.row, column: tupleStart.column); + + + sheet.Range(tuple.row, tuple.column, tuple.row,tuple.column + 7).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, $"Бурение в роторе : {blockDto.RotorDrillingModes}"); + tuple.row+=1; + sheet.Range(tuple.row, tuple.column, tuple.row,tuple.column + 7).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, $"Бурение в слайде : {blockDto.SlideDrillingModes}"); + tuple.row+=2; + + + sheet.Range(tuple.row, tuple.column, tuple.row,tuple.column + 7).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, "Бурение в роторе (за отчетный период) с использование САУБ-1"); + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Проходка"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Часы бурения"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Мех. скорость"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Среднее диф. Давление") + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.PenetrationInRotor}"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.NumberDrillingHours}"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, ""); + sheet.Cell(tuple.row,tuple.column).FormulaA1 = FormulaMechanicalSpeed(tuple); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.AVGDiffDropRotor}") + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + tuple.column=tupleStart.column; + tuple.row+=2; + + sheet.Range(tuple.row, tuple.column, tuple.row,tuple.column + 7).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, "Бурение в слайде (за отчетный период) с использование САУБ-1"); + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Проходка"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Часы бурения"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Мех. скорость"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, "Среднее диф. Давление"); + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.PenetrationInSlide}"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.DrillingTimeInRotor}"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, ""); + sheet.Cell(tuple.row,tuple.column).FormulaA1 = FormulaMechanicalSpeed(tuple); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.AVGDiffPressureSlide}"); + tuple.column=tupleStart.column; + tuple.row+=2; + + sheet.Range(tuple.row, tuple.column, tuple.row,tuple.column + 5).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Итого за отчетный период, использование САУБ-1"); + tuple.column+=6; + sheet.Range(tuple.row,tuple.column, tuple.row + 1,tuple.column + 1).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, "Плановая мех скорость"); + tuple.column = tupleStart.column; + tuple.row += 1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Проходка"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Часы бурения"); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Мех. скорость"); + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, ""); + sheet.Cell(tuple.row,tuple.column).FormulaA1 = FormulaSinking(tuple); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, ""); + sheet.Cell(tuple.row,tuple.column).FormulaA1 = FormulaDrillingWatch(tuple); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, ""); + tuple.column+=2; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 1).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.SectionROPPlan}"); + tuple.column=tupleStart.column; + tuple.row+=2; + + + + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Увеличение мех скорости за секцию %"); + tuple.column+=4; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, ""); + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Увеличение мех скорости за сутки %"); + tuple.column+=4; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, ""); + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Сокращение времени бурения за секцию, ч"); + tuple.column+=4; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, ""); + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Ротор / слайд, %"); + tuple.column+=4; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, ""); + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "МСП за секцию м/ч."); + tuple.column+=4; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, ""); + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Время бурения за секцию"); + tuple.column+=4; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.SectionDrillingTimeTotal}"); + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Проходка за секцию"); + tuple.column+=4; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.SectionPenetrationTotal}"); + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Кол- во наращиваний"); + tuple.column+=4; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.ExtensionsCount}"); + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge(); + SetCell(sheet.Row(tuple.row),tuple.column, "Отклонение от ГГД +/-, сут"); + tuple.column+=4; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 3).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, $"{blockDto.DeviationFromTVD}"); + tuple.column=tupleStart.column; + tuple.row+=1; + sheet.Range(tuple.row,tuple.column, tuple.row,tuple.column + 7).Merge() + .Style.Border.OutsideBorder = XLBorderStyleValues.Thin; + SetCell(sheet.Row(tuple.row),tuple.column, $"Примечание: {blockDto.DeclinesReasonsROP}"); + tuple.column += 7; + return tuple; } } struct CellAddress