-Добавлена часть "САУБ"

-Убраны лишние библиотеки из классов реализующие блоки
This commit is contained in:
IvanovEugeniy 2022-07-04 05:29:16 +05:00
parent e16df1f705
commit 0f27809489
8 changed files with 242 additions and 85 deletions

View File

@ -1,10 +1,8 @@
using System;
using AsbCloudApp.Data.DailyReport;
using AsbCloudApp.Data.DailyReport;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
{
class BhaBlock : BlockAbstract
{
private readonly DailyReportBhaDto blockDto;
@ -23,8 +21,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
public BhaBlock(CellAddress addressBlockBegin, DailyReportBhaDto blockDto)
{
this.blockDto = blockDto;
AddressBlockBegin = addressBlockBegin.Copy();
AddressBlockBegin.ColumnNumber = 0;
AddressBlockBegin = addressBlockBegin.Copy();
AddressBhaDescription = addressBlockBegin + (1,0);
AddressOperationTitle = addressBlockBegin + (3, 0);
AddressDurationTitle = addressBlockBegin + (3, 5);
@ -56,11 +53,13 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
AddressBlockEnd = AddressTotaData[4];
}
private string FormulaBhaBlock(CellAddress beginTime, CellAddress endTime )
{
return $"IF({endTime}>0,({endTime}-{beginTime})*24, \"\")";
private string FormulaBhaBlock(CellAddress beginTime, CellAddress endTime)
{
return string.Format("IF({0}>0,({1}-{2})*24, \"\")", endTime.ToString(), endTime.ToString(), beginTime.ToString());
}
public override void Draw(IXLWorksheet sheet)
{

View File

@ -1,5 +1,4 @@
using System;
using AsbCloudApp.Data.DailyReport;
using AsbCloudApp.Data.DailyReport;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
@ -56,12 +55,12 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
private string FormulaBlockPlan(CellAddress cellTarget)
{
return $"={cellTarget}/60*{saubBlock.AddressBhaWithFormula}";
return $"={cellTarget}/60*{saubBlock.ExtensionsCount}";
}
private string FormulaBlockExcess(CellAddress cellFact, CellAddress cellPlan)
{
return $"={cellFact}-{cellPlan}";
return string.Format("={0}-{1}", cellFact.ToString(), cellPlan.ToString());
}
public override void Draw(IXLWorksheet sheet)

View File

@ -82,12 +82,10 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
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();
@ -111,9 +109,9 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
._SetValue("До");
sheet._Range(AddressPeriodTableDataArray[0], AddressPeriodTableDataArray[0] + (0, 1))
._SetValue($"{blockDto.ReportDate}");
sheet._Range(AddressPeriodTableDataArray[1], AddressPeriodTableDataArray[1] + (0, 1));
sheet._Range(AddressPeriodTableDataArray[1], AddressPeriodTableDataArray[1] + (0, 1));
sheet.Cell(AddressPeriodTableDataArray[1])
.SetFormulaA1($"={AddressPeriodTableDataArray[0].ToString()}-1");
.SetFormulaA1(string.Format("{0}-1", AddressPeriodTableDataArray[0].ToString()));
sheet._Range(AddressPeriodTableDataArray[2], AddressPeriodTableDataArray[2] + (0, 1))
._SetValue($"{blockDto.WellDepthIntervalStartDate}");
sheet._Range(AddressPeriodTableDataArray[3], AddressPeriodTableDataArray[3] + (0, 1))

View File

@ -1,60 +1,225 @@
using System;
using AsbCloudApp.Data.DailyReport;
using AsbCloudApp.Data.DailyReport;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
{
internal class SaubBlock : BlockAbstract
{
private readonly DailyReportSaubDto blockDto;
public CellAddress AddressBhaWithFormula { get; }
public CellAddress[] AddressPeriodTableDataArray { get; }
/// <summary>
/// Значение нижняя правая ячейка блока
/// </summary>
public override CellAddress AddressBlockBegin { get; }
/// <summary>
/// Значение нижняя правая ячейка блока
/// </summary>
private readonly HeadBlock headBlock;
public CellAddress AddressRotorDrilling { get; }
public CellAddress AddressSlideDrilling { get; }
public CellAddress AddressDrillingTableTitle { get; }
public CellAddress[] AddressDrillingTableHead { get; }
public CellAddress[] AddressDrillingTableData { get; }
public CellAddress AddressSlideTableTitle { get; }
public CellAddress[] AddressSlideTableHead { get; }
public CellAddress[] AddressSlideTableData { get; }
public CellAddress AddressTotalTableMechanicalSpeed { get; }
public CellAddress AddressTotalTableTitle { get; }
public CellAddress[] AddressTotalTableHead { get; }
public CellAddress[] AddressTotalTableData { get; }
public CellAddress IncreaseSpeedSection { get; }
public CellAddress IncreaseSpeedDay { get; }
public CellAddress ReductionTimeDrilling { get; }
public CellAddress RotorSlidePercent { get; }
public CellAddress MspSection { get; }
public CellAddress SectionDrillingTimeTotal { get; }
public CellAddress SectionPenetrationTotal { get; }
public CellAddress ExtensionsCount { get; }
public CellAddress DeviationFromTVD { get; }
public CellAddress DeclinesReasonsROP { get; }
public CellAddress IncreaseSpeedSectionValue { get; }
public CellAddress IncreaseSpeedDayValue { get; }
public CellAddress ReductionTimeDrillingValue { get; }
public CellAddress RotorSlidePercentValue { get; }
public CellAddress MspSectionValue { get; }
public CellAddress SectionDrillingTimeTotalValue { get; }
public CellAddress SectionPenetrationTotalValue { get; }
public CellAddress ExtensionsCountValue { get; }
public CellAddress DeviationFromTVDValue { get; }
public override CellAddress AddressBlockBegin { get; }
public override CellAddress AddressBlockEnd { get; }
public SaubBlock(CellAddress addressBlockBegin, DailyReportSaubDto blockDto)
{
AddressBlockBegin = addressBlockBegin.Copy();
this.blockDto = blockDto;
AddressBhaWithFormula = addressBlockBegin + (0, 0);
AddressRotorDrilling = addressBlockBegin + (1, 0);
AddressSlideDrilling = addressBlockBegin + (2, 0);
AddressDrillingTableTitle = addressBlockBegin + (4, 0);
AddressDrillingTableHead = new CellAddress[4];
AddressDrillingTableHead[0] = addressBlockBegin + (5, 0);
AddressDrillingTableHead[1] = addressBlockBegin + (5, 2);
AddressDrillingTableHead[2] = addressBlockBegin + (5, 4);
AddressDrillingTableHead[3] = addressBlockBegin + (5, 6);
AddressDrillingTableData = new CellAddress[4];
AddressDrillingTableData[0] = addressBlockBegin + (6, 0);
AddressDrillingTableData[1] = addressBlockBegin + (6, 2);
AddressDrillingTableData[2] = addressBlockBegin + (6, 4);
AddressDrillingTableData[3] = addressBlockBegin + (6, 6);
AddressSlideTableTitle = addressBlockBegin + (8, 0);
AddressSlideTableHead = new CellAddress[4];
AddressSlideTableHead[0] = addressBlockBegin + (9, 0);
AddressSlideTableHead[1] = addressBlockBegin + (9, 2);
AddressSlideTableHead[2] = addressBlockBegin + (9, 4);
AddressSlideTableHead[3] = addressBlockBegin + (9, 6);
AddressSlideTableData = new CellAddress[4];
AddressSlideTableData[0] = addressBlockBegin + (10, 0);
AddressSlideTableData[1] = addressBlockBegin + (10, 2);
AddressSlideTableData[2] = addressBlockBegin + (10, 4);
AddressSlideTableData[3] = addressBlockBegin + (10, 6);
AddressTotalTableTitle = addressBlockBegin + (12, 0);
AddressTotalTableMechanicalSpeed = addressBlockBegin + (12, 6);
AddressTotalTableHead = new CellAddress[4];
AddressTotalTableHead[0] = addressBlockBegin + (13, 0);
AddressTotalTableHead[1] = addressBlockBegin + (13, 2);
AddressTotalTableHead[2] = addressBlockBegin + (13, 4);
AddressTotalTableData = new CellAddress[4];
AddressTotalTableData[0] = addressBlockBegin + (14, 0);
AddressTotalTableData[1] = addressBlockBegin + (14, 2);
AddressTotalTableData[2] = addressBlockBegin + (14, 4);
AddressTotalTableData[3] = addressBlockBegin + (14, 6);
IncreaseSpeedSection = addressBlockBegin + (16, 0);
IncreaseSpeedSectionValue = addressBlockBegin + (16, 4);
IncreaseSpeedDay = addressBlockBegin + (17, 0);
IncreaseSpeedDayValue = addressBlockBegin + (17, 4);
ReductionTimeDrilling = addressBlockBegin + (18, 0);
ReductionTimeDrillingValue = addressBlockBegin + (18, 4);
RotorSlidePercent = addressBlockBegin + (19, 0);
RotorSlidePercentValue = addressBlockBegin + (19, 4);
MspSection = addressBlockBegin + (20, 0);
MspSectionValue = addressBlockBegin + (20, 4);
SectionDrillingTimeTotal = addressBlockBegin + (21, 0);
SectionDrillingTimeTotalValue = addressBlockBegin + (21, 4);
SectionPenetrationTotal = addressBlockBegin + (22, 0);
SectionPenetrationTotalValue = addressBlockBegin + (22, 4);
ExtensionsCount = addressBlockBegin + (23, 0);
ExtensionsCountValue = addressBlockBegin + (23, 4);
DeviationFromTVD = addressBlockBegin + (24, 0);
DeviationFromTVDValue = addressBlockBegin + (24, 4);
DeclinesReasonsROP = addressBlockBegin + (25, 0);
AddressBlockEnd = DeclinesReasonsROP + (1,7) ;
}
//AddressExampleData1 = addressBlockBegin + (5, 0);
private string FormulaMechanicalSpeed(CellAddress cellSinking, CellAddress cellWatch )
{
return string.Format("=IF({0}>0,{1}/{2},0)", cellWatch.ToString(), cellSinking.ToString(), cellWatch.ToString());
}
//AddressBlockEnd = AddressesExampleDataArray.Last();
private string FormulaSinking(CellAddress sinkingDrilling, CellAddress sinkingSlide, CellAddress slaughterEnd, CellAddress slaughterBegin)
{
return string.Format($"=IF(({{0}}+{{1}})<>({{2}}-{{3}});\"ОШИБКА\";({{4}}+{{5}}))", sinkingSlide.ToString(), sinkingDrilling.ToString()
, slaughterEnd.ToString(), slaughterBegin.ToString(),
sinkingSlide.ToString(), sinkingDrilling.ToString());
}
public override void Draw(IXLWorksheet sheet)
{
sheet._Range(AddressRotorDrilling, AddressRotorDrilling + (0, 7))
._SetValue($"Бурение в роторе : {blockDto.RotorDrillingModes}");
sheet._Range(AddressSlideDrilling, AddressSlideDrilling + (0, 7))
._SetValue($"Бурение в слайде : {blockDto.SlideDrillingModes}");
sheet._Range(AddressDrillingTableTitle, AddressDrillingTableTitle + (0, 7))
._SetValue("Бурение в роторе(за отчетный период) с использование САУБ - 1");
sheet._Range(AddressDrillingTableHead[0], AddressDrillingTableHead[0] + (0, 1))
._SetValue("Проходка");
sheet._Range(AddressDrillingTableHead[1], AddressDrillingTableHead[1] + (0, 1))
._SetValue("Часы бурения");
sheet._Range(AddressDrillingTableHead[2], AddressDrillingTableHead[2] + (0, 1))
._SetValue("Мех. скорость");
sheet._Range(AddressDrillingTableHead[3], AddressDrillingTableHead[3] + (0, 1))
._SetValue("Среднее диф. Давление");
sheet._Range(AddressDrillingTableData[0], AddressDrillingTableData[0] + (0, 1))
._SetValue($"{blockDto.PenetrationInRotor}");
sheet._Range(AddressDrillingTableData[1], AddressDrillingTableData[1] + (0, 1))
._SetValue($"{blockDto.NumberDrillingHours}");
sheet._Range(AddressDrillingTableData[2], AddressDrillingTableData[2] + (0, 1));
sheet.Cell(AddressDrillingTableData[2])
.SetFormulaA1(FormulaMechanicalSpeed(AddressDrillingTableData[0], AddressDrillingTableData[1]));
sheet._Range(AddressDrillingTableData[3], AddressDrillingTableData[3] + (0, 1))
._SetValue($"{blockDto.AVGDiffDropRotor}");
sheet._Range(AddressSlideTableTitle, AddressSlideTableTitle + (0, 7))
._SetValue("Бурение в слайде (за отчетный период) с использование САУБ-1");
sheet._Range(AddressSlideTableHead[0], AddressSlideTableHead[0] + (0, 1))
._SetValue("Проходка");
sheet._Range(AddressSlideTableHead[1], AddressSlideTableHead[1] + (0, 1))
._SetValue("Часы бурения");
sheet._Range(AddressSlideTableHead[2], AddressSlideTableHead[2] + (0, 1))
._SetValue("Мех. скорость");
sheet._Range(AddressSlideTableHead[3], AddressSlideTableHead[3] + (0, 1))
._SetValue("Среднее диф. Давление");
sheet._Range(AddressSlideTableData[0], AddressSlideTableData[0] + (0, 1))
._SetValue($"{blockDto.PenetrationInSlide}");
sheet._Range(AddressSlideTableData[1], AddressSlideTableData[1] + (0, 1))
._SetValue($"{blockDto.DrillingTimeInRotor}");
sheet._Range(AddressSlideTableData[2], AddressSlideTableData[2] + (0, 1));
sheet.Cell(AddressSlideTableData[2])
.SetFormulaA1(FormulaMechanicalSpeed(AddressSlideTableData[0], AddressSlideTableData[1]));
sheet._Range(AddressSlideTableData[3], AddressSlideTableData[3] + (0, 1))
._SetValue($"{blockDto.AVGDiffPressureSlide}");
sheet._Range(AddressTotalTableTitle, AddressTotalTableTitle + (0, 5))
._SetValue("Итого за отчетный период, использование САУБ-1");
sheet._Range(AddressTotalTableMechanicalSpeed, AddressTotalTableMechanicalSpeed + (1, 1))
._SetValue("Плановая мех скорость");
sheet._Range(AddressTotalTableHead[0], AddressTotalTableHead[0] + (0, 1))
._SetValue("Проходка");
sheet._Range(AddressTotalTableHead[1], AddressTotalTableHead[1] + (0, 1))
._SetValue("Часы бурения");
sheet._Range(AddressTotalTableHead[2], AddressTotalTableHead[2] + (0, 1))
._SetValue("Мех. скорость");
var formulaWatch = string.Format("={0}+{1}",
AddressDrillingTableData[1].ToString(), AddressSlideTableData[1].ToString());
sheet._Range(AddressTotalTableData[0], AddressTotalTableData[0] + (0, 1));
sheet.Cell(AddressTotalTableData[0])
.SetFormulaA1(formulaWatch);
sheet._Range(AddressTotalTableData[1], AddressTotalTableData[1] + (0, 1));
sheet.Cell(AddressTotalTableData[1])
.SetFormulaA1(formulaWatch);
sheet._Range(AddressTotalTableData[2], AddressTotalTableData[2] + (0, 1))
._SetValue("");
sheet._Range(AddressTotalTableData[3], AddressTotalTableData[3] + (0, 1))
._SetValue($"{blockDto.SectionROPPlan}");
sheet._Range(IncreaseSpeedSection, IncreaseSpeedSection + (0, 3))
._SetValue("Увеличение мех скорости за секцию %");
sheet._Range(IncreaseSpeedSectionValue, IncreaseSpeedSectionValue + (0, 3))
._SetValue($"{blockDto.IncreaseSpeedSection}");
sheet._Range(IncreaseSpeedDay, IncreaseSpeedDay + (0, 3))
._SetValue("Увеличение мех скорости за сутки %");
sheet._Range(IncreaseSpeedDayValue, IncreaseSpeedDayValue + (0, 3))
._SetValue($"{blockDto.IncreaseSpeedDay}");
sheet._Range(ReductionTimeDrilling, ReductionTimeDrilling + (0, 3))
._SetValue("Сокращение времени бурения за секцию, ч");
sheet._Range(ReductionTimeDrillingValue, ReductionTimeDrillingValue + (0, 3))
._SetValue($"{blockDto.ReductionTimeDrilling}");
sheet._Range(RotorSlidePercent, RotorSlidePercent + (0, 3))
._SetValue("Ротор / слайд, %");
sheet._Range(RotorSlidePercentValue, RotorSlidePercentValue + (0, 3))
._SetValue($"{blockDto.RotorSlidePercent}");
sheet._Range(MspSection, MspSection + (0, 3))
._SetValue("МСП за секцию м/ч.");
sheet._Range(MspSectionValue, MspSectionValue + (0, 3))
._SetValue($"{blockDto.MspSection}");
sheet._Range(SectionDrillingTimeTotal, SectionDrillingTimeTotal + (0, 3))
._SetValue("Время бурения за секцию");
sheet._Range(SectionDrillingTimeTotalValue, SectionDrillingTimeTotalValue + (0, 3))
._SetValue($"{blockDto.SectionDrillingTimeTotal}");
sheet._Range(SectionPenetrationTotal, SectionPenetrationTotal + (0, 3))
._SetValue("Проходка за секцию");
sheet._Range(SectionPenetrationTotalValue, SectionPenetrationTotalValue + (0, 3))
._SetValue($"{blockDto.SectionPenetrationTotal}");
sheet._Range(ExtensionsCount, ExtensionsCount + (0, 3))
._SetValue("Кол- во наращиваний");
sheet._Range(ExtensionsCountValue, ExtensionsCountValue + (0, 3))
._SetValue($"{blockDto.ExtensionsCount}");
sheet._Range(DeviationFromTVD, DeviationFromTVD + (0, 3))
._SetValue("Отклонение от ГГД +/-, сут");
sheet._Range(DeviationFromTVDValue, DeviationFromTVDValue + (0, 3))
._SetValue($"{blockDto.DeviationFromTVD}");
sheet._Range(DeclinesReasonsROP, DeclinesReasonsROP + (1, 7))
._SetValue($"Примечание: {blockDto.DeclinesReasonsROP}");
//sheet.Range(AddressBhaDescription, AddressBhaDescription + (0, 7))
// ._SetValue($"{blockDto.BHADescription}");
// sheet._Range(AddressExampleData1, AddressExampleData1 + (0, 4))
// ._SetValue(blockDto.BottomholeDepth); // для примера с будущей формулой
}
}
}

View File

@ -1,14 +1,11 @@
using System;
using AsbCloudApp.Data.DailyReport;
using AsbCloudApp.Data.DailyReport;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
{
internal class SignBlock : BlockAbstract
{
private readonly DailyReportSignDto blockDto;
public CellAddress AddressDrillMasterHead { get; }
public CellAddress AddressDrillMaster { get; }
public CellAddress AddressSupervisorHead { get; }

View File

@ -1,16 +1,12 @@
using System;
using AsbCloudApp.Data.DailyReport;
using AsbCloudApp.Data.DailyReport;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
{
class TimeBalanceBlock : BlockAbstract
{
private readonly DailyReportTimeBalanceDto blockDto;
public CellAddress AddressTitle { get; }
public CellAddress AddressTitle { get; }
public CellAddress AddressDrilling { get; set; }
public CellAddress AddressFlushing { get; set; }
public CellAddress AddressBuilding { get; set; }

View File

@ -1,11 +1,7 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.DailyReport;
using AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks;
using ClosedXML.Excel;
using System;
using System.IO;
using System.Linq;
namespace AsbCloudInfrastructure.Services.DailyReport
{
public class DailyReportMakerExcel
@ -26,32 +22,29 @@ namespace AsbCloudInfrastructure.Services.DailyReport
var addressStart = new CellAddress(sheet, 1, 1);
var blockHeader = new HeadBlock(addressStart, dto.HeadDto);
addressStart = blockHeader.AddressBlockEnd + (1, 0);
addressStart.ColumnNumber = 0;
addressStart.ColumnNumber = 1;
var blockBha = new BhaBlock(addressStart, dto.BhaDto);
addressStart = blockBha.AddressBlockEnd + (1, 0);
addressStart.ColumnNumber = 0;
addressStart.ColumnNumber = 1;
var timeBalance = new TimeBalanceBlock(addressStart, dto.TimeBalanceDto);
addressStart = timeBalance.AddressBlockEnd + (1, 0);
addressStart.ColumnNumber = 0;
addressStart.ColumnNumber = 1;
var blockDimensionless = new DimensionlessBlock(addressStart, dto.DimensionlessDto);
addressStart = blockDimensionless.AddressBlockEnd + (1, 0);
addressStart.ColumnNumber = 0;
addressStart.ColumnNumber = 1;
var blockSaub = new SaubBlock(addressStart, dto.SaubDto);
addressStart = blockSaub.AddressBlockEnd + (1, 0);
addressStart.ColumnNumber = 1;
var blockSign = new SignBlock(addressStart, dto.SignDto);
addressStart = blockSign.AddressBlockEnd + (1, 0);
addressStart.ColumnNumber = 0;
addressStart.ColumnNumber = 1;
blockHeader.Draw(sheet);
blockBha.Draw(sheet);
timeBalance.Draw(sheet);
blockDimensionless.Draw(sheet);
blockSaub.Draw(sheet);
blockSign.Draw(sheet);
}
}
}
}

View File

@ -1,4 +1,6 @@
using AsbCloudApp.Data.DailyReport;
using AsbCloudApp.Data;
using AsbCloudApp.Data.DailyReport;
using AsbCloudInfrastructure.Services.DailyReport;
using ClosedXML.Excel;
using System;
using System.IO;
@ -12,6 +14,8 @@ namespace ConsoleApp1
// use ServiceFactory to make services
static void Main(/*string[] args*/)
{
var block = new DailyReportHeadDto()
{
AzimuthAngle = 12,
@ -28,11 +32,17 @@ namespace ConsoleApp1
{
BHADescription = "sadasdasdasdasdasdjlaskjdaksjdlasdlalskdklj"
};
var block3 = new DailyReportTimeBalanceDto();
var block3 = new DailyReportSaubDto();
var bloks = new DailyReportDto()
{
HeadDto = block,
SaubDto = block3
};
/*
var service = new DailyReportMakerExcel();
var stream = service.MakeReportFromBlocks(block, block2, block3,null, null, null);
var stream = service.MakeReportFromBlocks(bloks);
var filename = "____.xlsx";
if (File.Exists(filename))
File.Delete(filename);
@ -40,7 +50,7 @@ namespace ConsoleApp1
stream.CopyTo(fileStream);
return;
*/