forked from ddrilling/AsbCloudServer
Удалены старые реализации суточного рапорта и авто генерируемого отчёта
This commit is contained in:
parent
399393fd55
commit
070cd185cb
@ -1,30 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DTO авто-сгенерированного суточного отчёта
|
|
||||||
/// </summary>
|
|
||||||
public class AutoGeneratedDailyReportDto : AutoGeneratedDailyReportInfoDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Блок заголовка
|
|
||||||
/// </summary>
|
|
||||||
public HeadBlockDto Head { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Блок подсистем
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<SubsystemRecordDto> Subsystems { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Блок ограничивающих параметров
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<LimitingParameterRecordDto> LimitingParameters { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Баланс времени
|
|
||||||
/// </summary>
|
|
||||||
public IEnumerable<TimeBalanceRecordDto> TimeBalance { get; set; } = null!;
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Базовая информация о суточном отчёте
|
|
||||||
/// </summary>
|
|
||||||
public class AutoGeneratedDailyReportInfoDto : ReportInfoDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Дата формирования отчёта
|
|
||||||
/// </summary>
|
|
||||||
public DateOnly ReportDate { get; set; }
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
namespace AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Блок заголовка
|
|
||||||
/// </summary>
|
|
||||||
public class HeadBlockDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Название скважины
|
|
||||||
/// </summary>
|
|
||||||
public string Well { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Название куста
|
|
||||||
/// </summary>
|
|
||||||
public string Cluster { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Заказчик
|
|
||||||
/// </summary>
|
|
||||||
public string Customer { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Месторождение
|
|
||||||
/// </summary>
|
|
||||||
public string Deposit { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Глубина забоя на дату начала интервала
|
|
||||||
/// </summary>
|
|
||||||
public double DepthFrom { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Глубина забоя на дату окончания интервала
|
|
||||||
/// </summary>
|
|
||||||
public double DepthTo { get; set; }
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
namespace AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Блок ограничивающих параметров
|
|
||||||
/// </summary>
|
|
||||||
public class LimitingParameterRecordDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Время использования, мин
|
|
||||||
/// </summary>
|
|
||||||
public double Hours { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Проходка, м
|
|
||||||
/// </summary>
|
|
||||||
public double Depth { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Название ограничивающего параметра
|
|
||||||
/// </summary>
|
|
||||||
public string NameFeedRegulator { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Процент по проходке, %
|
|
||||||
/// </summary>
|
|
||||||
public double PercentDepth { get; set; }
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
namespace AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Блок подсистем
|
|
||||||
/// </summary>
|
|
||||||
public class SubsystemRecordDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Название подсистемы
|
|
||||||
/// </summary>
|
|
||||||
public string Name { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Использование, %
|
|
||||||
/// </summary>
|
|
||||||
public double KUsage { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Время работы, ч
|
|
||||||
/// </summary>
|
|
||||||
public double UsedTimeHours { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Проходка
|
|
||||||
/// </summary>
|
|
||||||
public double Depth { get; set; }
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
namespace AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Баланс времени
|
|
||||||
/// </summary>
|
|
||||||
public class TimeBalanceRecordDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Название операции
|
|
||||||
/// </summary>
|
|
||||||
public string Name { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Продолжительность, часы
|
|
||||||
/// </summary>
|
|
||||||
public double DurationHours { get; set; }
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
namespace AsbCloudApp.Data.DailyReport
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// блок КНБК
|
|
||||||
/// </summary>
|
|
||||||
public class BhaDto : ItemInfoDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// КНБК описание
|
|
||||||
/// </summary>
|
|
||||||
public string BHADescription { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Бурение с наращиваниями в инт. 2195-2763м. Время начала
|
|
||||||
/// </summary>
|
|
||||||
public string ExtensionDrillingOneBegin{ get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Бурение с наращиваниями в инт. 2195-2763м. Время окончания
|
|
||||||
/// </summary>
|
|
||||||
public string ExtensionDrillingOneFinish { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Промывка. Время начала
|
|
||||||
/// </summary>
|
|
||||||
public string SluiceBegin { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Промывка. Время окончания
|
|
||||||
/// </summary>
|
|
||||||
public string SluiceFinish { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Подъем КНБК. Время начала
|
|
||||||
/// </summary>
|
|
||||||
public string ClimbBegin { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Подъем КНБК. Время окончания
|
|
||||||
/// </summary>
|
|
||||||
public string ClimbFinish { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Спуск КНБК. Время начала
|
|
||||||
/// </summary>
|
|
||||||
public string DescentBegin { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Спуск КНБК. Время окончания
|
|
||||||
/// </summary>
|
|
||||||
public string DescentFinish { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Бурение с наращиваниями в инт. 2763-2850м. Время начала
|
|
||||||
/// </summary>
|
|
||||||
public string ExtensionDrillingTwoBegin { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Бурение с наращиваниями в инт. 2763-2850м. Время окончания
|
|
||||||
/// </summary>
|
|
||||||
public string ExtensionDrillingTwoFinish { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
|||||||
using System;
|
|
||||||
namespace AsbCloudApp.Data.DailyReport
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// блок заголовка
|
|
||||||
/// </summary>
|
|
||||||
public class HeadDto : ItemInfoDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// название скважины
|
|
||||||
/// </summary>
|
|
||||||
public string WellName { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// название куста
|
|
||||||
/// </summary>
|
|
||||||
public string ClusterName { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// заказчик
|
|
||||||
/// </summary>
|
|
||||||
public string Customer { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// подрядчик
|
|
||||||
/// </summary>
|
|
||||||
public string Contractor { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// дата рапорта
|
|
||||||
/// </summary>
|
|
||||||
public DateOnly ReportDate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// глубина забоя на дату начала интервала
|
|
||||||
/// </summary>
|
|
||||||
public double? WellDepthIntervalStartDate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// глубина забоя на дату окончания интервала
|
|
||||||
/// </summary>
|
|
||||||
public double? WellDepthIntervalFinishDate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Глубина забоя по стволу на окончание отчетного периода
|
|
||||||
/// </summary>
|
|
||||||
public double? BottomholeDepth { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Глубина забоя по вертикали на дату окончания отчетного периода
|
|
||||||
/// </summary>
|
|
||||||
public double? VerticalDepth { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Зенитный угол на дату окончания отчетного периода
|
|
||||||
/// </summary>
|
|
||||||
public double? ZenithAngle { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Азимутальный угол на дату окончания отчетного периода
|
|
||||||
/// </summary>
|
|
||||||
public double? AzimuthAngle { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ФИО бурильщиков
|
|
||||||
/// </summary>
|
|
||||||
public string FirstDriller { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ФИО бурильщиков
|
|
||||||
/// </summary>
|
|
||||||
public string SecondDriller { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Время работы АПД
|
|
||||||
/// </summary>
|
|
||||||
public double? WorkTimeSAUB { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Время работы спин мастер
|
|
||||||
/// </summary>
|
|
||||||
public double? WorkTimeSpinMaster { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Время работы torqueMaster
|
|
||||||
/// </summary>
|
|
||||||
public double? WorkTimeTorkMaster { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// количество метров пробуренных с включенным АПД
|
|
||||||
/// </summary>
|
|
||||||
public double? PenetrationSAUB { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// количество метров пробуренных с включенным Спин мастер
|
|
||||||
/// </summary>
|
|
||||||
public double? PenetrationSpinMaster { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// количество метров пробуренных с включенным torqueMaster
|
|
||||||
/// </summary>
|
|
||||||
public double? PenetrationTorkMaster { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Количество запусков МСЕ
|
|
||||||
/// </summary>
|
|
||||||
public int CountLaunchesMSE { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
namespace AsbCloudApp.Data.DailyReport
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// блок безметражные работы
|
|
||||||
/// </summary>
|
|
||||||
public class NoDrillingDto : ItemInfoDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию
|
|
||||||
/// </summary>
|
|
||||||
public double? StandardTimeBarrelPreparation { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Нормативное время на одну операцию по наращиванию
|
|
||||||
/// </summary>
|
|
||||||
public double? StandardTimeExtension { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Фактическое время проработок при подготовке ствола скважины к наращиванию.
|
|
||||||
/// </summary>
|
|
||||||
public double? ActualTimeBarrelPreparation { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Фактическое время наращиваний
|
|
||||||
/// </summary>
|
|
||||||
public double? ActualTimeExtension { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,107 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace AsbCloudApp.Data.DailyReport
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// блок САУБ
|
|
||||||
/// </summary>
|
|
||||||
public class SaubDto : ItemInfoDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Режимы бурения в роторе
|
|
||||||
/// </summary>
|
|
||||||
public string RotorDrillingModes { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// режимы бурения в слайде
|
|
||||||
/// </summary>
|
|
||||||
public string SlideDrillingModes { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Количество метров пробуренных в роторе за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? PenetrationInRotor { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Количество часов бурения в роторе за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? NumberDrillingHours { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// средний диф перепад в роторе за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? AVGDiffDropRotor { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// количество метров пробуренных в слайде за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? PenetrationInSlide { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// время бурения в роторе за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? DrillingTimeInRotor { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// средний диф. перепад в слайде за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? AVGDiffPressureSlide { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Плановая МСП за секцию
|
|
||||||
/// </summary>
|
|
||||||
public double? SectionROPPlan { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Общее время бурения за секцию
|
|
||||||
/// </summary>
|
|
||||||
public double? SectionDrillingTimeTotal { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Общая проходка за секцию
|
|
||||||
/// </summary>
|
|
||||||
public double? SectionPenetrationTotal { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Количество наращиваний за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public int ExtensionsCount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Отклонение относительно ГГД
|
|
||||||
/// </summary>
|
|
||||||
public double? DeviationFromTVD { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// указываются все причины, которые влияют на снижение МСП.
|
|
||||||
/// </summary>
|
|
||||||
public string DeclinesReasonsROP { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Увеличение мех скорости за секцию %
|
|
||||||
/// </summary>
|
|
||||||
public string IncreaseSpeedSection { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Увеличение мех скорости за сутки %
|
|
||||||
/// </summary>
|
|
||||||
public string IncreaseSpeedDay { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Сокращение времени бурения за секцию, ч
|
|
||||||
/// </summary>
|
|
||||||
public string ReductionTimeDrilling { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ротор/Слайд %
|
|
||||||
/// </summary>
|
|
||||||
public string RotorSlidePercent { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// МСП
|
|
||||||
/// </summary>
|
|
||||||
public string MspSection { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
namespace AsbCloudApp.Data.DailyReport
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// блок подписи
|
|
||||||
/// </summary>
|
|
||||||
public class SignDto : ItemInfoDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// ФИО Мастера буровой
|
|
||||||
/// </summary>
|
|
||||||
public string DrillingMaster { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ФИО супервайзера
|
|
||||||
/// </summary>
|
|
||||||
public string Supervisor { get; set; } = null!;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace AsbCloudApp.Data.DailyReport
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Блок баланса времени
|
|
||||||
/// </summary>
|
|
||||||
public class TimeBalanceDto : ItemInfoDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Статистика по операциям
|
|
||||||
/// </summary>
|
|
||||||
public Dictionary<int, double> OperationsStat { get; set; } = new Dictionary<int, double>();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AsbCloudApp.Data;
|
|
||||||
using AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
using AsbCloudApp.Requests;
|
|
||||||
|
|
||||||
namespace AsbCloudApp.Services.AutoGeneratedDailyReports;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Сервис для работы с авто-генерируемыми суточными отчётами
|
|
||||||
/// </summary>
|
|
||||||
public interface IAutoGeneratedDailyReportService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Список файлов суточных отчётов
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idWell"></param>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<PaginationContainer<AutoGeneratedDailyReportInfoDto>> GetListAsync(int idWell,
|
|
||||||
FileReportRequest request,
|
|
||||||
CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Генерация файла с отчётом
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idWell"></param>
|
|
||||||
/// <param name="reportDate"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<(string fileName, Stream stream)> GenerateAsync(int idWell, DateOnly reportDate,
|
|
||||||
CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получение диапазона дат
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idWell"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<DatesRangeDto?> GetDatesRangeAsync(int idWell, CancellationToken cancellationToken);
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
using AsbCloudApp.Data;
|
|
||||||
using AsbCloudApp.Data.DailyReport;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AsbCloudApp.Services
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Суточный рапорт (сводка)
|
|
||||||
/// </summary>
|
|
||||||
public interface IDailyReportService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// получить список сформированных рапортов по скважине за период времени
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idWell"></param>
|
|
||||||
/// <param name="begin"></param>
|
|
||||||
/// <param name="end"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<IEnumerable<DailyReportDto>> GetListAsync(int idWell, DateOnly? begin, DateOnly? end, CancellationToken cancellationToken);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Добавить новый рапорт
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idWell"></param>
|
|
||||||
/// <param name="startDate"></param>
|
|
||||||
/// <param name="idUser"></param>
|
|
||||||
/// <param name="token"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<int> AddAsync(int idWell, DateOnly startDate, int idUser, CancellationToken token);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Сформировать файл рапорта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idWell"></param>
|
|
||||||
/// <param name="date"></param>
|
|
||||||
/// <param name="token"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<Stream?> MakeReportAsync(int idWell, DateOnly date, CancellationToken token);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// изменить блок данных для суточного рапорта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idWell"></param>
|
|
||||||
/// <param name="startDate"></param>
|
|
||||||
/// <param name="dto"></param>
|
|
||||||
/// <param name="token"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<int> UpdateBlockAsync(int idWell, DateOnly startDate, ItemInfoDto dto, CancellationToken token);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
namespace AsbCloudDb.Model.DailyReport
|
|
||||||
{
|
|
||||||
public class Bha : ItemInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// КНБК описание
|
|
||||||
/// </summary>
|
|
||||||
public string BHADescription { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Бурение с наращиваниями в инт. 2195-2763м. Время начала
|
|
||||||
/// </summary>
|
|
||||||
public string ExtensionDrillingOneBegin { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Бурение с наращиваниями в инт. 2195-2763м. Время окончания
|
|
||||||
/// </summary>
|
|
||||||
public string ExtensionDrillingOneFinish { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Промывка. Время начала
|
|
||||||
/// </summary>
|
|
||||||
public string SluiceBegin { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Промывка. Время окончания
|
|
||||||
/// </summary>
|
|
||||||
public string SluiceFinish { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Подьем КНБК. Время начала
|
|
||||||
/// </summary>
|
|
||||||
public string ClimbBegin { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Подьем КНБК. Время окончания
|
|
||||||
/// </summary>
|
|
||||||
public string ClimbFinish { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Спуск КНБК. Время начала
|
|
||||||
/// </summary>
|
|
||||||
public string DescentBegin { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Спуск КНБК. Время окончания
|
|
||||||
/// </summary>
|
|
||||||
public string DescentFinish { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Бурение с наращиваниями в инт. 2763-2850м. Время начала
|
|
||||||
/// </summary>
|
|
||||||
public string ExtensionDrillingTwoBegin { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Бурение с наращиваниями в инт. 2763-2850м. Время окончания
|
|
||||||
/// </summary>
|
|
||||||
public string ExtensionDrillingTwoFinish { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
namespace AsbCloudDb.Model.DailyReport
|
|
||||||
{
|
|
||||||
[Table("t_daily_report"), Comment("Ежедневные отчёты")]
|
|
||||||
public class DailyReport
|
|
||||||
{
|
|
||||||
[Column("id_well"), Comment("ID скважины")]
|
|
||||||
public int IdWell { get; set; }
|
|
||||||
|
|
||||||
[Column("start_date", TypeName = "date"), Comment("Дата отчёта")]
|
|
||||||
public DateOnly StartDate { get; set; }
|
|
||||||
|
|
||||||
[Column("info", TypeName = "jsonb"), Comment("Список параметров для отчёта")]
|
|
||||||
public DailyReportInfo Info { get; set; } = null!;
|
|
||||||
|
|
||||||
[ForeignKey(nameof(IdWell))]
|
|
||||||
public virtual Well Well { get; set; } = null!;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using AsbCloudDb.Model.DailyReport;
|
|
||||||
|
|
||||||
namespace AsbCloudDb.Model
|
|
||||||
{
|
|
||||||
public class DailyReportInfo
|
|
||||||
{
|
|
||||||
public Head Head { get; set; } = null!;
|
|
||||||
public Bha Bha { get; set; } = new();
|
|
||||||
public NoDrilling NoDrilling { get; set; } = new();
|
|
||||||
public Saub Saub { get; set; } = new();
|
|
||||||
public Sign Sign { get; set; } = new();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,110 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace AsbCloudDb.Model.DailyReport
|
|
||||||
{
|
|
||||||
public class Head : ItemInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// название скважины
|
|
||||||
/// </summary>
|
|
||||||
public string WellName { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// название куста
|
|
||||||
/// </summary>
|
|
||||||
public string ClusterName { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// заказчик
|
|
||||||
/// </summary>
|
|
||||||
public string Customer { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// подрядчик
|
|
||||||
/// </summary>
|
|
||||||
public string Contractor { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// дата рапорта
|
|
||||||
/// </summary>
|
|
||||||
[JsonConverter(typeof(DateOnlyJsonConverter))]
|
|
||||||
public DateOnly ReportDate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// глубина забоя на дату начала интервала
|
|
||||||
/// </summary>
|
|
||||||
public double? WellDepthIntervalStartDate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// глубина забоя на дату окончания интервала
|
|
||||||
/// </summary>
|
|
||||||
public double? WellDepthIntervalFinishDate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Глубина забоя по стволу на окончание отчетного периода
|
|
||||||
/// </summary>
|
|
||||||
public double? BottomholeDepth { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Глубина забоя по вертикали на дату окончания отчетного периода
|
|
||||||
/// </summary>
|
|
||||||
public double? VerticalDepth { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Зенитный угол на дату окончания отчетного периода
|
|
||||||
/// </summary>
|
|
||||||
public double? ZenithAngle { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Азимутальный угол на дату окончания отчетного периода
|
|
||||||
/// </summary>
|
|
||||||
public double? AzimuthAngle { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ФИО бурильщиков
|
|
||||||
/// </summary>
|
|
||||||
public string FirstDriller { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ФИО бурильщиков
|
|
||||||
/// </summary>
|
|
||||||
public string SecondDriller { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Время работы АПД
|
|
||||||
/// </summary>
|
|
||||||
public double? WorkTimeSAUB { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Время работы спин мастер
|
|
||||||
/// </summary>
|
|
||||||
public double? WorkTimeSpinMaster { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Время работы torqueMaster
|
|
||||||
/// </summary>
|
|
||||||
public double? WorkTimeTorkMaster { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// количество метров пробуренных с включенным АПД
|
|
||||||
/// </summary>
|
|
||||||
public double? PenetrationSAUB { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// количество метров пробуренных с включенным Спин мастер
|
|
||||||
/// </summary>
|
|
||||||
public double? PenetrationSpinMaster { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// количество метров пробуренных с включенным torqueMaster
|
|
||||||
/// </summary>
|
|
||||||
public double? PenetrationTorkMaster { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Количество запусков МСЕ
|
|
||||||
/// </summary>
|
|
||||||
public int CountLaunchesMSE { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
namespace AsbCloudDb.Model.DailyReport
|
|
||||||
{
|
|
||||||
public class NoDrilling : ItemInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию
|
|
||||||
/// </summary>
|
|
||||||
public double? StandardTimeBarrelPreparation { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Нормативное время на одну операцию по наращиванию
|
|
||||||
/// </summary>
|
|
||||||
public double? StandardTimeExtension { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Фактическое время проработок при подготовке ствола скважины к наращиванию.
|
|
||||||
/// </summary>
|
|
||||||
public double? ActualTimeBarrelPreparation { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Фактическое время наращиваний
|
|
||||||
/// </summary>
|
|
||||||
public double? ActualTimeExtension { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
|||||||
namespace AsbCloudDb.Model.DailyReport
|
|
||||||
{
|
|
||||||
public class Saub : ItemInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Режимы бурения в роторе
|
|
||||||
/// </summary>
|
|
||||||
public string? RotorDrillingModes { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// режимы бурения в слайде
|
|
||||||
/// </summary>
|
|
||||||
public string? SlideDrillingModes { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Количество метров пробуренных в роторе за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? PenetrationInRotor { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Количество часов бурения в роторе за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? NumberDrillingHours { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// средний диф перепад в роторе за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? AVGDiffDropRotor { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// количество метров пробуренных в слайде за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? PenetrationInSlide { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// время бурения в роторе за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? DrillingTimeInRotor { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// средний диф. перепад в слайде за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public double? AVGDiffPressureSlide { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Плановая МСП за секцию
|
|
||||||
/// </summary>
|
|
||||||
public double? SectionROPPlan { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Общее время бурения за секцию
|
|
||||||
/// </summary>
|
|
||||||
public double? SectionDrillingTimeTotal { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Общая проходка за секцию
|
|
||||||
/// </summary>
|
|
||||||
public double? SectionPenetrationTotal { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Количество наращиваний за отчетный период
|
|
||||||
/// </summary>
|
|
||||||
public int ExtensionsCount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Отклонение относительно ГГД
|
|
||||||
/// </summary>
|
|
||||||
public double? DeviationFromTVD { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// указываются все причины, которые влияют на снижение МСП.
|
|
||||||
/// </summary>
|
|
||||||
public string DeclinesReasonsROP { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Увеличение мех скорости за секцию %
|
|
||||||
/// </summary>
|
|
||||||
public string IncreaseSpeedSection { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Увеличение мех скорости за сутки %
|
|
||||||
/// </summary>
|
|
||||||
public string IncreaseSpeedDay { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Сокращение времени бурения за секцию, ч
|
|
||||||
/// </summary>
|
|
||||||
public string ReductionTimeDrilling { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ротор/Слайд %
|
|
||||||
/// </summary>
|
|
||||||
public string RotorSlidePercent { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// МСП
|
|
||||||
/// </summary>
|
|
||||||
public string MspSection { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
namespace AsbCloudDb.Model.DailyReport
|
|
||||||
{
|
|
||||||
public class Sign : ItemInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// ФИО Мастера буровой
|
|
||||||
/// </summary>
|
|
||||||
public string DrillingMaster { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ФИО супервайзера
|
|
||||||
/// </summary>
|
|
||||||
public string Supervisor { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
using AsbCloudApp.Services;
|
|
||||||
using AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports;
|
|
||||||
|
|
||||||
public class AutoGeneratedDailyReportMakerService : IReportMakerService<AutoGeneratedDailyReportDto>
|
|
||||||
{
|
|
||||||
private readonly string templateName = "AutogeneratedDailyReportTemplate.xlsx";
|
|
||||||
|
|
||||||
private readonly IEnumerable<IExcelBlockWriter> blockWriters = new List<IExcelBlockWriter>()
|
|
||||||
{
|
|
||||||
new HeadExcelBlockWriter(),
|
|
||||||
new SubsystemExcelBlockWriter(),
|
|
||||||
new LimitingParameterExcelBlockWriter(),
|
|
||||||
new TimeBalanceExcelBlockWriter()
|
|
||||||
};
|
|
||||||
|
|
||||||
public async Task<Stream> MakeReportAsync(AutoGeneratedDailyReportDto report, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
using var excelTemplateStream = await Assembly
|
|
||||||
.GetExecutingAssembly()
|
|
||||||
.GetTemplateCopyStreamAsync(templateName, cancellationToken);
|
|
||||||
|
|
||||||
using var workbook = new XLWorkbook(excelTemplateStream, XLEventTracking.Disabled);
|
|
||||||
|
|
||||||
AddToWorkbook(workbook, report);
|
|
||||||
|
|
||||||
MemoryStream memoryStream = new MemoryStream();
|
|
||||||
workbook.SaveAs(memoryStream, new SaveOptions { });
|
|
||||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
|
||||||
|
|
||||||
return memoryStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddToWorkbook(XLWorkbook workbook, AutoGeneratedDailyReportDto report)
|
|
||||||
{
|
|
||||||
const string sheetName = "Рапорт";
|
|
||||||
|
|
||||||
var sheet = workbook.Worksheets.FirstOrDefault(ws => ws.Name == sheetName)
|
|
||||||
?? throw new FileFormatException($"Книга excel не содержит листа {sheetName}.");
|
|
||||||
|
|
||||||
foreach (var blockBuilder in blockWriters)
|
|
||||||
{
|
|
||||||
blockBuilder.Write(sheet, report);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,262 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AsbCloudApp.Data;
|
|
||||||
using AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
using AsbCloudApp.Data.Subsystems;
|
|
||||||
using AsbCloudApp.Exceptions;
|
|
||||||
using AsbCloudApp.Repositories;
|
|
||||||
using AsbCloudApp.Requests;
|
|
||||||
using AsbCloudApp.Services;
|
|
||||||
using AsbCloudApp.Services.AutoGeneratedDailyReports;
|
|
||||||
using AsbCloudApp.Services.Subsystems;
|
|
||||||
using AsbCloudDb.Model;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports;
|
|
||||||
|
|
||||||
public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
|
|
||||||
{
|
|
||||||
private const string fileNameTemplate = "Суточный_отчёт_по_скважине_{0}_куст_{1}_от_{2}.xlsx";
|
|
||||||
|
|
||||||
private readonly IWellService wellService;
|
|
||||||
private readonly IWellOperationRepository wellOperationRepository;
|
|
||||||
private readonly ISubsystemOperationTimeService subsystemOperationTimeService;
|
|
||||||
private readonly ICrudRepository<SubsystemDto> subsystemRepository;
|
|
||||||
private readonly ILimitingParameterService limitingParameterService;
|
|
||||||
private readonly IReportMakerService<AutoGeneratedDailyReportDto> autoGeneratedDailyReportMakerService;
|
|
||||||
|
|
||||||
public AutoGeneratedDailyReportService(IWellService wellService,
|
|
||||||
IWellOperationRepository wellOperationRepository,
|
|
||||||
ISubsystemOperationTimeService subsystemOperationTimeService,
|
|
||||||
ICrudRepository<SubsystemDto> subsystemRepository,
|
|
||||||
ILimitingParameterService limitingParameterService,
|
|
||||||
IReportMakerService<AutoGeneratedDailyReportDto> autoGeneratedDailyReportMakerService)
|
|
||||||
{
|
|
||||||
this.wellOperationRepository = wellOperationRepository;
|
|
||||||
this.wellService = wellService;
|
|
||||||
this.subsystemOperationTimeService = subsystemOperationTimeService;
|
|
||||||
this.subsystemRepository = subsystemRepository;
|
|
||||||
this.limitingParameterService = limitingParameterService;
|
|
||||||
this.autoGeneratedDailyReportMakerService = autoGeneratedDailyReportMakerService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<PaginationContainer<AutoGeneratedDailyReportInfoDto>> GetListAsync(int idWell,
|
|
||||||
FileReportRequest request,
|
|
||||||
CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var result = new PaginationContainer<AutoGeneratedDailyReportInfoDto>
|
|
||||||
{
|
|
||||||
Skip = request.Skip ?? 0,
|
|
||||||
Take = request.Take ?? 10,
|
|
||||||
Items = Enumerable.Empty<AutoGeneratedDailyReportInfoDto>()
|
|
||||||
};
|
|
||||||
|
|
||||||
var reports = new List<AutoGeneratedDailyReportInfoDto>();
|
|
||||||
|
|
||||||
var well = await wellService.GetOrDefaultAsync(idWell, cancellationToken)
|
|
||||||
?? throw new ArgumentInvalidException(nameof(idWell), "Скважина не найдена");
|
|
||||||
|
|
||||||
if (!well.IdTelemetry.HasValue)
|
|
||||||
throw new ArgumentInvalidException(nameof(idWell), "Телеметрия для скважины отсутствует");
|
|
||||||
|
|
||||||
var datesRange = await GetDatesRangeAsync(idWell, cancellationToken);
|
|
||||||
|
|
||||||
if (datesRange is null)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
if (request.GeDate.HasValue)
|
|
||||||
{
|
|
||||||
var startDate = new DateTime(request.GeDate.Value.Year, request.GeDate.Value.Month,
|
|
||||||
request.GeDate.Value.Day);
|
|
||||||
|
|
||||||
if(startDate.Date >= datesRange.From.Date)
|
|
||||||
datesRange.From = startDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request.LeDate.HasValue)
|
|
||||||
{
|
|
||||||
var finishDate = new DateTime(request.LeDate.Value.Year, request.LeDate.Value.Month,
|
|
||||||
request.LeDate.Value.Day);
|
|
||||||
|
|
||||||
if (finishDate.Date <= datesRange.To.Date)
|
|
||||||
datesRange.To = finishDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datesRange.From.AddDays(result.Skip) <= datesRange.To)
|
|
||||||
result.Count = (int)(Math.Ceiling((datesRange.To - DateTime.UnixEpoch).TotalDays) - Math.Floor((datesRange.From - DateTime.UnixEpoch).TotalDays));
|
|
||||||
|
|
||||||
for (int day = result.Skip; (day - result.Skip) < result.Take && (datesRange.From.AddDays(day)) <= datesRange.To; day++)
|
|
||||||
{
|
|
||||||
var reportDate = DateOnly.FromDateTime(datesRange.From.AddDays(day));
|
|
||||||
|
|
||||||
reports.Add(new AutoGeneratedDailyReportInfoDto
|
|
||||||
{
|
|
||||||
FileName = string.Format(fileNameTemplate, well.Caption, well.Cluster, reportDate),
|
|
||||||
ReportDate = reportDate,
|
|
||||||
FileSize = GetFileSize(reportDate, idWell),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Items = reports;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<(string fileName, Stream stream)> GenerateAsync(int idWell, DateOnly reportDate,
|
|
||||||
CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var startDate = new DateTime(reportDate.Year, reportDate.Month, reportDate.Day);
|
|
||||||
var finishDate = startDate.AddDays(1);
|
|
||||||
|
|
||||||
var well = await wellService.GetOrDefaultAsync(idWell, cancellationToken)
|
|
||||||
?? throw new ArgumentInvalidException(nameof(idWell), "Скважина не найдена");
|
|
||||||
|
|
||||||
if (!well.IdTelemetry.HasValue)
|
|
||||||
throw new ArgumentInvalidException(nameof(idWell), "Телеметрия для скважины отсутствует");
|
|
||||||
|
|
||||||
var factOperations = await GetFactOperationsAsync(well.Id, startDate, finishDate,
|
|
||||||
cancellationToken);
|
|
||||||
|
|
||||||
var report = new AutoGeneratedDailyReportDto
|
|
||||||
{
|
|
||||||
FileName = string.Format(fileNameTemplate, well.Caption, well.Cluster, reportDate),
|
|
||||||
FileSize = GetFileSize(reportDate, idWell),
|
|
||||||
ReportDate = reportDate,
|
|
||||||
Head = CreateHeadBlock(well, factOperations),
|
|
||||||
Subsystems = (await CreateSubsystemBlockAsync(idWell, startDate, finishDate, cancellationToken)).ToArray(),
|
|
||||||
LimitingParameters = (await CreateLimitingParameterBlockAsync(idWell, startDate, finishDate, cancellationToken)).ToArray(),
|
|
||||||
TimeBalance = factOperations.GroupBy(w => w.CategoryName).Select(x => new TimeBalanceRecordDto
|
|
||||||
{
|
|
||||||
Name = x.Key ?? "Название операции отсутствует",
|
|
||||||
DurationHours = x.Sum(o => o.DurationHours)
|
|
||||||
}).ToArray(),
|
|
||||||
};
|
|
||||||
|
|
||||||
var stream = await autoGeneratedDailyReportMakerService.MakeReportAsync(report, cancellationToken);
|
|
||||||
|
|
||||||
return (report.FileName, stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<DatesRangeDto?> GetDatesRangeAsync(int idWell, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var factOperations = await GetFactOperationsAsync(idWell, null, null,
|
|
||||||
cancellationToken);
|
|
||||||
|
|
||||||
if (!factOperations.Any())
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new DatesRangeDto
|
|
||||||
{
|
|
||||||
From = factOperations.Min(o => o.DateStart).Date,
|
|
||||||
To = factOperations.Max(o => o.DateStart).Date
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private HeadBlockDto CreateHeadBlock(WellDto well, IEnumerable<WellOperationDto> factOperations)
|
|
||||||
{
|
|
||||||
var customer = well.Companies.FirstOrDefault(company => company.IdCompanyType == 1);
|
|
||||||
var sortedFactOperations = factOperations.OrderBy(o => o.DateStart);
|
|
||||||
|
|
||||||
return new HeadBlockDto
|
|
||||||
{
|
|
||||||
Customer = customer?.Caption ?? string.Empty,
|
|
||||||
Deposit = well.Deposit ?? string.Empty,
|
|
||||||
Cluster = well.Cluster ?? string.Empty,
|
|
||||||
Well = well.Caption,
|
|
||||||
DepthFrom = sortedFactOperations.FirstOrDefault()?.DepthStart ?? 0.00,
|
|
||||||
DepthTo = sortedFactOperations.LastOrDefault()?.DepthEnd ?? 0.00
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<IEnumerable<SubsystemRecordDto>> CreateSubsystemBlockAsync(int idWell, DateTime startDate,
|
|
||||||
DateTime finishDate,
|
|
||||||
CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var subsystems = await subsystemRepository.GetAllAsync(cancellationToken);
|
|
||||||
var subsystemStats = await GetSubsystemStatsAsync(idWell, startDate, finishDate,
|
|
||||||
cancellationToken);
|
|
||||||
|
|
||||||
return subsystems.Select(subsystem =>
|
|
||||||
{
|
|
||||||
var subsytemStat = subsystemStats?.FirstOrDefault(s => s.IdSubsystem == subsystem.Id);
|
|
||||||
|
|
||||||
return new SubsystemRecordDto
|
|
||||||
{
|
|
||||||
Name = subsystem.Name,
|
|
||||||
KUsage = subsytemStat?.KUsage ?? 0.00,
|
|
||||||
UsedTimeHours = subsytemStat?.UsedTimeHours ?? 0.00,
|
|
||||||
Depth = subsytemStat?.SumDepthInterval ?? 0.00,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<IEnumerable<LimitingParameterRecordDto>> CreateLimitingParameterBlockAsync(int idWell,
|
|
||||||
DateTime startDate, DateTime finishDate, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var limitingParameterStats = (await GetLimitingParameterStatsAsync(idWell,
|
|
||||||
startDate, finishDate, cancellationToken)).ToArray();
|
|
||||||
|
|
||||||
var sumDepths = limitingParameterStats.Sum(x => x.Depth);
|
|
||||||
|
|
||||||
return limitingParameterStats.Select(l => new LimitingParameterRecordDto
|
|
||||||
{
|
|
||||||
NameFeedRegulator = l.NameFeedRegulator,
|
|
||||||
Hours = l.TotalMinutes,
|
|
||||||
PercentDepth = sumDepths != 0 ? l.Depth / sumDepths : 0,
|
|
||||||
Depth = l.Depth,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<IOrderedEnumerable<WellOperationDto>> GetFactOperationsAsync(int idWell, DateTime? startDate,
|
|
||||||
DateTime? finishDate, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var request = new WellOperationRequest
|
|
||||||
{
|
|
||||||
IdWell = idWell,
|
|
||||||
OperationType = WellOperation.IdOperationTypeFact,
|
|
||||||
GeDate = startDate,
|
|
||||||
LtDate = finishDate,
|
|
||||||
SortFields = new[] { "DateStart asc" },
|
|
||||||
};
|
|
||||||
|
|
||||||
return (await wellOperationRepository.GetAsync(request, cancellationToken))
|
|
||||||
.OrderBy(w => w.DateStart);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task<IEnumerable<SubsystemStatDto>> GetSubsystemStatsAsync(int idWell, DateTime startDate,
|
|
||||||
DateTime finishDate, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var request = new SubsystemOperationTimeRequest
|
|
||||||
{
|
|
||||||
IdWell = idWell,
|
|
||||||
GtDate = startDate,
|
|
||||||
LtDate = finishDate,
|
|
||||||
};
|
|
||||||
|
|
||||||
return subsystemOperationTimeService.GetStatAsync(request, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task<IEnumerable<LimitingParameterDto>> GetLimitingParameterStatsAsync(int idWell,
|
|
||||||
DateTime startDate, DateTime finishDate, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var request = new LimitingParameterRequest
|
|
||||||
{
|
|
||||||
IdWell = idWell,
|
|
||||||
GtDate = startDate,
|
|
||||||
LtDate = finishDate,
|
|
||||||
};
|
|
||||||
|
|
||||||
return limitingParameterService.GetStatAsync(request, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int GetFileSize(DateOnly reportDate, int idWell)
|
|
||||||
{
|
|
||||||
const int fileSizeTemplate = 10240;
|
|
||||||
long ticks = 1L * reportDate.Year * reportDate.Month * reportDate.Day * idWell;
|
|
||||||
int remainder = (int)(ticks % (fileSizeTemplate / 10));
|
|
||||||
return fileSizeTemplate + remainder;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
using AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks;
|
|
||||||
|
|
||||||
public class HeadExcelBlockWriter : IExcelBlockWriter
|
|
||||||
{
|
|
||||||
private static readonly (int, int) customerCell = (2, 2);
|
|
||||||
private static readonly (int, int) depositCell = (4, 2);
|
|
||||||
private static readonly (int, int) clusterCell = (5, 2);
|
|
||||||
private static readonly (int, int) wellCell = (6, 2);
|
|
||||||
|
|
||||||
private const int dateRow = 9;
|
|
||||||
private const int dateFromColumn = 2;
|
|
||||||
private const int dateFromToColumn = 3;
|
|
||||||
|
|
||||||
private const int depthRow = 10;
|
|
||||||
private const int depthFromColumn = 2;
|
|
||||||
private const int depthToColumn = 3;
|
|
||||||
|
|
||||||
public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report)
|
|
||||||
{
|
|
||||||
sheet.Cell(customerCell.Item1, customerCell.Item2).Value = report.Head.Customer;
|
|
||||||
sheet.Cell(depositCell.Item1, depositCell.Item2).Value = report.Head.Deposit;
|
|
||||||
sheet.Cell(clusterCell.Item1, clusterCell.Item2).Value = report.Head.Cluster;
|
|
||||||
sheet.Cell(wellCell.Item1, wellCell.Item2).Value = report.Head.Well;
|
|
||||||
|
|
||||||
sheet.Cell(dateRow, dateFromColumn).Value = report.ReportDate;
|
|
||||||
sheet.Cell(dateRow, dateFromToColumn).Value = report.ReportDate.AddDays(1);
|
|
||||||
|
|
||||||
sheet.Cell(depthRow, depthFromColumn).Value = report.Head.DepthFrom;
|
|
||||||
sheet.Cell(depthRow, depthToColumn).Value = report.Head.DepthTo;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
using AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks;
|
|
||||||
|
|
||||||
public interface IExcelBlockWriter
|
|
||||||
{
|
|
||||||
void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report);
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks;
|
|
||||||
|
|
||||||
public class LimitingParameterExcelBlockWriter : IExcelBlockWriter
|
|
||||||
{
|
|
||||||
private const int rowHeaderBlock = 20;
|
|
||||||
|
|
||||||
private const int columnNameFeedRegulator = 1;
|
|
||||||
private const int columnDepth = 2;
|
|
||||||
private const int columnTotalHours = 3;
|
|
||||||
private const int columnPercentDepth = 4;
|
|
||||||
|
|
||||||
public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report)
|
|
||||||
{
|
|
||||||
var i = 1;
|
|
||||||
foreach (var limitingParameter in report.LimitingParameters)
|
|
||||||
{
|
|
||||||
var row = sheet.Row( i++ + rowHeaderBlock);
|
|
||||||
row.Cell(columnNameFeedRegulator).Value = limitingParameter.NameFeedRegulator;
|
|
||||||
row.Cell(columnDepth).Value = limitingParameter.Depth;
|
|
||||||
row.Cell(columnTotalHours).Value = limitingParameter.Hours;
|
|
||||||
row.Cell(columnPercentDepth).Value = limitingParameter.PercentDepth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks;
|
|
||||||
|
|
||||||
public class SubsystemExcelBlockWriter : IExcelBlockWriter
|
|
||||||
{
|
|
||||||
private const int rowHeaderBlock = 13;
|
|
||||||
|
|
||||||
private const int columnName = 1;
|
|
||||||
private const int columnKUsage = 2;
|
|
||||||
private const int columnDepth = 3;
|
|
||||||
private const int columnUsedTimeHours = 4;
|
|
||||||
|
|
||||||
public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report)
|
|
||||||
{
|
|
||||||
var i = 1;
|
|
||||||
foreach( var subsystem in report.Subsystems )
|
|
||||||
{
|
|
||||||
var row = sheet.Row(i++ + rowHeaderBlock);
|
|
||||||
row.Cell(columnName).Value = subsystem.Name;
|
|
||||||
row.Cell(columnKUsage).Value = subsystem.KUsage;
|
|
||||||
row.Cell(columnDepth).Value = subsystem.Depth;
|
|
||||||
row.Cell(columnUsedTimeHours).Value = subsystem.UsedTimeHours;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.AutoGeneratedDailyReports.AutogeneratedDailyReportBlocks;
|
|
||||||
|
|
||||||
public class TimeBalanceExcelBlockWriter : IExcelBlockWriter
|
|
||||||
{
|
|
||||||
private const int rowHeaderBlock = 27;
|
|
||||||
|
|
||||||
private const int columnName = 1;
|
|
||||||
private const int columnDurationHours = 2;
|
|
||||||
|
|
||||||
public void Write(IXLWorksheet sheet, AutoGeneratedDailyReportDto report)
|
|
||||||
{
|
|
||||||
var i = 1;
|
|
||||||
foreach(var timeBalance in report.TimeBalance)
|
|
||||||
{
|
|
||||||
var row = sheet.Row(i++ + rowHeaderBlock);
|
|
||||||
row.Cell(columnName).Value = timeBalance.Name;
|
|
||||||
row.Cell(columnDurationHours).Value = timeBalance.DurationHours;
|
|
||||||
AddBorderToCell(row.Cell(columnName));
|
|
||||||
AddBorderToCell(row.Cell(columnDurationHours));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void AddBorderToCell(IXLCell cell)
|
|
||||||
{
|
|
||||||
cell.Style.Border.TopBorder = XLBorderStyleValues.Thin;
|
|
||||||
cell.Style.Border.BottomBorder = XLBorderStyleValues.Thin;
|
|
||||||
cell.Style.Border.LeftBorder = XLBorderStyleValues.Thin;
|
|
||||||
cell.Style.Border.RightBorder = XLBorderStyleValues.Thin;
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
@ -1,13 +0,0 @@
|
|||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DailyReport
|
|
||||||
{
|
|
||||||
|
|
||||||
abstract class BlockAbstract
|
|
||||||
{
|
|
||||||
public abstract CellAddress AddressBlockBegin { get; }
|
|
||||||
public abstract CellAddress AddressBlockEnd { get; }
|
|
||||||
public abstract void Draw(IXLWorksheet sheet);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,174 +0,0 @@
|
|||||||
using ClosedXML.Excel;
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DailyReport
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class CellAddress: IXLAddress
|
|
||||||
{
|
|
||||||
const int excelLettersCount = 'Z' - 'A' + 1;
|
|
||||||
public int RowNumber { get; set; }
|
|
||||||
public int ColumnNumber { get; set; }
|
|
||||||
|
|
||||||
public string ColumnLetter
|
|
||||||
{
|
|
||||||
get { return CalcColumnLetter(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool FixedColumn { get; set; }
|
|
||||||
|
|
||||||
public bool FixedRow { get; set; }
|
|
||||||
|
|
||||||
public string UniqueId => ToString(XLReferenceStyle.A1, true);
|
|
||||||
|
|
||||||
public IXLWorksheet? Worksheet { get; set; }
|
|
||||||
|
|
||||||
public CellAddress(IXLWorksheet? worksheet, int row, int colunm)
|
|
||||||
{
|
|
||||||
Worksheet = worksheet;
|
|
||||||
RowNumber = row;
|
|
||||||
ColumnNumber = colunm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CellAddress operator + (CellAddress a, CellAddress b)
|
|
||||||
=> new CellAddress(a.Worksheet, a.RowNumber + b.RowNumber, a.ColumnNumber + b.ColumnNumber);
|
|
||||||
public static CellAddress operator +(CellAddress a, (int row, int column) b)
|
|
||||||
=> new CellAddress(a.Worksheet, a.RowNumber + b.row, a.ColumnNumber + b.column);
|
|
||||||
public static CellAddress operator - (CellAddress a, CellAddress b)
|
|
||||||
=> new CellAddress(a.Worksheet, a.RowNumber - b.RowNumber, a.ColumnNumber - b.ColumnNumber);
|
|
||||||
public static bool operator == (CellAddress a, CellAddress b)
|
|
||||||
=> a.RowNumber == b.RowNumber && a.ColumnNumber == b.ColumnNumber;
|
|
||||||
public static bool operator !=(CellAddress a, CellAddress b)
|
|
||||||
=> !(a == b);
|
|
||||||
|
|
||||||
private string CalcColumnLetter()
|
|
||||||
{
|
|
||||||
string letter = "";
|
|
||||||
var columnNumber = ColumnNumber;
|
|
||||||
while (columnNumber > 0)
|
|
||||||
{
|
|
||||||
int modulo = (columnNumber - 1) % excelLettersCount;
|
|
||||||
letter = Convert.ToChar('A' + modulo) + letter;
|
|
||||||
columnNumber = (columnNumber - modulo) / excelLettersCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return letter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CellAddress Copy()
|
|
||||||
=> new CellAddress(Worksheet, RowNumber, ColumnNumber)
|
|
||||||
{
|
|
||||||
FixedColumn = this.FixedColumn,
|
|
||||||
FixedRow = this.FixedRow,
|
|
||||||
};
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
=> ToString(XLReferenceStyle.A1);
|
|
||||||
|
|
||||||
public string ToString(XLReferenceStyle referenceStyle)
|
|
||||||
=> ToString(referenceStyle, false);
|
|
||||||
|
|
||||||
public string ToString(XLReferenceStyle referenceStyle, bool includeSheet)
|
|
||||||
{
|
|
||||||
if (referenceStyle == XLReferenceStyle.R1C1)
|
|
||||||
throw new NotImplementedException("R1C1 - style doesn't implemented");
|
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
if (includeSheet && Worksheet is not null)
|
|
||||||
sb.Append('$')
|
|
||||||
.Append(Worksheet.Name)
|
|
||||||
.Append('.');
|
|
||||||
|
|
||||||
if (FixedColumn)
|
|
||||||
sb.Append('$');
|
|
||||||
|
|
||||||
sb.Append(ColumnLetter);
|
|
||||||
|
|
||||||
if (FixedRow)
|
|
||||||
sb.Append('$');
|
|
||||||
|
|
||||||
sb.Append(RowNumber);
|
|
||||||
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ToStringFixed()
|
|
||||||
=> ToStringFixed(XLReferenceStyle.A1);
|
|
||||||
|
|
||||||
public string ToStringFixed(XLReferenceStyle referenceStyle)
|
|
||||||
=> ToStringFixed(referenceStyle, false);
|
|
||||||
|
|
||||||
public string ToStringFixed(XLReferenceStyle referenceStyle, bool includeSheet)
|
|
||||||
{
|
|
||||||
if (referenceStyle == XLReferenceStyle.R1C1)
|
|
||||||
throw new NotImplementedException("R1C1 - style doesn't implemented");
|
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
if (includeSheet && Worksheet is not null)
|
|
||||||
sb.Append('$')
|
|
||||||
.Append(Worksheet.Name)
|
|
||||||
.Append('.');
|
|
||||||
|
|
||||||
sb.Append('$');
|
|
||||||
sb.Append(ColumnLetter);
|
|
||||||
sb.Append('$');
|
|
||||||
sb.Append(RowNumber);
|
|
||||||
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ToStringRelative()
|
|
||||||
=> ToStringRelative(false);
|
|
||||||
|
|
||||||
public string ToStringRelative(bool includeSheet)
|
|
||||||
{
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
if (includeSheet && Worksheet is not null)
|
|
||||||
sb.Append('$')
|
|
||||||
.Append(Worksheet.Name)
|
|
||||||
.Append('.');
|
|
||||||
|
|
||||||
sb.Append(ColumnLetter);
|
|
||||||
sb.Append(RowNumber);
|
|
||||||
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Equals(IXLAddress? x, IXLAddress? y)
|
|
||||||
=> x?.ColumnNumber == y?.ColumnNumber &&
|
|
||||||
x?.RowNumber == y?.RowNumber &&
|
|
||||||
x?.FixedColumn == y?.FixedColumn &&
|
|
||||||
x?.FixedRow == y?.FixedRow &&
|
|
||||||
x?.Worksheet == y?.Worksheet;
|
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
=> base.GetHashCode();
|
|
||||||
|
|
||||||
public int GetHashCode([DisallowNull] IXLAddress obj)
|
|
||||||
=> obj.GetHashCode();
|
|
||||||
|
|
||||||
public bool Equals(IXLAddress? other)
|
|
||||||
=> Equals(this, other);
|
|
||||||
|
|
||||||
public override bool Equals(object? obj)
|
|
||||||
{
|
|
||||||
if (ReferenceEquals(this, obj))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj is null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj is CellAddress address)
|
|
||||||
return this == address;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,118 +0,0 @@
|
|||||||
using AsbCloudApp.Data.DailyReport;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
|
|
||||||
{
|
|
||||||
|
|
||||||
class BhaBlock : BlockAbstract
|
|
||||||
{
|
|
||||||
private readonly BhaDto blockDto;
|
|
||||||
|
|
||||||
public CellAddress AddressBhaDescription { get; }
|
|
||||||
public CellAddress AddressOperationTitle { get; }
|
|
||||||
public CellAddress AddressDurationTitle { get; }
|
|
||||||
public CellAddress AddressTotalTitle { get; }
|
|
||||||
public CellAddress[] AddressOperationData { get; }
|
|
||||||
public CellAddress[] AddressDurationDataStart { get; }
|
|
||||||
public CellAddress[] AddressDurationDataFinish { get; }
|
|
||||||
public CellAddress[] AddressTotaData { get; }
|
|
||||||
public override CellAddress AddressBlockBegin { get; }
|
|
||||||
public override CellAddress AddressBlockEnd { get; }
|
|
||||||
|
|
||||||
public BhaBlock(CellAddress addressBlockBegin, BhaDto blockDto)
|
|
||||||
{
|
|
||||||
this.blockDto = blockDto;
|
|
||||||
AddressBlockBegin = addressBlockBegin.Copy();
|
|
||||||
AddressBhaDescription = addressBlockBegin + (1,0);
|
|
||||||
AddressOperationTitle = addressBlockBegin + (3, 0);
|
|
||||||
AddressDurationTitle = addressBlockBegin + (3, 5);
|
|
||||||
AddressTotalTitle = addressBlockBegin + (3, 7);
|
|
||||||
AddressOperationData = new CellAddress[5];
|
|
||||||
AddressOperationData[0] = addressBlockBegin + (4, 0);
|
|
||||||
AddressOperationData[1] = addressBlockBegin + (5, 0);
|
|
||||||
AddressOperationData[2] = addressBlockBegin + (6, 0);
|
|
||||||
AddressOperationData[3] = addressBlockBegin + (7, 0);
|
|
||||||
AddressOperationData[4] = addressBlockBegin + (8, 0);
|
|
||||||
AddressDurationDataStart = new CellAddress[5];
|
|
||||||
AddressDurationDataStart[0] = addressBlockBegin + (4, 5);
|
|
||||||
AddressDurationDataStart[1] = addressBlockBegin + (5, 5);
|
|
||||||
AddressDurationDataStart[2] = addressBlockBegin + (6, 5);
|
|
||||||
AddressDurationDataStart[3] = addressBlockBegin + (7, 5);
|
|
||||||
AddressDurationDataStart[4] = addressBlockBegin + (8, 5);
|
|
||||||
AddressDurationDataFinish = new CellAddress[5];
|
|
||||||
AddressDurationDataFinish[0] = addressBlockBegin + (4, 6);
|
|
||||||
AddressDurationDataFinish[1] = addressBlockBegin + (5, 6);
|
|
||||||
AddressDurationDataFinish[2] = addressBlockBegin + (6, 6);
|
|
||||||
AddressDurationDataFinish[3] = addressBlockBegin + (7, 6);
|
|
||||||
AddressDurationDataFinish[4] = addressBlockBegin + (8, 6);
|
|
||||||
AddressTotaData = new CellAddress[5];
|
|
||||||
AddressTotaData[0] = addressBlockBegin + (4, 7);
|
|
||||||
AddressTotaData[1] = addressBlockBegin + (5, 7);
|
|
||||||
AddressTotaData[2] = addressBlockBegin + (6, 7);
|
|
||||||
AddressTotaData[3] = addressBlockBegin + (7, 7);
|
|
||||||
AddressTotaData[4] = addressBlockBegin + (8, 7);
|
|
||||||
AddressBlockEnd = AddressTotaData[4];
|
|
||||||
}
|
|
||||||
|
|
||||||
private string FormulaBhaBlock(CellAddress beginTime, CellAddress endTime)
|
|
||||||
{
|
|
||||||
return string.Format("IF({0}>0,({0}-{1})*24, \"\")", endTime.ToString(), beginTime.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Draw(IXLWorksheet sheet)
|
|
||||||
{
|
|
||||||
sheet._Range(AddressBhaDescription, AddressBhaDescription + (0, 7))
|
|
||||||
._SetValue($"{blockDto.BHADescription}");
|
|
||||||
sheet._Range(AddressOperationTitle, AddressOperationTitle + (0, 4))
|
|
||||||
._SetValue("Выполняемые операции в отчетный период, комментарии:");
|
|
||||||
sheet._Range(AddressDurationTitle, AddressDurationTitle + (0, 1))
|
|
||||||
._SetValue("Продолжительность, ч. ");
|
|
||||||
sheet.Cell(AddressTotalTitle)
|
|
||||||
._SetValue("Итого");
|
|
||||||
sheet._Range(AddressOperationData[0], AddressOperationData[0] + (0, 4))
|
|
||||||
._SetValue("Бурение с наращиваниями в инт. 2195-2763м.");
|
|
||||||
sheet.Cell(AddressDurationDataStart[0])
|
|
||||||
._SetValue($"{blockDto.ExtensionDrillingOneBegin}");
|
|
||||||
sheet.Cell(AddressDurationDataFinish[0])
|
|
||||||
._SetValue($"{blockDto.ExtensionDrillingOneFinish}");
|
|
||||||
sheet.Cell(AddressTotaData[0])
|
|
||||||
.SetFormulaA1($"{FormulaBhaBlock(AddressDurationDataStart[0], AddressDurationDataFinish[0])}").Style.SetAllBorders();
|
|
||||||
sheet._Range(AddressOperationData[1], AddressOperationData[1] + (0, 4))
|
|
||||||
._SetValue("Промывка.");
|
|
||||||
sheet.Cell(AddressDurationDataStart[1])
|
|
||||||
._SetValue($"{blockDto.SluiceBegin}");
|
|
||||||
sheet.Cell(AddressDurationDataFinish[1])
|
|
||||||
._SetValue($"{blockDto.SluiceFinish}");
|
|
||||||
sheet.Cell(AddressTotaData[1])
|
|
||||||
.SetFormulaA1($"{FormulaBhaBlock(AddressDurationDataStart[1], AddressDurationDataFinish[1])}").Style.SetAllBorders();
|
|
||||||
sheet._Range(AddressOperationData[2], AddressOperationData[2] + (0, 4))
|
|
||||||
._SetValue("Подъем КНБК в инт. 2763-2442м.");
|
|
||||||
sheet.Cell(AddressDurationDataStart[2])
|
|
||||||
._SetValue($"{blockDto.ClimbBegin}");
|
|
||||||
sheet.Cell(AddressDurationDataFinish[2])
|
|
||||||
._SetValue($"{blockDto.ClimbFinish}");
|
|
||||||
sheet.Cell(AddressTotaData[2])
|
|
||||||
.SetFormulaA1($"{FormulaBhaBlock(AddressDurationDataStart[2], AddressDurationDataFinish[2])}").Style.SetAllBorders();
|
|
||||||
sheet._Range(AddressOperationData[3], AddressOperationData[3] + (0, 4))
|
|
||||||
._SetValue("Спуск КНБК в инт. 2442-2763м.");
|
|
||||||
sheet.Cell(AddressDurationDataStart[3])
|
|
||||||
._SetValue($"{blockDto.DescentBegin}");
|
|
||||||
sheet.Cell(AddressDurationDataFinish[3])
|
|
||||||
._SetValue($"{blockDto.DescentFinish}");
|
|
||||||
sheet.Cell(AddressTotaData[3])
|
|
||||||
.SetFormulaA1($"{FormulaBhaBlock(AddressDurationDataStart[3], AddressDurationDataFinish[3])}").Style.SetAllBorders();
|
|
||||||
sheet._Range(AddressOperationData[4], AddressOperationData[4] + (0, 4))
|
|
||||||
._SetValue("Бурение с наращиваниями в инт. 2763-2850м.");
|
|
||||||
sheet.Cell(AddressDurationDataStart[4])
|
|
||||||
._SetValue($"{blockDto.ExtensionDrillingTwoBegin}");
|
|
||||||
sheet.Cell(AddressDurationDataFinish[4])
|
|
||||||
._SetValue($"{blockDto.ExtensionDrillingTwoFinish}");
|
|
||||||
sheet.Cell(AddressTotaData[4])
|
|
||||||
.SetFormulaA1($"{FormulaBhaBlock(AddressDurationDataStart[4], AddressDurationDataFinish[4])}").Style.SetAllBorders();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,119 +0,0 @@
|
|||||||
using AsbCloudApp.Data.DailyReport;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class DimensionlessBlock : BlockAbstract
|
|
||||||
{
|
|
||||||
private readonly NoDrillingDto blockDto;
|
|
||||||
|
|
||||||
public SaubBlock SaubBlock { get; set; } = null!;
|
|
||||||
|
|
||||||
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; } = null!;
|
|
||||||
public override CellAddress AddressBlockBegin { get; }
|
|
||||||
public override CellAddress AddressBlockEnd { get; }
|
|
||||||
public DimensionlessBlock(CellAddress addressBlockBegin, NoDrillingDto 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.RowNumber, AddressDimensionTitle.ColumnNumber,
|
|
||||||
AddressDimensionTitle.RowNumber, AddressDimensionTitle.ColumnNumber + 1)
|
|
||||||
.Merge()
|
|
||||||
.Style.Alignment.SetWrapText(true);
|
|
||||||
sheet.Cell(AddressDimensionTitle.RowNumber, AddressDimensionTitle.ColumnNumber)._ValueNoBorder("БЕЗМЕТРАЖНЫЕ РАБОТЫ",true);
|
|
||||||
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.ActualTimeBarrelPreparation}");
|
|
||||||
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("Наращивание");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,181 +0,0 @@
|
|||||||
using AsbCloudApp.Data.DailyReport;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
|
|
||||||
{
|
|
||||||
|
|
||||||
class HeadBlock : BlockAbstract
|
|
||||||
{
|
|
||||||
private readonly HeadDto blockDto;
|
|
||||||
|
|
||||||
public CellAddress AddressTitle { get; }
|
|
||||||
public CellAddress AddressCustomer { get; }
|
|
||||||
public CellAddress AddressDriller { get; }
|
|
||||||
public CellAddress AddressPeriod { get; }
|
|
||||||
public CellAddress AddressSlaughter { get; }
|
|
||||||
public CellAddress AddressTrajectoryTableTitle { get; }
|
|
||||||
public CellAddress AddressDrillerOneTitle { get; }
|
|
||||||
public CellAddress AddressDrillerOne { get; }
|
|
||||||
public CellAddress AddressDrillerTwoTitle { get; }
|
|
||||||
public CellAddress AddressDrillerTwo { get; }
|
|
||||||
public CellAddress AddressWorkSaubTitle { get; }
|
|
||||||
public CellAddress AddressWatchTitle { get; }
|
|
||||||
public CellAddress AddressMetreTitle { get; }
|
|
||||||
public CellAddress[] AddressWorkSaubData { get; }
|
|
||||||
public CellAddress[] AddressWatchData { get; }
|
|
||||||
public CellAddress[] AddressMetreData { get; }
|
|
||||||
public CellAddress[] AddressPeriodTableHeadArray { get; }
|
|
||||||
public CellAddress[] AddressPeriodTableDataArray { get; }
|
|
||||||
public CellAddress[] AddressTrajectoryTableHeadArray { get; }
|
|
||||||
public CellAddress[] AddressTrajectoryTableDataArray { get; }
|
|
||||||
public override CellAddress AddressBlockBegin { get; }
|
|
||||||
public override CellAddress AddressBlockEnd { get; }
|
|
||||||
public HeadBlock(CellAddress addressBlockBegin, HeadDto blockDto)
|
|
||||||
{
|
|
||||||
AddressBlockBegin = addressBlockBegin.Copy();
|
|
||||||
this.blockDto = blockDto;
|
|
||||||
AddressTitle = addressBlockBegin + (0, 0);
|
|
||||||
AddressCustomer = addressBlockBegin + (1, 0);
|
|
||||||
AddressDriller = addressBlockBegin + (2, 0);
|
|
||||||
AddressPeriod = addressBlockBegin + (4, 0);
|
|
||||||
AddressSlaughter = addressBlockBegin + (4, 4);
|
|
||||||
AddressPeriodTableHeadArray = new CellAddress[4];
|
|
||||||
AddressPeriodTableHeadArray[0]= addressBlockBegin + (5, 0);
|
|
||||||
AddressPeriodTableHeadArray[1] = addressBlockBegin + (5, 2);
|
|
||||||
AddressPeriodTableHeadArray[2] = addressBlockBegin + (5, 4);
|
|
||||||
AddressPeriodTableHeadArray[3] = addressBlockBegin + (5, 6);
|
|
||||||
AddressPeriodTableDataArray = new CellAddress[4];
|
|
||||||
AddressPeriodTableDataArray[0] = addressBlockBegin + (6, 0);
|
|
||||||
AddressPeriodTableDataArray[1] = addressBlockBegin + (6, 2);
|
|
||||||
AddressPeriodTableDataArray[2] = addressBlockBegin + (6, 4);
|
|
||||||
AddressPeriodTableDataArray[3] = addressBlockBegin + (6, 6);
|
|
||||||
AddressTrajectoryTableTitle = addressBlockBegin + (8,0);
|
|
||||||
AddressTrajectoryTableHeadArray = new CellAddress[4];
|
|
||||||
AddressTrajectoryTableHeadArray[0] = addressBlockBegin + (9, 0);
|
|
||||||
AddressTrajectoryTableHeadArray[1] = addressBlockBegin + (9, 2);
|
|
||||||
AddressTrajectoryTableHeadArray[2] = addressBlockBegin + (9, 4);
|
|
||||||
AddressTrajectoryTableHeadArray[3] = addressBlockBegin + (9, 6);
|
|
||||||
AddressTrajectoryTableDataArray = new CellAddress[4];
|
|
||||||
AddressTrajectoryTableDataArray[0] = addressBlockBegin + (10, 0);
|
|
||||||
AddressTrajectoryTableDataArray[1] = addressBlockBegin + (10, 2);
|
|
||||||
AddressTrajectoryTableDataArray[2] = addressBlockBegin + (10, 4);
|
|
||||||
AddressTrajectoryTableDataArray[3] = addressBlockBegin + (10, 6);
|
|
||||||
AddressDrillerOneTitle = addressBlockBegin + (12, 0);
|
|
||||||
AddressDrillerOne = addressBlockBegin + (12, 2);
|
|
||||||
AddressDrillerTwoTitle = addressBlockBegin + (13, 0);
|
|
||||||
AddressDrillerTwo = addressBlockBegin + (13, 2);
|
|
||||||
AddressWorkSaubTitle = addressBlockBegin + (15, 0);
|
|
||||||
AddressWatchTitle = addressBlockBegin + (15, 3);
|
|
||||||
AddressMetreTitle = addressBlockBegin + (15, 4);
|
|
||||||
AddressWorkSaubData = new CellAddress[4];
|
|
||||||
AddressWorkSaubData[0] = addressBlockBegin + (16, 0);
|
|
||||||
AddressWorkSaubData[1] = addressBlockBegin + (17, 0);
|
|
||||||
AddressWorkSaubData[2] = addressBlockBegin + (18, 0);
|
|
||||||
AddressWorkSaubData[3] = addressBlockBegin + (19, 0);
|
|
||||||
AddressWatchData = new CellAddress[4];
|
|
||||||
AddressWatchData[0] = addressBlockBegin + (16, 3);
|
|
||||||
AddressWatchData[1] = addressBlockBegin + (17, 3);
|
|
||||||
AddressWatchData[2] = addressBlockBegin + (18, 3);
|
|
||||||
AddressWatchData[3] = addressBlockBegin + (19, 3);
|
|
||||||
AddressMetreData = new CellAddress[4];
|
|
||||||
AddressMetreData[0] = addressBlockBegin + (16, 4);
|
|
||||||
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();
|
|
||||||
|
|
||||||
sheet._Range(AddressCustomer, AddressCustomer + (0, 7))
|
|
||||||
._SetValue($"Заказчик: {blockDto.Customer}")
|
|
||||||
.Style.SetH1();
|
|
||||||
sheet._Range(AddressDriller, AddressDriller + (0, 7))
|
|
||||||
._SetValue($"Подрядчик: {blockDto.Contractor}")
|
|
||||||
.Style.SetH1();
|
|
||||||
sheet._Range(AddressPeriod, AddressPeriod + (0, 3))
|
|
||||||
._SetValue("Отчетный период");
|
|
||||||
sheet._Range(AddressSlaughter, AddressSlaughter + (0, 3))
|
|
||||||
._SetValue("Забой за отчетный период, м");
|
|
||||||
sheet._Range(AddressPeriodTableHeadArray[0], AddressPeriodTableHeadArray[0] + (0, 1))
|
|
||||||
._SetValue("От (дата, время)");
|
|
||||||
sheet._Range(AddressPeriodTableHeadArray[1], AddressPeriodTableHeadArray[1] + (0, 1))
|
|
||||||
._SetValue("До (дата, время)");
|
|
||||||
sheet._Range(AddressPeriodTableHeadArray[2], AddressPeriodTableHeadArray[2] + (0, 1))
|
|
||||||
._SetValue("От");
|
|
||||||
sheet._Range(AddressPeriodTableHeadArray[3], AddressPeriodTableHeadArray[3] + (0, 1))
|
|
||||||
._SetValue("До");
|
|
||||||
sheet._Range(AddressPeriodTableDataArray[0], AddressPeriodTableDataArray[0] + (0, 1))
|
|
||||||
._SetValue($"{blockDto.ReportDate}");
|
|
||||||
sheet._Range(AddressPeriodTableDataArray[1], AddressPeriodTableDataArray[1] + (0, 1))._SetValue("");
|
|
||||||
sheet.Cell(AddressPeriodTableDataArray[1])
|
|
||||||
.SetFormulaA1(string.Format("{0}-1", AddressPeriodTableDataArray[0].ToString()))
|
|
||||||
.Style.DateFormat.Format= "DD.MM.YYYY HH:MM:SS";
|
|
||||||
sheet._Range(AddressPeriodTableDataArray[2], AddressPeriodTableDataArray[2] + (0, 1))
|
|
||||||
._SetValue($"{blockDto.WellDepthIntervalStartDate}");
|
|
||||||
sheet._Range(AddressPeriodTableDataArray[3], AddressPeriodTableDataArray[3] + (0, 1))
|
|
||||||
._SetValue($"{blockDto.WellDepthIntervalFinishDate}");
|
|
||||||
sheet._Range(AddressTrajectoryTableTitle, AddressTrajectoryTableTitle + (0, 7))
|
|
||||||
._SetValue("Данные по траектории скважины на конец суток");
|
|
||||||
sheet._Range(AddressTrajectoryTableHeadArray[0], AddressTrajectoryTableHeadArray[0] + (0, 1))
|
|
||||||
._SetValue("Глубина по стволу");
|
|
||||||
sheet._Range(AddressTrajectoryTableHeadArray[1], AddressTrajectoryTableHeadArray[1] + (0, 1))
|
|
||||||
._SetValue("Глубина по вертикали");
|
|
||||||
sheet._Range(AddressTrajectoryTableHeadArray[2], AddressTrajectoryTableHeadArray[2] + (0, 1))
|
|
||||||
._SetValue("Зенитный угол");
|
|
||||||
sheet._Range(AddressTrajectoryTableHeadArray[3], AddressTrajectoryTableHeadArray[3] + (0, 1))
|
|
||||||
._SetValue("Азимут");
|
|
||||||
sheet._Range(AddressTrajectoryTableDataArray[0], AddressTrajectoryTableDataArray[0] + (0, 1))
|
|
||||||
._SetValue($"{blockDto.BottomholeDepth}");
|
|
||||||
sheet._Range(AddressTrajectoryTableDataArray[1], AddressTrajectoryTableDataArray[1] + (0, 1))
|
|
||||||
._SetValue($"{blockDto.VerticalDepth}");
|
|
||||||
sheet._Range(AddressTrajectoryTableDataArray[2], AddressTrajectoryTableDataArray[2] + (0, 1))
|
|
||||||
._SetValue($"{blockDto.ZenithAngle}");
|
|
||||||
sheet._Range(AddressTrajectoryTableDataArray[3], AddressTrajectoryTableDataArray[3] + (0, 1))
|
|
||||||
._SetValue($"{blockDto.AzimuthAngle}");
|
|
||||||
sheet._Range(AddressDrillerOneTitle, AddressDrillerOneTitle + (0, 1))
|
|
||||||
._SetValue("Бурильщик 1 смена");
|
|
||||||
sheet._Range(AddressDrillerOne, AddressDrillerOne + (0, 1))
|
|
||||||
._SetValue($"{blockDto.FirstDriller}");
|
|
||||||
sheet._Range(AddressDrillerTwoTitle, AddressDrillerTwoTitle + (0, 1))
|
|
||||||
._SetValue("Бурильщик 2 смена");
|
|
||||||
sheet._Range(AddressDrillerTwo, AddressDrillerTwo + (0, 1))
|
|
||||||
._SetValue($"{blockDto.SecondDriller}");
|
|
||||||
sheet._Range(AddressWorkSaubTitle, AddressWorkSaubTitle + (0, 2))
|
|
||||||
._SetValue("Работа модулей САУБ:");
|
|
||||||
sheet.Cell(AddressWatchTitle)
|
|
||||||
._SetValue("Часов:");
|
|
||||||
sheet.Cell(AddressMetreTitle)
|
|
||||||
._SetValue("Метров:");
|
|
||||||
sheet._Range(AddressWorkSaubData[0], AddressWorkSaubData[0] + (0, 2))
|
|
||||||
._SetValue("АПД (автоматическая подача долота), ч/м:");
|
|
||||||
sheet.Cell(AddressWatchData[0])
|
|
||||||
._SetValue($"{blockDto.WorkTimeSAUB}");
|
|
||||||
sheet.Cell(AddressMetreData[0])
|
|
||||||
._SetValue($"{blockDto.PenetrationSAUB}");
|
|
||||||
sheet._Range(AddressWorkSaubData[1], AddressWorkSaubData[1] + (0, 2))
|
|
||||||
._SetValue("Спин Мастер (осцилляция),ч/м:");
|
|
||||||
sheet.Cell(AddressWatchData[1])
|
|
||||||
._SetValue($"{blockDto.WorkTimeSpinMaster}");
|
|
||||||
sheet.Cell(AddressMetreData[1])
|
|
||||||
._SetValue($"{blockDto.PenetrationSpinMaster}");
|
|
||||||
sheet._Range(AddressWorkSaubData[2], AddressWorkSaubData[2] + (0, 2))
|
|
||||||
._SetValue("Торк Мастер (демпфирование), ч/:");
|
|
||||||
sheet.Cell(AddressWatchData[2])
|
|
||||||
._SetValue($"{blockDto.WorkTimeTorkMaster}");
|
|
||||||
sheet.Cell(AddressMetreData[2])
|
|
||||||
._SetValue($"{blockDto.PenetrationTorkMaster}");
|
|
||||||
sheet._Range(AddressWorkSaubData[3], AddressWorkSaubData[3] + (0, 2))
|
|
||||||
._SetValue("МСЕ, колличество запусков, раз:");
|
|
||||||
sheet._Range(AddressWatchData[3], AddressWatchData[3] + (0, 1))
|
|
||||||
._SetValue($"{blockDto.CountLaunchesMSE}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,230 +0,0 @@
|
|||||||
using AsbCloudApp.Data.DailyReport;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class SaubBlock : BlockAbstract
|
|
||||||
{
|
|
||||||
private readonly SaubDto blockDto;
|
|
||||||
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 AddressExtensionsCount { 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 AddressExtensionsCountValue { get; }
|
|
||||||
public CellAddress DeviationFromTVDValue { get; }
|
|
||||||
public override CellAddress AddressBlockBegin { get; }
|
|
||||||
public override CellAddress AddressBlockEnd { get; }
|
|
||||||
|
|
||||||
public SaubBlock(CellAddress addressBlockBegin, SaubDto blockDto, HeadBlock headBlock)
|
|
||||||
{
|
|
||||||
this.headBlock = headBlock;
|
|
||||||
AddressBlockBegin = addressBlockBegin.Copy();
|
|
||||||
this.blockDto = blockDto;
|
|
||||||
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);
|
|
||||||
AddressExtensionsCount = addressBlockBegin + (23, 0);
|
|
||||||
AddressExtensionsCountValue = addressBlockBegin + (23, 4);
|
|
||||||
DeviationFromTVD = addressBlockBegin + (24, 0);
|
|
||||||
DeviationFromTVDValue = addressBlockBegin + (24, 4);
|
|
||||||
DeclinesReasonsROP = addressBlockBegin + (25, 0);
|
|
||||||
AddressBlockEnd = DeclinesReasonsROP + (1,7) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string FormulaMechanicalSpeed(CellAddress cellSinking, CellAddress cellWatch )
|
|
||||||
{
|
|
||||||
return string.Format("=IF({0}>0,{1}/{2},0)", cellWatch.ToString(), cellSinking.ToString(), cellWatch.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private string FormulaSinking(CellAddress sinkingDrilling, CellAddress sinkingSlide, CellAddress slaughterEnd, CellAddress slaughterBegin)
|
|
||||||
{
|
|
||||||
return string.Format("=IF(({0}+{1})<>({2}-{3}),\"ОШИБКА\",({0}+{1}))", sinkingSlide.ToString(), sinkingDrilling.ToString(),
|
|
||||||
slaughterEnd.ToString(), slaughterBegin.ToString());
|
|
||||||
}
|
|
||||||
private string FormulaWatch(CellAddress cellSinkingDrill, CellAddress cellSinkingSlide)
|
|
||||||
{
|
|
||||||
return string.Format("={0}+{1}",
|
|
||||||
cellSinkingDrill.ToString(), cellSinkingSlide.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))._SetValue("");
|
|
||||||
sheet.Cell(AddressDrillingTableData[2])
|
|
||||||
.SetFormulaA1(FormulaMechanicalSpeed(AddressDrillingTableData[0], AddressDrillingTableData[1])).Style.SetAllBorders();
|
|
||||||
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))._SetValue("");
|
|
||||||
sheet.Cell(AddressSlideTableData[2])
|
|
||||||
.SetFormulaA1(FormulaMechanicalSpeed(AddressSlideTableData[0], AddressSlideTableData[1])).Style.SetAllBorders();
|
|
||||||
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("Мех. скорость");
|
|
||||||
|
|
||||||
sheet._Range(AddressTotalTableData[0], AddressTotalTableData[0] + (0, 1))._SetValue("");
|
|
||||||
sheet.Cell(AddressTotalTableData[0])
|
|
||||||
.SetFormulaA1(FormulaSinking(AddressDrillingTableData[0], AddressSlideTableData[0], headBlock.AddressPeriodTableDataArray[3], headBlock.AddressPeriodTableDataArray[2]));
|
|
||||||
sheet._Range(AddressTotalTableData[1], AddressTotalTableData[1] + (0, 1))._SetValue("");
|
|
||||||
sheet.Cell(AddressTotalTableData[1])
|
|
||||||
.SetFormulaA1(FormulaWatch(AddressDrillingTableData[1], AddressSlideTableData[1]));
|
|
||||||
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(AddressExtensionsCount, AddressExtensionsCount + (0, 3))
|
|
||||||
._SetValue("Кол- во наращиваний");
|
|
||||||
sheet._Range(AddressExtensionsCountValue, AddressExtensionsCountValue + (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}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
|||||||
using AsbCloudApp.Data.DailyReport;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class SignBlock : BlockAbstract
|
|
||||||
{
|
|
||||||
private readonly SignDto blockDto;
|
|
||||||
public CellAddress AddressDrillMasterHead { get; }
|
|
||||||
public CellAddress AddressDrillMaster { get; }
|
|
||||||
public CellAddress AddressSupervisorHead { get; }
|
|
||||||
public CellAddress AddressSupervisor { get; }
|
|
||||||
public override CellAddress AddressBlockBegin { get; }
|
|
||||||
public override CellAddress AddressBlockEnd { get; }
|
|
||||||
|
|
||||||
public SignBlock(CellAddress addressBlockBegin, SignDto blockDto)
|
|
||||||
{
|
|
||||||
AddressBlockBegin = addressBlockBegin.Copy();
|
|
||||||
this.blockDto = blockDto;
|
|
||||||
AddressDrillMasterHead = addressBlockBegin + (3, 0);
|
|
||||||
AddressDrillMaster = AddressDrillMasterHead + (0, 5);
|
|
||||||
AddressSupervisorHead = AddressDrillMasterHead + (2, 0);
|
|
||||||
AddressSupervisor = AddressSupervisorHead + (0, 5);
|
|
||||||
AddressBlockEnd = AddressSupervisor + (0,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Draw(IXLWorksheet sheet)
|
|
||||||
{
|
|
||||||
sheet.Range(AddressDrillMasterHead.RowNumber, AddressDrillMasterHead.ColumnNumber
|
|
||||||
, AddressDrillMasterHead.RowNumber, AddressDrillMasterHead.ColumnNumber + 2)
|
|
||||||
.Merge()
|
|
||||||
.SetValue("Мастер буровой ");
|
|
||||||
sheet.Range(AddressDrillMaster.RowNumber, AddressDrillMaster.ColumnNumber
|
|
||||||
, AddressDrillMaster.RowNumber, AddressDrillMaster.ColumnNumber + 2)
|
|
||||||
.Merge()
|
|
||||||
.SetValue($"{blockDto.DrillingMaster}");
|
|
||||||
sheet.Range(AddressSupervisorHead.RowNumber, AddressSupervisorHead.ColumnNumber
|
|
||||||
, AddressSupervisorHead.RowNumber, AddressSupervisorHead.ColumnNumber + 2)
|
|
||||||
.Merge()
|
|
||||||
.SetValue("Супервайзер ");
|
|
||||||
sheet.Range(AddressSupervisor.RowNumber, AddressSupervisor.ColumnNumber
|
|
||||||
, AddressSupervisor.RowNumber, AddressSupervisor.ColumnNumber + 2)
|
|
||||||
.Merge()
|
|
||||||
.SetValue($"{blockDto.Supervisor}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
|||||||
using AsbCloudApp.Data;
|
|
||||||
using AsbCloudApp.Data.DailyReport;
|
|
||||||
using ClosedXML.Excel;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
|
|
||||||
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Построение баланса времени
|
|
||||||
/// </summary>
|
|
||||||
class TimeBalanceBlock : BlockAbstract
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Начальная ячейка
|
|
||||||
/// </summary>
|
|
||||||
public override CellAddress AddressBlockBegin { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конечная ячейка
|
|
||||||
/// </summary>
|
|
||||||
public override CellAddress AddressBlockEnd { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ячейка с заголовком
|
|
||||||
/// </summary>
|
|
||||||
private CellAddress Title { get { return AddressBlockBegin + (1, 3); } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Статистика по операциям
|
|
||||||
/// </summary>
|
|
||||||
private Dictionary<int, double> OperationsStatistics { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Категории операций
|
|
||||||
/// </summary>
|
|
||||||
private IEnumerable<WellOperationCategoryDto> OperationCategories { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// количество столбцов в таблице
|
|
||||||
/// </summary>
|
|
||||||
private const int countColumns = 3;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// количество категорий операций
|
|
||||||
/// </summary>
|
|
||||||
private int OperationCategoriesCount { get { return OperationCategories.Count(); } }
|
|
||||||
|
|
||||||
|
|
||||||
public TimeBalanceBlock(CellAddress addressBlockBegin, TimeBalanceDto blockDto, IEnumerable<WellOperationCategoryDto> operationCategories)
|
|
||||||
{
|
|
||||||
AddressBlockBegin = addressBlockBegin.Copy();
|
|
||||||
|
|
||||||
OperationsStatistics = blockDto.OperationsStat;
|
|
||||||
OperationCategories = operationCategories;
|
|
||||||
|
|
||||||
var rowsCount = (int)Math.Ceiling( 1d * OperationCategoriesCount / countColumns);
|
|
||||||
var colsCount = (1 + 1) * countColumns;
|
|
||||||
AddressBlockEnd = Title + (rowsCount, colsCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Draw(IXLWorksheet sheet)
|
|
||||||
{
|
|
||||||
sheet.Range(Title.RowNumber, Title.ColumnNumber, Title.RowNumber, Title.ColumnNumber + 1)
|
|
||||||
.Merge()
|
|
||||||
.SetValue("БАЛАНС ВРЕМЕНИ");
|
|
||||||
|
|
||||||
var i = 0;
|
|
||||||
|
|
||||||
foreach (var operationCategory in OperationCategories)
|
|
||||||
{
|
|
||||||
var row = 2 + (int)Math.Floor(1d * i / countColumns);
|
|
||||||
var col = 1 + 2 *(i % countColumns);
|
|
||||||
i++;
|
|
||||||
|
|
||||||
sheet.Cell(AddressBlockBegin + (row, col))
|
|
||||||
._SetValue(operationCategory.Name, true);
|
|
||||||
sheet.Cell(AddressBlockBegin + (row, col + 1))
|
|
||||||
._SetValue(GetValue(operationCategory.Id), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetValue(int categoryId)
|
|
||||||
{
|
|
||||||
if (OperationsStatistics.TryGetValue(categoryId, out double duration))
|
|
||||||
return $"{duration}";
|
|
||||||
return "0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
|||||||
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
|
|
||||||
{
|
|
||||||
private IEnumerable<WellOperationCategoryDto> OperationCategories = null!;
|
|
||||||
|
|
||||||
public Stream MakeReportFromBlocks(DailyReportDto dto, IEnumerable<WellOperationCategoryDto> operationCategories)
|
|
||||||
{
|
|
||||||
OperationCategories = operationCategories;
|
|
||||||
|
|
||||||
using var workbook = new XLWorkbook();
|
|
||||||
FillExampleBlocks(workbook, dto);
|
|
||||||
MemoryStream memoryStream = new MemoryStream();
|
|
||||||
workbook.SaveAs(memoryStream, new SaveOptions { });
|
|
||||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
|
||||||
return memoryStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FillExampleBlocks(XLWorkbook workbook, DailyReportDto dto)
|
|
||||||
{
|
|
||||||
var sheet = workbook.Worksheets.Add(dto.Head.ReportDate.ToString("dd.MM.yyyy"));
|
|
||||||
var addressStart = new CellAddress(sheet, 2, 2);
|
|
||||||
var blockHeader = new HeadBlock(addressStart, dto.Head);
|
|
||||||
addressStart = blockHeader.AddressBlockEnd + (1, 0);
|
|
||||||
addressStart.ColumnNumber = 2;
|
|
||||||
var blockBha = new BhaBlock(addressStart, dto.Bha);
|
|
||||||
addressStart = blockBha.AddressBlockEnd + (1, 0);
|
|
||||||
addressStart.ColumnNumber = 2;
|
|
||||||
var timeBalance = new TimeBalanceBlock(addressStart, dto.TimeBalance, OperationCategories);
|
|
||||||
addressStart = timeBalance.AddressBlockEnd + (1, 0);
|
|
||||||
addressStart.ColumnNumber = 2;
|
|
||||||
var blockDimensionless = new DimensionlessBlock(addressStart, dto.NoDrilling);
|
|
||||||
addressStart = blockDimensionless.AddressBlockEnd + (1, 0);
|
|
||||||
addressStart.ColumnNumber = 2;
|
|
||||||
var blockSaub = new SaubBlock(addressStart, dto.Saub, blockHeader);
|
|
||||||
addressStart = blockSaub.AddressBlockEnd + (1, 0);
|
|
||||||
blockDimensionless.SaubBlock = blockSaub;
|
|
||||||
addressStart.ColumnNumber = 2;
|
|
||||||
var blockSign = new SignBlock(addressStart, dto.Sign);
|
|
||||||
addressStart = blockSign.AddressBlockEnd + (1, 0);
|
|
||||||
addressStart.ColumnNumber = 2;
|
|
||||||
blockHeader.Draw(sheet);
|
|
||||||
blockBha.Draw(sheet);
|
|
||||||
timeBalance.Draw(sheet);
|
|
||||||
blockDimensionless.Draw(sheet);
|
|
||||||
blockSaub.Draw(sheet);
|
|
||||||
blockSign.Draw(sheet);
|
|
||||||
//sheet.Columns().AdjustToContents(); // Adjust column width
|
|
||||||
sheet.Rows().AdjustToContents();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Binary file not shown.
@ -1,105 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Net;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AsbCloudApp.Data;
|
|
||||||
using AsbCloudApp.Data.AutogeneratedDailyReport;
|
|
||||||
using AsbCloudApp.Requests;
|
|
||||||
using AsbCloudApp.Services;
|
|
||||||
using AsbCloudApp.Services.AutoGeneratedDailyReports;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace AsbCloudWebApi.Controllers;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Контроллер для авто-генерируемых суточных отчётов
|
|
||||||
/// </summary>
|
|
||||||
[ApiController]
|
|
||||||
[Route("api/well/{idWell}/[controller]")]
|
|
||||||
[Authorize]
|
|
||||||
public class AutoGeneratedDailyReportController : ControllerBase
|
|
||||||
{
|
|
||||||
private readonly IAutoGeneratedDailyReportService autoGeneratedDailyReportService;
|
|
||||||
private readonly IWellService wellService;
|
|
||||||
|
|
||||||
public AutoGeneratedDailyReportController(
|
|
||||||
IAutoGeneratedDailyReportService autoGeneratedDailyReportService,
|
|
||||||
IWellService wellService)
|
|
||||||
{
|
|
||||||
this.autoGeneratedDailyReportService = autoGeneratedDailyReportService;
|
|
||||||
this.wellService = wellService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Формирование отчёта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idWell">Id скважины</param>
|
|
||||||
/// <param name="reportDate">Дата отчёта</param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK, "application/octet-stream")]
|
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
|
||||||
public async Task<IActionResult> GenerateReportAsync([FromRoute] int idWell,
|
|
||||||
[Required] DateOnly reportDate,
|
|
||||||
CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
if (!await CanUserAccessToWellAsync(idWell, cancellationToken))
|
|
||||||
return Forbid();
|
|
||||||
|
|
||||||
var reportFile = await autoGeneratedDailyReportService.GenerateAsync(idWell,
|
|
||||||
reportDate,
|
|
||||||
cancellationToken);
|
|
||||||
|
|
||||||
return File(reportFile.stream, "application/octet-stream", reportFile.fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Список файлов суточных отчётов
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idWell">Id скважины</param>
|
|
||||||
/// <param name="request">Параметры запроса</param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("all")]
|
|
||||||
[ProducesResponseType(typeof(PaginationContainer<AutoGeneratedDailyReportInfoDto>), (int)HttpStatusCode.OK)]
|
|
||||||
public async Task<IActionResult> GetListAsync([FromRoute][Required] int idWell,
|
|
||||||
[FromQuery] FileReportRequest request,
|
|
||||||
CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
if (!await CanUserAccessToWellAsync(idWell, cancellationToken))
|
|
||||||
return Forbid();
|
|
||||||
|
|
||||||
var reports = await autoGeneratedDailyReportService.GetListAsync(idWell,
|
|
||||||
request,
|
|
||||||
cancellationToken);
|
|
||||||
|
|
||||||
return Ok(reports);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Диапазон дат для формирования суточных отчётов
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="idWell"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("datesRange")]
|
|
||||||
[ProducesResponseType(typeof(DatesRangeDto), (int)HttpStatusCode.OK)]
|
|
||||||
public async Task<IActionResult> GetDatesRangeAsync(int idWell, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
if (!await CanUserAccessToWellAsync(idWell, cancellationToken))
|
|
||||||
return Forbid();
|
|
||||||
|
|
||||||
return Ok(await autoGeneratedDailyReportService.GetDatesRangeAsync(idWell, cancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
int? idCompany = User.GetCompanyId();
|
|
||||||
return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany,
|
|
||||||
idWell, cancellationToken).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user