2023-03-27 17:14:36 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
|
|
|
|
using AsbCloudApp.Data.DailyReport;
|
|
|
|
|
using AsbCloudDb.Model;
|
2022-06-29 13:04:30 +05:00
|
|
|
|
using ClosedXML.Excel;
|
2023-03-27 17:14:36 +05:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2022-06-29 13:04:30 +05:00
|
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
|
|
|
|
|
{
|
|
|
|
|
class TimeBalanceBlock : BlockAbstract
|
|
|
|
|
{
|
2023-03-27 17:14:36 +05:00
|
|
|
|
|
2022-06-29 13:04:30 +05:00
|
|
|
|
public override CellAddress AddressBlockBegin { get; }
|
2023-03-27 17:14:36 +05:00
|
|
|
|
public Dictionary<int, double> OperationsStatistics { get; set; }
|
|
|
|
|
public IEnumerable<WellOperationCategoryDto> OperationCategories { get; set; }
|
2022-06-29 13:04:30 +05:00
|
|
|
|
public override CellAddress AddressBlockEnd { get; }
|
|
|
|
|
|
2023-03-27 17:14:36 +05:00
|
|
|
|
public CellAddress Title { get { return AddressBlockBegin + (1, 3); } }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public TimeBalanceBlock(CellAddress addressBlockBegin, TimeBalanceDto blockDto, IEnumerable<WellOperationCategoryDto> operationCategories)
|
2022-06-29 13:04:30 +05:00
|
|
|
|
{
|
|
|
|
|
AddressBlockBegin = addressBlockBegin.Copy();
|
2023-03-27 17:14:36 +05:00
|
|
|
|
|
|
|
|
|
OperationsStatistics = blockDto.OperationsStat;
|
|
|
|
|
OperationCategories = operationCategories;
|
|
|
|
|
|
|
|
|
|
AddressBlockEnd = AddressBlockBegin + (7, 6);
|
2022-06-29 13:04:30 +05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Draw(IXLWorksheet sheet)
|
|
|
|
|
{
|
2023-03-27 17:14:36 +05:00
|
|
|
|
|
|
|
|
|
sheet.Range(Title.RowNumber, Title.ColumnNumber, Title.RowNumber, Title.ColumnNumber + 1)
|
2023-03-22 11:29:53 +05:00
|
|
|
|
.Merge()
|
|
|
|
|
.SetValue("БАЛАНС ВРЕМЕНИ");
|
2023-03-27 17:14:36 +05:00
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (2, 1))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.Knbk), true);
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (3, 1))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.IdMechanicalDrilling), true);
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (4, 1))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.MeasurementStat), true);
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (5, 1))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.NormalizedWellDiameter), true);
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (6, 1))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.Building), true);
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (7, 1))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.SPO), true);
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (2, 2))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.Knbk));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (3, 2))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.IdMechanicalDrilling));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (4, 2))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.MeasurementStat));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (5, 2))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.NormalizedWellDiameter));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (6, 2))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.Building));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (7, 2))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.SPO));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (2, 3))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.CasingRunning));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (3, 3))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.Cementing));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (4, 3))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.AuxiliaryWorkFastening));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (5, 3))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.AssemblyOrDisassemblyGIS));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (6, 3))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.SPO2));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (7, 3))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.GIS));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (2, 4))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.CasingRunning));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (3, 4))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.Cementing));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (4, 4))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.AuxiliaryWorkFastening));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (5, 4))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.AssemblyOrDisassemblyGIS));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (6, 4))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.SPO2));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (7, 4))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.GIS));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (2, 5))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.FlushingOBR));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (3, 5))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.AuxiliaryWork));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (4, 5))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.EquipmentRepair));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (5, 5))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.EmergencyWork));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (6, 5))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.Complication));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (7, 5))
|
|
|
|
|
._SetValue(GetCaption(WellOperationCategory.OperationsNotIncludedGGD));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (2, 6))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.FlushingOBR));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (3, 6))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.AuxiliaryWork));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (4, 6))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.EquipmentRepair));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (5, 6))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.EmergencyWork));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (6, 6))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.Complication));
|
|
|
|
|
|
|
|
|
|
sheet.Cell(AddressBlockBegin + (7, 6))
|
|
|
|
|
._SetValue(GetValue(WellOperationCategory.OperationsNotIncludedGGD));
|
2022-06-29 13:04:30 +05:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-27 17:14:36 +05:00
|
|
|
|
private string GetValue(int categoryId)
|
|
|
|
|
{
|
|
|
|
|
if (OperationsStatistics.TryGetValue(categoryId, out double duration))
|
|
|
|
|
return $"{duration}";
|
|
|
|
|
return "0";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string GetCaption(int categoryId)
|
|
|
|
|
{
|
|
|
|
|
var caption = OperationCategories.FirstOrDefault(o => o.Id == categoryId)?.Name ?? string.Empty;
|
|
|
|
|
return caption;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-29 13:04:30 +05:00
|
|
|
|
}
|
|
|
|
|
|