diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportDto.cs deleted file mode 100644 index ec87e260..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportDto.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections; -using System.Collections.Generic; - -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// DTO авто-сгенерированного суточного отчёта -/// -public class AutoGeneratedDailyReportDto : AutoGeneratedDailyReportInfoDto -{ - /// - /// Блок заголовка - /// - public HeadBlockDto Head { get; set; } = null!; - - /// - /// Блок подсистем - /// - public IEnumerable Subsystems { get; set; } = null!; - - /// - /// Блок ограничивающих параметров - /// - public IEnumerable LimitingParameters { get; set; } = null!; - - /// - /// Баланс времени - /// - public IEnumerable TimeBalance { get; set; } = null!; -} \ No newline at end of file diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportInfoDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportInfoDto.cs deleted file mode 100644 index 22e34cf2..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/AutoGeneratedDailyReportInfoDto.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// Базовая информация о суточном отчёте -/// -public class AutoGeneratedDailyReportInfoDto : ReportInfoDto -{ - /// - /// Дата формирования отчёта - /// - public DateOnly ReportDate { get; set; } -} \ No newline at end of file diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/HeadBlockDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/HeadBlockDto.cs deleted file mode 100644 index 43ff5246..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/HeadBlockDto.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// Блок заголовка -/// -public class HeadBlockDto -{ - /// - /// Название скважины - /// - public string Well { get; set; } = null!; - - /// - /// Название куста - /// - public string Cluster { get; set; } = null!; - - /// - /// Заказчик - /// - public string Customer { get; set; } = null!; - - /// - /// Месторождение - /// - public string Deposit { get; set; } = null!; - - /// - /// Глубина забоя на дату начала интервала - /// - public double DepthFrom { get; set; } - - /// - /// Глубина забоя на дату окончания интервала - /// - public double DepthTo { get; set; } -} \ No newline at end of file diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/LimitingParameterRecordDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/LimitingParameterRecordDto.cs deleted file mode 100644 index e62b32d9..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/LimitingParameterRecordDto.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// Блок ограничивающих параметров -/// -public class LimitingParameterRecordDto -{ - /// - /// Время использования, мин - /// - public double Hours { get; set; } - - /// - /// Проходка, м - /// - public double Depth { get; set; } - - /// - /// Название ограничивающего параметра - /// - public string NameFeedRegulator { get; set; } = null!; - - /// - /// Процент по проходке, % - /// - public double PercentDepth { get; set; } -} \ No newline at end of file diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/SubsystemRecordDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/SubsystemRecordDto.cs deleted file mode 100644 index 34b2e4a7..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/SubsystemRecordDto.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// Блок подсистем -/// -public class SubsystemRecordDto -{ - /// - /// Название подсистемы - /// - public string Name { get; set; } = null!; - - /// - /// Использование, % - /// - public double KUsage { get; set; } - - /// - /// Время работы, ч - /// - public double UsedTimeHours { get; set; } - - /// - /// Проходка - /// - public double Depth { get; set; } -} \ No newline at end of file diff --git a/AsbCloudApp/Data/AutogeneratedDailyReport/TimeBalanceRecordDto.cs b/AsbCloudApp/Data/AutogeneratedDailyReport/TimeBalanceRecordDto.cs deleted file mode 100644 index a6ac9845..00000000 --- a/AsbCloudApp/Data/AutogeneratedDailyReport/TimeBalanceRecordDto.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace AsbCloudApp.Data.AutogeneratedDailyReport; - -/// -/// Баланс времени -/// -public class TimeBalanceRecordDto -{ - /// - /// Название операции - /// - public string Name { get; set; } = null!; - - /// - /// Продолжительность, часы - /// - public double DurationHours { get; set; } -} \ No newline at end of file diff --git a/AsbCloudApp/Data/DailyReport/BhaDto.cs b/AsbCloudApp/Data/DailyReport/BhaDto.cs deleted file mode 100644 index b39ba11c..00000000 --- a/AsbCloudApp/Data/DailyReport/BhaDto.cs +++ /dev/null @@ -1,64 +0,0 @@ -namespace AsbCloudApp.Data.DailyReport -{ - /// - /// блок КНБК - /// - public class BhaDto : ItemInfoDto - { - /// - /// КНБК описание - /// - public string BHADescription { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2195-2763м. Время начала - /// - public string ExtensionDrillingOneBegin{ get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2195-2763м. Время окончания - /// - public string ExtensionDrillingOneFinish { get; set; } = string.Empty; - - /// - /// Промывка. Время начала - /// - public string SluiceBegin { get; set; } = string.Empty; - - /// - /// Промывка. Время окончания - /// - public string SluiceFinish { get; set; } = string.Empty; - - /// - /// Подъем КНБК. Время начала - /// - public string ClimbBegin { get; set; } = string.Empty; - - /// - /// Подъем КНБК. Время окончания - /// - public string ClimbFinish { get; set; } = string.Empty; - - /// - /// Спуск КНБК. Время начала - /// - public string DescentBegin { get; set; } = string.Empty; - - /// - /// Спуск КНБК. Время окончания - /// - public string DescentFinish { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2763-2850м. Время начала - /// - public string ExtensionDrillingTwoBegin { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2763-2850м. Время окончания - /// - public string ExtensionDrillingTwoFinish { get; set; } = string.Empty; - } -} - diff --git a/AsbCloudApp/Data/DailyReport/HeadDto.cs b/AsbCloudApp/Data/DailyReport/HeadDto.cs deleted file mode 100644 index 173d4e63..00000000 --- a/AsbCloudApp/Data/DailyReport/HeadDto.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -namespace AsbCloudApp.Data.DailyReport -{ - /// - /// блок заголовка - /// - public class HeadDto : ItemInfoDto - { - /// - /// название скважины - /// - public string WellName { get; set; } = string.Empty; - - /// - /// название куста - /// - public string ClusterName { get; set; } = string.Empty; - - /// - /// заказчик - /// - public string Customer { get; set; } = string.Empty; - - /// - /// подрядчик - /// - public string Contractor { get; set; } = string.Empty; - - /// - /// дата рапорта - /// - public DateOnly ReportDate { get; set; } - - /// - /// глубина забоя на дату начала интервала - /// - public double? WellDepthIntervalStartDate { get; set; } - - /// - /// глубина забоя на дату окончания интервала - /// - public double? WellDepthIntervalFinishDate { get; set; } - - /// - /// Глубина забоя по стволу на окончание отчетного периода - /// - public double? BottomholeDepth { get; set; } - - /// - /// Глубина забоя по вертикали на дату окончания отчетного периода - /// - public double? VerticalDepth { get; set; } - - /// - /// Зенитный угол на дату окончания отчетного периода - /// - public double? ZenithAngle { get; set; } - - /// - /// Азимутальный угол на дату окончания отчетного периода - /// - public double? AzimuthAngle { get; set; } - - /// - /// ФИО бурильщиков - /// - public string FirstDriller { get; set; } = string.Empty; - - /// - /// ФИО бурильщиков - /// - public string SecondDriller { get; set; } = string.Empty; - - /// - /// Время работы АПД - /// - public double? WorkTimeSAUB { get; set; } - - /// - /// Время работы спин мастер - /// - public double? WorkTimeSpinMaster { get; set; } - - /// - /// Время работы torqueMaster - /// - public double? WorkTimeTorkMaster { get; set; } - - /// - /// количество метров пробуренных с включенным АПД - /// - public double? PenetrationSAUB { get; set; } - - /// - /// количество метров пробуренных с включенным Спин мастер - /// - public double? PenetrationSpinMaster { get; set; } - - /// - /// количество метров пробуренных с включенным torqueMaster - /// - public double? PenetrationTorkMaster { get; set; } - - /// - /// Количество запусков МСЕ - /// - public int CountLaunchesMSE { get; set; } - } -} - diff --git a/AsbCloudApp/Data/DailyReport/NoDrillingDto.cs b/AsbCloudApp/Data/DailyReport/NoDrillingDto.cs deleted file mode 100644 index ff08eb2f..00000000 --- a/AsbCloudApp/Data/DailyReport/NoDrillingDto.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace AsbCloudApp.Data.DailyReport -{ - /// - /// блок безметражные работы - /// - public class NoDrillingDto : ItemInfoDto - { - /// - /// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию - /// - public double? StandardTimeBarrelPreparation { get; set; } - - /// - /// Нормативное время на одну операцию по наращиванию - /// - public double? StandardTimeExtension { get; set; } - - /// - /// Фактическое время проработок при подготовке ствола скважины к наращиванию. - /// - public double? ActualTimeBarrelPreparation { get; set; } - - /// - /// Фактическое время наращиваний - /// - public double? ActualTimeExtension { get; set; } - } -} - diff --git a/AsbCloudApp/Data/DailyReport/SaubDto.cs b/AsbCloudApp/Data/DailyReport/SaubDto.cs deleted file mode 100644 index b59ef9ff..00000000 --- a/AsbCloudApp/Data/DailyReport/SaubDto.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System.Collections.Generic; - -namespace AsbCloudApp.Data.DailyReport -{ - /// - /// блок САУБ - /// - public class SaubDto : ItemInfoDto - { - /// - /// Режимы бурения в роторе - /// - public string RotorDrillingModes { get; set; } = string.Empty; - - /// - /// режимы бурения в слайде - /// - public string SlideDrillingModes { get; set; } = string.Empty; - - /// - /// Количество метров пробуренных в роторе за отчетный период - /// - public double? PenetrationInRotor { get; set; } - - /// - /// Количество часов бурения в роторе за отчетный период - /// - public double? NumberDrillingHours { get; set; } - - /// - /// средний диф перепад в роторе за отчетный период - /// - public double? AVGDiffDropRotor { get; set; } - - /// - /// количество метров пробуренных в слайде за отчетный период - /// - public double? PenetrationInSlide { get; set; } - - /// - /// время бурения в роторе за отчетный период - /// - public double? DrillingTimeInRotor { get; set; } - - /// - /// средний диф. перепад в слайде за отчетный период - /// - public double? AVGDiffPressureSlide { get; set; } - - /// - /// Плановая МСП за секцию - /// - public double? SectionROPPlan { get; set; } - - /// - /// Общее время бурения за секцию - /// - public double? SectionDrillingTimeTotal { get; set; } - - /// - /// Общая проходка за секцию - /// - public double? SectionPenetrationTotal { get; set; } - - /// - /// Количество наращиваний за отчетный период - /// - public int ExtensionsCount { get; set; } - - /// - /// Отклонение относительно ГГД - /// - public double? DeviationFromTVD { get; set; } - - /// - /// указываются все причины, которые влияют на снижение МСП. - /// - public string DeclinesReasonsROP { get; set; } = string.Empty; - - /// - /// Увеличение мех скорости за секцию % - /// - public string IncreaseSpeedSection { get; set; } = string.Empty; - - /// - /// Увеличение мех скорости за сутки % - /// - public string IncreaseSpeedDay { get; set; } = string.Empty; - - /// - /// Сокращение времени бурения за секцию, ч - /// - public string ReductionTimeDrilling { get; set; } = string.Empty; - - /// - /// Ротор/Слайд % - /// - public string RotorSlidePercent { get; set; } = string.Empty; - - /// - /// МСП - /// - public string MspSection { get; set; } = string.Empty; - - } -} - diff --git a/AsbCloudApp/Data/DailyReport/SignDto.cs b/AsbCloudApp/Data/DailyReport/SignDto.cs deleted file mode 100644 index f6726bb7..00000000 --- a/AsbCloudApp/Data/DailyReport/SignDto.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace AsbCloudApp.Data.DailyReport -{ - /// - /// блок подписи - /// - public class SignDto : ItemInfoDto - { - /// - /// ФИО Мастера буровой - /// - public string DrillingMaster { get; set; } = null!; - - /// - /// ФИО супервайзера - /// - public string Supervisor { get; set; } = null!; - } -} - diff --git a/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs b/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs deleted file mode 100644 index 855d5fd7..00000000 --- a/AsbCloudApp/Data/DailyReport/TimeBalanceDto.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; - -namespace AsbCloudApp.Data.DailyReport -{ - - /// - /// Блок баланса времени - /// - public class TimeBalanceDto : ItemInfoDto - { - /// - /// Статистика по операциям - /// - public Dictionary OperationsStat { get; set; } = new Dictionary(); - - } -} - diff --git a/AsbCloudApp/Services/AutoGeneratedDailyReports/IAutoGeneratedDailyReportService.cs b/AsbCloudApp/Services/AutoGeneratedDailyReports/IAutoGeneratedDailyReportService.cs deleted file mode 100644 index 979f948c..00000000 --- a/AsbCloudApp/Services/AutoGeneratedDailyReports/IAutoGeneratedDailyReportService.cs +++ /dev/null @@ -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; - -/// -/// Сервис для работы с авто-генерируемыми суточными отчётами -/// -public interface IAutoGeneratedDailyReportService -{ - /// - /// Список файлов суточных отчётов - /// - /// - /// - /// - /// - Task> GetListAsync(int idWell, - FileReportRequest request, - CancellationToken cancellationToken); - - /// - /// Генерация файла с отчётом - /// - /// - /// - /// - /// - Task<(string fileName, Stream stream)> GenerateAsync(int idWell, DateOnly reportDate, - CancellationToken cancellationToken); - - /// - /// Получение диапазона дат - /// - /// - /// - /// - Task GetDatesRangeAsync(int idWell, CancellationToken cancellationToken); -} \ No newline at end of file diff --git a/AsbCloudApp/Services/IDailyReportService.cs b/AsbCloudApp/Services/IDailyReportService.cs deleted file mode 100644 index 66e7bd71..00000000 --- a/AsbCloudApp/Services/IDailyReportService.cs +++ /dev/null @@ -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 -{ - /// - /// Суточный рапорт (сводка) - /// - public interface IDailyReportService - { - /// - /// получить список сформированных рапортов по скважине за период времени - /// - /// - /// - /// - /// - /// - Task> GetListAsync(int idWell, DateOnly? begin, DateOnly? end, CancellationToken cancellationToken); - - /// - /// Добавить новый рапорт - /// - /// - /// - /// - /// - /// - Task AddAsync(int idWell, DateOnly startDate, int idUser, CancellationToken token); - - /// - /// Сформировать файл рапорта - /// - /// - /// - /// - /// - Task MakeReportAsync(int idWell, DateOnly date, CancellationToken token); - - /// - /// изменить блок данных для суточного рапорта - /// - /// - /// - /// - /// - /// - Task UpdateBlockAsync(int idWell, DateOnly startDate, ItemInfoDto dto, CancellationToken token); - } -} diff --git a/AsbCloudDb/Model/DailyReport/Bha.cs b/AsbCloudDb/Model/DailyReport/Bha.cs deleted file mode 100644 index b1765c19..00000000 --- a/AsbCloudDb/Model/DailyReport/Bha.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace AsbCloudDb.Model.DailyReport -{ - public class Bha : ItemInfo - { - /// - /// КНБК описание - /// - public string BHADescription { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2195-2763м. Время начала - /// - public string ExtensionDrillingOneBegin { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2195-2763м. Время окончания - /// - public string ExtensionDrillingOneFinish { get; set; } = string.Empty; - - /// - /// Промывка. Время начала - /// - public string SluiceBegin { get; set; } = string.Empty; - - /// - /// Промывка. Время окончания - /// - public string SluiceFinish { get; set; } = string.Empty; - - /// - /// Подьем КНБК. Время начала - /// - public string ClimbBegin { get; set; } = string.Empty; - - /// - /// Подьем КНБК. Время окончания - /// - public string ClimbFinish { get; set; } = string.Empty; - - /// - /// Спуск КНБК. Время начала - /// - public string DescentBegin { get; set; } = string.Empty; - - /// - /// Спуск КНБК. Время окончания - /// - public string DescentFinish { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2763-2850м. Время начала - /// - public string ExtensionDrillingTwoBegin { get; set; } = string.Empty; - - /// - /// Бурение с наращиваниями в инт. 2763-2850м. Время окончания - /// - public string ExtensionDrillingTwoFinish { get; set; } = string.Empty; - - } -} diff --git a/AsbCloudDb/Model/DailyReport/DailyReport.cs b/AsbCloudDb/Model/DailyReport/DailyReport.cs deleted file mode 100644 index f620221f..00000000 --- a/AsbCloudDb/Model/DailyReport/DailyReport.cs +++ /dev/null @@ -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!; - } -} \ No newline at end of file diff --git a/AsbCloudDb/Model/DailyReport/DailyReportInfo.cs b/AsbCloudDb/Model/DailyReport/DailyReportInfo.cs deleted file mode 100644 index d5a7bfd6..00000000 --- a/AsbCloudDb/Model/DailyReport/DailyReportInfo.cs +++ /dev/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(); - } -} diff --git a/AsbCloudDb/Model/DailyReport/Head.cs b/AsbCloudDb/Model/DailyReport/Head.cs deleted file mode 100644 index fc5542e8..00000000 --- a/AsbCloudDb/Model/DailyReport/Head.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.Text.Json.Serialization; - -namespace AsbCloudDb.Model.DailyReport -{ - public class Head : ItemInfo - { - /// - /// название скважины - /// - public string WellName { get; set; } = string.Empty; - - /// - /// название куста - /// - public string ClusterName { get; set; } = string.Empty; - - /// - /// заказчик - /// - public string Customer { get; set; } = string.Empty; - - /// - /// подрядчик - /// - public string Contractor { get; set; } = string.Empty; - - /// - /// дата рапорта - /// - [JsonConverter(typeof(DateOnlyJsonConverter))] - public DateOnly ReportDate { get; set; } - - /// - /// глубина забоя на дату начала интервала - /// - public double? WellDepthIntervalStartDate { get; set; } - - /// - /// глубина забоя на дату окончания интервала - /// - public double? WellDepthIntervalFinishDate { get; set; } - - /// - /// Глубина забоя по стволу на окончание отчетного периода - /// - public double? BottomholeDepth { get; set; } - - /// - /// Глубина забоя по вертикали на дату окончания отчетного периода - /// - public double? VerticalDepth { get; set; } - - /// - /// Зенитный угол на дату окончания отчетного периода - /// - public double? ZenithAngle { get; set; } - - /// - /// Азимутальный угол на дату окончания отчетного периода - /// - public double? AzimuthAngle { get; set; } - - /// - /// ФИО бурильщиков - /// - public string FirstDriller { get; set; } = string.Empty; - - /// - /// ФИО бурильщиков - /// - public string SecondDriller { get; set; } = string.Empty; - - /// - /// Время работы АПД - /// - public double? WorkTimeSAUB { get; set; } - - /// - /// Время работы спин мастер - /// - public double? WorkTimeSpinMaster { get; set; } - - /// - /// Время работы torqueMaster - /// - public double? WorkTimeTorkMaster { get; set; } - - /// - /// количество метров пробуренных с включенным АПД - /// - public double? PenetrationSAUB { get; set; } - - /// - /// количество метров пробуренных с включенным Спин мастер - /// - public double? PenetrationSpinMaster { get; set; } - - /// - /// количество метров пробуренных с включенным torqueMaster - /// - public double? PenetrationTorkMaster { get; set; } - - /// - /// Количество запусков МСЕ - /// - public int CountLaunchesMSE { get; set; } - } -} - diff --git a/AsbCloudDb/Model/DailyReport/NoDrilling.cs b/AsbCloudDb/Model/DailyReport/NoDrilling.cs deleted file mode 100644 index c1a3b604..00000000 --- a/AsbCloudDb/Model/DailyReport/NoDrilling.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace AsbCloudDb.Model.DailyReport -{ - public class NoDrilling : ItemInfo - { - /// - /// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию - /// - public double? StandardTimeBarrelPreparation { get; set; } - - /// - /// Нормативное время на одну операцию по наращиванию - /// - public double? StandardTimeExtension { get; set; } - - /// - /// Фактическое время проработок при подготовке ствола скважины к наращиванию. - /// - public double? ActualTimeBarrelPreparation { get; set; } - - /// - /// Фактическое время наращиваний - /// - public double? ActualTimeExtension { get; set; } - } -} - diff --git a/AsbCloudDb/Model/DailyReport/Saub.cs b/AsbCloudDb/Model/DailyReport/Saub.cs deleted file mode 100644 index 43202677..00000000 --- a/AsbCloudDb/Model/DailyReport/Saub.cs +++ /dev/null @@ -1,101 +0,0 @@ -namespace AsbCloudDb.Model.DailyReport -{ - public class Saub : ItemInfo - { - /// - /// Режимы бурения в роторе - /// - public string? RotorDrillingModes { get; set; } - - /// - /// режимы бурения в слайде - /// - public string? SlideDrillingModes { get; set; } - - /// - /// Количество метров пробуренных в роторе за отчетный период - /// - public double? PenetrationInRotor { get; set; } - - /// - /// Количество часов бурения в роторе за отчетный период - /// - public double? NumberDrillingHours { get; set; } - - /// - /// средний диф перепад в роторе за отчетный период - /// - public double? AVGDiffDropRotor { get; set; } - - /// - /// количество метров пробуренных в слайде за отчетный период - /// - public double? PenetrationInSlide { get; set; } - - /// - /// время бурения в роторе за отчетный период - /// - public double? DrillingTimeInRotor { get; set; } - - /// - /// средний диф. перепад в слайде за отчетный период - /// - public double? AVGDiffPressureSlide { get; set; } - - /// - /// Плановая МСП за секцию - /// - public double? SectionROPPlan { get; set; } - - /// - /// Общее время бурения за секцию - /// - public double? SectionDrillingTimeTotal { get; set; } - - /// - /// Общая проходка за секцию - /// - public double? SectionPenetrationTotal { get; set; } - - /// - /// Количество наращиваний за отчетный период - /// - public int ExtensionsCount { get; set; } - - /// - /// Отклонение относительно ГГД - /// - public double? DeviationFromTVD { get; set; } - - /// - /// указываются все причины, которые влияют на снижение МСП. - /// - public string DeclinesReasonsROP { get; set; } = string.Empty; - - /// - /// Увеличение мех скорости за секцию % - /// - public string IncreaseSpeedSection { get; set; } = string.Empty; - - /// - /// Увеличение мех скорости за сутки % - /// - public string IncreaseSpeedDay { get; set; } = string.Empty; - - /// - /// Сокращение времени бурения за секцию, ч - /// - public string ReductionTimeDrilling { get; set; } = string.Empty; - - /// - /// Ротор/Слайд % - /// - public string RotorSlidePercent { get; set; } = string.Empty; - - /// - /// МСП - /// - public string MspSection { get; set; } = string.Empty; - } -} - diff --git a/AsbCloudDb/Model/DailyReport/Sign.cs b/AsbCloudDb/Model/DailyReport/Sign.cs deleted file mode 100644 index 1b443348..00000000 --- a/AsbCloudDb/Model/DailyReport/Sign.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace AsbCloudDb.Model.DailyReport -{ - public class Sign : ItemInfo - { - /// - /// ФИО Мастера буровой - /// - public string DrillingMaster { get; set; } = string.Empty; - - /// - /// ФИО супервайзера - /// - public string Supervisor { get; set; } = string.Empty; - } -} - diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportMakerService.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportMakerService.cs deleted file mode 100644 index cfc95753..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportMakerService.cs +++ /dev/null @@ -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 -{ - private readonly string templateName = "AutogeneratedDailyReportTemplate.xlsx"; - - private readonly IEnumerable blockWriters = new List() - { - new HeadExcelBlockWriter(), - new SubsystemExcelBlockWriter(), - new LimitingParameterExcelBlockWriter(), - new TimeBalanceExcelBlockWriter() - }; - - public async Task 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); - } - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs deleted file mode 100644 index 1ada2676..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs +++ /dev/null @@ -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 subsystemRepository; - private readonly ILimitingParameterService limitingParameterService; - private readonly IReportMakerService autoGeneratedDailyReportMakerService; - - public AutoGeneratedDailyReportService(IWellService wellService, - IWellOperationRepository wellOperationRepository, - ISubsystemOperationTimeService subsystemOperationTimeService, - ICrudRepository subsystemRepository, - ILimitingParameterService limitingParameterService, - IReportMakerService autoGeneratedDailyReportMakerService) - { - this.wellOperationRepository = wellOperationRepository; - this.wellService = wellService; - this.subsystemOperationTimeService = subsystemOperationTimeService; - this.subsystemRepository = subsystemRepository; - this.limitingParameterService = limitingParameterService; - this.autoGeneratedDailyReportMakerService = autoGeneratedDailyReportMakerService; - } - - public async Task> GetListAsync(int idWell, - FileReportRequest request, - CancellationToken cancellationToken) - { - var result = new PaginationContainer - { - Skip = request.Skip ?? 0, - Take = request.Take ?? 10, - Items = Enumerable.Empty() - }; - - var reports = new List(); - - 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 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 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> 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> 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> 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> 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> 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; - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/HeadExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/HeadExcelBlockWriter.cs deleted file mode 100644 index dad6bf35..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/HeadExcelBlockWriter.cs +++ /dev/null @@ -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; - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/IExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/IExcelBlockWriter.cs deleted file mode 100644 index 0f83fe05..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/IExcelBlockWriter.cs +++ /dev/null @@ -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); -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/LimitingParameterExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/LimitingParameterExcelBlockWriter.cs deleted file mode 100644 index 30cf36f0..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/LimitingParameterExcelBlockWriter.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/SubsystemExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/SubsystemExcelBlockWriter.cs deleted file mode 100644 index a1b25c88..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/SubsystemExcelBlockWriter.cs +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/TimeBalanceExcelBlockWriter.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/TimeBalanceExcelBlockWriter.cs deleted file mode 100644 index 51e4643e..00000000 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportBlocks/TimeBalanceExcelBlockWriter.cs +++ /dev/null @@ -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; - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportTemplate.xlsx b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportTemplate.xlsx deleted file mode 100644 index 0a887a4e..00000000 Binary files a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutogeneratedDailyReportTemplate.xlsx and /dev/null differ diff --git a/AsbCloudInfrastructure/Services/DailyReport/BlockAbstract.cs b/AsbCloudInfrastructure/Services/DailyReport/BlockAbstract.cs deleted file mode 100644 index 92286ee6..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/BlockAbstract.cs +++ /dev/null @@ -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); - } - -} diff --git a/AsbCloudInfrastructure/Services/DailyReport/CellAddress.cs b/AsbCloudInfrastructure/Services/DailyReport/CellAddress.cs deleted file mode 100644 index 10329a4c..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/CellAddress.cs +++ /dev/null @@ -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; - } - } - -} diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/BhaBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/BhaBlock.cs deleted file mode 100644 index 9c3d1cdc..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/BhaBlock.cs +++ /dev/null @@ -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(); - } - } - -} - - - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs deleted file mode 100644 index 18ee9fbc..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/DimensionlessBlock.cs +++ /dev/null @@ -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("Наращивание"); - } - } - -} - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs deleted file mode 100644 index b7ae4dfe..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/HeadBlock.cs +++ /dev/null @@ -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}"); - } - } - -} - - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs deleted file mode 100644 index f6f4791f..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SaubBlock.cs +++ /dev/null @@ -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}"); - } - } - -} - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs deleted file mode 100644 index b7e5eb60..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/SignBlock.cs +++ /dev/null @@ -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}"); - } - } - -} - - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs deleted file mode 100644 index 9fe13a72..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportBlocks/TimeBalanceBlock.cs +++ /dev/null @@ -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 -{ - /// - /// Построение баланса времени - /// - class TimeBalanceBlock : BlockAbstract - { - /// - /// Начальная ячейка - /// - public override CellAddress AddressBlockBegin { get; } - - /// - /// Конечная ячейка - /// - public override CellAddress AddressBlockEnd { get; } - - /// - /// Ячейка с заголовком - /// - private CellAddress Title { get { return AddressBlockBegin + (1, 3); } } - - /// - /// Статистика по операциям - /// - private Dictionary OperationsStatistics { get; } - - /// - /// Категории операций - /// - private IEnumerable OperationCategories { get; } - - /// - /// количество столбцов в таблице - /// - private const int countColumns = 3; - - /// - /// количество категорий операций - /// - private int OperationCategoriesCount { get { return OperationCategories.Count(); } } - - - public TimeBalanceBlock(CellAddress addressBlockBegin, TimeBalanceDto blockDto, IEnumerable 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"; - } - } -} - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs deleted file mode 100644 index 56b68c30..00000000 --- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportMakerExcel.cs +++ /dev/null @@ -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 OperationCategories = null!; - - public Stream MakeReportFromBlocks(DailyReportDto dto, IEnumerable 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(); - } - } - -} - diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportTemplate.xlsx b/AsbCloudInfrastructure/Services/DailyReport/DailyReportTemplate.xlsx deleted file mode 100644 index 640f481b..00000000 Binary files a/AsbCloudInfrastructure/Services/DailyReport/DailyReportTemplate.xlsx and /dev/null differ diff --git a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs b/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs deleted file mode 100644 index a392bf51..00000000 --- a/AsbCloudWebApi/Controllers/AutoGeneratedDailyReportController.cs +++ /dev/null @@ -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; - -/// -/// Контроллер для авто-генерируемых суточных отчётов -/// -[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; - } - - /// - /// Формирование отчёта - /// - /// Id скважины - /// Дата отчёта - /// - /// - [HttpGet] - [ProducesResponseType(typeof(PhysicalFileResult), (int)HttpStatusCode.OK, "application/octet-stream")] - [ProducesResponseType(StatusCodes.Status204NoContent)] - public async Task 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); - } - - /// - /// Список файлов суточных отчётов - /// - /// Id скважины - /// Параметры запроса - /// - /// - [HttpGet("all")] - [ProducesResponseType(typeof(PaginationContainer), (int)HttpStatusCode.OK)] - public async Task 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); - } - - /// - /// Диапазон дат для формирования суточных отчётов - /// - /// - /// - /// - [HttpGet("datesRange")] - [ProducesResponseType(typeof(DatesRangeDto), (int)HttpStatusCode.OK)] - public async Task GetDatesRangeAsync(int idWell, CancellationToken cancellationToken) - { - if (!await CanUserAccessToWellAsync(idWell, cancellationToken)) - return Forbid(); - - return Ok(await autoGeneratedDailyReportService.GetDatesRangeAsync(idWell, cancellationToken)); - } - - private async Task CanUserAccessToWellAsync(int idWell, CancellationToken cancellationToken) - { - int? idCompany = User.GetCompanyId(); - return idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync((int)idCompany, - idWell, cancellationToken).ConfigureAwait(false); - } -} \ No newline at end of file