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