DD.WellWorkover.Cloud/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs

181 lines
11 KiB
C#
Raw Normal View History

using AsbCloudApp.Data.DailyReport;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
{
class HeadBlock : BlockAbstract
{
private readonly DailyReportHeadDto blockDto;
public CellAddress AddressTitle { get; }
public CellAddress AddressCustomer { get; }
public CellAddress AddressDriller { get; }
public CellAddress AddressPeriod { get; }
public CellAddress AddressSlaughter { get; }
public CellAddress AddressTrajectoryTableTitle { get; }
public CellAddress AddressDrillerOneTitle { get; }
public CellAddress AddressDrillerOne { get; }
public CellAddress AddressDrillerTwoTitle { get; }
public CellAddress AddressDrillerTwo { get; }
public CellAddress AddressWorkSaubTitle { get; }
public CellAddress AddressWatchTitle { get; }
public CellAddress AddressMetreTitle { get; }
public CellAddress[] AddressWorkSaubData { get; }
public CellAddress[] AddressWatchData { get; }
public CellAddress[] AddressMetreData { get; }
public CellAddress[] AddressPeriodTableHeadArray { get; }
public CellAddress[] AddressPeriodTableDataArray { get; }
public CellAddress[] AddressTrajectoryTableHeadArray { get; }
public CellAddress[] AddressTrajectoryTableDataArray { get; }
public override CellAddress AddressBlockBegin { get; }
public override CellAddress AddressBlockEnd { get; }
public HeadBlock(CellAddress addressBlockBegin, DailyReportHeadDto blockDto)
{
AddressBlockBegin = addressBlockBegin.Copy();
this.blockDto = blockDto;
AddressTitle = addressBlockBegin + (0, 0);
AddressCustomer = addressBlockBegin + (1, 0);
AddressDriller = addressBlockBegin + (2, 0);
AddressPeriod = addressBlockBegin + (4, 0);
AddressSlaughter = addressBlockBegin + (4, 4);
AddressPeriodTableHeadArray = new CellAddress[4];
AddressPeriodTableHeadArray[0]= addressBlockBegin + (5, 0);
AddressPeriodTableHeadArray[1] = addressBlockBegin + (5, 2);
AddressPeriodTableHeadArray[2] = addressBlockBegin + (5, 4);
AddressPeriodTableHeadArray[3] = addressBlockBegin + (5, 6);
AddressPeriodTableDataArray = new CellAddress[4];
AddressPeriodTableDataArray[0] = addressBlockBegin + (6, 0);
AddressPeriodTableDataArray[1] = addressBlockBegin + (6, 2);
AddressPeriodTableDataArray[2] = addressBlockBegin + (6, 4);
AddressPeriodTableDataArray[3] = addressBlockBegin + (6, 6);
AddressTrajectoryTableTitle = addressBlockBegin + (8,0);
AddressTrajectoryTableHeadArray = new CellAddress[4];
AddressTrajectoryTableHeadArray[0] = addressBlockBegin + (9, 0);
AddressTrajectoryTableHeadArray[1] = addressBlockBegin + (9, 2);
AddressTrajectoryTableHeadArray[2] = addressBlockBegin + (9, 4);
AddressTrajectoryTableHeadArray[3] = addressBlockBegin + (9, 6);
AddressTrajectoryTableDataArray = new CellAddress[4];
AddressTrajectoryTableDataArray[0] = addressBlockBegin + (10, 0);
AddressTrajectoryTableDataArray[1] = addressBlockBegin + (10, 2);
AddressTrajectoryTableDataArray[2] = addressBlockBegin + (10, 4);
AddressTrajectoryTableDataArray[3] = addressBlockBegin + (10, 6);
AddressDrillerOneTitle = addressBlockBegin + (12, 0);
AddressDrillerOne = addressBlockBegin + (12, 2);
AddressDrillerTwoTitle = addressBlockBegin + (13, 0);
AddressDrillerTwo = addressBlockBegin + (13, 2);
AddressWorkSaubTitle = addressBlockBegin + (15, 0);
AddressWatchTitle = addressBlockBegin + (15, 3);
AddressMetreTitle = addressBlockBegin + (15, 4);
AddressWorkSaubData = new CellAddress[4];
AddressWorkSaubData[0] = addressBlockBegin + (16, 0);
AddressWorkSaubData[1] = addressBlockBegin + (17, 0);
AddressWorkSaubData[2] = addressBlockBegin + (18, 0);
AddressWorkSaubData[3] = addressBlockBegin + (19, 0);
AddressWatchData = new CellAddress[4];
AddressWatchData[0] = addressBlockBegin + (16, 3);
AddressWatchData[1] = addressBlockBegin + (17, 3);
AddressWatchData[2] = addressBlockBegin + (18, 3);
AddressWatchData[3] = addressBlockBegin + (19, 3);
AddressMetreData = new CellAddress[4];
AddressMetreData[0] = addressBlockBegin + (16, 4);
AddressMetreData[1] = addressBlockBegin + (17, 4);
AddressMetreData[2] = addressBlockBegin + (18, 4);
AddressBlockEnd = AddressWatchData[3]+(0,1);
}
public override void Draw(IXLWorksheet sheet)
{
sheet._Range(AddressTitle, AddressTitle + (0, 7))
._SetValue($"Суточная сводка бурения скважины: {blockDto.WellName}, куст: {blockDto.ClusterName}")
.Style.SetH1();
sheet._Range(AddressCustomer, AddressCustomer + (0, 7))
._SetValue($"Заказчик: {blockDto.Customer}")
.Style.SetH1();
sheet._Range(AddressDriller, AddressDriller + (0, 7))
._SetValue($"Подрядчик: {blockDto.Contractor}")
.Style.SetH1();
sheet._Range(AddressPeriod, AddressPeriod + (0, 3))
._SetValue("Отчетный период");
sheet._Range(AddressSlaughter, AddressSlaughter + (0, 3))
._SetValue("Забой за отчетный период, м");
sheet._Range(AddressPeriodTableHeadArray[0], AddressPeriodTableHeadArray[0] + (0, 1))
._SetValue("От (дата, время)");
sheet._Range(AddressPeriodTableHeadArray[1], AddressPeriodTableHeadArray[1] + (0, 1))
._SetValue("До (дата, время)");
sheet._Range(AddressPeriodTableHeadArray[2], AddressPeriodTableHeadArray[2] + (0, 1))
._SetValue("От");
sheet._Range(AddressPeriodTableHeadArray[3], AddressPeriodTableHeadArray[3] + (0, 1))
._SetValue("До");
sheet._Range(AddressPeriodTableDataArray[0], AddressPeriodTableDataArray[0] + (0, 1))
._SetValue($"{blockDto.ReportDate}");
sheet._Range(AddressPeriodTableDataArray[1], AddressPeriodTableDataArray[1] + (0, 1))._SetValue("");
sheet.Cell(AddressPeriodTableDataArray[1])
.SetFormulaA1(string.Format("{0}-1", AddressPeriodTableDataArray[0].ToString()))
.Style.DateFormat.Format= "DD.MM.YYYY HH:MM:SS";
sheet._Range(AddressPeriodTableDataArray[2], AddressPeriodTableDataArray[2] + (0, 1))
._SetValue($"{blockDto.WellDepthIntervalStartDate}");
sheet._Range(AddressPeriodTableDataArray[3], AddressPeriodTableDataArray[3] + (0, 1))
._SetValue($"{blockDto.WellDepthIntervalFinishDate}");
sheet._Range(AddressTrajectoryTableTitle, AddressTrajectoryTableTitle + (0, 7))
._SetValue("Данные по траектории скважины на конец суток");
sheet._Range(AddressTrajectoryTableHeadArray[0], AddressTrajectoryTableHeadArray[0] + (0, 1))
._SetValue("Глубина по стволу");
sheet._Range(AddressTrajectoryTableHeadArray[1], AddressTrajectoryTableHeadArray[1] + (0, 1))
._SetValue("Глубина по вертикали");
sheet._Range(AddressTrajectoryTableHeadArray[2], AddressTrajectoryTableHeadArray[2] + (0, 1))
._SetValue("Зенитный угол");
sheet._Range(AddressTrajectoryTableHeadArray[3], AddressTrajectoryTableHeadArray[3] + (0, 1))
._SetValue("Азимут");
sheet._Range(AddressTrajectoryTableDataArray[0], AddressTrajectoryTableDataArray[0] + (0, 1))
._SetValue($"{blockDto.BottomholeDepth}");
sheet._Range(AddressTrajectoryTableDataArray[1], AddressTrajectoryTableDataArray[1] + (0, 1))
._SetValue($"{blockDto.VerticalDepth}");
sheet._Range(AddressTrajectoryTableDataArray[2], AddressTrajectoryTableDataArray[2] + (0, 1))
._SetValue($"{blockDto.ZenithAngle}");
sheet._Range(AddressTrajectoryTableDataArray[3], AddressTrajectoryTableDataArray[3] + (0, 1))
._SetValue($"{blockDto.AzimuthAngle}");
sheet._Range(AddressDrillerOneTitle, AddressDrillerOneTitle + (0, 1))
._SetValue("Бурильщик 1 смена");
sheet._Range(AddressDrillerOne, AddressDrillerOne + (0, 1))
._SetValue($"{blockDto.FirstDriller}");
sheet._Range(AddressDrillerTwoTitle, AddressDrillerTwoTitle + (0, 1))
._SetValue("Бурильщик 2 смена");
sheet._Range(AddressDrillerTwo, AddressDrillerTwo + (0, 1))
._SetValue($"{blockDto.SecondDriller}");
sheet._Range(AddressWorkSaubTitle, AddressWorkSaubTitle + (0, 2))
._SetValue("Работа модулей САУБ:");
sheet.Cell(AddressWatchTitle)
._SetValue("Часов:");
sheet.Cell(AddressMetreTitle)
._SetValue("Метров:");
sheet._Range(AddressWorkSaubData[0], AddressWorkSaubData[0] + (0, 2))
._SetValue("АПД (автоматическая подача долота), ч/м:");
sheet.Cell(AddressWatchData[0])
._SetValue($"{blockDto.WorkTimeSAUB}");
sheet.Cell(AddressMetreData[0])
._SetValue($"{blockDto.PenetrationSAUB}");
sheet._Range(AddressWorkSaubData[1], AddressWorkSaubData[1] + (0, 2))
._SetValue("Спин Мастер (осцилляция),ч/м:");
sheet.Cell(AddressWatchData[1])
._SetValue($"{blockDto.WorkTimeSpinMaster}");
sheet.Cell(AddressMetreData[1])
._SetValue($"{blockDto.PenetrationTorkMaster}");
sheet._Range(AddressWorkSaubData[2], AddressWorkSaubData[2] + (0, 2))
._SetValue("Торк Мастер (демпфирование), ч/:");
sheet.Cell(AddressWatchData[2])
._SetValue($"{blockDto.WorkTimeTorkMaster}");
sheet.Cell(AddressMetreData[2])
._SetValue($"{blockDto.PenetrationTorkMaster}");
sheet._Range(AddressWorkSaubData[3], AddressWorkSaubData[3] + (0, 2))
._SetValue("МСЕ, колличество запусков, раз:");
sheet._Range(AddressWatchData[3], AddressWatchData[3] + (0, 1))
._SetValue($"{blockDto.CountLaunchesMSE}");
}
}
}