DD.WellWorkover.Cloud/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs

1040 lines
52 KiB
C#
Raw Normal View History

using AsbCloudApp.Data;
using AsbCloudApp.Data.DailyReport;
using AsbCloudApp.Data.DailyReportModel;
using AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks;
using ClosedXML.Excel;
using System;
using System.IO;
using System.Linq;
namespace AsbCloudInfrastructure.Services.DailyReport
{
public class DailyReportMakerExcel
{
// черновик реализации отчета "по блокам"
public Stream MakeReportFromBlocks(DailyReportHeadDto blockHead, DailyReportBhaDto blockBha, DailyReportTimeBalanceDto blockBalance ,DailyReportDimensionlessDto blockDimensionless, DailyReportSaubDto blockSaub, DailyReportSignDto blockSign)
{
using var workbook = new XLWorkbook();
FillExampleBlocks(workbook, blockHead, blockBha, blockBalance);
//FillSheet6blocks(workbook, blockHead, blockBha, blockDimensionless, blockSaub, blockSign);
MemoryStream memoryStream = new MemoryStream();
workbook.SaveAs(memoryStream, new SaveOptions { });
memoryStream.Seek(0, SeekOrigin.Begin);
return memoryStream;
}
private void FillExampleBlocks(XLWorkbook workbook, DailyReportHeadDto blockHeadDto, DailyReportBhaDto blockBhaDto, DailyReportTimeBalanceDto timeBalanceDto)
{
var sheet = workbook.Worksheets.Add(blockHeadDto.ReportDate.ToString("dd.MM.yyyy"));
var addressStart = new CellAddress(sheet, 1, 1);
var blockHeader = new HeadBlock(addressStart, blockHeadDto);
addressStart = blockHeader.AddressBlockEnd + (1, 0);
var blockBha = new BhaBlock(addressStart, blockBhaDto);
addressStart = blockBha.AddressBlockEnd + (1, 0);
var timeBalance = new TimeBalanceBlock(addressStart, timeBalanceDto);
blockHeader.Draw(sheet);
blockBha.Draw(sheet);
timeBalance.Draw(sheet);
//blockWithFormula.Draw(sheet);
}
private String converteCellCoordinate(int row, bool isCaps, int column)
{
var c = (Char)((isCaps ? 65 : 97) + (column - 1));
string convertColumn = c.ToString();
return $"{convertColumn}{row}";
}
2022-06-22 23:26:04 +05:00
private string FormulaBhaBlock((int row, int col) tuple)
{
2022-06-22 23:26:04 +05:00
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, \"\")";
}
2022-06-22 23:26:04 +05:00
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)";
}
2022-06-22 23:26:04 +05:00
private string FormulaDrillingWatch((int row, int col) tuple)
{
return $"=IF({converteCellCoordinate(tuple.row - 8, true, tuple.col)}+" +
$"{converteCellCoordinate(tuple.row - 4, true, tuple.col)}";
}
2022-06-22 23:26:04 +05:00
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)})";
}
2022-06-22 23:26:04 +05:00
public void FillSheet6blocks(XLWorkbook workbook, DailyReportHeadDto blockHead, DailyReportBhaDto blockBha, DailyReportDimensionlessDto blockDimensionless, DailyReportSaubDto blockSaub, DailyReportSignDto blockSign)
{
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)));
2022-06-22 23:26:04 +05:00
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)
{
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();
tuple.row += 1;
sheet.Cell(tuple.row, tuple.column).Value =
$"Заказчик: {blockDto.Customer}";
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge();
tuple.row += 1;
sheet.Cell(tuple.row, tuple.column).Value =
$"Подрядчик: {blockDto.Contractor}";
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 7).Merge();
tuple.row += 2;
//7,3
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge();
2022-06-22 23:26:04 +05:00
SetCell(sheet.Row(tuple.row), tuple.column, "Отчетный период");
tuple.column += 4;
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 3).Merge();
2022-06-22 23:26:04 +05:00
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.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge();
2022-06-22 23:26:04 +05:00
SetCell(sheet.Row(tuple.row), tuple.column, "От (дата, время)");
tuple.column += 2; //8,5
2022-06-22 23:26:04 +05:00
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge();
2022-06-22 23:26:04 +05:00
SetCell(sheet.Row(tuple.row), tuple.column, "До (дата, время)");
tuple.column += 2; //8,7
2022-06-22 23:26:04 +05:00
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge();
2022-06-22 23:26:04 +05:00
SetCell(sheet.Row(tuple.row), tuple.column, "От");
tuple.column += 2; //8,9
2022-06-22 23:26:04 +05:00
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge();
2022-06-22 23:26:04 +05:00
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
2022-06-22 23:26:04 +05:00
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
2022-06-22 23:26:04 +05:00
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;
2022-06-22 23:26:04 +05:00
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge();
SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.WellDepthIntervalStartDate}");
tuple.column += 2;
2022-06-22 23:26:04 +05:00
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
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;
2022-06-22 23:26:04 +05:00
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge();
SetCell(sheet.Row(tuple.row), tuple.column, $"{blockDto.VerticalDepth}");
tuple.column += 2;
2022-06-22 23:26:04 +05:00
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();
2022-06-22 23:26:04 +05:00
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;
2022-06-22 23:26:04 +05:00
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;
}
2022-06-22 23:26:04 +05:00
private (int row, int column) AddBlockBha(IXLWorksheet sheet, DailyReportBhaDto blockDto, (int row, int column) tupleStart)
{
2022-06-22 23:26:04 +05:00
tupleStart.column = 3;
tupleStart.row += 1;
var tuple = (row: tupleStart.row, column: tupleStart.column);
2022-06-22 23:26:04 +05:00
2022-06-22 23:26:04 +05:00
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.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;
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 4).Merge();
SetCell(sheet.Row(tuple.row), tuple.column, "Бурение с наращиваниями в инт. 2195-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, "Промывка.");
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;
}
2022-06-22 23:26:04 +05:00
private (int row, int column) AddBlockTimeBalance(IXLWorksheet sheet, (int row, int column) tupleStart)
{
2022-06-22 23:26:04 +05:00
tupleStart.column = 4;
tupleStart.row += 2;
var tuple = (row: tupleStart.row, column: tupleStart.column);
sheet.Cell(tuple.row, tuple.column + 2).Value =
"БАЛАНС ВРЕМЕНИ";
2022-06-22 23:26:04 +05:00
sheet.Range(tuple.row, tuple.column + 2, tuple.row, tuple.column + 3).Merge();
tuple.row += 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 += 1;
SetCell(sheet.Row(tuple.row), tuple.column, "");
tuple.column = tupleStart.column;
tuple.row += 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 += 1;
SetCell(sheet.Row(tuple.row), tuple.column, "");
tuple.column = tupleStart.column;
tuple.row += 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 += 1;
SetCell(sheet.Row(tuple.row), tuple.column, "");
tuple.column = tupleStart.column;
tuple.row += 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 += 1;
SetCell(sheet.Row(tuple.row), tuple.column, "");
tuple.column = tupleStart.column;
tuple.row += 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 += 1;
SetCell(sheet.Row(tuple.row), tuple.column, "");
return tuple;
}
2022-06-22 23:26:04 +05:00
private (int row, int column) AddBlockDimensionless(IXLWorksheet sheet, DailyReportDimensionlessDto blockDto, (int row, int column) tupleStart)
{
2022-06-22 23:26:04 +05:00
tupleStart.column = 4;
tupleStart.row += 2;
var tuple = (row: tupleStart.row, column: tupleStart.column);
sheet.Cell(tuple.row, tuple.column).Value =
"БЕЗМЕТРАЖНЫЕ РАБОТЫ";
2022-06-22 23:26:04 +05:00
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;
2022-06-22 23:26:04 +05:00
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.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;
2022-06-22 23:26:04 +05:00
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.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)
{
2022-06-22 23:26:04 +05:00
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;
}
2022-06-22 23:26:04 +05:00
private (int row, int column) AddBlockSign(IXLWorksheet sheet, DailyReportSignDto blockDto, (int row, int column) tupleStart)
{
2022-06-22 23:26:04 +05:00
tupleStart.row += 2;
tupleStart.column = 3;
var tuple = (row: tupleStart.row, column: tupleStart.column);
sheet.Cell(tuple.row,tuple.column).Value =
"Мастер буровой ";
2022-06-22 23:26:04 +05:00
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge();
sheet.Cell(tuple.row, tuple.column+5).Value =
$"{blockDto.DrillingMaster}";
2022-06-22 23:26:04 +05:00
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 =
"Супервайзер ";
2022-06-22 23:26:04 +05:00
sheet.Range(tuple.row, tuple.column, tuple.row, tuple.column + 1).Merge();
sheet.Cell(tuple.row, tuple.column + 5).Value =
$"{blockDto.Supervisor}";
2022-06-22 23:26:04 +05:00
sheet.Range(tuple.row, tuple.column + 5, tuple.row, tuple.column + 1).Merge();
return tuple;
}
// реализация "как есть"
2022-05-05 10:06:15 +05:00
public Stream MakeReport(DailyReportDto dailyReportDto)
{
using var templateStream = System.Reflection.Assembly.GetExecutingAssembly()
.GetManifestResourceStream("AsbCloudInfrastructure.Services.DailyReport.DailyReportTemplate.xlsx");
using var workbook = new XLWorkbook(templateStream, XLEventTracking.Disabled);
FillSheet(workbook, dailyReportDto);
MemoryStream memoryStream = new MemoryStream();
workbook.SaveAs(memoryStream, new SaveOptions { });
memoryStream.Seek(0, SeekOrigin.Begin);
return memoryStream;
}
public void FillSheet(XLWorkbook workbook, DailyReportDto reportParams)
{
var sheet = workbook.Worksheets.First();//.Add(reportParams.ReportDate.ToString("dd.MM.yyyy"));
sheet.Name = reportParams.ReportDate.ToString("dd.MM.yyyy");
var activeRow = 3;
activeRow = AddBlockHead(sheet, activeRow, reportParams);
activeRow = AddBlockSlaughtersReport(sheet, activeRow, reportParams);
activeRow = AddBlockTrajectoryReport(sheet, activeRow, reportParams);
activeRow = AddBlockDrillers(sheet, activeRow, reportParams);
activeRow = AddBlockSAUB(sheet, activeRow, reportParams);
activeRow = AddBlockBHA(sheet, activeRow, reportParams);
activeRow = AddBlockBHADescription(sheet, activeRow, reportParams);
activeRow = AddBlockOperations(sheet, activeRow, reportParams);
activeRow = AddBlockTimeBalans(sheet, activeRow, reportParams);
activeRow = AddBlockMeterlessWorks(sheet, activeRow, reportParams);
activeRow = AddBlockDrillingModes(sheet, activeRow, reportParams);
activeRow = AddBlockRotorDrilling(sheet, activeRow, reportParams);
activeRow = AddBlockSlideDrilling(sheet, activeRow, reportParams);
activeRow = AddBlockROPPlan(sheet, activeRow, reportParams);
activeRow = AddBlockSummary(sheet, activeRow, reportParams);
activeRow = AddBlockSubscribes(sheet, activeRow, reportParams);
}
private int AddBlockHead(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow, 3).Value =
$"Суточная сводка бурения скважины №{reportDto.WellName}, куст: {reportDto.ClusterName}";
sheet.Cell(startRow + 1, 3).Value =
$"Заказчик: {reportDto.Customer}";
sheet.Cell(startRow + 2, 3).Value =
$"Подрядчик: {reportDto.Contractor}";
return startRow + 2;
}
2022-05-05 10:06:15 +05:00
private int AddBlockSlaughtersReport(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 4, 3).Value =
$"{reportDto.ReportDate}";
sheet.Cell(startRow + 4, 5).Value =
$"{reportDto.WellDepthIntervalStartDate}";
sheet.Cell(startRow + 4, 6).Value =
$"{reportDto.WellDepthIntervalFinishDate}";
return startRow + 4;
}
2022-05-05 10:06:15 +05:00
private int AddBlockTrajectoryReport(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 4, 3).Value =
$"{reportDto.BottomholeDepth}";
sheet.Cell(startRow + 4, 4).Value =
$"{reportDto.VerticalDepth}";
sheet.Cell(startRow + 4, 5).Value =
$"{reportDto.ZenithAngle}";
sheet.Cell(startRow + 4, 6).Value =
$"{reportDto.AzimuthAngle}";
return startRow + 4;
}
2022-05-05 10:06:15 +05:00
private int AddBlockDrillers(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 2, 4).Value =
$"{reportDto.FirstDriller}";
sheet.Cell(startRow + 3, 4).Value =
$"{reportDto.SecondDriller}";
return startRow + 3;
}
2022-05-05 10:06:15 +05:00
private int AddBlockSAUB(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 6).Value =
$"{reportDto.WorkTimeSAUB}";
sheet.Cell(startRow + 4, 6).Value =
$"{reportDto.WorkTimeSpinMaster}";
sheet.Cell(startRow + 5, 6).Value =
$"{reportDto.WorkTimeTorkMaster}";
sheet.Cell(startRow + 3, 7).Value =
$"{reportDto.PenetrationSAUB}";
sheet.Cell(startRow + 4, 7).Value =
$"{reportDto.PenetrationSpinMaster}";
sheet.Cell(startRow + 5, 7).Value =
$"{reportDto.PenetrationTorkMaster}";
sheet.Cell(startRow + 6, 6).Value =
$"{reportDto.CountLaunchesMSE}";
return startRow + 6;
}
2022-05-05 10:06:15 +05:00
private int AddBlockBHA(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 6).Value =
$"{reportDto.WorkTimeSAUB}";
sheet.Cell(startRow + 4, 6).Value =
$"{reportDto.WorkTimeSpinMaster}";
sheet.Cell(startRow + 5, 6).Value =
$"{reportDto.WorkTimeTorkMaster}";
sheet.Cell(startRow + 3, 7).Value =
$"{reportDto.PenetrationSAUB}";
sheet.Cell(startRow + 4, 7).Value =
$"{reportDto.PenetrationSpinMaster}";
sheet.Cell(startRow + 5, 7).Value =
$"{reportDto.PenetrationTorkMaster}";
sheet.Cell(startRow + 6, 6).Value =
$"{reportDto.CountLaunchesMSE}";
return startRow + 6;
}
2022-05-05 10:06:15 +05:00
private int AddBlockBHADescription(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 2, 3).Value =
$"{reportDto.BHADescription}";
return startRow + 6;
}
2022-05-05 10:06:15 +05:00
private int AddBlockOperations(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
return startRow + 7;
}
2022-05-05 10:06:15 +05:00
private int AddBlockTimeBalans(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
return startRow + 8;
}
2022-05-05 10:06:15 +05:00
private int AddBlockMeterlessWorks(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 4, 6).Value =
$"{reportDto.StandardTimeBarrelPreparation}";
sheet.Cell(startRow + 4, 9).Value =
$"{reportDto.StandardTimeExtension}";
sheet.Cell(startRow + 6, 6).Value =
$"{reportDto.ActualTimeBarrelPreparation}";
sheet.Cell(startRow + 6, 9).Value =
$"{reportDto.ActualTimeExtension}";
return startRow + 9;
}
//
2022-05-05 10:06:15 +05:00
private int AddBlockDrillingModes(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 2, 6).Value =
$"{string.Join(", ", reportDto.RotorDrillingModes)}";
sheet.Cell(startRow + 3, 9).Value =
$"{string.Join(", ", reportDto.SlideDrillingModes)}";
return startRow + 3;
}
2022-05-05 10:06:15 +05:00
private int AddBlockRotorDrilling(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 3).Value =
$"{reportDto.PenetrationInRotor}";
sheet.Cell(startRow + 3, 5).Value =
$"{reportDto.NumberDrillingHours}";
sheet.Cell(startRow + 3, 9).Value =
$"{reportDto.AVGDiffDropRotor}";
return startRow + 3;
}
2022-05-05 10:06:15 +05:00
private int AddBlockSlideDrilling(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 3).Value =
$"{reportDto.PenetrationInSlide}";
sheet.Cell(startRow + 3, 5).Value =
$"{reportDto.DrillingTimeInRotor}";
sheet.Cell(startRow + 3, 9).Value =
$"{reportDto.AVGDiffPressureSlide}";
return startRow + 3;
}
2022-05-05 10:06:15 +05:00
private int AddBlockROPPlan(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 9).Value =
$"{reportDto.SectionROPPlan}";
return startRow + 3;
}
2022-05-05 10:06:15 +05:00
private int AddBlockSummary(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 7, 7).Value =
$"{reportDto.SectionDrillingTimeTotal}";
sheet.Cell(startRow + 8, 7).Value =
$"{reportDto.SectionPenetrationTotal}";
sheet.Cell(startRow + 9, 7).Value =
$"{reportDto.ExtensionsCount}";
sheet.Cell(startRow + 10, 7).Value =
$"{reportDto.DeviationFromTVD}";
sheet.Cell(startRow + 11, 3).Value =
$"{reportDto.DeclinesReasonsROP}";
return startRow + 13;
}
//
2022-05-05 10:06:15 +05:00
private int AddBlockSubscribes(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 9).Value =
$"{reportDto.DrillingMaster}";
sheet.Cell(startRow + 5, 9).Value =
$"{reportDto.Supervisor}";
return startRow + 5;
}
2022-05-05 10:06:15 +05:00
private static string GetColunmLetter(int columnNumber)
{
string letter = "";
while (columnNumber > 0)
{
int modulo = (columnNumber - 1) % 26;
letter = Convert.ToChar('A' + modulo) + letter;
columnNumber = (columnNumber - modulo) / 26;
}
return letter;
}
2022-05-05 10:06:15 +05:00
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;
}
2022-05-05 10:06:15 +05:00
private static IXLCell SetDateTime(IXLCell cell)
{
cell.DataType = XLDataType.DateTime;
cell.Style.DateFormat.Format = "DD.MM.YYYY HH:MM:SS";
return cell;
}
2022-05-05 10:06:15 +05:00
private static IXLCell SetNumber(IXLCell cell)
{
cell.DataType = XLDataType.Number;
cell.Style.NumberFormat.Format = "0.00";
return cell;
}
2022-05-05 10:06:15 +05:00
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;
}
}
}