DD.WellWorkover.Cloud/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs
IvanovEugeniy eca35ee491 добавлены стили ячеек с формулой
изменение наименования ячейки ExtensionsCount в блоке SAUB
2022-07-05 12:05:04 +05:00

118 lines
6.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using AsbCloudApp.Data.DailyReport;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
{
internal class DimensionlessBlock : BlockAbstract
{
private readonly DailyReportDimensionlessDto blockDto;
public SaubBlock SaubBlock { get; set; }
public CellAddress AddressDimensionTitle { get; }
public CellAddress AddressPreparationTitle { get; }
public CellAddress AddressExtensionTitle { get; }
public CellAddress AddressPreparationDescription { get; }
public CellAddress AddressExtensionDescription { get; }
public CellAddress[] AddressPreparationHead { get; }
public CellAddress[] AddressPreparationValue { get; }
public CellAddress[] AddressExtensionHead { get; }
public CellAddress[] AddressExtensionValue { get; }
public CellAddress AddressBlockFormula { get; }
public override CellAddress AddressBlockBegin { get; }
public override CellAddress AddressBlockEnd { get; }
public DimensionlessBlock(CellAddress addressBlockBegin, DailyReportDimensionlessDto blockDto)
{
AddressBlockBegin = addressBlockBegin.Copy();
this.blockDto = blockDto;
AddressDimensionTitle = addressBlockBegin + (2, 3);
AddressPreparationTitle = addressBlockBegin + (3, 1);
AddressExtensionTitle = addressBlockBegin + (3, 4);
AddressPreparationHead = new CellAddress[4];
AddressPreparationHead[0] = addressBlockBegin + (4, 1);
AddressPreparationHead[1] = addressBlockBegin + (5, 1);
AddressPreparationHead[2] = addressBlockBegin + (6, 1);
AddressPreparationHead[3] = addressBlockBegin + (7, 1);
AddressPreparationValue = new CellAddress[4];
AddressPreparationValue[0] = addressBlockBegin + (4, 3);
AddressPreparationValue[1] = addressBlockBegin + (5, 3);
AddressPreparationValue[2] = addressBlockBegin + (6, 3);
AddressPreparationValue[3] = addressBlockBegin + (7, 3);
AddressPreparationDescription = addressBlockBegin + (8, 1);
AddressExtensionHead = new CellAddress[4];
AddressExtensionHead[0] = addressBlockBegin + (4, 4);
AddressExtensionHead[1] = addressBlockBegin + (5, 4);
AddressExtensionHead[2] = addressBlockBegin + (6, 4);
AddressExtensionHead[3] = addressBlockBegin + (7, 4);
AddressExtensionValue = new CellAddress[4];
AddressExtensionValue[0] = addressBlockBegin + (4, 6);
AddressExtensionValue[1] = addressBlockBegin + (5, 6);
AddressExtensionValue[2] = addressBlockBegin + (6, 6);
AddressExtensionValue[3] = addressBlockBegin + (7, 6);
AddressExtensionDescription = addressBlockBegin + (8, 4);
AddressBlockEnd = addressBlockBegin + (9,0);
}
private string FormulaBlockPlan(CellAddress cellTarget)
{
return $"={cellTarget}/60*{SaubBlock.AddressExtensionsCountValue}";
}
private string FormulaBlockExcess(CellAddress cellFact, CellAddress cellPlan)
{
return string.Format("={0}-{1}", cellFact.ToString(), cellPlan.ToString());
}
public override void Draw(IXLWorksheet sheet)
{
sheet._Range(AddressDimensionTitle, AddressDimensionTitle + (0, 1))
._SetValue("БЕЗМЕТРАЖНЫЕ РАБОТЫ");
sheet._Range(AddressPreparationTitle, AddressPreparationTitle + (0, 2))
._SetValue("Подготовка ствола скв. к наращиванию");
sheet._Range(AddressExtensionTitle, AddressExtensionTitle + (0, 2))
._SetValue("Наращивание");
sheet._Range(AddressPreparationHead[0], AddressPreparationHead[0] + (0, 1))
._SetValue("Норматив на одну операцию, (мин):");
sheet.Cell(AddressPreparationValue[0])
._SetValue($"{blockDto.StandardTimeBarrelPreparation}");
sheet._Range(AddressPreparationHead[1], AddressPreparationHead[1] + (0, 1))
._SetValue("Проработка при бур, план (ч):");
sheet.Cell(AddressPreparationValue[1])
.SetFormulaA1($"{FormulaBlockPlan(AddressPreparationValue[0])}").Style.SetAllBorders();
sheet._Range(AddressPreparationHead[2], AddressPreparationHead[2] + (0, 1))
._SetValue("Проработка при бур, факт (ч):");
sheet.Cell(AddressPreparationValue[2])
._SetValue($"{blockDto.StandardTimeExtension}");
sheet._Range(AddressPreparationHead[3], AddressPreparationHead[3] + (0, 1))
._SetValue("Превышение плановых норм, (ч):");
sheet.Cell(AddressPreparationValue[3])
.SetFormulaA1($"{FormulaBlockExcess(AddressPreparationValue[2], AddressPreparationValue[1])}").Style.SetAllBorders();
sheet._Range(AddressExtensionHead[0], AddressExtensionHead[0] + (0, 1))
._SetValue("Норматив на одну операцию, (мин):");
sheet.Cell(AddressExtensionValue[0])
._SetValue($"{blockDto.StandardTimeExtension}");
sheet._Range(AddressExtensionHead[1], AddressExtensionHead[1] + (0, 1))
._SetValue("Наращивание, план (ч):");
sheet.Cell(AddressExtensionValue[1])
.SetFormulaA1($"{FormulaBlockPlan(AddressExtensionValue[0])}").Style.SetAllBorders();
sheet._Range(AddressExtensionHead[2], AddressExtensionHead[2] + (0, 1))
._SetValue("Наращивание, факт (ч):");
sheet.Cell(AddressExtensionValue[2])
._SetValue($"{blockDto.ActualTimeExtension}");
sheet._Range(AddressExtensionHead[3], AddressExtensionHead[3] + (0, 1))
._SetValue("Превышение плановых норм, (ч):");
sheet.Cell(AddressExtensionValue[3])
.SetFormulaA1($"{FormulaBlockExcess(AddressExtensionValue[2], AddressExtensionValue[1])}").Style.SetAllBorders();
sheet._Range(AddressPreparationDescription, AddressPreparationDescription + (1, 2))
._SetValue("Подготовка ствола скв. к наращиванию");
sheet._Range(AddressExtensionDescription, AddressExtensionDescription + (1, 2))
._SetValue("Наращивание");
}
}
}