forked from ddrilling/AsbCloudServer
Актуализирован блок "Баланс времени" в выгружаемом отчете.
This commit is contained in:
parent
56be9b2358
commit
6815dc4437
@ -1,15 +0,0 @@
|
||||
namespace AsbCloudApp.Data.DailyReport
|
||||
{
|
||||
/// <summary>
|
||||
/// Статистика по операции
|
||||
/// </summary>
|
||||
public class OperationStatDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Глубина забоя
|
||||
/// </summary>
|
||||
public double Depth { get; set; }
|
||||
|
||||
//TODO: Дописать
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudApp.Data.DailyReport
|
||||
{
|
||||
@ -12,7 +11,8 @@ namespace AsbCloudApp.Data.DailyReport
|
||||
/// <summary>
|
||||
/// Статистика по операциям
|
||||
/// </summary>
|
||||
public IEnumerable<OperationStatDto> OperationsStat { get; set; } = Enumerable.Empty<OperationStatDto>();
|
||||
public Dictionary<int, double> OperationsStat { get; set; } = new Dictionary<int, double>();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,11 @@ namespace AsbCloudApp.Data
|
||||
/// </summary>
|
||||
public string? CategoryName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ключ родителя у категории
|
||||
/// </summary>
|
||||
public int? IdParentCategory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// дополнительная информация по операции
|
||||
/// </summary>
|
||||
|
@ -1,7 +1,11 @@
|
||||
namespace AsbCloudDb.Model.DefaultData
|
||||
using Microsoft.VisualBasic;
|
||||
using static AsbCloudDb.Model.DefaultData.DefaultContextData;
|
||||
|
||||
namespace AsbCloudDb.Model.DefaultData
|
||||
{
|
||||
internal class EntityFillerWellOperationCategory : EntityFiller<WellOperationCategory>
|
||||
{
|
||||
|
||||
public override WellOperationCategory[] GetData() => new WellOperationCategory[]{
|
||||
|
||||
// Этап работ
|
||||
@ -13,24 +17,24 @@
|
||||
new () {Id = WellOperationCategory.IdNonProductiveTime, Name = "Непроизводительное время (НПВ)", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
|
||||
// Виды работ
|
||||
new () {Id = 4000, IdParent = 3000, Name = "КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.Knbk, IdParent = 3000, Name = "КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdMechanicalDrilling, IdParent = 3000, Name = "Механическое. бурение", KeyValueName = "dT", KeyValueUnits = "м/ч" },
|
||||
new () {Id = 4002, IdParent = 3000, Name = "Статический замер", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4003, IdParent = 3000, Name = "Нормализация диаметра скважины", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4004, IdParent = 3000, Name = "Наращивание", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4005, IdParent = 3001, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4006, IdParent = 3002, Name = "Спуск обсадной колонны", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4007, IdParent = 3002, Name = "Цементирование", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4008, IdParent = 3002, Name = "Вспомогательные работы при креплении", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4009, IdParent = 3003, Name = "Сборка/разборка приборов ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4010, IdParent = 3003, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4011, IdParent = 3003, Name = "ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4012, IdParent = 3004, Name = "Промывка, ОБР", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4013, IdParent = 3004, Name = "Вспомогательные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4014, IdParent = 3005, Name = "Ремонт оборудования", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4015, IdParent = 3005, Name = "Аварийные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4016, IdParent = 3005, Name = "Осложнение", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 4017, IdParent = 3005, Name = "Незаложенные в ГГД операции", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.MeasurementStat, IdParent = 3000, Name = "Статический замер", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.NormalizedWellDiameter, IdParent = 3000, Name = "Нормализация диаметра скважины", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.Building, IdParent = 3000, Name = "Наращивание", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.SPO , IdParent = 3001, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.CasingRunning, IdParent = 3002, Name = "Спуск обсадной колонны", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.Cementing, IdParent = 3002, Name = "Цементирование", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.AuxiliaryWorkFastening, IdParent = 3002, Name = "Вспомогательные работы при креплении", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.AssemblyOrDisassemblyGIS, IdParent = 3003, Name = "Сборка/разборка приборов ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.SPO2, IdParent = 3003, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.GIS, IdParent = 3003, Name = "ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.FlushingOBR, IdParent = 3004, Name = "Промывка, ОБР", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.AuxiliaryWork, IdParent = 3004, Name = "Вспомогательные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.EquipmentRepair, IdParent = 3005, Name = "Ремонт оборудования", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.EmergencyWork, IdParent = 3005, Name = "Аварийные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.Complication, IdParent = 3005, Name = "Осложнение", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.OperationsNotIncludedGGD, IdParent = 3005, Name = "Незаложенные в ГГД операции", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
|
||||
//переименованные категории с новым ИД
|
||||
new () {Id = WellOperationCategory.IdBhaDisassembly, IdParent = 4000, Name = "Разборка КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
|
@ -18,7 +18,6 @@ namespace AsbCloudDb.Model
|
||||
/// </summary>
|
||||
public const int IdNonProductiveTime = 3005;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Механическое. бурение
|
||||
/// </summary>
|
||||
@ -84,6 +83,92 @@ namespace AsbCloudDb.Model
|
||||
/// Ремонт бурового оборудования
|
||||
/// </summary>
|
||||
public const int IdEquipmentRepair = 5058;
|
||||
|
||||
/// <summary>
|
||||
/// КНБК
|
||||
/// </summary>
|
||||
public const int Knbk = 4000;
|
||||
|
||||
/// <summary>
|
||||
/// СПО
|
||||
/// </summary>
|
||||
public const int SPO = 4005;
|
||||
|
||||
/// <summary>
|
||||
/// ГИС
|
||||
/// </summary>
|
||||
public const int GIS = 4011;
|
||||
|
||||
/// <summary>
|
||||
/// Статический замер
|
||||
/// </summary>
|
||||
public const int MeasurementStat = 4002;
|
||||
|
||||
/// <summary>
|
||||
/// Нормализация диаметра скважины
|
||||
/// </summary>
|
||||
public const int NormalizedWellDiameter = 4003;
|
||||
|
||||
/// <summary>
|
||||
/// Наращивание
|
||||
/// </summary>
|
||||
public const int Building = 4004;
|
||||
|
||||
/// <summary>
|
||||
/// Спуск обсадной колонны
|
||||
/// </summary>
|
||||
public const int CasingRunning = 4006;
|
||||
|
||||
/// <summary>
|
||||
/// Цементирование
|
||||
/// </summary>
|
||||
public const int Cementing = 4007;
|
||||
|
||||
/// <summary>
|
||||
/// Вспомогательные работы при креплении
|
||||
/// </summary>
|
||||
public const int AuxiliaryWorkFastening = 4008;
|
||||
|
||||
/// <summary>
|
||||
/// Сборка/разборка приборов ГИС
|
||||
/// </summary>
|
||||
public const int AssemblyOrDisassemblyGIS = 4009;
|
||||
|
||||
/// <summary>
|
||||
/// СПО2
|
||||
/// </summary>
|
||||
public const int SPO2 = 4010;
|
||||
|
||||
/// <summary>
|
||||
/// Промывка, ОБР
|
||||
/// </summary>
|
||||
public const int FlushingOBR = 4012;
|
||||
|
||||
/// <summary>
|
||||
/// Вспомогательные работы
|
||||
/// </summary>
|
||||
public const int AuxiliaryWork = 4013;
|
||||
|
||||
/// <summary>
|
||||
/// Ремонт оборудования
|
||||
/// </summary>
|
||||
public const int EquipmentRepair = 4014;
|
||||
|
||||
/// <summary>
|
||||
/// Аварийные работы
|
||||
/// </summary>
|
||||
public const int EmergencyWork = 4015;
|
||||
|
||||
/// <summary>
|
||||
/// Осложнение
|
||||
/// </summary>
|
||||
public const int Complication = 4016;
|
||||
|
||||
/// <summary>
|
||||
/// Незаложенные в ГГД операции
|
||||
/// </summary>
|
||||
public const int OperationsNotIncludedGGD = 4017;
|
||||
|
||||
/// <summary>
|
||||
/// Список всех категорий НПВ
|
||||
/// </summary>
|
||||
|
@ -352,6 +352,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
IdWell = o.IdWell,
|
||||
IdWellSectionType = o.IdWellSectionType,
|
||||
IdCategory = o.IdCategory,
|
||||
IdParentCategory = o.OperationCategory.IdParent,
|
||||
|
||||
CategoryName = o.OperationCategory.Name,
|
||||
WellSectionTypeName = o.WellSectionType.Caption,
|
||||
|
@ -1,164 +1,161 @@
|
||||
using AsbCloudApp.Data.DailyReport;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.DailyReport;
|
||||
using AsbCloudDb.Model;
|
||||
using ClosedXML.Excel;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
|
||||
{
|
||||
class TimeBalanceBlock : BlockAbstract
|
||||
{
|
||||
private readonly TimeBalanceDto blockDto;
|
||||
public CellAddress AddressTitle { get; }
|
||||
public CellAddress AddressDrilling { get; set; }
|
||||
public CellAddress AddressFlushing { get; set; }
|
||||
public CellAddress AddressBuilding { get; set; }
|
||||
public CellAddress AddressElaboration { get; set; }
|
||||
public CellAddress AddressExtension { get; set; }
|
||||
public CellAddress AddressRepair { get; set; }
|
||||
public CellAddress AddressDrillingValue { get; set; }
|
||||
public CellAddress AddressFlushingValue { get; set; }
|
||||
public CellAddress AddressBuildingValue { get; set; }
|
||||
public CellAddress AddressElaborationValue { get; set; }
|
||||
public CellAddress AddressExtensionValue { get; set; }
|
||||
public CellAddress AddressRepairValue { get; set; }
|
||||
public CellAddress AddressKnbk { get; set; }
|
||||
public CellAddress AddressSpo { get; set; }
|
||||
public CellAddress AddressPzr { get; set; }
|
||||
public CellAddress AddressPvo { get; set; }
|
||||
public CellAddress AddressPgr { get; set; }
|
||||
public CellAddress AddressGis { get; set; }
|
||||
public CellAddress AddressKnbkValue { get; set; }
|
||||
public CellAddress AddressSpoValue { get; set; }
|
||||
public CellAddress AddressPzrValue { get; set; }
|
||||
public CellAddress AddressPvoValue { get; set; }
|
||||
public CellAddress AddressPgrValue { get; set; }
|
||||
public CellAddress AddressGisValue { get; set; }
|
||||
public CellAddress AddressOzc { get; set; }
|
||||
public CellAddress AddressEngineeringWorks { get; set; }
|
||||
public CellAddress AddressTakingMeasure { get; set; }
|
||||
public CellAddress AddressCementing { get; set; }
|
||||
public CellAddress AddressSimple { get; set; }
|
||||
public CellAddress AddressNpv { get; set; }
|
||||
public CellAddress AddressOzcValue { get; set; }
|
||||
public CellAddress AddressEngineeringWorksValue { get; set; }
|
||||
public CellAddress AddressTakingMeasureValue { get; set; }
|
||||
public CellAddress AddressCementingValue { get; set; }
|
||||
public CellAddress AddressSimpleValue { get; set; }
|
||||
public CellAddress AddressNpvValue { get; set; }
|
||||
public CellAddress[] AddressPeriodTableDataArray { get; }
|
||||
|
||||
public override CellAddress AddressBlockBegin { get; }
|
||||
public Dictionary<int, double> OperationsStatistics { get; set; }
|
||||
public IEnumerable<WellOperationCategoryDto> OperationCategories { get; set; }
|
||||
public override CellAddress AddressBlockEnd { get; }
|
||||
|
||||
public TimeBalanceBlock(CellAddress addressBlockBegin, TimeBalanceDto blockDto)
|
||||
public CellAddress Title { get { return AddressBlockBegin + (1, 3); } }
|
||||
|
||||
|
||||
public TimeBalanceBlock(CellAddress addressBlockBegin, TimeBalanceDto blockDto, IEnumerable<WellOperationCategoryDto> operationCategories)
|
||||
{
|
||||
AddressBlockBegin = addressBlockBegin.Copy();
|
||||
this.blockDto = blockDto;
|
||||
AddressTitle = addressBlockBegin + (1, 3);
|
||||
AddressDrilling = addressBlockBegin + (2, 1);
|
||||
AddressFlushing = addressBlockBegin + (3, 1);
|
||||
AddressBuilding = addressBlockBegin + (4, 1);
|
||||
AddressElaboration = addressBlockBegin + (5, 1);
|
||||
AddressExtension = addressBlockBegin + (6, 1);
|
||||
AddressRepair = addressBlockBegin + (7, 1);
|
||||
AddressDrillingValue = addressBlockBegin + (2, 2);
|
||||
AddressFlushingValue = addressBlockBegin + (3, 2);
|
||||
AddressBuildingValue = addressBlockBegin + (4, 2);
|
||||
AddressElaborationValue = addressBlockBegin + (5, 2);
|
||||
AddressExtensionValue = addressBlockBegin + (6, 2);
|
||||
AddressRepairValue = addressBlockBegin + (7, 2);
|
||||
AddressKnbk = addressBlockBegin + (2, 3);
|
||||
AddressSpo = addressBlockBegin + (3, 3);
|
||||
AddressPzr = addressBlockBegin + (4, 3);
|
||||
AddressPvo = addressBlockBegin + (5, 3);
|
||||
AddressPgr = addressBlockBegin + (6, 3);
|
||||
AddressGis = addressBlockBegin + (7, 3);
|
||||
AddressKnbkValue = addressBlockBegin + (2, 4);
|
||||
AddressSpoValue = addressBlockBegin + (3, 4);
|
||||
AddressPzrValue = addressBlockBegin + (4, 4);
|
||||
AddressPvoValue = addressBlockBegin + (5, 4);
|
||||
AddressPgrValue = addressBlockBegin + (6, 4);
|
||||
AddressGisValue = addressBlockBegin + (7, 4);
|
||||
AddressOzc = addressBlockBegin + (2, 5);
|
||||
AddressEngineeringWorks = addressBlockBegin + (3, 5);
|
||||
AddressTakingMeasure = addressBlockBegin + (4, 5);
|
||||
AddressCementing = addressBlockBegin + (5, 5);
|
||||
AddressSimple = addressBlockBegin + (6, 5);
|
||||
AddressNpv = addressBlockBegin + (7, 5);
|
||||
AddressOzcValue = addressBlockBegin + (2, 6);
|
||||
AddressEngineeringWorksValue = addressBlockBegin + (3, 6);
|
||||
AddressTakingMeasureValue = addressBlockBegin + (4, 6);
|
||||
AddressCementingValue = addressBlockBegin + (5, 6);
|
||||
AddressSimpleValue = addressBlockBegin + (6, 6);
|
||||
AddressNpvValue = addressBlockBegin + (7, 6);
|
||||
AddressBlockEnd = AddressNpvValue;
|
||||
|
||||
OperationsStatistics = blockDto.OperationsStat;
|
||||
OperationCategories = operationCategories;
|
||||
|
||||
AddressBlockEnd = AddressBlockBegin + (7, 6);
|
||||
}
|
||||
|
||||
public override void Draw(IXLWorksheet sheet)
|
||||
{
|
||||
sheet.Range(AddressTitle.RowNumber, AddressTitle.ColumnNumber, AddressTitle.RowNumber, AddressTitle.ColumnNumber + 1)
|
||||
|
||||
sheet.Range(Title.RowNumber, Title.ColumnNumber, Title.RowNumber, Title.ColumnNumber + 1)
|
||||
.Merge()
|
||||
.SetValue("БАЛАНС ВРЕМЕНИ");
|
||||
sheet.Cell(AddressDrilling)
|
||||
._SetValue("Бурение", true);
|
||||
sheet.Cell(AddressFlushing)
|
||||
._SetValue("Промывка", true);
|
||||
sheet.Cell(AddressBuilding)
|
||||
._SetValue("Наращивание", true);
|
||||
sheet.Cell(AddressElaboration)
|
||||
._SetValue("Проработка", true);
|
||||
sheet.Cell(AddressExtension)
|
||||
._SetValue("Расширка", true);
|
||||
sheet.Cell(AddressRepair)
|
||||
._SetValue("Ремонт", true);
|
||||
//TODO: дописать timebalance
|
||||
sheet.Cell(AddressKnbk)
|
||||
._SetValue("КНБК");
|
||||
sheet.Cell(AddressSpo)
|
||||
._SetValue("СПО");
|
||||
sheet.Cell(AddressPzr)
|
||||
._SetValue("ПЗР");
|
||||
sheet.Cell(AddressPvo)
|
||||
._SetValue("ПВО");
|
||||
sheet.Cell(AddressPgr)
|
||||
._SetValue("ПГР");
|
||||
sheet.Cell(AddressGis)
|
||||
._SetValue("ГИС");
|
||||
//sheet.Cell(AddressKnbkValue)
|
||||
// ._SetValue($"{blockDto.Knbk}");
|
||||
//sheet.Cell(AddressSpoValue)
|
||||
// ._SetValue($"{blockDto.Spo}");
|
||||
//sheet.Cell(AddressPzrValue)
|
||||
// ._SetValue($"{blockDto.Pzr}");
|
||||
//sheet.Cell(AddressPvoValue)
|
||||
// ._SetValue($"{blockDto.Pvo}");
|
||||
//sheet.Cell(AddressPgrValue)
|
||||
// ._SetValue($"{blockDto.Pgr}");
|
||||
//sheet.Cell(AddressGisValue)
|
||||
// ._SetValue($"{blockDto.Gis}");
|
||||
sheet.Cell(AddressOzc)
|
||||
._SetValue("ОЗЦ");
|
||||
sheet.Cell(AddressEngineeringWorks)
|
||||
._SetValue("Тех. работы");
|
||||
sheet.Cell(AddressTakingMeasure)
|
||||
._SetValue("Снятие замера");
|
||||
sheet.Cell(AddressCementing)
|
||||
._SetValue("Цементирование");
|
||||
sheet.Cell(AddressSimple)
|
||||
._SetValue("Простой");
|
||||
sheet.Cell(AddressNpv)
|
||||
._SetValue("НПВ");
|
||||
//sheet.Cell(AddressOzcValue)
|
||||
// ._SetValue($"{blockDto.Ozc}");
|
||||
//sheet.Cell(AddressEngineeringWorksValue)
|
||||
// ._SetValue($"{blockDto.EngineeringWorks}");
|
||||
//sheet.Cell(AddressTakingMeasureValue)
|
||||
// ._SetValue($"{blockDto.TakingMeasure}");
|
||||
//sheet.Cell(AddressCementingValue)
|
||||
// ._SetValue($"{blockDto.Cementing}");
|
||||
//sheet.Cell(AddressSimpleValue)
|
||||
// ._SetValue($"{blockDto.Simple}");
|
||||
//sheet.Cell(AddressNpvValue)
|
||||
// ._SetValue($"{blockDto.Npv}");
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,21 @@
|
||||
using AsbCloudApp.Data.DailyReport;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.DailyReport;
|
||||
using AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks;
|
||||
using ClosedXML.Excel;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
namespace AsbCloudInfrastructure.Services.DailyReport
|
||||
{
|
||||
public class DailyReportMakerExcel
|
||||
{
|
||||
public Stream MakeReportFromBlocks(DailyReportDto dto)
|
||||
private IEnumerable<WellOperationCategoryDto> OperationCategories;
|
||||
|
||||
public Stream MakeReportFromBlocks(DailyReportDto dto, IEnumerable<WellOperationCategoryDto> operationCategories)
|
||||
{
|
||||
OperationCategories = operationCategories;
|
||||
|
||||
using var workbook = new XLWorkbook();
|
||||
FillExampleBlocks(workbook, dto);
|
||||
FillExampleBlocks(workbook, dto);
|
||||
MemoryStream memoryStream = new MemoryStream();
|
||||
workbook.SaveAs(memoryStream, new SaveOptions { });
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
@ -26,7 +32,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
||||
var blockBha = new BhaBlock(addressStart, dto.Bha);
|
||||
addressStart = blockBha.AddressBlockEnd + (1, 0);
|
||||
addressStart.ColumnNumber = 2;
|
||||
var timeBalance = new TimeBalanceBlock(addressStart, dto.TimeBalance);
|
||||
var timeBalance = new TimeBalanceBlock(addressStart, dto.TimeBalance, OperationCategories);
|
||||
addressStart = timeBalance.AddressBlockEnd + (1, 0);
|
||||
addressStart.ColumnNumber = 2;
|
||||
var blockDimensionless = new DimensionlessBlock(addressStart, dto.NoDrilling);
|
||||
@ -47,7 +53,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
||||
blockSign.Draw(sheet);
|
||||
//sheet.Columns().AdjustToContents(); // Adjust column width
|
||||
sheet.Rows().AdjustToContents();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,11 +180,14 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
||||
|
||||
public async Task<Stream?> MakeReportAsync(int idWell, DateTime date, CancellationToken token = default)
|
||||
{
|
||||
var wellOperationCategories = wellOperationRepository.GetCategories(true);
|
||||
|
||||
var dailyReportDto = await GetOrDefaultAsync(idWell, date, token);
|
||||
if (dailyReportDto is null)
|
||||
return null;
|
||||
|
||||
var memoryStream = dailyReportMaker.MakeReportFromBlocks(dailyReportDto);
|
||||
var memoryStream = dailyReportMaker.MakeReportFromBlocks(dailyReportDto, wellOperationCategories);
|
||||
|
||||
return memoryStream;
|
||||
}
|
||||
|
||||
@ -220,12 +223,15 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
||||
var dto = entity.Info.Adapt<DailyReportDto>();
|
||||
dto.StartDate = entity.StartDate;
|
||||
|
||||
dto.TimeBalance.OperationsStat = (factOperationsForDtos
|
||||
.Where(o => DateOnly.FromDateTime(o.DateStart) == dto.StartDate)
|
||||
.GroupBy(o => o.IdCategory)
|
||||
.Select(g => new OperationStatDto() { Depth = g.Sum(o => o.DepthEnd - o.DepthStart) }));
|
||||
var dailyFactOperation = factOperationsForDtos
|
||||
.Where(o => DateOnly.FromDateTime(o.DateStart) == dto.StartDate)
|
||||
.Where(o => o.IdParentCategory is not null)
|
||||
.GroupBy(o => o.IdParentCategory!.Value)
|
||||
.ToDictionary(g => g.Key, g => g.Sum(o => o.DurationHours));
|
||||
|
||||
await SetUserNamesToDailyReportDtoAsync(dto, token);
|
||||
dto.TimeBalance.OperationsStat = dailyFactOperation;
|
||||
|
||||
await SetUserNamesToDailyReportDtoAsync(dto, token);
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user