merge dev to subsystems

This commit is contained in:
eugeniy_ivanov 2022-08-08 17:02:52 +05:00
commit a20dbf72e0
122 changed files with 60666 additions and 1407 deletions

View File

@ -10,4 +10,7 @@
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<None Remove="Data\DailyReport\" />
</ItemGroup>
</Project>

View File

@ -9,7 +9,7 @@ namespace AsbCloudApp.Comparators
/// </summary>
public class ComparerIId : IComparer<IId>, IEqualityComparer<IId>
{
private static readonly ComparerIId instance = new ComparerIId();
private static readonly ComparerIId instance = new ();
private ComparerIId() { }
/// <summary>

View File

@ -0,0 +1,64 @@
namespace AsbCloudApp.Data.DailyReport
{
/// <summary>
/// блок КНБК
/// </summary>
public class BhaDto
{
/// <summary>
/// КНБК описание
/// </summary>
public string BHADescription { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2195-2763м. Время начала
/// </summary>
public string ExtensionDrillingOneBegin{ get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2195-2763м. Время окончания
/// </summary>
public string ExtensionDrillingOneFinish { get; set; }
/// <summary>
/// Промывка. Время начала
/// </summary>
public string SluiceBegin { get; set; }
/// <summary>
/// Промывка. Время окончания
/// </summary>
public string SluiceFinish { get; set; }
/// <summary>
/// Подъем КНБК. Время начала
/// </summary>
public string ClimbBegin { get; set; }
/// <summary>
/// Подъем КНБК. Время окончания
/// </summary>
public string ClimbFinish { get; set; }
/// <summary>
/// Спуск КНБК. Время начала
/// </summary>
public string DescentBegin { get; set; }
/// <summary>
/// Спуск КНБК. Время окончания
/// </summary>
public string DescentFinish { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2763-2850м. Время начала
/// </summary>
public string ExtensionDrillingTwoBegin { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2763-2850м. Время окончания
/// </summary>
public string ExtensionDrillingTwoFinish { get; set; }
}
}

View File

@ -0,0 +1,38 @@
namespace AsbCloudApp.Data.DailyReport
{
/// <summary>
/// Блоки для формирования суточного рапорта
/// </summary>
public class DailyReportDto
{
/// <summary>
/// блок заголовка
/// </summary>
public HeadDto Head { get; set; } = new();
/// <summary>
/// блок КНБК
/// </summary>
public BhaDto Bha { get; set; } = new();
/// <summary>
/// блок безметражные работы
/// </summary>
public NoDrillingDto NoDrilling { get; set; } = new();
/// <summary>
/// блок баланса времени
/// </summary>
public TimeBalanceDto TimeBalance { get; set; } = new();
/// <summary>
/// блок САУБ
/// </summary>
public SaubDto Saub { get; set; } = new();
/// <summary>
/// блок подписи
/// </summary>
public SignDto Sign { get; set; } = new();
}
}

View File

@ -0,0 +1,115 @@
using System;
namespace AsbCloudApp.Data.DailyReport
{
/// <summary>
/// блок заголовка
/// </summary>
public class HeadDto
{
/// <summary>
/// название скважины
/// </summary>
public string WellName { get; set; }
/// <summary>
/// название куста
/// </summary>
public string ClusterName { get; set; }
/// <summary>
/// заказчик
/// </summary>
public string Customer { get; set; }
/// <summary>
/// подрядчик
/// </summary>
public string Contractor { get; set; }
/// <summary>
/// дата рапорта
/// </summary>
public DateTime ReportDate { get; set; }
/// <summary>
/// глубина забоя на дату начала интервала
/// </summary>
public double? WellDepthIntervalStartDate { get; set; }
/// <summary>
/// глубина забоя на дату окончания интервала
/// </summary>
public double? WellDepthIntervalFinishDate { get; set; }
/// <summary>
/// Глубина забоя по стволу на окончание отчетного периода
/// </summary>
public double? BottomholeDepth { get; set; }
/// <summary>
/// Глубина забоя по вертикали на дату окончания отчетного периода
/// </summary>
public double? VerticalDepth { get; set; }
/// <summary>
/// Зенитный угол на дату окончания отчетного периода
/// </summary>
public double? ZenithAngle { get; set; }
/// <summary>
/// Азимутальный угол на дату окончания отчетного периода
/// </summary>
public double? AzimuthAngle { get; set; }
/// <summary>
/// ФИО бурильщиков
/// </summary>
public string FirstDriller { get; set; }
/// <summary>
/// ФИО бурильщиков
/// </summary>
public string SecondDriller { get; set; }
/// <summary>
/// Время работы АПД
/// </summary>
public double? WorkTimeSAUB { get; set; }
/// <summary>
/// Время работы спин мастер
/// </summary>
public double? WorkTimeSpinMaster { get; set; }
/// <summary>
/// Время работы torqueMaster
/// </summary>
public double? WorkTimeTorkMaster { get; set; }
/// <summary>
/// количество метров пробуренных с включенным АПД
/// </summary>
public double? PenetrationSAUB { get; set; }
/// <summary>
/// количество метров пробуренных с включенным Спин мастер
/// </summary>
public double? PenetrationSpinMaster { get; set; }
/// <summary>
/// количество метров пробуренных с включенным torqueMaster
/// </summary>
public double? PenetrationTorkMaster { get; set; }
/// <summary>
/// Количество запусков МСЕ
/// </summary>
public int CountLaunchesMSE { get; set; }
}
}

View File

@ -0,0 +1,29 @@
namespace AsbCloudApp.Data.DailyReport
{
/// <summary>
/// блок безметражные работы
/// </summary>
public class NoDrillingDto
{
/// <summary>
/// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию
/// </summary>
public double? StandardTimeBarrelPreparation { get; set; }
/// <summary>
/// Нормативное время на одну операцию по наращиванию
/// </summary>
public double? StandardTimeExtension { get; set; }
/// <summary>
/// Фактическое время проработок при подготовке ствола скважины к наращиванию.
/// </summary>
public double? ActualTimeBarrelPreparation { get; set; }
/// <summary>
/// Фактическое время наращиваний
/// </summary>
public double? ActualTimeExtension { get; set; }
}
}

View File

@ -0,0 +1,107 @@
using System.Collections.Generic;
namespace AsbCloudApp.Data.DailyReport
{
/// <summary>
/// блок САУБ
/// </summary>
public class SaubDto
{
/// <summary>
/// Режимы бурения в роторе
/// </summary>
public string RotorDrillingModes { get; set; }
/// <summary>
/// режимы бурения в слайде
/// </summary>
public string SlideDrillingModes { get; set; }
/// <summary>
/// Количество метров пробуренных в роторе за отчетный период
/// </summary>
public double? PenetrationInRotor { get; set; }
/// <summary>
/// Количество часов бурения в роторе за отчетный период
/// </summary>
public double? NumberDrillingHours { get; set; }
/// <summary>
/// средний диф перепад в роторе за отчетный период
/// </summary>
public double? AVGDiffDropRotor { get; set; }
/// <summary>
/// количество метров пробуренных в слайде за отчетный период
/// </summary>
public double? PenetrationInSlide { get; set; }
/// <summary>
/// время бурения в роторе за отчетный период
/// </summary>
public double? DrillingTimeInRotor { get; set; }
/// <summary>
/// средний диф. перепад в слайде за отчетный период
/// </summary>
public double? AVGDiffPressureSlide { get; set; }
/// <summary>
/// Плановая МСП за секцию
/// </summary>
public double? SectionROPPlan { get; set; }
/// <summary>
/// Общее время бурения за секцию
/// </summary>
public double? SectionDrillingTimeTotal { get; set; }
/// <summary>
/// Общая проходка за секцию
/// </summary>
public double? SectionPenetrationTotal { get; set; }
/// <summary>
/// Количество наращиваний за отчетный период
/// </summary>
public int ExtensionsCount { get; set; }
/// <summary>
/// Отклонение относительно ГГД
/// </summary>
public double? DeviationFromTVD { get; set; }
/// <summary>
/// указываются все причины, которые влияют на снижение МСП.
/// </summary>
public string DeclinesReasonsROP { get; set; }
/// <summary>
/// Увеличение мех скорости за секцию %
/// </summary>
public string IncreaseSpeedSection { get; set; }
/// <summary>
/// Увеличение мех скорости за сутки %
/// </summary>
public string IncreaseSpeedDay { get; set; }
/// <summary>
/// Сокращение времени бурения за секцию, ч
/// </summary>
public string ReductionTimeDrilling { get; set; }
/// <summary>
/// Ротор/Слайд %
/// </summary>
public string RotorSlidePercent { get; set; }
/// <summary>
/// МСП
/// </summary>
public string MspSection { get; set; }
}
}

View File

@ -0,0 +1,19 @@
namespace AsbCloudApp.Data.DailyReport
{
/// <summary>
/// блок подписи
/// </summary>
public class SignDto
{
/// <summary>
/// ФИО Мастера буровой
/// </summary>
public string DrillingMaster { get; set; }
/// <summary>
/// ФИО супервайзера
/// </summary>
public string Supervisor { get; set; }
}
}

View File

@ -0,0 +1,99 @@
namespace AsbCloudApp.Data.DailyReport
{
/// <summary>
/// блок баланса времени
/// </summary>
public class TimeBalanceDto
{
/// <summary>
/// Бурение
/// </summary>
public string Drilling { get; set; }
/// <summary>
/// Промывка
/// </summary>
public string Flushing { get; set; }
/// <summary>
/// Наращивание
/// </summary>
public string Building { get; set; }
/// <summary>
/// Проработка
/// </summary>
public string Elaboration { get; set; }
/// <summary>
/// Расширка
/// </summary>
public string Extension { get; set; }
/// <summary>
/// Ремонт
/// </summary>
public string Repair { get; set; }
/// <summary>
/// КНБК
/// </summary>
public string Knbk { get; set; }
/// <summary>
/// СПО
/// </summary>
public string Spo { get; set; }
/// <summary>
/// ПЗР
/// </summary>
public string Pzr { get; set; }
/// <summary>
/// ПВО
/// </summary>
public string Pvo { get; set; }
/// <summary>
/// ПГР
/// </summary>
public string Pgr { get; set; }
/// <summary>
/// ГИС
/// </summary>
public string Gis { get; set; }
/// <summary>
/// ОЗЦ
/// </summary>
public string Ozc { get; set; }
/// <summary>
/// Тех. работы
/// </summary>
public string EngineeringWorks { get; set; }
/// <summary>
/// Снятие замера
/// </summary>
public string TakingMeasure { get; set; }
/// <summary>
/// Цементирование
/// </summary>
public string Cementing { get; set; }
/// <summary>
/// Простой
/// </summary>
public string Simple { get; set; }
/// <summary>
/// НПВ
/// </summary>
public string Npv { get; set; }
}
}

View File

@ -1,216 +0,0 @@
using System;
using System.Collections.Generic;
namespace AsbCloudApp.Data
{
/// <summary>
/// Параметры для формирования суточного рапорта
/// </summary>
public class DailyReportDto
{
/// <summary>
/// название скважины
/// </summary>
public string WellName { get; set; }
/// <summary>
/// название куста
/// </summary>
public string ClusterName { get; set; }
/// <summary>
/// заказчик
/// </summary>
public string Customer { get; set; }
/// <summary>
/// подрядчик
/// </summary>
public string Contractor { get; set; }
/// <summary>
/// дата рапорта
/// </summary>
public DateTime ReportDate { get; set; }
/// <summary>
/// глубина забоя на дату начала интервала
/// </summary>
public double? WellDepthIntervalStartDate { get; set; }
/// <summary>
/// глубина забоя на дату окончания интервала
/// </summary>
public double? WellDepthIntervalFinishDate { get; set; }
/// <summary>
/// Глубина забоя по стволу на окончание отчетного периода
/// </summary>
public double? BottomholeDepth { get; set; }
/// <summary>
/// Глубина забоя по вертикали на дату окончания отчетного периода
/// </summary>
public double? VerticalDepth { get; set; }
/// <summary>
/// Зенитный угол на дату окончания отчетного периода
/// </summary>
public double? ZenithAngle { get; set; }
/// <summary>
/// Азимутальный угол на дату окончания отчетного периода
/// </summary>
public double? AzimuthAngle { get; set; }
/// <summary>
/// ФИО бурильщиков
/// </summary>
public string FirstDriller { get; set; }
/// <summary>
/// ФИО бурильщиков
/// </summary>
public string SecondDriller { get; set; }
/// <summary>
/// Время работы АПД
/// </summary>
public double? WorkTimeSAUB { get; set; }
/// <summary>
/// Время работы спин мастер
/// </summary>
public double? WorkTimeSpinMaster { get; set; }
/// <summary>
/// Время работы torqueMaster
/// </summary>
public double? WorkTimeTorkMaster { get; set; }
/// <summary>
/// количество метров пробуренных с включенным АПД
/// </summary>
public double? PenetrationSAUB { get; set; }
/// <summary>
/// количество метров пробуренных с включенным Спин мастер
/// </summary>
public double? PenetrationSpinMaster { get; set; }
/// <summary>
/// количество метров пробуренных с включенным torqueMaster
/// </summary>
public double? PenetrationTorkMaster { get; set; }
/// <summary>
/// Количество запусков МСЕ
/// </summary>
public int CountLaunchesMSE { get; set; }
/// <summary>
/// КНБК описание
/// </summary>
public string BHADescription { get; set; }
/// <summary>
/// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию
/// </summary>
public double? StandardTimeBarrelPreparation { get; set; }
/// <summary>
/// Нормативное время на одну операцию по наращиванию
/// </summary>
public double? StandardTimeExtension { get; set; }
/// <summary>
/// Фактическое время проработок при подготовке ствола скважины к наращиванию.
/// </summary>
public double? ActualTimeBarrelPreparation { get; set; }
/// <summary>
/// Фактическое время наращиваний
/// </summary>
public double? ActualTimeExtension { get; set; }
/// <summary>
/// Режимы бурения в роторе
/// </summary>
public IEnumerable<string> RotorDrillingModes { get; set; }
/// <summary>
/// режимы бурения в слайде
/// </summary>
public IEnumerable<string> SlideDrillingModes { get; set; }
/// <summary>
/// Количество метров пробуренных в роторе за отчетный период
/// </summary>
public double? PenetrationInRotor { get; set; }
/// <summary>
/// Количество часов бурения в роторе за отчетный период
/// </summary>
public double? NumberDrillingHours { get; set; }
/// <summary>
/// средний диф перепад в роторе за отчетный период
/// </summary>
public double? AVGDiffDropRotor { get; set; }
/// <summary>
/// количество метров пробуренных в слайде за отчетный период
/// </summary>
public double? PenetrationInSlide { get; set; }
/// <summary>
/// время бурения в роторе за отчетный период
/// </summary>
public double? DrillingTimeInRotor { get; set; }
/// <summary>
/// средний диф. перепад в слайде за отчетный период
/// </summary>
public double? AVGDiffPressureSlide { get; set; }
/// <summary>
/// Плановая МСП за секцию
/// </summary>
public double? SectionROPPlan { get; set; }
/// <summary>
/// Общее время бурения за секцию
/// </summary>
public double? SectionDrillingTimeTotal { get; set; }
/// <summary>
/// Общая проходка за секцию
/// </summary>
public double? SectionPenetrationTotal { get; set; }
/// <summary>
/// Количество наращиваний за отчетный период
/// </summary>
public int ExtensionsCount { get; set; }
/// <summary>
/// Отклонение относительно ГГД
/// </summary>
public double? DeviationFromTVD { get; set; }
/// <summary>
/// указываются все причины, которые влияют на снижение МСП.
/// </summary>
public string DeclinesReasonsROP { get; set; }
/// <summary>
/// ФИО Мастера буровой
/// </summary>
public string DrillingMaster { get; set; }
/// <summary>
/// ФИО супервайзера
/// </summary>
public string Supervisor { get; set; }
}
}

View File

@ -1,12 +1,10 @@
using System.Collections.Generic;
namespace AsbCloudApp.Data
namespace AsbCloudApp.Data.DetectedOperation
{
#nullable enable
/// <summary>
/// Статистика по операциям бурильщика
/// </summary>
public class DetectedOperationStatDto
public class DetectedOperationDrillersStatDto
{
/// <summary>
/// Бурильщик
@ -38,18 +36,5 @@ namespace AsbCloudApp.Data
/// </summary>
public double? Loss { get; set; }
}
/// <summary>
/// Автоматически определяемая операция
/// </summary>
public class DetectedOperationListDto
{
/// <summary>
/// Список всех операций
/// </summary>
public IEnumerable<DetectedOperationDto> Operations { get; set; }
public IEnumerable<DetectedOperationStatDto> Stats { get; set; }
}
#nullable disable
}

View File

@ -1,6 +1,6 @@
using System;
namespace AsbCloudApp.Data
namespace AsbCloudApp.Data.DetectedOperation
{
#nullable enable
/// <summary>
@ -52,12 +52,12 @@ namespace AsbCloudApp.Data
/// <summary>
/// название/описание операции
/// </summary>
public WellOperationCategoryDto OperationCategory { get; set; }
public WellOperationCategoryDto OperationCategory { get; set; } = null!;
/// <summary>
/// Пользователь панели оператора
/// </summary>
public string TelemetryUserName { get; set; }
public string? TelemetryUserName { get; set; }
/// <summary>
/// Бурильщик

View File

@ -0,0 +1,22 @@
using System.Collections.Generic;
namespace AsbCloudApp.Data.DetectedOperation
{
/// <summary>
/// Автоматически определяемая операция
/// </summary>
public class DetectedOperationListDto
{
/// <summary>
/// Список всех операций
/// </summary>
public IEnumerable<DetectedOperationDto> Operations { get; set; }
/// <summary>
/// Статистика по бурильщикам
/// </summary>
public IEnumerable<DetectedOperationDrillersStatDto> Stats { get; set; }
}
#nullable disable
}

View File

@ -0,0 +1,60 @@
namespace AsbCloudApp.Data.DetectedOperation
{
#nullable enable
/// <summary>
/// Статистика по операциям например за период.
/// </summary>
public class DetectedOperationStatDto
{
/// <summary>
/// Id названия/описания операции
/// </summary>
public int IdCategory { get; set; }
/// <summary>
/// Название операции
/// </summary>
public string Category { get; set; } = string.Empty;
/// <summary>
/// Количество операций
/// </summary>
public int Count { get; set; }
/// <summary>
/// Среднее по ключевому показателю
/// </summary>
public double ValueAverage { get; set; }
/// <summary>
/// Мин по ключевому показателю
/// </summary>
public double ValueMin { get; set; }
/// <summary>
/// Макс по ключевому показателю
/// </summary>
public double ValueMax { get; set; }
/// <summary>
/// Суммарное время операций, мин
/// </summary>
public double MinutesTotal { get; set; }
/// <summary>
/// Мин продолжительность операции, мин
/// </summary>
public double MinutesMin { get; set; }
/// <summary>
/// Макс продолжительность операции, мин
/// </summary>
public double MinutesMax { get; set; }
/// <summary>
/// Средняя продолжительность операции, мин
/// </summary>
public double MinutesAverage { get; set; }
}
#nullable disable
}

View File

@ -120,5 +120,32 @@ namespace AsbCloudApp.Data
/// <inheritdoc/>
public int CompareTo(TimeDto other)
=> TotalSeconds - other.TotalSeconds;
/// <inheritdoc/>
public override bool Equals(object obj)
{
if (ReferenceEquals(this, obj))
{
return true;
}
if (obj is null)
{
return false;
}
if (obj is TimeDto objTime)
{
return objTime == this;
}
return false;
}
/// <inheritdoc/>
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}

View File

@ -1,4 +1,6 @@
namespace AsbCloudApp.Data
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data
{
/// <summary>
/// DTO категория операции
@ -17,5 +19,17 @@
/// код операции
/// </summary>
public int Code { get; set; }
/// <summary>
/// Название ключевого показателя операции
/// </summary>
[StringLength(32)]
public string KeyValueName { get; set; }
/// <summary>
/// Единицы измерения ключевого показателя операции
/// </summary>
[StringLength(16)]
public string KeyValueUnits { get; set; }
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Requests
@ -15,10 +16,9 @@ namespace AsbCloudApp.Requests
public int IdWell { get; set; }
/// <summary>
/// категория операций
/// категории операций
/// </summary>
[Required]
public int IdCategory { get; set; }
public IEnumerable<int> IdsCategories { get; set; }
/// <summary>
/// Больше или равно дате

View File

@ -5,14 +5,49 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
/// <summary>
/// Сервис авторизации
/// </summary>
public interface IAuthService
{
/// <summary>
/// Смена пароля пользователю
/// </summary>
/// <param name="idUser"></param>
/// <param name="newPassword"></param>
/// <returns></returns>
int ChangePassword(int idUser, string newPassword);
/// <summary>
/// Смена пароля пользователю
/// </summary>
/// <param name="userLogin"></param>
/// <param name="newPassword"></param>
/// <returns></returns>
int ChangePassword(string userLogin, string newPassword);
/// <summary>
/// Авторизация
/// </summary>
/// <param name="login"></param>
/// <param name="password"></param>
/// <param name="token">токен отмены задачи</param>
/// <returns></returns>
Task<UserTokenDto> LoginAsync(string login,
string password, CancellationToken token = default);
/// <summary>
/// Обновление токена авторизации
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
string Refresh(ClaimsPrincipal user);
/// <summary>
/// Регистрация нового пользователя
/// </summary>
/// <param name="userDto"></param>
/// <returns></returns>
int Register(UserRegistrationDto userDto);
}
}

View File

@ -4,19 +4,47 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
/// <summary>
/// Сервис выстраивает очередь из фоновых задач. Ограничивает количество одновременно выполняющихся задач.
/// </summary>
public interface IBackgroundWorkerService
{
/// <summary>
/// Проверка, есть ли задача в очереди
/// </summary>
/// <param name="id">идентификатор задачи</param>
/// <returns></returns>
bool Contains(string id);
/// <summary>
/// Добавляет в очередь задач новую задачу
/// </summary>
/// <param name="id">id задачи в очереди</param>
/// <param name="id">идентификатор задачи</param>
/// <param name="func">делегат</param>
/// <returns>id задачи в очереди</returns>
string Enqueue(string id, Func<string, CancellationToken, Task> func);
/// <summary>
/// Добавляет в очередь задач новую задачу
/// </summary>
/// <param name="func"></param>
/// <returns></returns>
string Enqueue(Func<string, CancellationToken, Task> func);
/// <summary>
/// Добавляет в очередь задач новую задачу
/// </summary>
/// <param name="id">идентификатор задачи</param>
/// <param name="func"></param>
/// <param name="onError"></param>
/// <returns></returns>
string Enqueue(string id, Func<string, CancellationToken, Task> func, Func<string, Exception, CancellationToken, Task> onError);
/// <summary>
/// Пробуем удалить задачу по идентификатору
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
bool TryRemove(string id);
}
}

View File

@ -5,16 +5,57 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
//TODO: remove unused methods
/// <summary>
/// Сервис информации о кустах
/// </summary>
public interface IClusterService
{
/// <summary>
/// список месторождений
/// </summary>
/// <param name="idCompany"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<DepositDto>> GetDepositsAsync(int idCompany,
CancellationToken token);
/// <summary>
/// Список кустов с заполненными параметрами бурения
/// </summary>
/// <param name="idCompany"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<DepositDto>> GetDepositsDrillParamsAsync(int idCompany,
CancellationToken token = default);
/// <summary>
/// Список кустов месторождения доступных компании
/// </summary>
/// <param name="idCompany"></param>
/// <param name="depositId"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<ClusterDto>> GetClustersAsync(int idCompany,
int depositId, CancellationToken token);
/// <summary>
/// Список кустов доступных компании
/// </summary>
/// <param name="idCompany"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<ClusterDto>> GetClustersAsync(int idCompany,
CancellationToken token);
/// <summary>
/// Список скважин доступных компании
/// </summary>
/// <param name="idCompany"></param>
/// <param name="clusterId"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<WellDto>> GetWellsAsync(int idCompany,
int clusterId, CancellationToken token);
}

View File

@ -1,4 +1,4 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.DailyReport;
using System;
using System.Collections.Generic;
using System.IO;
@ -7,8 +7,12 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
/// <summary>
/// Суточный рапорт (сводка)
/// </summary>
public interface IDailyReportService
{
{
Task<IEnumerable<DailyReportDto>> GetListAsync(int idWell, DateTime? v1, DateTime? v2, CancellationToken cancellationToken);
Task<DailyReportDto> GetOrGenerateAsync(int idWell, DateTime date, CancellationToken token);
Task<int> AddAsync(int idWell, DailyReportDto dto, CancellationToken token = default);

View File

@ -1,15 +1,59 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.DetectedOperation;
using AsbCloudApp.Requests;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
#nullable enable
/// <summary>
/// Сервис автоматически определенных по телеметрии операций
/// </summary>
public interface IDetectedOperationService
{
Task<IEnumerable<WellOperationCategoryDto>> GetCategoriesAsync(int? idWell, CancellationToken token);
Task<DetectedOperationListDto> GetAsync(DetectedOperationRequest request, CancellationToken token);
/// <summary>
/// Список названий операций.
/// Если указан idWell, то возвращается список названий операций найденных на указанной скважине.
/// </summary>
/// <param name="idWell"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<WellOperationCategoryDto>?> GetCategoriesAsync(int? idWell, CancellationToken token);
/// <summary>
/// Получить автоматически определенные по телеметрии операции с анализом по бурильщикам
/// </summary>
/// <param name="request"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<DetectedOperationListDto?> GetAsync(DetectedOperationRequest request, CancellationToken token);
/// <summary>
/// Удалить операции
/// </summary>
/// <param name="request"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> DeleteAsync(DetectedOperationRequest request, CancellationToken token);
/// <summary>
/// Статистика по операциям
/// </summary>
/// <param name="request"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<DetectedOperationStatDto>?> GetOperationsStatAsync(DetectedOperationRequest request, CancellationToken token);
/// <summary>
/// Выгрузка в Excel
/// </summary>
/// <param name="idsWells"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<Stream> ExportAsync(IEnumerable<int> idsWells, CancellationToken token);
}
#nullable disable
}

View File

@ -6,8 +6,18 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
/// <summary>
/// ÐÒÊ
/// </summary>
public interface IDrillFlowChartService : ICrudWellRelatedService<DrillFlowChartDto>
{
/// <summary>
/// Ïîëó÷èòü ïàðàìåòðû áóðåíèÿ íà÷èíàÿ ñ äàòû.
/// </summary>
/// <param name="idWell"></param>
/// <param name="updateFrom"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<DrillFlowChartDto>> GetAllAsync(int idWell,
DateTime updateFrom, CancellationToken token = default);
}

View File

@ -2,6 +2,9 @@
namespace AsbCloudApp.Services
{
/// <summary>
/// Сервис добавления бурильщиков
/// </summary>
public interface IDrillerService : ICrudService<DrillerDto>
{

View File

@ -5,19 +5,109 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
/// <summary>
/// Программа бурения
/// </summary>
public interface IDrillingProgramService
{
/// <summary>
/// Получить пользователей доступных для назначения в публикаторы или акцепторы
/// </summary>
/// <param name="idWell"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<UserDto>> GetAvailableUsers(int idWell, CancellationToken token = default);
/// <summary>
/// Части программы бурения
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<FileCategoryDto>> GetCategoriesAsync(CancellationToken token = default);
/// <summary>
/// Состояние программы бурения
/// </summary>
/// <param name="idWell"></param>
/// <param name="idUser"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<DrillingProgramStateDto> GetStateAsync(int idWell, int idUser,
CancellationToken token = default);
/// <summary>
/// Загрузить файл
/// </summary>
/// <param name="idWell"></param>
/// <param name="idFileCategory"></param>
/// <param name="idUser"></param>
/// <param name="fileFullName"></param>
/// <param name="fileStream"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> AddFile(int idWell, int idFileCategory, int idUser, string fileFullName, System.IO.Stream fileStream, CancellationToken token = default);
/// <summary>
/// Добавить часть программы бурения
/// </summary>
/// <param name="idWell"></param>
/// <param name="idFileCategories"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> AddPartsAsync(int idWell, IEnumerable<int> idFileCategories, CancellationToken token = default);
/// <summary>
/// Удалить часть программы бурения
/// </summary>
/// <param name="idWell"></param>
/// <param name="idFileCategories"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> RemovePartsAsync(int idWell, IEnumerable<int> idFileCategories, CancellationToken token = default);
/// <summary>
/// Назначить пользователю роль
/// </summary>
/// <param name="idWell"></param>
/// <param name="idFileCategory"></param>
/// <param name="idUser"></param>
/// <param name="idUserRole"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> AddUserAsync(int idWell, int idFileCategory, int idUser, int idUserRole, CancellationToken token = default);
/// <summary>
/// Удалить пользователя
/// </summary>
/// <param name="idWell"></param>
/// <param name="idFileCategory"></param>
/// <param name="idUser"></param>
/// <param name="idUserRole"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> RemoveUserAsync(int idWell, int idFileCategory, int idUser, int idUserRole, CancellationToken token = default);
/// <summary>
/// Добавить или изменить отметку для файла (согласование/отклонение)
/// </summary>
/// <param name="fileMarkDto"></param>
/// <param name="idUser"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> AddOrReplaceFileMarkAsync(FileMarkDto fileMarkDto, int idUser, CancellationToken token);
/// <summary>
/// Удалить отметку с файла
/// </summary>
/// <param name="idFileMark"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> MarkAsDeletedFileMarkAsync(int idFileMark, CancellationToken token);
/// <summary>
/// Сбросить ошибку формирования
/// </summary>
/// <param name="idWell"></param>
void ClearError(int idWell);
}
}

View File

@ -2,9 +2,25 @@
namespace AsbCloudApp.Services
{
/// <summary>
/// Сервис отправки сообщений
/// </summary>
public interface IEmailService
{
/// <summary>
/// добавить сообщение на отправку нескольким пользователям
/// </summary>
/// <param name="addresses"></param>
/// <param name="subject"></param>
/// <param name="htmlBody"></param>
void EnqueueSend(IEnumerable<string> addresses, string subject, string htmlBody);
/// <summary>
/// добавить сообщение на отправку одному пользователю
/// </summary>
/// <param name="address"></param>
/// <param name="subject"></param>
/// <param name="htmlBody"></param>
void EnqueueSend(string address, string subject, string htmlBody);
}
}

View File

@ -5,8 +5,18 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
/// <summary>
/// Сервис сохранения списка сообщений от панелей
/// </summary>
public interface IEventService
{
/// <summary>
/// Сохранить. Добавить или заменить.
/// </summary>
/// <param name="uid"></param>
/// <param name="dtos"></param>
/// <param name="token"></param>
/// <returns></returns>
Task UpsertAsync(string uid, IEnumerable<EventDto> dtos,
CancellationToken token = default);
}

View File

@ -7,35 +7,178 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
//TODO: refactor IFileService
/// <summary>
/// Сервис доступа к файлам
/// </summary>
public interface IFileService
{
/// <summary>
/// Директория хранения файлов
/// </summary>
string RootPath { get; }
/// <summary>
/// получить url Google drive
/// </summary>
/// <param name="idFileInfo"></param>
/// <param name="idUser"></param>
/// <param name="fileShareService"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<string> GetSharedUrlAsync(int idFileInfo, int idUser, IFileShareService fileShareService, CancellationToken token);
/// <summary>
/// получить url Google drive
/// </summary>
/// <param name="dto"></param>
/// <param name="idUser"></param>
/// <param name="fileShareService"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<string> GetSharedUrlAsync(FileInfoDto dto, int idUser, IFileShareService fileShareService,
CancellationToken token = default);
/// <summary>
/// Сохранить файл
/// </summary>
/// <param name="idWell"></param>
/// <param name="idUser"></param>
/// <param name="idCategory"></param>
/// <param name="fileFullName"></param>
/// <param name="fileStream"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<FileInfoDto> SaveAsync(int idWell, int? idUser, int idCategory, string fileFullName, Stream fileStream, CancellationToken token = default);
/// <summary>
/// Получить список файлов в контейнере
/// </summary>
/// <param name="idWell"></param>
/// <param name="idCategory"></param>
/// <param name="companyName"></param>
/// <param name="fileName"></param>
/// <param name="begin"></param>
/// <param name="end"></param>
/// <param name="skip"></param>
/// <param name="take"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<PaginationContainer<FileInfoDto>> GetInfosAsync(int idWell,
int idCategory, string companyName = default, string fileName = default, DateTime begin = default, DateTime end = default,
int skip = 0, int take = 32, CancellationToken token = default);
/// <summary>
/// Инфо о файле
/// </summary>
/// <param name="idFile"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<FileInfoDto> GetInfoAsync(int idFile,
CancellationToken token);
/// <summary>
/// Пометить файл как удаленный
/// </summary>
/// <param name="idFile"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> MarkAsDeletedAsync(int idFile,
CancellationToken token = default);
/// <summary>
/// Получить файлы определенной категории
/// </summary>
/// <param name="idWell"></param>
/// <param name="idCategory"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<FileInfoDto>> GetInfosByCategoryAsync(int idWell, int idCategory, CancellationToken token = default);
/// <summary>
/// удалить файл
/// </summary>
/// <param name="id"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> DeleteAsync(int id, CancellationToken token);
/// <summary>
/// удалить файлы
/// </summary>
/// <param name="ids"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> DeleteAsync(IEnumerable<int> ids, CancellationToken token);
/// <summary>
/// получить путь для скачивания
/// </summary>
/// <param name="fileInfo"></param>
/// <returns></returns>
string GetUrl(FileInfoDto fileInfo);
/// <summary>
/// получить путь для скачивания
/// </summary>
/// <param name="idFile"></param>
/// <returns></returns>
string GetUrl(int idFile);
/// <summary>
/// получить путь для скачивания
/// </summary>
/// <param name="idWell"></param>
/// <param name="idCategory"></param>
/// <param name="idFile"></param>
/// <param name="dotExtention"></param>
/// <returns></returns>
string GetUrl(int idWell, int idCategory, int idFile, string dotExtention);
/// <summary>
/// добавить метку на файл
/// </summary>
/// <param name="fileMarkDto"></param>
/// <param name="idUser"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> CreateFileMarkAsync(FileMarkDto fileMarkDto, int idUser, CancellationToken token);
/// <summary>
/// пометить метку файла как удаленную
/// </summary>
/// <param name="idMark"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> MarkFileMarkAsDeletedAsync(int idMark, CancellationToken token);
/// <summary>
/// переместить файл
/// </summary>
/// <param name="idWell"></param>
/// <param name="idUser"></param>
/// <param name="idCategory"></param>
/// <param name="destinationFileName"></param>
/// <param name="srcFileFullName"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<FileInfoDto> MoveAsync(int idWell, int? idUser, int idCategory, string destinationFileName, string srcFileFullName, CancellationToken token = default);
/// <summary>
/// получить инфо о файле по метке
/// </summary>
/// <param name="idMark"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<FileInfoDto> GetByMarkId(int idMark, CancellationToken token);
/// <summary>
/// пометить метки файлов как удаленные
/// </summary>
/// <param name="idsMarks"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> MarkFileMarkAsDeletedAsync(IEnumerable<int> idsMarks, CancellationToken token);
}
}

View File

@ -3,11 +3,29 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
//TODO: Óäàëèòü ýòîò ôóíêöèîíàë
/// <summary>
/// Ñåðâèñ âûêëàäûâàíèÿ ôàéëà íà Google disk
/// </summary>
public interface IFileShareService
{
/// <summary>
/// Îïóáëèêîâàòü
/// </summary>
/// <param name="filePath"></param>
/// <param name="originalName"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<string> PublishFileToCloudAsync(string filePath, string originalName,
CancellationToken token);
/// <summary>
/// Óäàëèòü ïóáëèêàöèþ
/// </summary>
/// <param name="sharedFileId"></param>
/// <param name="token"></param>
/// <returns></returns>
Task DeleteFileAsync(string sharedFileId,
CancellationToken token = default);
}

View File

@ -5,14 +5,70 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
/// <summary>
/// Сервис хранения результатов лабораторных анализов и измерений
/// </summary>
public interface IMeasureService
{
/// <summary>
/// Категории измерений
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
Task<Dictionary<int, string>> GetCategoriesAsync(CancellationToken token);
/// <summary>
/// Последние измерения по категории
/// </summary>
/// <param name="idWell"></param>
/// <param name="idCategory"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<MeasureDto> GetLastAsync(int idWell, int idCategory, CancellationToken token);
/// <summary>
/// История измерений по категории
/// </summary>
/// <param name="idWell"></param>
/// <param name="idCategory"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<MeasureDto>> GetHisoryAsync(int idWell, int? idCategory, CancellationToken token);
/// <summary>
/// Добавить измерение
/// </summary>
/// <param name="idWell"></param>
/// <param name="data"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> InsertAsync(int idWell, MeasureDto data, CancellationToken token);
/// <summary>
/// Редактировать
/// </summary>
/// <param name="idWell"></param>
/// <param name="data"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> UpdateAsync(int idWell, MeasureDto data, CancellationToken token);
/// <summary>
/// Пометить удаленным
/// </summary>
/// <param name="idWell"></param>
/// <param name="idData"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> MarkAsDeleteAsync(int idWell, int idData, CancellationToken token);
/// <summary>
/// Удалить
/// </summary>
/// <param name="idWell"></param>
/// <param name="idData"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<int> DeleteAsync(int idWell, int idData, CancellationToken token);
}
}

View File

@ -0,0 +1,15 @@
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
public interface IUserSettingsRepository
{
public const int ErrorKeyNotFound = -1;
public const int ErrorKeyIsUsed = -2;
Task<object> GetOrDefaultAsync(int userId, string key, CancellationToken token);
Task<int> InsertAsync(int userId, string key, object value, CancellationToken token);
Task<int> UpdateAsync(int userId, string key, object value, CancellationToken token);
Task<int> DeleteAsync(int userId, string key, CancellationToken token);
}
}

View File

@ -17,4 +17,7 @@
<Folder Include="Model\WITS\" />
</ItemGroup>
<ItemGroup>
<None Remove="Model\DailyReport\" />
</ItemGroup>
</Project>

View File

@ -65,7 +65,7 @@ namespace AsbCloudDb
{
var factory = GetQueryStringFactory(dbSet);
var query = factory.MakeInsertOrUpdateSql(items);
return database.ExecuteSqlRawAsync(query, token);
}
@ -130,7 +130,10 @@ namespace AsbCloudDb
pk = pkColsNames is null ? string.Empty : $"({string.Join(", ", pkColsNames)})";
TableName = dbset.EntityType.GetTableName()!;
getters = properties.Select(p => p.GetGetter());
getters = properties
.Where(p => !p.IsShadowProperty())
.Select(p => p.GetGetter()).ToList();
Columns = properties.Select(p => $"\"{p.GetColumnBaseName()}\"");
var colunmsString = $"({string.Join(", ", Columns)})";
@ -175,13 +178,21 @@ namespace AsbCloudDb
private static string FormatValue(object? v)
=> v switch
{
string vStr => $"'{vStr}'",
string vStr => $"'{EscapeCurlyBraces(vStr)}'",
DateTime vDate => $"'{FormatDateValue(vDate)}'",
DateTimeOffset vDate => $"'{FormatDateValue(vDate.UtcDateTime)}'",
IFormattable vFormattable => FormatFormattableValue(vFormattable),
_ => System.Text.Json.JsonSerializer.Serialize(v),
};
private static string EscapeCurlyBraces(string vStr)
{
var result = vStr
.Replace("{", "{{")
.Replace("}", "}}");
return result;
}
private static string FormatFormattableValue(IFormattable v)
=> v switch
{

View File

@ -7,6 +7,7 @@ namespace AsbCloudDb.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_user_t_user_role_id_role",
table: "t_user");

View File

@ -1,6 +1,6 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
#nullable disable

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Remove_DailyReportData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("DELETE FROM t_daily_report", true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,185 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Rename_WITS_base_table : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_1_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_1");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_50_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_50");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_60_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_60");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_61_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_61");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_7_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_7");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_8_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_8");
migrationBuilder.DropPrimaryKey(
name: "PK_RecordBase",
table: "RecordBase");
migrationBuilder.RenameTable(
name: "RecordBase",
newName: "t_telemetry_wits_base");
migrationBuilder.AddPrimaryKey(
name: "PK_t_telemetry_wits_base",
table: "t_telemetry_wits_base",
columns: new[] { "id_telemetry", "date" });
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_1_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_1",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_50_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_50",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_60_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_60",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_61_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_61",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_7_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_7",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_8_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_8",
columns: new[] { "id_telemetry", "date" },
principalTable: "t_telemetry_wits_base",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_1_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_1");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_50_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_50");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_60_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_60");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_61_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_61");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_7_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_7");
migrationBuilder.DropForeignKey(
name: "FK_t_telemetry_wits_8_t_telemetry_wits_base_id_telemetry_date",
table: "t_telemetry_wits_8");
migrationBuilder.DropPrimaryKey(
name: "PK_t_telemetry_wits_base",
table: "t_telemetry_wits_base");
migrationBuilder.RenameTable(
name: "t_telemetry_wits_base",
newName: "RecordBase");
migrationBuilder.AddPrimaryKey(
name: "PK_RecordBase",
table: "RecordBase",
columns: new[] { "id_telemetry", "date" });
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_1_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_1",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_50_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_50",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_60_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_60",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_61_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_61",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_7_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_7",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_telemetry_wits_8_RecordBase_id_telemetry_date",
table: "t_telemetry_wits_8",
columns: new[] { "id_telemetry", "date" },
principalTable: "RecordBase",
principalColumns: new[] { "id_telemetry", "date" },
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_Well_operation_Flashing : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[] { 20, 0, "Промывка перед наращиванием" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 20);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_Well_operation_StaticSurveying : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 20,
column: "name",
value: "Промывка перед наращиванием");
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[] { 21, 0, "Статический замер телесистемы" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 21);
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 20,
column: "name",
value: "Шаблонировка перед наращиванием");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_user_settings : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_user_settings",
columns: table => new
{
idUser = table.Column<int>(type: "integer", nullable: false),
key = table.Column<string>(type: "text", nullable: false, comment: "Ключ настроек пользователя"),
setting_value = table.Column<object>(type: "jsonb", nullable: true, comment: "Значение настроек пользователя")
},
constraints: table =>
{
table.PrimaryKey("PK_t_user_settings", x => new { x.idUser, x.key });
table.ForeignKey(
name: "FK_t_user_settings_t_user_idUser",
column: x => x.idUser,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "настройки интерфейса пользователя");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_user_settings");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_user_settings_key_size_limit : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "key",
table: "t_user_settings",
type: "character varying(255)",
maxLength: 255,
nullable: false,
comment: "Ключ настроек пользователя",
oldClrType: typeof(string),
oldType: "text",
oldComment: "Ключ настроек пользователя");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "key",
table: "t_user_settings",
type: "text",
nullable: false,
comment: "Ключ настроек пользователя",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldComment: "Ключ настроек пользователя");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class UserSettings_rename_idUser : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_user_settings_t_user_idUser",
table: "t_user_settings");
migrationBuilder.RenameColumn(
name: "idUser",
table: "t_user_settings",
newName: "id_user");
migrationBuilder.AddForeignKey(
name: "FK_t_user_settings_t_user_id_user",
table: "t_user_settings",
column: "id_user",
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_user_settings_t_user_id_user",
table: "t_user_settings");
migrationBuilder.RenameColumn(
name: "id_user",
table: "t_user_settings",
newName: "idUser");
migrationBuilder.AddForeignKey(
name: "FK_t_user_settings_t_user_idUser",
table: "t_user_settings",
column: "idUser",
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_new_operation : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[] { 22, 0, "Промывка" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 22);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,550 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Mod_structure_of_WellOperation : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "key_value_name",
table: "t_well_operation_category",
type: "character varying(32)",
maxLength: 32,
nullable: true,
comment: "Название ключевого показателя операции");
migrationBuilder.AddColumn<string>(
name: "key_value_units",
table: "t_well_operation_category",
type: "character varying(16)",
maxLength: 16,
nullable: true,
comment: "Единицы измерения ключевого показателя операции");
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 2,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "МСП", "м/ч" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 3,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "МСП", "м/ч" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 4,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 5,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 6,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 7,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 8,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 9,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 10,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 11,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 12,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 13,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 14,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 15,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 16,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 17,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 18,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 19,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 20,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 21,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 22,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1001,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "МСП", "м/ч" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1002,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1003,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1004,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1005,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1006,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1007,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1008,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1011,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1012,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1013,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1014,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1015,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1016,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1017,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1018,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1019,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1020,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1021,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1022,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1023,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1024,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1025,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1026,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1027,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1028,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1029,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1030,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1031,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1032,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1033,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1034,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1035,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1037,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1038,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1039,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1040,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1041,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1042,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1043,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1044,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1045,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1046,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1047,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1048,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1050,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1051,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1052,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1053,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1054,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1055,
columns: new[] { "key_value_name", "key_value_units" },
values: new object[] { "Продолжительность", "мин" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "key_value_name",
table: "t_well_operation_category");
migrationBuilder.DropColumn(
name: "key_value_units",
table: "t_well_operation_category");
}
}
}

View File

@ -136,7 +136,7 @@ namespace AsbCloudDb.Migrations
});
});
modelBuilder.Entity("AsbCloudDb.Model.DailyReport", b =>
modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b =>
{
b.Property<int>("IdWell")
.HasColumnType("integer")
@ -3965,6 +3965,30 @@ namespace AsbCloudDb.Migrations
});
});
modelBuilder.Entity("AsbCloudDb.Model.UserSetting", b =>
{
b.Property<int>("IdUser")
.HasColumnType("integer")
.HasColumnName("id_user");
b.Property<string>("Key")
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("key")
.HasComment("Ключ настроек пользователя");
b.Property<object>("Value")
.HasColumnType("jsonb")
.HasColumnName("setting_value")
.HasComment("Значение настроек пользователя");
b.HasKey("IdUser", "Key");
b.ToTable("t_user_settings");
b.HasComment("настройки интерфейса пользователя");
});
modelBuilder.Entity("AsbCloudDb.Model.Well", b =>
{
b.Property<int>("Id")
@ -4141,6 +4165,18 @@ namespace AsbCloudDb.Migrations
.HasColumnName("code")
.HasComment("Код операции");
b.Property<string>("KeyValueName")
.HasMaxLength(32)
.HasColumnType("character varying(32)")
.HasColumnName("key_value_name")
.HasComment("Название ключевого показателя операции");
b.Property<string>("KeyValueUnits")
.HasMaxLength(16)
.HasColumnType("character varying(16)")
.HasColumnName("key_value_units")
.HasComment("Единицы измерения ключевого показателя операции");
b.Property<string>("Name")
.HasColumnType("text")
.HasColumnName("name")
@ -4157,420 +4193,584 @@ namespace AsbCloudDb.Migrations
{
Id = 1,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Невозможно определить операцию"
},
new
{
Id = 2,
Code = 0,
KeyValueName = "МСП",
KeyValueUnits = "м/ч",
Name = "Роторное бурение"
},
new
{
Id = 3,
Code = 0,
KeyValueName = "МСП",
KeyValueUnits = "м/ч",
Name = "Слайдирование"
},
new
{
Id = 4,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Подъем с проработкой"
},
new
{
Id = 5,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Спуск с проработкой"
},
new
{
Id = 6,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Подъем с промывкой"
},
new
{
Id = 7,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Спуск с промывкой"
},
new
{
Id = 8,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Спуск в скважину"
},
new
{
Id = 9,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Спуск с вращением"
},
new
{
Id = 10,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Подъем из скважины"
},
new
{
Id = 11,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Подъем с вращением"
},
new
{
Id = 12,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Промывка в покое"
},
new
{
Id = 13,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Промывка с вращением"
},
new
{
Id = 14,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Удержание в клиньях"
},
new
{
Id = 15,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Неподвижное состояние"
},
new
{
Id = 16,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Вращение без циркуляции"
},
new
{
Id = 17,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "На поверхности"
},
new
{
Id = 18,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Проработка перед наращиванием"
},
new
{
Id = 19,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Шаблонировка перед наращиванием"
},
new
{
Id = 20,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Промывка перед наращиванием"
},
new
{
Id = 21,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Статический замер телесистемы"
},
new
{
Id = 22,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Промывка"
},
new
{
Id = 1001,
Code = 0,
KeyValueName = "МСП",
KeyValueUnits = "м/ч",
Name = "Бурение"
},
new
{
Id = 1002,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "ГИС"
},
new
{
Id = 1003,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "ГФР"
},
new
{
Id = 1004,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Монтаж ПВО"
},
new
{
Id = 1005,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Демонтаж ПВО"
},
new
{
Id = 1006,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Установка ФА"
},
new
{
Id = 1007,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Оборудование устья"
},
new
{
Id = 1008,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "ОЗЦ"
},
new
{
Id = 1011,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Начало цикла строительства скважины"
},
new
{
Id = 1012,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Окончание цикла строительства скважины"
},
new
{
Id = 1013,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Опрессовка ПВО"
},
new
{
Id = 1014,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Опрессовка Ц.К."
},
new
{
Id = 1015,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Опрессовка ВЗД"
},
new
{
Id = 1016,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Перевод скв на другой тип промывочной жидкости"
},
new
{
Id = 1017,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Перезапись каротажа"
},
new
{
Id = 1018,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Перетяжка талевого каната"
},
new
{
Id = 1019,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Наращивание, промывка"
},
new
{
Id = 1020,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Подъем инструмента"
},
new
{
Id = 1021,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Подъем инструмента с промывкой"
},
new
{
Id = 1022,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Обратная проработка"
},
new
{
Id = 1023,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Сборка инструмента с мостков"
},
new
{
Id = 1024,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Подготовительные работы"
},
new
{
Id = 1025,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Сборка КНБК"
},
new
{
Id = 1026,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Разборка КНБК"
},
new
{
Id = 1027,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Промывка"
},
new
{
Id = 1028,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Промежуточная промывка"
},
new
{
Id = 1029,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Прокачка пачек"
},
new
{
Id = 1030,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Разбуривание тех.оснастки"
},
new
{
Id = 1031,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Ремонт"
},
new
{
Id = 1032,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Спуск инструмента"
},
new
{
Id = 1033,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Спуск инструмента с промывкой"
},
new
{
Id = 1034,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Прямая проработка"
},
new
{
Id = 1035,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Принудительная проработка"
},
new
{
Id = 1037,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Тех СПО-подъем"
},
new
{
Id = 1038,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Тех СПО-спуск"
},
new
{
Id = 1039,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Техническое обслуживание"
},
new
{
Id = 1040,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Цементаж"
},
new
{
Id = 1041,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Шаблонировка ствола"
},
new
{
Id = 1042,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Геологическое осложнение"
},
new
{
Id = 1043,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "НПВ"
},
new
{
Id = 1044,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "ВМР"
},
new
{
Id = 1045,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Прочее"
},
new
{
Id = 1046,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Спуск КНБК"
},
new
{
Id = 1047,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Подъем КНБК"
},
new
{
Id = 1048,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Спуск ОК"
},
new
{
Id = 1050,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Промывка при спуске ОК"
},
new
{
Id = 1051,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Замер ТС"
},
new
{
Id = 1052,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Тех. отстой"
},
new
{
Id = 1053,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Циркуляция и Обработка БР"
},
new
{
Id = 1054,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Срезка ствола"
},
new
{
Id = 1055,
Code = 0,
KeyValueName = "Продолжительность",
KeyValueUnits = "мин",
Name = "Вспомогательные работы"
});
});
@ -4825,7 +5025,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "DateTime");
b.ToTable("RecordBase");
b.ToTable("t_telemetry_wits_base");
});
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b =>
@ -5501,7 +5701,7 @@ namespace AsbCloudDb.Migrations
b.Navigation("CompanyType");
});
modelBuilder.Entity("AsbCloudDb.Model.DailyReport", b =>
modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b =>
{
b.HasOne("AsbCloudDb.Model.Well", "Well")
.WithMany()
@ -5910,6 +6110,17 @@ namespace AsbCloudDb.Migrations
b.Navigation("Company");
});
modelBuilder.Entity("AsbCloudDb.Model.UserSetting", b =>
{
b.HasOne("AsbCloudDb.Model.User", "User")
.WithMany()
.HasForeignKey("IdUser")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("AsbCloudDb.Model.Well", b =>
{
b.HasOne("AsbCloudDb.Model.Cluster", "Cluster")

View File

@ -1,6 +1,5 @@
using AsbCloudDb.Model.Subsystems;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@ -11,7 +10,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<Cluster> Clusters => Set<Cluster>();
public virtual DbSet<Company> Companies => Set<Company>();
public virtual DbSet<CompanyType> CompaniesTypes => Set<CompanyType>();
public virtual DbSet<DailyReport> DailyReports => Set<DailyReport>();
public virtual DbSet<DailyReport.DailyReport> DailyReports => Set <DailyReport.DailyReport >();
public virtual DbSet<Deposit> Deposits => Set<Deposit>();
public virtual DbSet<DetectedOperation> DetectedOperations => Set<DetectedOperation>();
public virtual DbSet<DrillFlowChart> DrillFlowChart => Set<DrillFlowChart>();
@ -41,6 +40,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<TelemetryUser> TelemetryUsers => Set<TelemetryUser>();
public virtual DbSet<User> Users => Set<User>();
public virtual DbSet<UserRole> UserRoles => Set<UserRole>();
public virtual DbSet<UserSetting> UserSettings => Set<UserSetting>();
public virtual DbSet<Well> Wells => Set<Well>();
public virtual DbSet<WellComposite> WellComposites => Set<WellComposite>();
public virtual DbSet<WellOperation> WellOperations => Set<WellOperation>();
@ -318,7 +318,7 @@ namespace AsbCloudDb.Model
.IsRequired();
});
modelBuilder.Entity<DailyReport>(entity =>
modelBuilder.Entity<DailyReport.DailyReport >(entity =>
{
entity.HasKey(e => new { e.IdWell, e.StartDate })
.HasName("t_id_well_date_start_pk");
@ -345,7 +345,13 @@ namespace AsbCloudDb.Model
.HasJsonConversion();
});
FillData(modelBuilder);
modelBuilder.Entity<UserSetting>(entity =>
{
entity.HasKey(nameof(UserSetting.IdUser), nameof(UserSetting.Key));
});
DefaultData.DefaultContextData.Fill(modelBuilder);
}
public Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token)
@ -362,489 +368,6 @@ namespace AsbCloudDb.Model
return Database.ExecuteSqlRawAsync(sql, token);
}
private static void FillData(ModelBuilder modelBuilder)
{
modelBuilder.Entity<UserRole>(entity =>
{
entity.HasData(new List<UserRole>{
new UserRole{ Id = 1, Caption = "root", IdType = 1},
new UserRole{ Id = 1100, Caption = "admin_cluster.view", IdType = 1},
new UserRole{ Id = 1101, Caption = "admin_cluster.edit", IdType = 1},
new UserRole{ Id = 1102, Caption = "admin_company.view", IdType = 1},
new UserRole{ Id = 1103, Caption = "admin_company.edit", IdType = 1},
new UserRole{ Id = 1104, Caption = "admin_company_type.view", IdType = 1},
new UserRole{ Id = 1105, Caption = "admin_company_type.edit", IdType = 1},
new UserRole{ Id = 1106, Caption = "admin_deposit.view", IdType = 1},
new UserRole{ Id = 1107, Caption = "admin_deposit.edit", IdType = 1},
new UserRole{ Id = 1108, Caption = "admin_permission.view", IdType = 1},
new UserRole{ Id = 1109, Caption = "admin_permission.edit", IdType = 1},
new UserRole{ Id = 1110, Caption = "admin_role.view", IdType = 1},
new UserRole{ Id = 1111, Caption = "admin_role.edit", IdType = 1},
new UserRole{ Id = 1112, Caption = "admin_telemetry.view", IdType = 1},
new UserRole{ Id = 1113, Caption = "admin_user.view", IdType = 1},
new UserRole{ Id = 1114, Caption = "admin_user.edit", IdType = 1},
new UserRole{ Id = 1115, Caption = "admin_visit_log.view", IdType = 1},
new UserRole{ Id = 1116, Caption = "admin_well.view", IdType = 1},
new UserRole{ Id = 1117, Caption = "admin_well.edit", IdType = 1},
new UserRole{ Id = 1200, Caption = "archive.view", IdType = 1},
new UserRole{ Id = 1201, Caption = "cluster.view", IdType = 1},
new UserRole{ Id = 1202, Caption = "composite.view", IdType = 1},
new UserRole{ Id = 1203, Caption = "composite.edit", IdType = 1},
new UserRole{ Id = 1204, Caption = "deposit.view", IdType = 1},
new UserRole{ Id = 1205, Caption = "document.view", IdType = 1},
new UserRole{ Id = 1206, Caption = "drillProcessFlow.view", IdType = 1},
new UserRole{ Id = 1207, Caption = "drillProcessFlow.edit", IdType = 1},
new UserRole{ Id = 1208, Caption = "measure.view", IdType = 1},
new UserRole{ Id = 1209, Caption = "measure.edit", IdType = 1},
new UserRole{ Id = 1210, Caption = "message.view", IdType = 1},
new UserRole{ Id = 1211, Caption = "operations.view", IdType = 1},
new UserRole{ Id = 1212, Caption = "operations.edit", IdType = 1},
new UserRole{ Id = 1213, Caption = "params.view", IdType = 1},
new UserRole{ Id = 1214, Caption = "params.edit", IdType = 1},
new UserRole{ Id = 1215, Caption = "report.view", IdType = 1},
new UserRole{ Id = 1216, Caption = "report.edit", IdType = 1},
new UserRole{ Id = 1217, Caption = "setpoints.view", IdType = 1},
new UserRole{ Id = 1218, Caption = "setpoints.edit", IdType = 1},
new UserRole{ Id = 1219, Caption = "telemetry.view", IdType = 1},
new UserRole{ Id = 1220, Caption = "telemetryAnalysis.view", IdType = 1},
new UserRole{ Id = 1221, Caption = "well.view", IdType = 1},
new UserRole{ Id = 1500, Caption = "Просмотр всего", IdType = 1},
new UserRole{ Id = 1501, Caption = "file.edit", IdType = 1},
new UserRole{ Id = 1502, Caption = "drillingProgram.edit", IdType = 1},
new UserRole{ Id = 2000, Caption = "Заказчик", IdType = 0},
new UserRole{ Id = 2001, Caption = "Супервайзер", IdType = 0},
new UserRole{ Id = 2002, Caption = "Буровой подрядчик", IdType = 0},
new UserRole{ Id = 2003, Caption = "Растворщик", IdType = 0},
new UserRole{ Id = 2004, Caption = "Телеметрист", IdType = 0},
new UserRole{ Id = 2005, Caption = "Долотный сервис", IdType = 0},
new UserRole{ Id = 2006, Caption = "ГТИ", IdType = 0},
new UserRole{ Id = 2007, Caption = "Цементирование", IdType = 0},
});
});
modelBuilder.Entity<RelationUserRoleUserRole>(entity =>
{
entity.HasData(new List<RelationUserRoleUserRole>
{
new RelationUserRoleUserRole{ Id = 1101, IdInclude = 1100 },
new RelationUserRoleUserRole{ Id = 1103, IdInclude = 1102 },
new RelationUserRoleUserRole{ Id = 1105, IdInclude = 1104 },
new RelationUserRoleUserRole{ Id = 1107, IdInclude = 1106 },
new RelationUserRoleUserRole{ Id = 1109, IdInclude = 1108 },
new RelationUserRoleUserRole{ Id = 1111, IdInclude = 1110 },
new RelationUserRoleUserRole{ Id = 1114, IdInclude = 1113 },
new RelationUserRoleUserRole{ Id = 1117, IdInclude = 1116 },
new RelationUserRoleUserRole{ Id = 1203, IdInclude = 1202 },
new RelationUserRoleUserRole{ Id = 1207, IdInclude = 1206 },
new RelationUserRoleUserRole{ Id = 1209, IdInclude = 1208 },
new RelationUserRoleUserRole{ Id = 1212, IdInclude = 1211 },
new RelationUserRoleUserRole{ Id = 1214, IdInclude = 1213 },
new RelationUserRoleUserRole{ Id = 1216, IdInclude = 1215 },
new RelationUserRoleUserRole{ Id = 1218, IdInclude = 1217 },
new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1200}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1201}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1202}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1204}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1205}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1206}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1208}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1210}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1211}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1213}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1215}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1217}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1219}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1220}, new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1221},
new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1500 },new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1501 },new RelationUserRoleUserRole{ Id = 2000, IdInclude = 1502 },
new RelationUserRoleUserRole{ Id = 2001, IdInclude = 1500 },new RelationUserRoleUserRole{ Id = 2001, IdInclude = 1501 },new RelationUserRoleUserRole{ Id = 2001, IdInclude = 1502 },
new RelationUserRoleUserRole{ Id = 2002, IdInclude = 1500 },new RelationUserRoleUserRole{ Id = 2002, IdInclude = 1501 },new RelationUserRoleUserRole{ Id = 2002, IdInclude = 1502 },
new RelationUserRoleUserRole{ Id = 2003, IdInclude = 1500 },new RelationUserRoleUserRole{ Id = 2003, IdInclude = 1501 },new RelationUserRoleUserRole{ Id = 2003, IdInclude = 1502 },
new RelationUserRoleUserRole{ Id = 2004, IdInclude = 1500 },new RelationUserRoleUserRole{ Id = 2004, IdInclude = 1501 },new RelationUserRoleUserRole{ Id = 2004, IdInclude = 1502 },
new RelationUserRoleUserRole{ Id = 2005, IdInclude = 1500 },new RelationUserRoleUserRole{ Id = 2005, IdInclude = 1501 },new RelationUserRoleUserRole{ Id = 2005, IdInclude = 1502 },
new RelationUserRoleUserRole{ Id = 2006, IdInclude = 1500 },new RelationUserRoleUserRole{ Id = 2006, IdInclude = 1501 },new RelationUserRoleUserRole{ Id = 2006, IdInclude = 1502 },
new RelationUserRoleUserRole{ Id = 2007, IdInclude = 1500 },new RelationUserRoleUserRole{ Id = 2007, IdInclude = 1501 },new RelationUserRoleUserRole{ Id = 2007, IdInclude = 1502 },
});
});
modelBuilder.Entity<Permission>(entity =>
{
entity.HasData(new List<Permission>
{
new Permission{ Id = 100, Name="AdminCluster.delete", Description="Разрешение удалять админ. Кусты"},
new Permission{ Id = 101, Name="AdminCluster.edit", Description="Разрешение редактировать админ. Кусты"},
new Permission{ Id = 102, Name="AdminCluster.get", Description="Разрешение просматривать админ. Кусты"},
new Permission{ Id = 103, Name="AdminCompany.delete", Description="Разрешение удалять админ. Компании"},
new Permission{ Id = 104, Name="AdminCompany.edit", Description="Разрешение редактировать админ. Компании"},
new Permission{ Id = 105, Name="AdminCompany.get", Description="Разрешение просматривать админ. Компании"},
new Permission{ Id = 106, Name="AdminCompanyType.delete", Description="Разрешение удалять админ. Типы компаний"},
new Permission{ Id = 107, Name="AdminCompanyType.edit", Description="Разрешение редактировать админ. Типы компаний"},
new Permission{ Id = 108, Name="AdminCompanyType.get", Description="Разрешение просматривать админ. Типы компаний"},
new Permission{ Id = 109, Name="AdminDeposit.delete", Description="Разрешение удалять админ. Месторождения"},
new Permission{ Id = 110, Name="AdminDeposit.edit", Description="Разрешение редактировать админ. Месторождения"},
new Permission{ Id = 111, Name="AdminDeposit.get", Description="Разрешение просматривать админ. Месторождения"},
new Permission{ Id = 112, Name="AdminPermission.delete", Description="Разрешение удалять админ. Разрешения"},
new Permission{ Id = 113, Name="AdminPermission.edit", Description="Разрешение редактировать админ. Разрешения"},
new Permission{ Id = 114, Name="AdminPermission.get", Description="Разрешение просматривать админ. Разрешения"},
new Permission{ Id = 115, Name="AdminTelemetry.delete", Description="Разрешение удалять админ. Телеметрию"},
new Permission{ Id = 116, Name="AdminTelemetry.edit", Description="Разрешение редактировать админ. Телеметрию"},
new Permission{ Id = 117, Name="AdminTelemetry.get", Description="Разрешение просматривать админ. Телеметрию"},
new Permission{ Id = 118, Name="AdminUser.delete", Description="Разрешение удалять админ. Пользователей"},
new Permission{ Id = 119, Name="AdminUser.edit", Description="Разрешение редактировать админ. Пользователей"},
new Permission{ Id = 120, Name="AdminUser.get", Description="Разрешение просматривать админ. Пользователей"},
new Permission{ Id = 121, Name="AdminUserRole.delete", Description="Разрешение удалять админ. Роли пользователей"},
new Permission{ Id = 122, Name="AdminUserRole.edit", Description="Разрешение редактировать админ. Роли пользователей"},
new Permission{ Id = 123, Name="AdminUserRole.get", Description="Разрешение просматривать админ. Роли пользователей"},
new Permission{ Id = 124, Name="AdminWell.delete", Description="Разрешение удалять админ. Скважины"},
new Permission{ Id = 125, Name="AdminWell.edit", Description="Разрешение редактировать админ. Скважины"},
new Permission{ Id = 126, Name="AdminWell.get", Description="Разрешение просматривать админ. Скважины"},
new Permission{ Id = 127, Name="AdminSubsytem.delete", Description="Разрешение удалять админ. Подсистемы"},
new Permission{ Id = 128, Name="AdminSubsytem.edit", Description="Разрешение редактировать админ. Подсистемы"},
new Permission{ Id = 129, Name="AdminSubsytem.get", Description="Разрешение просматривать админ. Подсистемы"},
new Permission{ Id = 200, Name="Auth.edit", Description="Разрешение редактировать 0"},
new Permission{ Id = 201, Name="Auth.get", Description="Разрешение просматривать 0"},
new Permission{ Id = 202, Name="Cluster.get", Description="Разрешение просматривать Кусты"},
new Permission{ Id = 203, Name="Deposit.get", Description="Разрешение просматривать Месторождения"},
new Permission{ Id = 204, Name="DrillFlowChart.delete", Description="Разрешение удалять РТК"},
new Permission{ Id = 205, Name="DrillFlowChart.edit", Description="Разрешение редактировать РТК"},
new Permission{ Id = 206, Name="DrillFlowChart.get", Description="Разрешение просматривать РТК"},
new Permission{ Id = 207, Name="DrillingProgram.delete", Description="Разрешение удалять Программу бурения"},
new Permission{ Id = 208, Name="DrillingProgram.edit", Description="Разрешение редактировать Программу бурения"},
new Permission{ Id = 209, Name="DrillingProgram.get", Description="Разрешение просматривать Программу бурения"},
new Permission{ Id = 210, Name="DrillParams.delete", Description="Разрешение удалять Режимы бурения"},
new Permission{ Id = 211, Name="DrillParams.edit", Description="Разрешение редактировать Режимы бурения"},
new Permission{ Id = 212, Name="DrillParams.get", Description="Разрешение просматривать Режимы бурения"},
new Permission{ Id = 213, Name="File.delete", Description="Разрешение удалять Файлы"},
new Permission{ Id = 214, Name="File.edit", Description="Разрешение редактировать Файлы"},
new Permission{ Id = 215, Name="File.get", Description="Разрешение просматривать Файлы"},
new Permission{ Id = 216, Name="Measure.delete", Description="Разрешение удалять Измерения"},
new Permission{ Id = 217, Name="Measure.edit", Description="Разрешение редактировать Измерения"},
new Permission{ Id = 218, Name="Measure.get", Description="Разрешение просматривать Измерения"},
new Permission{ Id = 219, Name="Message.get", Description="Разрешение просматривать Сообщения телеметрии"},
new Permission{ Id = 220, Name="OperationStat.get", Description="Разрешение просматривать Статистику по операциям"},
new Permission{ Id = 221, Name="Report.edit", Description="Разрешение редактировать Рапорта"},
new Permission{ Id = 222, Name="Report.get", Description="Разрешение просматривать Рапорта"},
new Permission{ Id = 223, Name="RequestTracker.get", Description="Разрешение просматривать админ. Системная статистика"},
new Permission{ Id = 224, Name="Setpoints.delete", Description="Разрешение удалять Рекомендации уставок"},
new Permission{ Id = 225, Name="Setpoints.edit", Description="Разрешение редактировать Рекомендации уставок"},
new Permission{ Id = 226, Name="Setpoints.get", Description="Разрешение просматривать Рекомендации уставок"},
new Permission{ Id = 227, Name="Telemetry.edit", Description="Разрешение редактировать Телеметрии"},
new Permission{ Id = 228, Name="TelemetryAnalytics.get", Description="Разрешение просматривать Анализ телеметрии"},
new Permission{ Id = 229, Name="TelemetryDataSaub.edit", Description="Разрешение редактировать Данные телеметрии по САУБ"},
new Permission{ Id = 230, Name="TelemetryDataSaub.get", Description="Разрешение просматривать Данные телеметрии по САУБ"},
new Permission{ Id = 231, Name="TelemetryDataSpin.edit", Description="Разрешение редактировать Данные телеметрии по SpinMaster"},
new Permission{ Id = 232, Name="TelemetryDataSpin.get", Description="Разрешение просматривать Данные телеметрии по SpinMaster"},
new Permission{ Id = 233, Name="Well.edit", Description="Разрешение редактировать Скважины"},
new Permission{ Id = 234, Name="Well.get", Description="Разрешение просматривать Скважины"},
new Permission{ Id = 235, Name="WellComposite.edit", Description="Разрешение редактировать Композитные скважины"},
new Permission{ Id = 236, Name="WellComposite.get", Description="Разрешение просматривать Композитные скважины"},
new Permission{ Id = 237, Name="WellOperation.delete", Description="Разрешение удалять Операции по скважинам"},
new Permission{ Id = 238, Name="WellOperation.edit", Description="Разрешение редактировать Операции по скважинам"},
new Permission{ Id = 239, Name="WellOperation.get", Description="Разрешение просматривать Операции по скважинам"},
new Permission{ Id = 240, Name="File.edit1", Description="Разрешение редактировать Файлы категории 1 (Растворный сервис)"},
new Permission{ Id = 241, Name="File.edit2", Description="Разрешение редактировать Файлы категории 2 (Цементирование)"},
new Permission{ Id = 242, Name="File.edit3", Description="Разрешение редактировать Файлы категории 3 (ННБ)"},
new Permission{ Id = 243, Name="File.edit4", Description="Разрешение редактировать Файлы категории 4 (ГТИ)"},
new Permission{ Id = 244, Name="File.edit5", Description="Разрешение редактировать Файлы категории 5 (Документы по скважине)"},
new Permission{ Id = 245, Name="File.edit6", Description="Разрешение редактировать Файлы категории 6 (Супервайзер)"},
new Permission{ Id = 246, Name="File.edit7", Description="Разрешение редактировать Файлы категории 7 (Мастер)"},
new Permission{ Id = 247, Name="File.edit8", Description="Разрешение редактировать Файлы категории 8 (Долотный сервис)"},
new Permission{ Id = 248, Name="File.edit9", Description="Разрешение редактировать Файлы категории 9 (Буровой подрядчик)"},
new Permission{ Id = 249, Name="File.edit10", Description="Разрешение редактировать Файлы категории 10 (Сервис по заканчиванию скважины)"},
new Permission{ Id = 250, Name="File.edit11", Description="Разрешение редактировать Файлы категории 11 (Рапорт)"},
new Permission{ Id = 251, Name="File.edit12", Description="Разрешение редактировать Файлы категории 12"},
new Permission{ Id = 252, Name="File.edit13", Description="Разрешение редактировать Файлы категории 12"},
new Permission{ Id = 253, Name="File.edit14", Description="Разрешение редактировать Файлы категории 13"},
new Permission{ Id = 254, Name="File.edit15", Description="Разрешение редактировать Файлы категории 14"},
new Permission{ Id = 255, Name="File.edit16", Description="Разрешение редактировать Файлы категории 15"},
new Permission{ Id = 256, Name="File.edit17", Description="Разрешение редактировать Файлы категории 16"},
new Permission{ Id = 257, Name="File.edit18", Description="Разрешение редактировать Файлы категории 17"},
new Permission{ Id = 258, Name="File.edit19", Description="Разрешение редактировать Файлы категории 18"},
new Permission{ Id = 259, Name="File.edit20", Description="Разрешение редактировать Файлы категории 19"},
new Permission{ Id = 260, Name="File.edit21", Description="Разрешение редактировать Файлы категории 20"},
new Permission{ Id = 261, Name="File.edit22", Description="Разрешение редактировать Файлы категории 21"},
new Permission{ Id = 262, Name="File.edit23", Description="Разрешение редактировать Файлы категории 22"},
new Permission{ Id = 263, Name="File.edit24", Description="Разрешение редактировать Файлы категории 23"},
new Permission{ Id = 264, Name="File.edit25", Description="Разрешение редактировать Файлы категории 24"},
new Permission{ Id = 265, Name="File.edit26", Description="Разрешение редактировать Файлы категории 25"},
new Permission{ Id = 266, Name="File.edit27", Description="Разрешение редактировать Файлы категории 26"},
new Permission{ Id = 267, Name="File.edit28", Description="Разрешение редактировать Файлы категории 27"},
new Permission{ Id = 268, Name="File.edit29", Description="Разрешение редактировать Файлы категории 28"},
new Permission{ Id = 269, Name="File.edit30", Description="Разрешение редактировать Файлы категории 29"},
new Permission{ Id = 380, Name="Driller.get", Description="Разрешение просматривать список бурильщиков"},
new Permission{ Id = 381, Name="Driller.edit", Description="Разрешение редактировать бурильщика"},
new Permission{ Id = 382, Name="Driller.delete", Description="Разрешение удалять бурильщик"},
new Permission{ Id = 383, Name="Schedule.get", Description="Разрешение просматривать графики бурильщиков"},
new Permission{ Id = 384, Name="Schedule.edit", Description="Разрешение редактировать график бурильщика"},
new Permission{ Id = 385, Name="Schedule.delete", Description="Разрешение удалять график бурильщика"},
new Permission{ Id = 386, Name="DailyReport.get", Description="Разрешение просматривать суточный рапорт"},
new Permission{ Id = 387, Name="DailyReport.edit", Description="Разрешение редактировать суточный рапорт"},
new Permission{ Id = 388, Name="DetectedOperation.get", Description="Разрешение просматривать авто. определенные операции"},
new Permission{ Id = 389, Name="OperationValue.get", Description="Разрешение просматривать целевые значения"},
new Permission{ Id = 390, Name="OperationValue.edit", Description="Разрешение редактировать целевые значения"},
new Permission{ Id = 391, Name="OperationValue.delete", Description="Разрешение удалять целевые значения"},
new Permission{ Id = 400, Name="WitsInfo.get", Description="Разрешение просматривать инфо по wits параметрам"},
new Permission{ Id = 401, Name="WitsRecord1.get", Description="Разрешение просматривать WITS record 1"},
new Permission{ Id = 407, Name="WitsRecord7.get", Description="Разрешение просматривать WITS record 7"},
new Permission{ Id = 408, Name="WitsRecord8.get", Description="Разрешение просматривать WITS record 8"},
new Permission{ Id = 450, Name="WitsRecord50.get", Description="Разрешение просматривать WITS record 50"},
new Permission{ Id = 460, Name="WitsRecord60.get", Description="Разрешение просматривать WITS record 60"},
new Permission{ Id = 461, Name="WitsRecord61.get", Description="Разрешение просматривать WITS record 61"},
});
});
modelBuilder.Entity<RelationUserRolePermission>(entity =>
{
entity.HasData(new List<RelationUserRolePermission>
{
new RelationUserRolePermission{ IdUserRole = 1100, IdPermission = 102}, new RelationUserRolePermission{ IdUserRole = 1100, IdPermission = 111},
new RelationUserRolePermission{ IdUserRole = 1101, IdPermission = 101}, new RelationUserRolePermission{ IdUserRole = 1101, IdPermission = 100},
new RelationUserRolePermission{ IdUserRole = 1102, IdPermission = 105}, new RelationUserRolePermission{ IdUserRole = 1102, IdPermission = 108},
new RelationUserRolePermission{ IdUserRole = 1103, IdPermission = 104}, new RelationUserRolePermission{ IdUserRole = 1103, IdPermission = 103},
new RelationUserRolePermission{ IdUserRole = 1104, IdPermission = 108},
new RelationUserRolePermission{ IdUserRole = 1105, IdPermission = 107}, new RelationUserRolePermission{ IdUserRole = 1105, IdPermission = 106},
new RelationUserRolePermission{ IdUserRole = 1106, IdPermission = 111},
new RelationUserRolePermission{ IdUserRole = 1107, IdPermission = 110}, new RelationUserRolePermission{ IdUserRole = 1107, IdPermission = 109},
new RelationUserRolePermission{ IdUserRole = 1108, IdPermission = 114},
new RelationUserRolePermission{ IdUserRole = 1109, IdPermission = 113}, new RelationUserRolePermission{ IdUserRole = 1109, IdPermission = 112},
new RelationUserRolePermission{ IdUserRole = 1110, IdPermission = 123}, new RelationUserRolePermission{ IdUserRole = 1110, IdPermission = 114},
new RelationUserRolePermission{ IdUserRole = 1111, IdPermission = 122}, new RelationUserRolePermission{ IdUserRole = 1111, IdPermission = 121},
new RelationUserRolePermission{ IdUserRole = 1112, IdPermission = 117},
new RelationUserRolePermission{ IdUserRole = 1113, IdPermission = 105}, new RelationUserRolePermission{ IdUserRole = 1113, IdPermission = 123}, new RelationUserRolePermission{ IdUserRole = 1113, IdPermission = 120},
new RelationUserRolePermission{ IdUserRole = 1114, IdPermission = 119}, new RelationUserRolePermission{ IdUserRole = 1114, IdPermission = 118}, new RelationUserRolePermission{ IdUserRole = 1114, IdPermission = 200},
new RelationUserRolePermission{ IdUserRole = 1115, IdPermission = 223},
new RelationUserRolePermission{ IdUserRole = 1116, IdPermission = 105}, new RelationUserRolePermission{ IdUserRole = 1116, IdPermission = 102}, new RelationUserRolePermission{ IdUserRole = 1116, IdPermission = 117}, new RelationUserRolePermission{ IdUserRole = 1116, IdPermission = 126},
new RelationUserRolePermission{ IdUserRole = 1117, IdPermission = 125}, new RelationUserRolePermission{ IdUserRole = 1117, IdPermission = 124},
new RelationUserRolePermission{ IdUserRole = 1200, IdPermission = 203}, new RelationUserRolePermission{ IdUserRole = 1200, IdPermission = 230},
new RelationUserRolePermission{ IdUserRole = 1201, IdPermission = 202}, new RelationUserRolePermission{ IdUserRole = 1201, IdPermission = 203}, new RelationUserRolePermission{ IdUserRole = 1201, IdPermission = 220},
new RelationUserRolePermission{ IdUserRole = 1202, IdPermission = 203}, new RelationUserRolePermission{ IdUserRole = 1202, IdPermission = 220}, new RelationUserRolePermission{ IdUserRole = 1202, IdPermission = 236}, new RelationUserRolePermission{ IdUserRole = 1202, IdPermission = 212},
new RelationUserRolePermission{ IdUserRole = 1203, IdPermission = 235},
new RelationUserRolePermission{ IdUserRole = 1204, IdPermission = 202}, new RelationUserRolePermission{ IdUserRole = 1204, IdPermission = 203},
new RelationUserRolePermission{ IdUserRole = 1205, IdPermission = 215},
new RelationUserRolePermission{ IdUserRole = 1206, IdPermission = 203}, new RelationUserRolePermission{ IdUserRole = 1206, IdPermission = 206},
new RelationUserRolePermission{ IdUserRole = 1207, IdPermission = 205},
new RelationUserRolePermission{ IdUserRole = 1208, IdPermission = 218},
new RelationUserRolePermission{ IdUserRole = 1209, IdPermission = 217},
new RelationUserRolePermission{ IdUserRole = 1210, IdPermission = 203}, new RelationUserRolePermission{ IdUserRole = 1210, IdPermission = 230}, new RelationUserRolePermission{ IdUserRole = 1210, IdPermission = 219},
new RelationUserRolePermission{ IdUserRole = 1211, IdPermission = 203}, new RelationUserRolePermission{ IdUserRole = 1211, IdPermission = 220}, new RelationUserRolePermission{ IdUserRole = 1211, IdPermission = 239},
new RelationUserRolePermission{ IdUserRole = 1212, IdPermission = 238}, new RelationUserRolePermission{ IdUserRole = 1212, IdPermission = 237},
new RelationUserRolePermission{ IdUserRole = 1213, IdPermission = 203}, new RelationUserRolePermission{ IdUserRole = 1213, IdPermission = 239}, new RelationUserRolePermission{ IdUserRole = 1213, IdPermission = 212},
new RelationUserRolePermission{ IdUserRole = 1214, IdPermission = 211}, new RelationUserRolePermission{ IdUserRole = 1214, IdPermission = 210},
new RelationUserRolePermission{ IdUserRole = 1215, IdPermission = 203}, new RelationUserRolePermission{ IdUserRole = 1215, IdPermission = 222},
new RelationUserRolePermission{ IdUserRole = 1216, IdPermission = 221},
new RelationUserRolePermission{ IdUserRole = 1217, IdPermission = 226},
new RelationUserRolePermission{ IdUserRole = 1218, IdPermission = 225}, new RelationUserRolePermission{ IdUserRole = 1218, IdPermission = 224},
new RelationUserRolePermission{ IdUserRole = 1219, IdPermission = 203}, new RelationUserRolePermission{ IdUserRole = 1219, IdPermission = 206}, new RelationUserRolePermission{ IdUserRole = 1219, IdPermission = 230}, new RelationUserRolePermission{ IdUserRole = 1219, IdPermission = 232},
new RelationUserRolePermission{ IdUserRole = 1220, IdPermission = 203}, new RelationUserRolePermission{ IdUserRole = 1220, IdPermission = 228},
new RelationUserRolePermission{ IdUserRole = 1221, IdPermission = 202}, new RelationUserRolePermission{ IdUserRole = 1221, IdPermission = 203}, new RelationUserRolePermission{ IdUserRole = 1221, IdPermission = 220}, new RelationUserRolePermission{ IdUserRole = 1221, IdPermission = 234},
new RelationUserRolePermission{ IdUserRole = 1501, IdPermission = 214}, new RelationUserRolePermission{ IdUserRole = 1501, IdPermission = 213},
new RelationUserRolePermission{ IdUserRole = 1502, IdPermission = 207}, new RelationUserRolePermission{ IdUserRole = 1502, IdPermission = 208},
new RelationUserRolePermission{ IdUserRole = 2000, IdPermission = 205}, new RelationUserRolePermission{ IdUserRole = 2000, IdPermission = 204}, new RelationUserRolePermission{ IdUserRole = 2000, IdPermission = 245},
new RelationUserRolePermission{ IdUserRole = 2001, IdPermission = 244}, new RelationUserRolePermission{ IdUserRole = 2001, IdPermission = 245},
new RelationUserRolePermission{ IdUserRole = 2002, IdPermission = 244}, new RelationUserRolePermission{ IdUserRole = 2002, IdPermission = 246}, new RelationUserRolePermission{ IdUserRole = 2002, IdPermission = 237}, new RelationUserRolePermission{ IdUserRole = 2002, IdPermission = 238},
new RelationUserRolePermission{ IdUserRole = 2003, IdPermission = 240}, new RelationUserRolePermission{ IdUserRole = 2003, IdPermission = 217}, new RelationUserRolePermission{ IdUserRole = 2003, IdPermission = 216},
new RelationUserRolePermission{ IdUserRole = 2004, IdPermission = 242}, new RelationUserRolePermission{ IdUserRole = 2004, IdPermission = 217}, new RelationUserRolePermission{ IdUserRole = 2004, IdPermission = 216}, new RelationUserRolePermission{ IdUserRole = 2004, IdPermission = 205}, new RelationUserRolePermission{ IdUserRole = 2004, IdPermission = 204},
new RelationUserRolePermission{ IdUserRole = 2005, IdPermission = 247}, new RelationUserRolePermission{ IdUserRole = 2005, IdPermission = 205}, new RelationUserRolePermission{ IdUserRole = 2005, IdPermission = 204},
new RelationUserRolePermission{ IdUserRole = 2006, IdPermission = 243}, new RelationUserRolePermission{ IdUserRole = 2006, IdPermission = 205}, new RelationUserRolePermission{ IdUserRole = 2006, IdPermission = 204},
new RelationUserRolePermission{ IdUserRole = 2007, IdPermission = 241}, new RelationUserRolePermission{ IdUserRole = 2007, IdPermission = 205}, new RelationUserRolePermission{ IdUserRole = 2007, IdPermission = 204},
});
});
modelBuilder.Entity<User>(entity =>
{
entity.HasData(new List<User>{
new User{
Id = 1,
IdCompany = 1,
Login = "dev",
PasswordHash = "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072",
Name = "Разработчик",
},
});
});
modelBuilder.Entity<RelationUserUserRole>(entity =>
{
entity.HasData(new List<RelationUserUserRole>{
new RelationUserUserRole { IdUser = 1, IdUserRole = 1, },
});
});
modelBuilder.Entity<Company>(entity =>
{
entity.HasData(new List<Company>{
new Company{ Id = 1, Caption = "ООО \"АСБ\"", IdCompanyType = 3},
});
});
modelBuilder.Entity<WellOperationCategory>(entity =>
{
entity.HasData(new List<WellOperationCategory> {
// Автоматически определяемые операции
new WellOperationCategory {Id = 1, Name = "Невозможно определить операцию", Code = 0},
new WellOperationCategory {Id = 2, Name = "Роторное бурение", Code = 0 },
new WellOperationCategory {Id = 3, Name = "Слайдирование", Code = 0 },
new WellOperationCategory {Id = 4, Name = "Подъем с проработкой", Code = 0 },
new WellOperationCategory {Id = 5, Name = "Спуск с проработкой", Code = 0 },
new WellOperationCategory {Id = 6, Name = "Подъем с промывкой", Code = 0 },
new WellOperationCategory {Id = 7, Name = "Спуск с промывкой", Code = 0 },
new WellOperationCategory {Id = 8, Name = "Спуск в скважину", Code = 0 },
new WellOperationCategory {Id = 9, Name = "Спуск с вращением", Code = 0 },
new WellOperationCategory {Id = 10, Name = "Подъем из скважины", Code = 0 },
new WellOperationCategory {Id = 11, Name = "Подъем с вращением", Code = 0 },
new WellOperationCategory {Id = 12, Name = "Промывка в покое", Code = 0 },
new WellOperationCategory {Id = 13, Name = "Промывка с вращением", Code = 0 },
new WellOperationCategory {Id = 14, Name = "Удержание в клиньях", Code = 0 },
new WellOperationCategory {Id = 15, Name = "Неподвижное состояние", Code = 0 },
new WellOperationCategory {Id = 16, Name = "Вращение без циркуляции", Code = 0 },
new WellOperationCategory {Id = 17, Name = "На поверхности", Code = 0 },
new WellOperationCategory {Id = 18, Name = "Проработка перед наращиванием", Code = 0 },
new WellOperationCategory {Id = 19, Name = "Шаблонировка перед наращиванием", Code = 0 },
// Операции ручного ввода
new WellOperationCategory {Id = 1001, Name = "Бурение", Code = 0 },
new WellOperationCategory {Id = 1002, Name = "ГИС", Code = 0 },
new WellOperationCategory {Id = 1003, Name = "ГФР", Code = 0 },
new WellOperationCategory {Id = 1004, Name = "Монтаж ПВО", Code = 0 },
new WellOperationCategory {Id = 1005, Name = "Демонтаж ПВО", Code = 0 },
new WellOperationCategory {Id = 1006, Name = "Установка ФА", Code = 0 },
new WellOperationCategory {Id = 1007, Name = "Оборудование устья", Code = 0 },
new WellOperationCategory {Id = 1008, Name = "ОЗЦ", Code = 0 },
new WellOperationCategory {Id = 1011, Name = "Начало цикла строительства скважины", Code = 0 },
new WellOperationCategory {Id = 1012, Name = "Окончание цикла строительства скважины", Code = 0 },
new WellOperationCategory {Id = 1013, Name = "Опрессовка ПВО", Code = 0 },
new WellOperationCategory {Id = 1014, Name = "Опрессовка Ц.К.", Code = 0 },
new WellOperationCategory {Id = 1015, Name = "Опрессовка ВЗД", Code = 0 },
new WellOperationCategory {Id = 1016, Name = "Перевод скв на другой тип промывочной жидкости", Code = 0 },
new WellOperationCategory {Id = 1017, Name = "Перезапись каротажа", Code = 0 },
new WellOperationCategory {Id = 1018, Name = "Перетяжка талевого каната", Code = 0 },
new WellOperationCategory {Id = 1019, Name = "Наращивание, промывка", Code = 0 },
new WellOperationCategory {Id = 1020, Name = "Подъем инструмента", Code = 0 },
new WellOperationCategory {Id = 1021, Name = "Подъем инструмента с промывкой", Code = 0 },
new WellOperationCategory {Id = 1022, Name = "Обратная проработка", Code = 0 },
new WellOperationCategory {Id = 1023, Name = "Сборка инструмента с мостков", Code = 0 },
new WellOperationCategory {Id = 1024, Name = "Подготовительные работы", Code = 0 },
new WellOperationCategory {Id = 1025, Name = "Сборка КНБК", Code = 0 },
new WellOperationCategory {Id = 1026, Name = "Разборка КНБК", Code = 0 },
new WellOperationCategory {Id = 1027, Name = "Промывка", Code = 0 },
new WellOperationCategory {Id = 1028, Name = "Промежуточная промывка", Code = 0 },
new WellOperationCategory {Id = 1029, Name = "Прокачка пачек", Code = 0 },
new WellOperationCategory {Id = 1030, Name = "Разбуривание тех.оснастки", Code = 0 },
new WellOperationCategory {Id = 1031, Name = "Ремонт", Code = 0 },
new WellOperationCategory {Id = 1032, Name = "Спуск инструмента", Code = 0 },
new WellOperationCategory {Id = 1033, Name = "Спуск инструмента с промывкой", Code = 0 },
new WellOperationCategory {Id = 1034, Name = "Прямая проработка", Code = 0 },
new WellOperationCategory {Id = 1035, Name = "Принудительная проработка", Code = 0 },
new WellOperationCategory {Id = 1037, Name = "Тех СПО-подъем", Code = 0 },
new WellOperationCategory {Id = 1038, Name = "Тех СПО-спуск", Code = 0 },
new WellOperationCategory {Id = 1039, Name = "Техническое обслуживание", Code = 0 },
new WellOperationCategory {Id = 1040, Name = "Цементаж", Code = 0 },
new WellOperationCategory {Id = 1041, Name = "Шаблонировка ствола", Code = 0 },
new WellOperationCategory {Id = 1042, Name = "Геологическое осложнение", Code = 0 },
new WellOperationCategory {Id = 1043, Name = "НПВ", Code = 0 },
new WellOperationCategory {Id = 1044, Name = "ВМР", Code = 0 },
new WellOperationCategory {Id = 1045, Name = "Прочее", Code = 0 },
new WellOperationCategory {Id = 1046, Name = "Спуск КНБК", Code = 0 },
new WellOperationCategory {Id = 1047, Name = "Подъем КНБК", Code = 0 },
new WellOperationCategory {Id = 1048, Name = "Спуск ОК", Code = 0 },
new WellOperationCategory {Id = 1050, Name = "Промывка при спуске ОК", Code = 0 },
new WellOperationCategory {Id = 1051, Name = "Замер ТС", Code = 0 },
new WellOperationCategory {Id = 1052, Name = "Тех. отстой", Code = 0 },
new WellOperationCategory {Id = 1053, Name = "Циркуляция и Обработка БР", Code = 0 },
new WellOperationCategory {Id = 1054, Name = "Срезка ствола", Code = 0 },
new WellOperationCategory {Id = 1055, Name = "Вспомогательные работы", Code = 0 },
});
});
modelBuilder.Entity<FileCategory>(entity =>
{
entity.HasData(new List<FileCategory> {
new FileCategory {Id = 1, Name = "Растворный сервис", ShortName = "fluidService"},
new FileCategory {Id = 2, Name = "Цементирование", ShortName = "cement"},
new FileCategory {Id = 3, Name = "ННБ", ShortName = "nnb"},
new FileCategory {Id = 4, Name = "ГТИ", ShortName = "gti"},
new FileCategory {Id = 5, Name = "Документы по скважине", ShortName = "wellDocuments"},
new FileCategory {Id = 6, Name = "Супервайзер", ShortName = "supervisor"},
new FileCategory {Id = 7, Name = "Мастер", ShortName = "master"},
new FileCategory {Id = 8, Name = "Долотный сервис", ShortName = "toolService"},
new FileCategory {Id = 9, Name = "Буровой подрядчик", ShortName = "drillService"},
new FileCategory {Id = 10, Name = "Сервис по заканчиванию скважины", ShortName = "closingService"},
//new FileCategory {Id = 11, Name = "", ShortName = ""},
new FileCategory {Id = 12, Name = "Рапорт", ShortName = "report"},
new FileCategory {Id = 1000, Name = "Программа бурения"},
new FileCategory {Id = 1001, Name = "Задание от геологов"},
new FileCategory {Id = 1002, Name = "Профиль ствола скважины (ННБ)"},
new FileCategory {Id = 1003, Name = "Технологические расчеты (ННБ)"},
new FileCategory {Id = 1004, Name = "Долотная программа"},
new FileCategory {Id = 1005, Name = "Программа по растворам"},
new FileCategory {Id = 1006, Name = "Программа геофизических исследований"},
new FileCategory {Id = 1007, Name = "Планы спусков обсадных колонн"},
new FileCategory {Id = 1008, Name = "Программы цементирования обсадных колонн"},
});
});
modelBuilder.Entity<WellSectionType>(entity =>
{
entity.HasData(new List<WellSectionType>{
new WellSectionType{ Id = 1, Caption = "Пилотный ствол"},
new WellSectionType{ Id = 2, Caption = "Направление"},
new WellSectionType{ Id = 3, Caption = "Кондуктор"},
new WellSectionType{ Id = 4, Caption = "Эксплуатационная колонна"},
new WellSectionType{ Id = 5, Caption = "Транспортный ствол"},
new WellSectionType{ Id = 6, Caption = "Хвостовик"},
new WellSectionType{ Id = 7, Caption = "Пилотный ствол 2"},
new WellSectionType{ Id = 8, Caption = "Направление 2"},
new WellSectionType{ Id = 9, Caption = "Кондуктор 2"},
new WellSectionType{ Id = 10, Caption = "Эксплуатационная колонна 2"},
new WellSectionType{ Id = 11, Caption = "Транспортный ствол 2"},
new WellSectionType{ Id = 12, Caption = "Хвостовик 2"},
new WellSectionType{ Id = 13, Caption = "Пилотный ствол 3"},
new WellSectionType{ Id = 14, Caption = "Направление 3"},
new WellSectionType{ Id = 15, Caption = "Кондуктор 3"},
new WellSectionType{ Id = 16, Caption = "Эксплуатационная колонна 3"},
new WellSectionType{ Id = 17, Caption = "Транспортный ствол 3"},
new WellSectionType{ Id = 18, Caption = "Хвостовик 3"},
new WellSectionType{ Id = 19, Caption = "Пилотный ствол 4"},
new WellSectionType{ Id = 20, Caption = "Направление 4"},
new WellSectionType{ Id = 21, Caption = "Кондуктор 4"},
new WellSectionType{ Id = 22, Caption = "Эксплуатационная колонна 4"},
new WellSectionType{ Id = 23, Caption = "Транспортный ствол 4"},
new WellSectionType{ Id = 24, Caption = "Хвостовик 4"},
new WellSectionType{ Id = 25, Caption = "Пилотный ствол 5"},
new WellSectionType{ Id = 26, Caption = "Направление 5"},
new WellSectionType{ Id = 27, Caption = "Кондуктор 5"},
new WellSectionType{ Id = 28, Caption = "Эксплуатационная колонна 5"},
new WellSectionType{ Id = 29, Caption = "Транспортный ствол 5"},
new WellSectionType{ Id = 30, Caption = "Хвостовик 5"},
});
});
modelBuilder.Entity<WellType>(entity =>
{
entity.HasData(new List<WellType> {
new WellType{ Id = 1, Caption = "Наклонно-направленная"},
new WellType{ Id = 2, Caption = "Горизонтальная"},
});
});
modelBuilder.Entity<MeasureCategory>(entity =>
{
entity.HasData(new List<MeasureCategory> {
new MeasureCategory{ Id = 1, Name = "Показатели бурового раствора", ShortName = "Раствор"},
new MeasureCategory{ Id = 2, Name = "Шламограмма", ShortName = "Шламограмма"},
new MeasureCategory{ Id = 3, Name = "ННБ", ShortName = "ННБ"},
});
});
modelBuilder.Entity<CompanyType>(entity =>
{
entity.HasData(new List<CompanyType>{
new CompanyType{ Id = 1, Caption = "Недрапользователь", },
new CompanyType{ Id = 2, Caption = "Буровой подрядчик", },
new CompanyType{ Id = 3, Caption = "Сервис автоматизации бурения", },
});
});
}
public Task<int> RefreshMaterializedViewAsync<TEntity>(string? mwName = null, CancellationToken token = default) where TEntity : class
{
throw new System.NotImplementedException();

View File

@ -0,0 +1,62 @@
namespace AsbCloudDb.Model.DailyReport
{
public class Bha
{
/// <summary>
/// КНБК описание
/// </summary>
public string BHADescription { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2195-2763м. Время начала
/// </summary>
public string ExtensionDrillingOneBegin { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2195-2763м. Время окончания
/// </summary>
public string ExtensionDrillingOneFinish { get; set; }
/// <summary>
/// Промывка. Время начала
/// </summary>
public string SluiceBegin { get; set; }
/// <summary>
/// Промывка. Время окончания
/// </summary>
public string SluiceFinish { get; set; }
/// <summary>
/// Подьем КНБК. Время начала
/// </summary>
public string ClimbBegin { get; set; }
/// <summary>
/// Подьем КНБК. Время окончания
/// </summary>
public string ClimbFinish { get; set; }
/// <summary>
/// Спуск КНБК. Время начала
/// </summary>
public string DescentBegin { get; set; }
/// <summary>
/// Спуск КНБК. Время окончания
/// </summary>
public string DescentFinish { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2763-2850м. Время начала
/// </summary>
public string ExtensionDrillingTwoBegin { get; set; }
/// <summary>
/// Бурение с наращиваниями в инт. 2763-2850м. Время окончания
/// </summary>
public string ExtensionDrillingTwoFinish { get; set; }
}
}

View File

@ -2,8 +2,7 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model
namespace AsbCloudDb.Model.DailyReport
{
#nullable disable
[Table("t_daily_report"), Comment("Ежедневные отчёты")]
@ -21,5 +20,14 @@ namespace AsbCloudDb.Model
[ForeignKey(nameof(IdWell))]
public virtual Well Well { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using AsbCloudDb.Model.DailyReport;
namespace AsbCloudDb.Model
{
#nullable disable
public class DailyReportInfo
{
public Head Head { get; set; }
public Bha Bha { get; set; }
public NoDrilling NoDrilling { get; set; }
public TimeBalance TimeBalance { get; set; }
public Saub Saub { get; set; }
public Sign Sign { get; set; }
}
}

View File

@ -0,0 +1,107 @@
using System;
namespace AsbCloudDb.Model.DailyReport
{
public class Head
{
/// <summary>
/// название скважины
/// </summary>
public string WellName { get; set; }
/// <summary>
/// название куста
/// </summary>
public string ClusterName { get; set; }
/// <summary>
/// заказчик
/// </summary>
public string Customer { get; set; }
/// <summary>
/// подрядчик
/// </summary>
public string Contractor { get; set; }
/// <summary>
/// дата рапорта
/// </summary>
public DateTime ReportDate { get; set; }
/// <summary>
/// глубина забоя на дату начала интервала
/// </summary>
public double? WellDepthIntervalStartDate { get; set; }
/// <summary>
/// глубина забоя на дату окончания интервала
/// </summary>
public double? WellDepthIntervalFinishDate { get; set; }
/// <summary>
/// Глубина забоя по стволу на окончание отчетного периода
/// </summary>
public double? BottomholeDepth { get; set; }
/// <summary>
/// Глубина забоя по вертикали на дату окончания отчетного периода
/// </summary>
public double? VerticalDepth { get; set; }
/// <summary>
/// Зенитный угол на дату окончания отчетного периода
/// </summary>
public double? ZenithAngle { get; set; }
/// <summary>
/// Азимутальный угол на дату окончания отчетного периода
/// </summary>
public double? AzimuthAngle { get; set; }
/// <summary>
/// ФИО бурильщиков
/// </summary>
public string FirstDriller { get; set; }
/// <summary>
/// ФИО бурильщиков
/// </summary>
public string SecondDriller { get; set; }
/// <summary>
/// Время работы АПД
/// </summary>
public double? WorkTimeSAUB { get; set; }
/// <summary>
/// Время работы спин мастер
/// </summary>
public double? WorkTimeSpinMaster { get; set; }
/// <summary>
/// Время работы torqueMaster
/// </summary>
public double? WorkTimeTorkMaster { get; set; }
/// <summary>
/// количество метров пробуренных с включенным АПД
/// </summary>
public double? PenetrationSAUB { get; set; }
/// <summary>
/// количество метров пробуренных с включенным Спин мастер
/// </summary>
public double? PenetrationSpinMaster { get; set; }
/// <summary>
/// количество метров пробуренных с включенным torqueMaster
/// </summary>
public double? PenetrationTorkMaster { get; set; }
/// <summary>
/// Количество запусков МСЕ
/// </summary>
public int CountLaunchesMSE { get; set; }
}
}

View File

@ -0,0 +1,26 @@
namespace AsbCloudDb.Model.DailyReport
{
public class NoDrilling
{
/// <summary>
/// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию
/// </summary>
public double? StandardTimeBarrelPreparation { get; set; }
/// <summary>
/// Нормативное время на одну операцию по наращиванию
/// </summary>
public double? StandardTimeExtension { get; set; }
/// <summary>
/// Фактическое время проработок при подготовке ствола скважины к наращиванию.
/// </summary>
public double? ActualTimeBarrelPreparation { get; set; }
/// <summary>
/// Фактическое время наращиваний
/// </summary>
public double? ActualTimeExtension { get; set; }
}
}

View File

@ -0,0 +1,104 @@
using System.Collections.Generic;
namespace AsbCloudDb.Model.DailyReport
{
public class Saub
{
/// <summary>
/// Режимы бурения в роторе
/// </summary>
public string? RotorDrillingModes { get; set; }
/// <summary>
/// режимы бурения в слайде
/// </summary>
public string? SlideDrillingModes { get; set; }
/// <summary>
/// Количество метров пробуренных в роторе за отчетный период
/// </summary>
public double? PenetrationInRotor { get; set; }
/// <summary>
/// Количество часов бурения в роторе за отчетный период
/// </summary>
public double? NumberDrillingHours { get; set; }
/// <summary>
/// средний диф перепад в роторе за отчетный период
/// </summary>
public double? AVGDiffDropRotor { get; set; }
/// <summary>
/// количество метров пробуренных в слайде за отчетный период
/// </summary>
public double? PenetrationInSlide { get; set; }
/// <summary>
/// время бурения в роторе за отчетный период
/// </summary>
public double? DrillingTimeInRotor { get; set; }
/// <summary>
/// средний диф. перепад в слайде за отчетный период
/// </summary>
public double? AVGDiffPressureSlide { get; set; }
/// <summary>
/// Плановая МСП за секцию
/// </summary>
public double? SectionROPPlan { get; set; }
/// <summary>
/// Общее время бурения за секцию
/// </summary>
public double? SectionDrillingTimeTotal { get; set; }
/// <summary>
/// Общая проходка за секцию
/// </summary>
public double? SectionPenetrationTotal { get; set; }
/// <summary>
/// Количество наращиваний за отчетный период
/// </summary>
public int ExtensionsCount { get; set; }
/// <summary>
/// Отклонение относительно ГГД
/// </summary>
public double? DeviationFromTVD { get; set; }
/// <summary>
/// указываются все причины, которые влияют на снижение МСП.
/// </summary>
public string DeclinesReasonsROP { get; set; }
/// <summary>
/// Увеличение мех скорости за секцию %
/// </summary>
public string IncreaseSpeedSection { get; set; }
/// <summary>
/// Увеличение мех скорости за сутки %
/// </summary>
public string IncreaseSpeedDay { get; set; }
/// <summary>
/// Сокращение времени бурения за секцию, ч
/// </summary>
public string ReductionTimeDrilling { get; set; }
/// <summary>
/// Ротор/Слайд %
/// </summary>
public string RotorSlidePercent { get; set; }
/// <summary>
/// МСП
/// </summary>
public string MspSection { get; set; }
}
}

View File

@ -0,0 +1,16 @@
namespace AsbCloudDb.Model.DailyReport
{
public class Sign
{
/// <summary>
/// ФИО Мастера буровой
/// </summary>
public string DrillingMaster { get; set; }
/// <summary>
/// ФИО супервайзера
/// </summary>
public string Supervisor { get; set; }
}
}

View File

@ -0,0 +1,96 @@
namespace AsbCloudDb.Model.DailyReport
{
public class TimeBalance
{
/// <summary>
/// Бурение
/// </summary>
public string Drilling { get; set; }
/// <summary>
/// Промывка
/// </summary>
public string Flushing { get; set; }
/// <summary>
/// Наращивание
/// </summary>
public string Building { get; set; }
/// <summary>
/// Проработка
/// </summary>
public string Elaboration { get; set; }
/// <summary>
/// Расширка
/// </summary>
public string Extension { get; set; }
/// <summary>
/// Ремонт
/// </summary>
public string Repair { get; set; }
/// <summary>
/// КНБК
/// </summary>
public string Knbk { get; set; }
/// <summary>
/// СПО
/// </summary>
public string Spo { get; set; }
/// <summary>
/// ПЗР
/// </summary>
public string Pzr { get; set; }
/// <summary>
/// ПВО
/// </summary>
public string Pvo { get; set; }
/// <summary>
/// ПГР
/// </summary>
public string Pgr { get; set; }
/// <summary>
/// ГИС
/// </summary>
public string Gis { get; set; }
/// <summary>
/// ОЗЦ
/// </summary>
public string Ozc { get; set; }
/// <summary>
/// Тех. работы
/// </summary>
public string EngineeringWorks { get; set; }
/// <summary>
/// Снятие замера
/// </summary>
public string TakingMeasure { get; set; }
/// <summary>
/// Цементирование
/// </summary>
public string Cementing { get; set; }
/// <summary>
/// Простой
/// </summary>
public string Simple { get; set; }
/// <summary>
/// НПВ
/// </summary>
public string Npv { get; set; }
}
}

View File

@ -1,215 +0,0 @@
using System;
using System.Collections.Generic;
namespace AsbCloudDb.Model
{
#nullable disable
public class DailyReportInfo
{
/// <summary>
/// название скважины
/// </summary>
public string WellName { get; set; }
/// <summary>
/// название куста
/// </summary>
public string ClusterName { get; set; }
/// <summary>
/// заказчик
/// </summary>
public string Customer { get; set; }
/// <summary>
/// подрядчик
/// </summary>
public string Contractor { get; set; }
/// <summary>
/// дата рапорта
/// </summary>
public DateTimeOffset ReportDate { get; set; }
/// <summary>
/// глубина забоя на дату начала интервала
/// </summary>
public double? WellDepthIntervalStartDate { get; set; }
/// <summary>
/// глубина забоя на дату окончания интервала
/// </summary>
public double? WellDepthIntervalFinishDate { get; set; }
/// <summary>
/// Глубина забоя по стволу на окончание отчетного периода
/// </summary>
public double? BottomholeDepth { get; set; }
/// <summary>
/// Глубина забоя по вертикали на дату окончания отчетного периода
/// </summary>
public double? VerticalDepth { get; set; }
/// <summary>
/// Зенитный угол на дату окончания отчетного периода
/// </summary>
public double? ZenithAngle { get; set; }
/// <summary>
/// Азимутальный угол на дату окончания отчетного периода
/// </summary>
public double? AzimuthAngle { get; set; }
/// <summary>
/// ФИО бурильщиков
/// </summary>
public string FirstDriller { get; set; }
/// <summary>
/// ФИО бурильщиков
/// </summary>
public string SecondDriller { get; set; }
/// <summary>
/// Время работы АПД
/// </summary>
public double? WorkTimeSAUB { get; set; }
/// <summary>
/// Время работы спин мастер
/// </summary>
public double? WorkTimeSpinMaster { get; set; }
/// <summary>
/// Время работы torqueMaster
/// </summary>
public double? WorkTimeTorkMaster { get; set; }
/// <summary>
/// количество метров пробуренных с включенным АПД
/// </summary>
public double? PenetrationSAUB { get; set; }
/// <summary>
/// количество метров пробуренных с включенным Спин мастер
/// </summary>
public double? PenetrationSpinMaster { get; set; }
/// <summary>
/// количество метров пробуренных с включенным torqueMaster
/// </summary>
public double? PenetrationTorkMaster { get; set; }
/// <summary>
/// Количество запусков МСЕ
/// </summary>
public int CountLaunchesMSE { get; set; }
/// <summary>
/// КНБК описание
/// </summary>
public string BHADescription { get; set; }
/// <summary>
/// Нормативное время на одну операцию по подготовке ствола скважины к наращиванию
/// </summary>
public double? StandardTimeBarrelPreparation { get; set; }
/// <summary>
/// Нормативное время на одну операцию по наращиванию
/// </summary>
public double? StandardTimeExtension { get; set; }
/// <summary>
/// Фактическое время проработок при подготовке ствола скважины к наращиванию.
/// </summary>
public double? ActualTimeBarrelPreparation { get; set; }
/// <summary>
/// Фактическое время наращиваний
/// </summary>
public double? ActualTimeExtension { get; set; }
/// <summary>
/// Режимы бурения в роторе
/// </summary>
public IEnumerable<string> RotorDrillingModes { get; set; }
/// <summary>
/// режимы бурения в слайде
/// </summary>
public IEnumerable<string> SlideDrillingModes { get; set; }
/// <summary>
/// Количество метров пробуренных в роторе за отчетный период
/// </summary>
public double? PenetrationInRotor { get; set; }
/// <summary>
/// Количество часов бурения в роторе за отчетный период
/// </summary>
public double? NumberDrillingHours { get; set; }
/// <summary>
/// средний диф перепад в роторе за отчетный период
/// </summary>
public double? AVGDiffDropRotor { get; set; }
/// <summary>
/// количество метров пробуренных в слайде за отчетный период
/// </summary>
public double? PenetrationInSlide { get; set; }
/// <summary>
/// время бурения в роторе за отчетный период
/// </summary>
public double? DrillingTimeInRotor { get; set; }
/// <summary>
/// средний диф перепад в слайде за отчетный период
/// </summary>
public double? AVGDiffPressureSlide { get; set; }
/// <summary>
/// Плановая МСП за секцию
/// </summary>
public double? SectionROPPlan { get; set; }
/// <summary>
/// Общее время бурения за секцию
/// </summary>
public double? SectionDrillingTimeTotal { get; set; }
/// <summary>
/// Общая проходка за секцию
/// </summary>
public double? SectionPenetrationTotal { get; set; }
/// <summary>
/// Количество наращиваний за отчетный период
/// </summary>
public int ExtensionsCount { get; set; }
/// <summary>
/// Отклонение относительно ГГД
/// </summary>
public double? DeviationFromTVD { get; set; }
/// <summary>
/// указываются все причины, которые влияют на снижение МСП.
/// </summary>
public string DeclinesReasonsROP { get; set; }
/// <summary>
/// ФИО Мастера буровой
/// </summary>
public string DrillingMaster { get; set; }
/// <summary>
/// ФИО супервайзера
/// </summary>
public string Supervisor { get; set; }
}
}

View File

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore;
namespace AsbCloudDb.Model.DefaultData
{
internal static class DefaultContextData
{
public static void Fill(ModelBuilder modelBuilder)
{
var fillers = new IEntityFiller[]
{
// Order does meter
new EntityFillerUserRole(),
new EntityFillerRelationUserRoleUserRole(),
new EntityFillerPermission(),
new EntityFillerRelationUserRolePermission(),
new EntityFillerUser(),
new EntityFillerRelationUserUserRole(),
new EntityFillerCompany(),
new EntityFillerWellOperationCategory(),
new EntityFillerFileCategory(),
new EntityFillerWellSectionType(),
new EntityFillerWellType(),
new EntityFillerMeasureCategory(),
new EntityFillerCompanyType(),
};
foreach (var filler in fillers)
filler.FillData(modelBuilder);
}
}
}

View File

@ -0,0 +1,18 @@
using Microsoft.EntityFrameworkCore;
namespace AsbCloudDb.Model.DefaultData
{
internal abstract class EntityFiller<TEntity> : IEntityFiller
where TEntity : class
{
protected abstract TEntity[] GetData();
public void FillData(ModelBuilder modelBuilder)
{
modelBuilder.Entity<TEntity>(entity =>
{
entity.HasData(GetData());
});
}
}
}

View File

@ -0,0 +1,10 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerCompany : EntityFiller<Company>
{
protected override Company[] GetData() => new Company[]
{
new (){ Id = 1, Caption = "ООО \"АСБ\"", IdCompanyType = 3},
};
}
}

View File

@ -0,0 +1,11 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerCompanyType : EntityFiller<CompanyType>
{
protected override CompanyType[] GetData() => new CompanyType[] {
new (){ Id = 1, Caption = "Недрапользователь", },
new (){ Id = 2, Caption = "Буровой подрядчик", },
new (){ Id = 3, Caption = "Сервис автоматизации бурения", },
};
}
}

View File

@ -0,0 +1,32 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerFileCategory: EntityFiller<FileCategory>
{
protected override FileCategory[] GetData() => new FileCategory[]{
new () {Id = 1, Name = "Растворный сервис", ShortName = "fluidService"},
new () {Id = 2, Name = "Цементирование", ShortName = "cement"},
new () {Id = 3, Name = "ННБ", ShortName = "nnb"},
new () {Id = 4, Name = "ГТИ", ShortName = "gti"},
new () {Id = 5, Name = "Документы по скважине", ShortName = "wellDocuments"},
new () {Id = 6, Name = "Супервайзер", ShortName = "supervisor"},
new () {Id = 7, Name = "Мастер", ShortName = "master"},
new () {Id = 8, Name = "Долотный сервис", ShortName = "toolService"},
new () {Id = 9, Name = "Буровой подрядчик", ShortName = "drillService"},
new () {Id = 10, Name = "Сервис по заканчиванию скважины", ShortName = "closingService"},
//new () {Id = 11, Name = "", ShortName = ""},
new () {Id = 12, Name = "Рапорт", ShortName = "report"},
new () {Id = 1000, Name = "Программа бурения"},
new () {Id = 1001, Name = "Задание от геологов"},
new () {Id = 1002, Name = "Профиль ствола скважины (ННБ)"},
new () {Id = 1003, Name = "Технологические расчеты (ННБ)"},
new () {Id = 1004, Name = "Долотная программа"},
new () {Id = 1005, Name = "Программа по растворам"},
new () {Id = 1006, Name = "Программа геофизических исследований"},
new () {Id = 1007, Name = "Планы спусков обсадных колонн"},
new () {Id = 1008, Name = "Программы цементирования обсадных колонн"},
};
}
}

View File

@ -0,0 +1,11 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerMeasureCategory : EntityFiller<MeasureCategory>
{
protected override MeasureCategory[] GetData() => new MeasureCategory[] {
new (){ Id = 1, Name = "Показатели бурового раствора", ShortName = "Раствор"},
new (){ Id = 2, Name = "Шламограмма", ShortName = "Шламограмма"},
new (){ Id = 3, Name = "ННБ", ShortName = "ННБ"},
};
}
}

View File

@ -0,0 +1,127 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerPermission : EntityFiller<Permission>
{
protected override Permission[] GetData() => new Permission[]{
new (){ Id = 100, Name="AdminCluster.delete", Description="Разрешение удалять админ. Кусты"},
new (){ Id = 101, Name="AdminCluster.edit", Description="Разрешение редактировать админ. Кусты"},
new (){ Id = 102, Name="AdminCluster.get", Description="Разрешение просматривать админ. Кусты"},
new (){ Id = 103, Name="AdminCompany.delete", Description="Разрешение удалять админ. Компании"},
new (){ Id = 104, Name="AdminCompany.edit", Description="Разрешение редактировать админ. Компании"},
new (){ Id = 105, Name="AdminCompany.get", Description="Разрешение просматривать админ. Компании"},
new (){ Id = 106, Name="AdminCompanyType.delete", Description="Разрешение удалять админ. Типы компаний"},
new (){ Id = 107, Name="AdminCompanyType.edit", Description="Разрешение редактировать админ. Типы компаний"},
new (){ Id = 108, Name="AdminCompanyType.get", Description="Разрешение просматривать админ. Типы компаний"},
new (){ Id = 109, Name="AdminDeposit.delete", Description="Разрешение удалять админ. Месторождения"},
new (){ Id = 110, Name="AdminDeposit.edit", Description="Разрешение редактировать админ. Месторождения"},
new (){ Id = 111, Name="AdminDeposit.get", Description="Разрешение просматривать админ. Месторождения"},
new (){ Id = 112, Name="AdminPermission.delete", Description="Разрешение удалять админ. Разрешения"},
new (){ Id = 113, Name="AdminPermission.edit", Description="Разрешение редактировать админ. Разрешения"},
new (){ Id = 114, Name="AdminPermission.get", Description="Разрешение просматривать админ. Разрешения"},
new (){ Id = 115, Name="AdminTelemetry.delete", Description="Разрешение удалять админ. Телеметрию"},
new (){ Id = 116, Name="AdminTelemetry.edit", Description="Разрешение редактировать админ. Телеметрию"},
new (){ Id = 117, Name="AdminTelemetry.get", Description="Разрешение просматривать админ. Телеметрию"},
new (){ Id = 118, Name="AdminUser.delete", Description="Разрешение удалять админ. Пользователей"},
new (){ Id = 119, Name="AdminUser.edit", Description="Разрешение редактировать админ. Пользователей"},
new (){ Id = 120, Name="AdminUser.get", Description="Разрешение просматривать админ. Пользователей"},
new (){ Id = 121, Name="AdminUserRole.delete", Description="Разрешение удалять админ. Роли пользователей"},
new (){ Id = 122, Name="AdminUserRole.edit", Description="Разрешение редактировать админ. Роли пользователей"},
new (){ Id = 123, Name="AdminUserRole.get", Description="Разрешение просматривать админ. Роли пользователей"},
new (){ Id = 124, Name="AdminWell.delete", Description="Разрешение удалять админ. Скважины"},
new (){ Id = 125, Name="AdminWell.edit", Description="Разрешение редактировать админ. Скважины"},
new (){ Id = 126, Name="AdminWell.get", Description="Разрешение просматривать админ. Скважины"},
new (){ Id = 200, Name="Auth.edit", Description="Разрешение редактировать 0"},
new (){ Id = 201, Name="Auth.get", Description="Разрешение просматривать 0"},
new (){ Id = 202, Name="Cluster.get", Description="Разрешение просматривать Кусты"},
new (){ Id = 203, Name="Deposit.get", Description="Разрешение просматривать Месторождения"},
new (){ Id = 204, Name="DrillFlowChart.delete", Description="Разрешение удалять РТК"},
new (){ Id = 205, Name="DrillFlowChart.edit", Description="Разрешение редактировать РТК"},
new (){ Id = 206, Name="DrillFlowChart.get", Description="Разрешение просматривать РТК"},
new (){ Id = 207, Name="DrillingProgram.delete", Description="Разрешение удалять Программу бурения"},
new (){ Id = 208, Name="DrillingProgram.edit", Description="Разрешение редактировать Программу бурения"},
new (){ Id = 209, Name="DrillingProgram.get", Description="Разрешение просматривать Программу бурения"},
new (){ Id = 210, Name="DrillParams.delete", Description="Разрешение удалять Режимы бурения"},
new (){ Id = 211, Name="DrillParams.edit", Description="Разрешение редактировать Режимы бурения"},
new (){ Id = 212, Name="DrillParams.get", Description="Разрешение просматривать Режимы бурения"},
new (){ Id = 213, Name="File.delete", Description="Разрешение удалять Файлы"},
new (){ Id = 214, Name="File.edit", Description="Разрешение редактировать Файлы"},
new (){ Id = 215, Name="File.get", Description="Разрешение просматривать Файлы"},
new (){ Id = 216, Name="Measure.delete", Description="Разрешение удалять Измерения"},
new (){ Id = 217, Name="Measure.edit", Description="Разрешение редактировать Измерения"},
new (){ Id = 218, Name="Measure.get", Description="Разрешение просматривать Измерения"},
new (){ Id = 219, Name="Message.get", Description="Разрешение просматривать Сообщения телеметрии"},
new (){ Id = 220, Name="OperationStat.get", Description="Разрешение просматривать Статистику по операциям"},
new (){ Id = 221, Name="Report.edit", Description="Разрешение редактировать Рапорта"},
new (){ Id = 222, Name="Report.get", Description="Разрешение просматривать Рапорта"},
new (){ Id = 223, Name="RequestTracker.get", Description="Разрешение просматривать админ. Системная статистика"},
new (){ Id = 224, Name="Setpoints.delete", Description="Разрешение удалять Рекомендации уставок"},
new (){ Id = 225, Name="Setpoints.edit", Description="Разрешение редактировать Рекомендации уставок"},
new (){ Id = 226, Name="Setpoints.get", Description="Разрешение просматривать Рекомендации уставок"},
new (){ Id = 227, Name="Telemetry.edit", Description="Разрешение редактировать Телеметрии"},
new (){ Id = 228, Name="TelemetryAnalytics.get", Description="Разрешение просматривать Анализ телеметрии"},
new (){ Id = 229, Name="TelemetryDataSaub.edit", Description="Разрешение редактировать Данные телеметрии по САУБ"},
new (){ Id = 230, Name="TelemetryDataSaub.get", Description="Разрешение просматривать Данные телеметрии по САУБ"},
new (){ Id = 231, Name="TelemetryDataSpin.edit", Description="Разрешение редактировать Данные телеметрии по SpinMaster"},
new (){ Id = 232, Name="TelemetryDataSpin.get", Description="Разрешение просматривать Данные телеметрии по SpinMaster"},
new (){ Id = 233, Name="Well.edit", Description="Разрешение редактировать Скважины"},
new (){ Id = 234, Name="Well.get", Description="Разрешение просматривать Скважины"},
new (){ Id = 235, Name="WellComposite.edit", Description="Разрешение редактировать Композитные скважины"},
new (){ Id = 236, Name="WellComposite.get", Description="Разрешение просматривать Композитные скважины"},
new (){ Id = 237, Name="WellOperation.delete", Description="Разрешение удалять Операции по скважинам"},
new (){ Id = 238, Name="WellOperation.edit", Description="Разрешение редактировать Операции по скважинам"},
new (){ Id = 239, Name="WellOperation.get", Description="Разрешение просматривать Операции по скважинам"},
new (){ Id = 240, Name="File.edit1", Description="Разрешение редактировать Файлы категории 1 (Растворный сервис)"},
new (){ Id = 241, Name="File.edit2", Description="Разрешение редактировать Файлы категории 2 (Цементирование)"},
new (){ Id = 242, Name="File.edit3", Description="Разрешение редактировать Файлы категории 3 (ННБ)"},
new (){ Id = 243, Name="File.edit4", Description="Разрешение редактировать Файлы категории 4 (ГТИ)"},
new (){ Id = 244, Name="File.edit5", Description="Разрешение редактировать Файлы категории 5 (Документы по скважине)"},
new (){ Id = 245, Name="File.edit6", Description="Разрешение редактировать Файлы категории 6 (Супервайзер)"},
new (){ Id = 246, Name="File.edit7", Description="Разрешение редактировать Файлы категории 7 (Мастер)"},
new (){ Id = 247, Name="File.edit8", Description="Разрешение редактировать Файлы категории 8 (Долотный сервис)"},
new (){ Id = 248, Name="File.edit9", Description="Разрешение редактировать Файлы категории 9 (Буровой подрядчик)"},
new (){ Id = 249, Name="File.edit10", Description="Разрешение редактировать Файлы категории 10 (Сервис по заканчиванию скважины)"},
new (){ Id = 250, Name="File.edit11", Description="Разрешение редактировать Файлы категории 11 (Рапорт)"},
new (){ Id = 251, Name="File.edit12", Description="Разрешение редактировать Файлы категории 12"},
new (){ Id = 252, Name="File.edit13", Description="Разрешение редактировать Файлы категории 12"},
new (){ Id = 253, Name="File.edit14", Description="Разрешение редактировать Файлы категории 13"},
new (){ Id = 254, Name="File.edit15", Description="Разрешение редактировать Файлы категории 14"},
new (){ Id = 255, Name="File.edit16", Description="Разрешение редактировать Файлы категории 15"},
new (){ Id = 256, Name="File.edit17", Description="Разрешение редактировать Файлы категории 16"},
new (){ Id = 257, Name="File.edit18", Description="Разрешение редактировать Файлы категории 17"},
new (){ Id = 258, Name="File.edit19", Description="Разрешение редактировать Файлы категории 18"},
new (){ Id = 259, Name="File.edit20", Description="Разрешение редактировать Файлы категории 19"},
new (){ Id = 260, Name="File.edit21", Description="Разрешение редактировать Файлы категории 20"},
new (){ Id = 261, Name="File.edit22", Description="Разрешение редактировать Файлы категории 21"},
new (){ Id = 262, Name="File.edit23", Description="Разрешение редактировать Файлы категории 22"},
new (){ Id = 263, Name="File.edit24", Description="Разрешение редактировать Файлы категории 23"},
new (){ Id = 264, Name="File.edit25", Description="Разрешение редактировать Файлы категории 24"},
new (){ Id = 265, Name="File.edit26", Description="Разрешение редактировать Файлы категории 25"},
new (){ Id = 266, Name="File.edit27", Description="Разрешение редактировать Файлы категории 26"},
new (){ Id = 267, Name="File.edit28", Description="Разрешение редактировать Файлы категории 27"},
new (){ Id = 268, Name="File.edit29", Description="Разрешение редактировать Файлы категории 28"},
new (){ Id = 269, Name="File.edit30", Description="Разрешение редактировать Файлы категории 29"},
new (){ Id = 380, Name="Driller.get", Description="Разрешение просматривать список бурильщиков"},
new (){ Id = 381, Name="Driller.edit", Description="Разрешение редактировать бурильщика"},
new (){ Id = 382, Name="Driller.delete", Description="Разрешение удалять бурильщик"},
new (){ Id = 383, Name="Schedule.get", Description="Разрешение просматривать графики бурильщиков"},
new (){ Id = 384, Name="Schedule.edit", Description="Разрешение редактировать график бурильщика"},
new (){ Id = 385, Name="Schedule.delete", Description="Разрешение удалять график бурильщика"},
new (){ Id = 386, Name="DailyReport.get", Description="Разрешение просматривать суточный рапорт"},
new (){ Id = 387, Name="DailyReport.edit", Description="Разрешение редактировать суточный рапорт"},
new (){ Id = 388, Name="DetectedOperation.get", Description="Разрешение просматривать авто. определенные операции"},
new (){ Id = 389, Name="OperationValue.get", Description="Разрешение просматривать целевые значения"},
new (){ Id = 390, Name="OperationValue.edit", Description="Разрешение редактировать целевые значения"},
new (){ Id = 391, Name="OperationValue.delete", Description="Разрешение удалять целевые значения"},
new (){ Id = 400, Name="WitsInfo.get", Description="Разрешение просматривать инфо по wits параметрам"},
new (){ Id = 401, Name="WitsRecord1.get", Description="Разрешение просматривать WITS record 1"},
new (){ Id = 407, Name="WitsRecord7.get", Description="Разрешение просматривать WITS record 7"},
new (){ Id = 408, Name="WitsRecord8.get", Description="Разрешение просматривать WITS record 8"},
new (){ Id = 450, Name="WitsRecord50.get", Description="Разрешение просматривать WITS record 50"},
new (){ Id = 460, Name="WitsRecord60.get", Description="Разрешение просматривать WITS record 60"},
new (){ Id = 461, Name="WitsRecord61.get", Description="Разрешение просматривать WITS record 61"},
};
}
}

View File

@ -0,0 +1,58 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerRelationUserRolePermission: EntityFiller<RelationUserRolePermission>
{
protected override RelationUserRolePermission[] GetData() => new RelationUserRolePermission[]{
new (){ IdUserRole = 1100, IdPermission = 102}, new (){ IdUserRole = 1100, IdPermission = 111},
new (){ IdUserRole = 1101, IdPermission = 101}, new (){ IdUserRole = 1101, IdPermission = 100},
new (){ IdUserRole = 1102, IdPermission = 105}, new (){ IdUserRole = 1102, IdPermission = 108},
new (){ IdUserRole = 1103, IdPermission = 104}, new (){ IdUserRole = 1103, IdPermission = 103},
new (){ IdUserRole = 1104, IdPermission = 108},
new (){ IdUserRole = 1105, IdPermission = 107}, new (){ IdUserRole = 1105, IdPermission = 106},
new (){ IdUserRole = 1106, IdPermission = 111},
new (){ IdUserRole = 1107, IdPermission = 110}, new (){ IdUserRole = 1107, IdPermission = 109},
new (){ IdUserRole = 1108, IdPermission = 114},
new (){ IdUserRole = 1109, IdPermission = 113}, new (){ IdUserRole = 1109, IdPermission = 112},
new (){ IdUserRole = 1110, IdPermission = 123}, new (){ IdUserRole = 1110, IdPermission = 114},
new (){ IdUserRole = 1111, IdPermission = 122}, new (){ IdUserRole = 1111, IdPermission = 121},
new (){ IdUserRole = 1112, IdPermission = 117},
new (){ IdUserRole = 1113, IdPermission = 105}, new (){ IdUserRole = 1113, IdPermission = 123}, new (){ IdUserRole = 1113, IdPermission = 120},
new (){ IdUserRole = 1114, IdPermission = 119}, new (){ IdUserRole = 1114, IdPermission = 118}, new (){ IdUserRole = 1114, IdPermission = 200},
new (){ IdUserRole = 1115, IdPermission = 223},
new (){ IdUserRole = 1116, IdPermission = 105}, new (){ IdUserRole = 1116, IdPermission = 102}, new (){ IdUserRole = 1116, IdPermission = 117}, new (){ IdUserRole = 1116, IdPermission = 126},
new (){ IdUserRole = 1117, IdPermission = 125}, new (){ IdUserRole = 1117, IdPermission = 124},
new (){ IdUserRole = 1200, IdPermission = 203}, new (){ IdUserRole = 1200, IdPermission = 230},
new (){ IdUserRole = 1201, IdPermission = 202}, new (){ IdUserRole = 1201, IdPermission = 203}, new (){ IdUserRole = 1201, IdPermission = 220},
new (){ IdUserRole = 1202, IdPermission = 203}, new (){ IdUserRole = 1202, IdPermission = 220}, new (){ IdUserRole = 1202, IdPermission = 236}, new (){ IdUserRole = 1202, IdPermission = 212},
new (){ IdUserRole = 1203, IdPermission = 235},
new (){ IdUserRole = 1204, IdPermission = 202}, new (){ IdUserRole = 1204, IdPermission = 203},
new (){ IdUserRole = 1205, IdPermission = 215},
new (){ IdUserRole = 1206, IdPermission = 203}, new (){ IdUserRole = 1206, IdPermission = 206},
new (){ IdUserRole = 1207, IdPermission = 205},
new (){ IdUserRole = 1208, IdPermission = 218},
new (){ IdUserRole = 1209, IdPermission = 217},
new (){ IdUserRole = 1210, IdPermission = 203}, new (){ IdUserRole = 1210, IdPermission = 230}, new (){ IdUserRole = 1210, IdPermission = 219},
new (){ IdUserRole = 1211, IdPermission = 203}, new (){ IdUserRole = 1211, IdPermission = 220}, new (){ IdUserRole = 1211, IdPermission = 239},
new (){ IdUserRole = 1212, IdPermission = 238}, new (){ IdUserRole = 1212, IdPermission = 237},
new (){ IdUserRole = 1213, IdPermission = 203}, new (){ IdUserRole = 1213, IdPermission = 239}, new (){ IdUserRole = 1213, IdPermission = 212},
new (){ IdUserRole = 1214, IdPermission = 211}, new (){ IdUserRole = 1214, IdPermission = 210},
new (){ IdUserRole = 1215, IdPermission = 203}, new (){ IdUserRole = 1215, IdPermission = 222},
new (){ IdUserRole = 1216, IdPermission = 221},
new (){ IdUserRole = 1217, IdPermission = 226},
new (){ IdUserRole = 1218, IdPermission = 225}, new (){ IdUserRole = 1218, IdPermission = 224},
new (){ IdUserRole = 1219, IdPermission = 203}, new (){ IdUserRole = 1219, IdPermission = 206}, new (){ IdUserRole = 1219, IdPermission = 230}, new (){ IdUserRole = 1219, IdPermission = 232},
new (){ IdUserRole = 1220, IdPermission = 203}, new (){ IdUserRole = 1220, IdPermission = 228},
new (){ IdUserRole = 1221, IdPermission = 202}, new (){ IdUserRole = 1221, IdPermission = 203}, new (){ IdUserRole = 1221, IdPermission = 220}, new (){ IdUserRole = 1221, IdPermission = 234},
new (){ IdUserRole = 1501, IdPermission = 214}, new (){ IdUserRole = 1501, IdPermission = 213},
new (){ IdUserRole = 1502, IdPermission = 207}, new (){ IdUserRole = 1502, IdPermission = 208},
new (){ IdUserRole = 2000, IdPermission = 205}, new (){ IdUserRole = 2000, IdPermission = 204}, new (){ IdUserRole = 2000, IdPermission = 245},
new (){ IdUserRole = 2001, IdPermission = 244}, new (){ IdUserRole = 2001, IdPermission = 245},
new (){ IdUserRole = 2002, IdPermission = 244}, new (){ IdUserRole = 2002, IdPermission = 246}, new (){ IdUserRole = 2002, IdPermission = 237}, new (){ IdUserRole = 2002, IdPermission = 238},
new (){ IdUserRole = 2003, IdPermission = 240}, new (){ IdUserRole = 2003, IdPermission = 217}, new (){ IdUserRole = 2003, IdPermission = 216},
new (){ IdUserRole = 2004, IdPermission = 242}, new (){ IdUserRole = 2004, IdPermission = 217}, new (){ IdUserRole = 2004, IdPermission = 216}, new (){ IdUserRole = 2004, IdPermission = 205}, new (){ IdUserRole = 2004, IdPermission = 204},
new (){ IdUserRole = 2005, IdPermission = 247}, new (){ IdUserRole = 2005, IdPermission = 205}, new (){ IdUserRole = 2005, IdPermission = 204},
new (){ IdUserRole = 2006, IdPermission = 243}, new (){ IdUserRole = 2006, IdPermission = 205}, new (){ IdUserRole = 2006, IdPermission = 204},
new (){ IdUserRole = 2007, IdPermission = 241}, new (){ IdUserRole = 2007, IdPermission = 205}, new (){ IdUserRole = 2007, IdPermission = 204},
};
}
}

View File

@ -0,0 +1,32 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerRelationUserRoleUserRole: EntityFiller< RelationUserRoleUserRole>
{
protected override RelationUserRoleUserRole[] GetData() => new RelationUserRoleUserRole[]{
new (){ Id = 1101, IdInclude = 1100 },
new (){ Id = 1103, IdInclude = 1102 },
new (){ Id = 1105, IdInclude = 1104 },
new (){ Id = 1107, IdInclude = 1106 },
new (){ Id = 1109, IdInclude = 1108 },
new (){ Id = 1111, IdInclude = 1110 },
new (){ Id = 1114, IdInclude = 1113 },
new (){ Id = 1117, IdInclude = 1116 },
new (){ Id = 1203, IdInclude = 1202 },
new (){ Id = 1207, IdInclude = 1206 },
new (){ Id = 1209, IdInclude = 1208 },
new (){ Id = 1212, IdInclude = 1211 },
new (){ Id = 1214, IdInclude = 1213 },
new (){ Id = 1216, IdInclude = 1215 },
new (){ Id = 1218, IdInclude = 1217 },
new (){ Id = 2000, IdInclude = 1200}, new (){ Id = 2000, IdInclude = 1201}, new (){ Id = 2000, IdInclude = 1202}, new (){ Id = 2000, IdInclude = 1204}, new (){ Id = 2000, IdInclude = 1205}, new (){ Id = 2000, IdInclude = 1206}, new (){ Id = 2000, IdInclude = 1208}, new (){ Id = 2000, IdInclude = 1210}, new (){ Id = 2000, IdInclude = 1211}, new (){ Id = 2000, IdInclude = 1213}, new (){ Id = 2000, IdInclude = 1215}, new (){ Id = 2000, IdInclude = 1217}, new (){ Id = 2000, IdInclude = 1219}, new (){ Id = 2000, IdInclude = 1220}, new (){ Id = 2000, IdInclude = 1221},
new (){ Id = 2000, IdInclude = 1500 },new (){ Id = 2000, IdInclude = 1501 },new (){ Id = 2000, IdInclude = 1502 },
new (){ Id = 2001, IdInclude = 1500 },new (){ Id = 2001, IdInclude = 1501 },new (){ Id = 2001, IdInclude = 1502 },
new (){ Id = 2002, IdInclude = 1500 },new (){ Id = 2002, IdInclude = 1501 },new (){ Id = 2002, IdInclude = 1502 },
new (){ Id = 2003, IdInclude = 1500 },new (){ Id = 2003, IdInclude = 1501 },new (){ Id = 2003, IdInclude = 1502 },
new (){ Id = 2004, IdInclude = 1500 },new (){ Id = 2004, IdInclude = 1501 },new (){ Id = 2004, IdInclude = 1502 },
new (){ Id = 2005, IdInclude = 1500 },new (){ Id = 2005, IdInclude = 1501 },new (){ Id = 2005, IdInclude = 1502 },
new (){ Id = 2006, IdInclude = 1500 },new (){ Id = 2006, IdInclude = 1501 },new (){ Id = 2006, IdInclude = 1502 },
new (){ Id = 2007, IdInclude = 1500 },new (){ Id = 2007, IdInclude = 1501 },new (){ Id = 2007, IdInclude = 1502 },
};
}
}

View File

@ -0,0 +1,10 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerRelationUserUserRole : EntityFiller<RelationUserUserRole>
{
protected override RelationUserUserRole[] GetData() => new RelationUserUserRole[]
{
new () { IdUser = 1, IdUserRole = 1, },
};
}
}

View File

@ -0,0 +1,15 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerUser : EntityFiller<User>
{
protected override User[] GetData() => new User[]{
new (){
Id = 1,
IdCompany = 1,
Login = "dev",
PasswordHash = "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072",
Name = "Разработчик",
},
};
}
}

View File

@ -0,0 +1,60 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerUserRole : EntityFiller<UserRole>
{
protected override UserRole[] GetData() => new UserRole[]{
new (){ Id = 1, Caption = "root", IdType = 1},
new (){ Id = 1100, Caption = "admin_cluster.view", IdType = 1},
new (){ Id = 1101, Caption = "admin_cluster.edit", IdType = 1},
new (){ Id = 1102, Caption = "admin_company.view", IdType = 1},
new (){ Id = 1103, Caption = "admin_company.edit", IdType = 1},
new (){ Id = 1104, Caption = "admin_company_type.view", IdType = 1},
new (){ Id = 1105, Caption = "admin_company_type.edit", IdType = 1},
new (){ Id = 1106, Caption = "admin_deposit.view", IdType = 1},
new (){ Id = 1107, Caption = "admin_deposit.edit", IdType = 1},
new (){ Id = 1108, Caption = "admin_permission.view", IdType = 1},
new (){ Id = 1109, Caption = "admin_permission.edit", IdType = 1},
new (){ Id = 1110, Caption = "admin_role.view", IdType = 1},
new (){ Id = 1111, Caption = "admin_role.edit", IdType = 1},
new (){ Id = 1112, Caption = "admin_telemetry.view", IdType = 1},
new (){ Id = 1113, Caption = "admin_user.view", IdType = 1},
new (){ Id = 1114, Caption = "admin_user.edit", IdType = 1},
new (){ Id = 1115, Caption = "admin_visit_log.view", IdType = 1},
new (){ Id = 1116, Caption = "admin_well.view", IdType = 1},
new (){ Id = 1117, Caption = "admin_well.edit", IdType = 1},
new (){ Id = 1200, Caption = "archive.view", IdType = 1},
new (){ Id = 1201, Caption = "cluster.view", IdType = 1},
new (){ Id = 1202, Caption = "composite.view", IdType = 1},
new (){ Id = 1203, Caption = "composite.edit", IdType = 1},
new (){ Id = 1204, Caption = "deposit.view", IdType = 1},
new (){ Id = 1205, Caption = "document.view", IdType = 1},
new (){ Id = 1206, Caption = "drillProcessFlow.view", IdType = 1},
new (){ Id = 1207, Caption = "drillProcessFlow.edit", IdType = 1},
new (){ Id = 1208, Caption = "measure.view", IdType = 1},
new (){ Id = 1209, Caption = "measure.edit", IdType = 1},
new (){ Id = 1210, Caption = "message.view", IdType = 1},
new (){ Id = 1211, Caption = "operations.view", IdType = 1},
new (){ Id = 1212, Caption = "operations.edit", IdType = 1},
new (){ Id = 1213, Caption = "params.view", IdType = 1},
new (){ Id = 1214, Caption = "params.edit", IdType = 1},
new (){ Id = 1215, Caption = "report.view", IdType = 1},
new (){ Id = 1216, Caption = "report.edit", IdType = 1},
new (){ Id = 1217, Caption = "setpoints.view", IdType = 1},
new (){ Id = 1218, Caption = "setpoints.edit", IdType = 1},
new (){ Id = 1219, Caption = "telemetry.view", IdType = 1},
new (){ Id = 1220, Caption = "telemetryAnalysis.view", IdType = 1},
new (){ Id = 1221, Caption = "well.view", IdType = 1},
new (){ Id = 1500, Caption = "Просмотр всего", IdType = 1},
new (){ Id = 1501, Caption = "file.edit", IdType = 1},
new (){ Id = 1502, Caption = "drillingProgram.edit", IdType = 1},
new (){ Id = 2000, Caption = "Заказчик", IdType = 0},
new (){ Id = 2001, Caption = "Супервайзер", IdType = 0},
new (){ Id = 2002, Caption = "Буровой подрядчик", IdType = 0},
new (){ Id = 2003, Caption = "Растворщик", IdType = 0},
new (){ Id = 2004, Caption = "Телеметрист", IdType = 0},
new (){ Id = 2005, Caption = "Долотный сервис", IdType = 0},
new (){ Id = 2006, Caption = "ГТИ", IdType = 0},
new (){ Id = 2007, Caption = "Цементирование", IdType = 0},
};
}
}

View File

@ -0,0 +1,84 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerWellOperationCategory : EntityFiller<WellOperationCategory>
{
protected override WellOperationCategory[] GetData() => new WellOperationCategory[]{
// Автоматически определяемые операции
new () {Id = 1, Name = "Невозможно определить операцию", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин"},
new () {Id = 2, Name = "Роторное бурение", Code = 0, KeyValueName = "МСП", KeyValueUnits = "м/ч" },
new () {Id = 3, Name = "Слайдирование", Code = 0, KeyValueName = "МСП", KeyValueUnits = "м/ч" },
new () {Id = 4, Name = "Подъем с проработкой", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 5, Name = "Спуск с проработкой", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 6, Name = "Подъем с промывкой", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 7, Name = "Спуск с промывкой", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 8, Name = "Спуск в скважину", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 9, Name = "Спуск с вращением", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 10, Name = "Подъем из скважины", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 11, Name = "Подъем с вращением", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 12, Name = "Промывка в покое", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 13, Name = "Промывка с вращением", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 14, Name = "Удержание в клиньях", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 15, Name = "Неподвижное состояние", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 16, Name = "Вращение без циркуляции", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 17, Name = "На поверхности", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 18, Name = "Проработка перед наращиванием", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 19, Name = "Шаблонировка перед наращиванием", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 20, Name = "Промывка перед наращиванием", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 21, Name = "Статический замер телесистемы", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 22, Name = "Промывка", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
// Операции ручного ввода
new () {Id = 1001, Name = "Бурение", Code = 0, KeyValueName = "МСП", KeyValueUnits = "м/ч" },
new () {Id = 1002, Name = "ГИС", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1003, Name = "ГФР", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1004, Name = "Монтаж ПВО", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1005, Name = "Демонтаж ПВО", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1006, Name = "Установка ФА", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1007, Name = "Оборудование устья", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1008, Name = "ОЗЦ", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1011, Name = "Начало цикла строительства скважины", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1012, Name = "Окончание цикла строительства скважины", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1013, Name = "Опрессовка ПВО", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1014, Name = "Опрессовка Ц.К.", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1015, Name = "Опрессовка ВЗД", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1016, Name = "Перевод скв на другой тип промывочной жидкости", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1017, Name = "Перезапись каротажа", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1018, Name = "Перетяжка талевого каната", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1019, Name = "Наращивание, промывка", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1020, Name = "Подъем инструмента", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1021, Name = "Подъем инструмента с промывкой", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1022, Name = "Обратная проработка", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1023, Name = "Сборка инструмента с мостков", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1024, Name = "Подготовительные работы", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1025, Name = "Сборка КНБК", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1026, Name = "Разборка КНБК", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1027, Name = "Промывка", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1028, Name = "Промежуточная промывка", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1029, Name = "Прокачка пачек", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1030, Name = "Разбуривание тех.оснастки", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1031, Name = "Ремонт", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1032, Name = "Спуск инструмента", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1033, Name = "Спуск инструмента с промывкой", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1034, Name = "Прямая проработка", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1035, Name = "Принудительная проработка", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1037, Name = "Тех СПО-подъем", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1038, Name = "Тех СПО-спуск", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1039, Name = "Техническое обслуживание", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1040, Name = "Цементаж", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1041, Name = "Шаблонировка ствола", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1042, Name = "Геологическое осложнение", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1043, Name = "НПВ", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1044, Name = "ВМР", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1045, Name = "Прочее", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1046, Name = "Спуск КНБК", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1047, Name = "Подъем КНБК", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1048, Name = "Спуск ОК", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1050, Name = "Промывка при спуске ОК", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1051, Name = "Замер ТС", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1052, Name = "Тех. отстой", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1053, Name = "Циркуляция и Обработка БР", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1054, Name = "Срезка ствола", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
new () {Id = 1055, Name = "Вспомогательные работы", Code = 0, KeyValueName = "Продолжительность", KeyValueUnits = "мин" },
};
}
}

View File

@ -0,0 +1,43 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerWellSectionType : EntityFiller<WellSectionType>
{
protected override WellSectionType[] GetData() => new WellSectionType[]
{
new (){ Id = 1, Caption = "Пилотный ствол"},
new (){ Id = 2, Caption = "Направление"},
new (){ Id = 3, Caption = "Кондуктор"},
new (){ Id = 4, Caption = "Эксплуатационная колонна"},
new (){ Id = 5, Caption = "Транспортный ствол"},
new (){ Id = 6, Caption = "Хвостовик"},
new (){ Id = 7, Caption = "Пилотный ствол 2"},
new (){ Id = 8, Caption = "Направление 2"},
new (){ Id = 9, Caption = "Кондуктор 2"},
new (){ Id = 10, Caption = "Эксплуатационная колонна 2"},
new (){ Id = 11, Caption = "Транспортный ствол 2"},
new (){ Id = 12, Caption = "Хвостовик 2"},
new (){ Id = 13, Caption = "Пилотный ствол 3"},
new (){ Id = 14, Caption = "Направление 3"},
new (){ Id = 15, Caption = "Кондуктор 3"},
new (){ Id = 16, Caption = "Эксплуатационная колонна 3"},
new (){ Id = 17, Caption = "Транспортный ствол 3"},
new (){ Id = 18, Caption = "Хвостовик 3"},
new (){ Id = 19, Caption = "Пилотный ствол 4"},
new (){ Id = 20, Caption = "Направление 4"},
new (){ Id = 21, Caption = "Кондуктор 4"},
new (){ Id = 22, Caption = "Эксплуатационная колонна 4"},
new (){ Id = 23, Caption = "Транспортный ствол 4"},
new (){ Id = 24, Caption = "Хвостовик 4"},
new (){ Id = 25, Caption = "Пилотный ствол 5"},
new (){ Id = 26, Caption = "Направление 5"},
new (){ Id = 27, Caption = "Кондуктор 5"},
new (){ Id = 28, Caption = "Эксплуатационная колонна 5"},
new (){ Id = 29, Caption = "Транспортный ствол 5"},
new (){ Id = 30, Caption = "Хвостовик 5"},
};
}
}

View File

@ -0,0 +1,11 @@
namespace AsbCloudDb.Model.DefaultData
{
internal class EntityFillerWellType : EntityFiller<WellType>
{
protected override WellType[] GetData() => new WellType[]
{
new (){ Id = 1, Caption = "Наклонно-направленная"},
new (){ Id = 2, Caption = "Горизонтальная"},
};
}
}

View File

@ -0,0 +1,9 @@
using Microsoft.EntityFrameworkCore;
namespace AsbCloudDb.Model.DefaultData
{
internal interface IEntityFiller
{
void FillData(ModelBuilder modelBuilder);
}
}

View File

@ -12,7 +12,7 @@ namespace AsbCloudDb.Model
{
DbSet<Cluster> Clusters { get; }
DbSet<Company> Companies { get; }
DbSet<DailyReport> DailyReports { get; }
DbSet<DailyReport.DailyReport> DailyReports { get; }
DbSet<Deposit> Deposits { get; }
DbSet<DetectedOperation> DetectedOperations { get; }
DbSet<DrillFlowChart> DrillFlowChart { get; }

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model
{
[Table("t_user_settings"), Comment("настройки интерфейса пользователя")]
public class UserSetting
{
[Column("id_user")]
public int IdUser { get; set; }
[Column("key"), Comment("Ключ настроек пользователя"), StringLength(255)]
public string Key { get; set; } = null!;
[Column("setting_value", TypeName = "jsonb"), Comment("Значение настроек пользователя")]
public object? Value { get; set; }
[ForeignKey(nameof(IdUser))]
public User User { get; set; } = null!;
}
}

View File

@ -6,6 +6,7 @@ namespace AsbCloudDb.Model.WITS
/// <summary>
/// This is base class for all WITS-0 records
/// </summary>
[Table("t_telemetry_wits_base")]
public abstract class RecordBase : ITelemetryData
{
[Column("id_telemetry")]

View File

@ -18,5 +18,10 @@ namespace AsbCloudDb.Model
[Column("code"), Comment("Код операции")]
public int Code { get; set; }
[Column("key_value_name"), Comment("Название ключевого показателя операции"), StringLength(32)]
public string KeyValueName { get; set; }
[Column("key_value_units"), Comment("Единицы измерения ключевого показателя операции"), StringLength(16)]
public string KeyValueUnits { get; set; }
}
}

View File

@ -12,6 +12,7 @@
<None Remove="Services\DailyReport\DailyReportTemplate.xlsx" />
<None Remove="Services\WellOperationService\ScheduleReportTemplate.xlsx" />
<None Remove="Services\WellOperationService\WellOperationImportTemplate.xlsx" />
<None Remove="Services\DailyReport\DailyReportBlocks\" />
</ItemGroup>
<ItemGroup>
@ -44,6 +45,7 @@
<ItemGroup>
<Folder Include="CommonLibs\" />
<Folder Include="Services\DailyReport\DailyReportBlocks\" />
</ItemGroup>
<ItemGroup>

View File

@ -71,8 +71,6 @@ namespace AsbCloudInfrastructure
.ForType<ClusterDto, Cluster>()
.Ignore(dst => dst.Deposit,
dst => dst.Wells);
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -124,6 +122,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IScheduleService, ScheduleService>();
services.AddTransient<IOperationValueService, OperationValueService>();
services.AddTransient<ISubsystemOperationTimeService, SubsystemOperationTimeService>();
services.AddTransient<IUserSettingsRepository, UserSettingsRepository>();
// admin crud services:
services.AddTransient<ICrudService<TelemetryDto>, CrudServiceBase<TelemetryDto, Telemetry>>(s =>

View File

@ -195,10 +195,13 @@ namespace AsbCloudInfrastructure.Services
private bool CheckPassword(string passwordHash, string password)
{
if (passwordHash.Length == 0 && password.Length == 0)
if (passwordHash?.Length == 0 && password.Length == 0)
return true;
if (passwordHash.Length < PasswordSaltLength)
if (passwordHash?.Length < PasswordSaltLength)
return false;
if (passwordHash is null)
return false;
var salt = passwordHash[0..PasswordSaltLength];

View File

@ -0,0 +1,11 @@
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);
}
}

View File

@ -0,0 +1,174 @@
using ClosedXML.Excel;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace AsbCloudInfrastructure.Services.DailyReport
{
#nullable enable
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;
}
}
#nullable disable
}

View File

@ -0,0 +1,116 @@
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.SluiceBegin}");
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();
}
}
}

View File

@ -0,0 +1,119 @@
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; }
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; }
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.StandardTimeExtension}");
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("Наращивание");
}
}
}

View File

@ -0,0 +1,180 @@
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.PenetrationTorkMaster}");
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}");
}
}
}

View File

@ -0,0 +1,228 @@
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}");
}
}
}

View File

@ -0,0 +1,51 @@
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 CellAddress[] AddressPeriodTableDataArray { 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}");
}
}
}

View File

@ -0,0 +1,175 @@
using AsbCloudApp.Data.DailyReport;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
{
class TimeBalanceBlock : BlockAbstract
{
private readonly TimeBalanceDto blockDto;
public CellAddress AddressTitle { get; }
public CellAddress AddressDrilling { get; set; }
public CellAddress AddressFlushing { get; set; }
public CellAddress AddressBuilding { get; set; }
public CellAddress AddressElaboration { get; set; }
public CellAddress AddressExtension { get; set; }
public CellAddress AddressRepair { get; set; }
public CellAddress AddressDrillingValue { get; set; }
public CellAddress AddressFlushingValue { get; set; }
public CellAddress AddressBuildingValue { get; set; }
public CellAddress AddressElaborationValue { get; set; }
public CellAddress AddressExtensionValue { get; set; }
public CellAddress AddressRepairValue { get; set; }
public CellAddress AddressKnbk { get; set; }
public CellAddress AddressSpo { get; set; }
public CellAddress AddressPzr { get; set; }
public CellAddress AddressPvo { get; set; }
public CellAddress AddressPgr { get; set; }
public CellAddress AddressGis { get; set; }
public CellAddress AddressKnbkValue { get; set; }
public CellAddress AddressSpoValue { get; set; }
public CellAddress AddressPzrValue { get; set; }
public CellAddress AddressPvoValue { get; set; }
public CellAddress AddressPgrValue { get; set; }
public CellAddress AddressGisValue { get; set; }
public CellAddress AddressOzc { get; set; }
public CellAddress AddressEngineeringWorks { get; set; }
public CellAddress AddressTakingMeasure { get; set; }
public CellAddress AddressCementing { get; set; }
public CellAddress AddressSimple { get; set; }
public CellAddress AddressNpv { get; set; }
public CellAddress AddressOzcValue { get; set; }
public CellAddress AddressEngineeringWorksValue { get; set; }
public CellAddress AddressTakingMeasureValue { get; set; }
public CellAddress AddressCementingValue { get; set; }
public CellAddress AddressSimpleValue { get; set; }
public CellAddress AddressNpvValue { get; set; }
public CellAddress[] AddressPeriodTableDataArray { get; }
public override CellAddress AddressBlockBegin { get; }
public override CellAddress AddressBlockEnd { get; }
public TimeBalanceBlock(CellAddress addressBlockBegin, TimeBalanceDto blockDto)
{
AddressBlockBegin = addressBlockBegin.Copy();
this.blockDto = blockDto;
AddressTitle = addressBlockBegin + (1, 3);
AddressDrilling = addressBlockBegin + (2, 1);
AddressFlushing = addressBlockBegin + (3, 1);
AddressBuilding = addressBlockBegin + (4, 1);
AddressElaboration = addressBlockBegin + (5, 1);
AddressExtension = addressBlockBegin + (6, 1);
AddressRepair = addressBlockBegin + (7, 1);
AddressDrillingValue = addressBlockBegin + (2, 2);
AddressFlushingValue = addressBlockBegin + (3, 2);
AddressBuildingValue = addressBlockBegin + (4, 2);
AddressElaborationValue = addressBlockBegin + (5, 2);
AddressExtensionValue = addressBlockBegin + (6, 2);
AddressRepairValue = addressBlockBegin + (7, 2);
AddressKnbk = addressBlockBegin + (2, 3);
AddressSpo = addressBlockBegin + (3, 3);
AddressPzr = addressBlockBegin + (4, 3);
AddressPvo = addressBlockBegin + (5, 3);
AddressPgr = addressBlockBegin + (6, 3);
AddressGis = addressBlockBegin + (7, 3);
AddressKnbkValue = addressBlockBegin + (2, 4);
AddressSpoValue = addressBlockBegin + (3, 4);
AddressPzrValue = addressBlockBegin + (4, 4);
AddressPvoValue = addressBlockBegin + (5, 4);
AddressPgrValue = addressBlockBegin + (6, 4);
AddressGisValue = addressBlockBegin + (7, 4);
AddressOzc = addressBlockBegin + (2, 5);
AddressEngineeringWorks = addressBlockBegin + (3, 5);
AddressTakingMeasure = addressBlockBegin + (4, 5);
AddressCementing = addressBlockBegin + (5, 5);
AddressSimple = addressBlockBegin + (6, 5);
AddressNpv = addressBlockBegin + (7, 5);
AddressOzcValue = addressBlockBegin + (2, 6);
AddressEngineeringWorksValue = addressBlockBegin + (3, 6);
AddressTakingMeasureValue = addressBlockBegin + (4, 6);
AddressCementingValue = addressBlockBegin + (5, 6);
AddressSimpleValue = addressBlockBegin + (6, 6);
AddressNpvValue = addressBlockBegin + (7, 6);
AddressBlockEnd = AddressNpvValue;
}
public override void Draw(IXLWorksheet sheet)
{
sheet.Range(AddressTitle.RowNumber, AddressTitle.ColumnNumber, AddressTitle.RowNumber, AddressTitle.ColumnNumber + 1)
.Merge()
.SetValue("БАЛАНС ВРЕМЕНИ");
sheet.Cell(AddressDrilling)
._SetValue("Бурение", true);
sheet.Cell(AddressFlushing)
._SetValue("Промывка", true);
sheet.Cell(AddressBuilding)
._SetValue("Наращивание", true);
sheet.Cell(AddressElaboration)
._SetValue("Проработка", true);
sheet.Cell(AddressExtension)
._SetValue("Расширка", true);
sheet.Cell(AddressRepair)
._SetValue("Ремонт", true);
sheet.Cell(AddressDrillingValue)
._SetValue($"{blockDto.Drilling}");
sheet.Cell(AddressFlushingValue)
._SetValue($"{blockDto.Flushing}");
sheet.Cell(AddressBuildingValue)
._SetValue($"{blockDto.Building}");
sheet.Cell(AddressElaborationValue)
._SetValue($"{blockDto.Elaboration}");
sheet.Cell(AddressExtensionValue)
._SetValue($"{blockDto.Extension}");
sheet.Cell(AddressRepairValue)
._SetValue($"{blockDto.Repair}");
sheet.Cell(AddressKnbk)
._SetValue("КНБК");
sheet.Cell(AddressSpo)
._SetValue("СПО");
sheet.Cell(AddressPzr)
._SetValue("ПЗР");
sheet.Cell(AddressPvo)
._SetValue("ПВО");
sheet.Cell(AddressPgr)
._SetValue("ПГР");
sheet.Cell(AddressGis)
._SetValue("ГИС");
sheet.Cell(AddressKnbkValue)
._SetValue($"{blockDto.Knbk}");
sheet.Cell(AddressSpoValue)
._SetValue($"{blockDto.Spo}");
sheet.Cell(AddressPzrValue)
._SetValue($"{blockDto.Pzr}");
sheet.Cell(AddressPvoValue)
._SetValue($"{blockDto.Pvo}");
sheet.Cell(AddressPgrValue)
._SetValue($"{blockDto.Pgr}");
sheet.Cell(AddressGisValue)
._SetValue($"{blockDto.Gis}");
sheet.Cell(AddressOzc)
._SetValue("ОЗЦ");
sheet.Cell(AddressEngineeringWorks)
._SetValue("Тех. работы");
sheet.Cell(AddressTakingMeasure)
._SetValue("Снятие замера");
sheet.Cell(AddressCementing)
._SetValue("Цементирование");
sheet.Cell(AddressSimple)
._SetValue("Простой");
sheet.Cell(AddressNpv)
._SetValue("НПВ");
sheet.Cell(AddressOzcValue)
._SetValue($"{blockDto.Ozc}");
sheet.Cell(AddressEngineeringWorksValue)
._SetValue($"{blockDto.EngineeringWorks}");
sheet.Cell(AddressTakingMeasureValue)
._SetValue($"{blockDto.TakingMeasure}");
sheet.Cell(AddressCementingValue)
._SetValue($"{blockDto.Cementing}");
sheet.Cell(AddressSimpleValue)
._SetValue($"{blockDto.Simple}");
sheet.Cell(AddressNpvValue)
._SetValue($"{blockDto.Npv}");
}
}
}

View File

@ -1,299 +1,51 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.DailyReport;
using AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks;
using ClosedXML.Excel;
using System;
using System.IO;
using System.Linq;
namespace AsbCloudInfrastructure.Services.DailyReport
{
public class DailyReportMakerExcel
{
public Stream MakeReport(DailyReportDto dailyReportDto)
public Stream MakeReportFromBlocks(DailyReportDto dto)
{
using var templateStream = System.Reflection.Assembly.GetExecutingAssembly()
.GetManifestResourceStream("AsbCloudInfrastructure.Services.DailyReport.DailyReportTemplate.xlsx");
using var workbook = new XLWorkbook(templateStream, XLEventTracking.Disabled);
FillSheet(workbook, dailyReportDto);
using var workbook = new XLWorkbook();
FillExampleBlocks(workbook, dto);
MemoryStream memoryStream = new MemoryStream();
workbook.SaveAs(memoryStream, new SaveOptions { });
memoryStream.Seek(0, SeekOrigin.Begin);
return memoryStream;
}
public void FillSheet(XLWorkbook workbook, DailyReportDto reportParams)
private void FillExampleBlocks(XLWorkbook workbook, DailyReportDto dto)
{
var sheet = workbook.Worksheets.First();//.Add(reportParams.ReportDate.ToString("dd.MM.yyyy"));
sheet.Name = reportParams.ReportDate.ToString("dd.MM.yyyy");
var activeRow = 3;
activeRow = AddBlockHead(sheet, activeRow, reportParams);
activeRow = AddBlockSlaughtersReport(sheet, activeRow, reportParams);
activeRow = AddBlockTrajectoryReport(sheet, activeRow, reportParams);
activeRow = AddBlockDrillers(sheet, activeRow, reportParams);
activeRow = AddBlockSAUB(sheet, activeRow, reportParams);
activeRow = AddBlockBHA(sheet, activeRow, reportParams);
activeRow = AddBlockBHADescription(sheet, activeRow, reportParams);
activeRow = AddBlockOperations(sheet, activeRow, reportParams);
activeRow = AddBlockTimeBalans(sheet, activeRow, reportParams);
activeRow = AddBlockMeterlessWorks(sheet, activeRow, reportParams);
activeRow = AddBlockDrillingModes(sheet, activeRow, reportParams);
activeRow = AddBlockRotorDrilling(sheet, activeRow, reportParams);
activeRow = AddBlockSlideDrilling(sheet, activeRow, reportParams);
activeRow = AddBlockROPPlan(sheet, activeRow, reportParams);
activeRow = AddBlockSummary(sheet, activeRow, reportParams);
activeRow = AddBlockSubscribes(sheet, activeRow, reportParams);
}
private int AddBlockHead(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow, 3).Value =
$"Суточная сводка бурения скважины №{reportDto.WellName}, куст: {reportDto.ClusterName}";
sheet.Cell(startRow + 1, 3).Value =
$"Заказчик: {reportDto.Customer}";
sheet.Cell(startRow + 2, 3).Value =
$"Подрядчик: {reportDto.Contractor}";
return startRow + 2;
}
private int AddBlockSlaughtersReport(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 4, 3).Value =
$"{reportDto.ReportDate}";
sheet.Cell(startRow + 4, 5).Value =
$"{reportDto.WellDepthIntervalStartDate}";
sheet.Cell(startRow + 4, 6).Value =
$"{reportDto.WellDepthIntervalFinishDate}";
return startRow + 4;
}
private int AddBlockTrajectoryReport(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 4, 3).Value =
$"{reportDto.BottomholeDepth}";
sheet.Cell(startRow + 4, 4).Value =
$"{reportDto.VerticalDepth}";
sheet.Cell(startRow + 4, 5).Value =
$"{reportDto.ZenithAngle}";
sheet.Cell(startRow + 4, 6).Value =
$"{reportDto.AzimuthAngle}";
return startRow + 4;
}
private int AddBlockDrillers(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 2, 4).Value =
$"{reportDto.FirstDriller}";
sheet.Cell(startRow + 3, 4).Value =
$"{reportDto.SecondDriller}";
return startRow + 3;
}
private int AddBlockSAUB(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 6).Value =
$"{reportDto.WorkTimeSAUB}";
sheet.Cell(startRow + 4, 6).Value =
$"{reportDto.WorkTimeSpinMaster}";
sheet.Cell(startRow + 5, 6).Value =
$"{reportDto.WorkTimeTorkMaster}";
sheet.Cell(startRow + 3, 7).Value =
$"{reportDto.PenetrationSAUB}";
sheet.Cell(startRow + 4, 7).Value =
$"{reportDto.PenetrationSpinMaster}";
sheet.Cell(startRow + 5, 7).Value =
$"{reportDto.PenetrationTorkMaster}";
sheet.Cell(startRow + 6, 6).Value =
$"{reportDto.CountLaunchesMSE}";
return startRow + 6;
}
private int AddBlockBHA(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 6).Value =
$"{reportDto.WorkTimeSAUB}";
sheet.Cell(startRow + 4, 6).Value =
$"{reportDto.WorkTimeSpinMaster}";
sheet.Cell(startRow + 5, 6).Value =
$"{reportDto.WorkTimeTorkMaster}";
sheet.Cell(startRow + 3, 7).Value =
$"{reportDto.PenetrationSAUB}";
sheet.Cell(startRow + 4, 7).Value =
$"{reportDto.PenetrationSpinMaster}";
sheet.Cell(startRow + 5, 7).Value =
$"{reportDto.PenetrationTorkMaster}";
sheet.Cell(startRow + 6, 6).Value =
$"{reportDto.CountLaunchesMSE}";
return startRow + 6;
}
private int AddBlockBHADescription(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 2, 3).Value =
$"{reportDto.BHADescription}";
return startRow + 6;
}
private int AddBlockOperations(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
return startRow + 7;
}
private int AddBlockTimeBalans(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
return startRow + 8;
}
private int AddBlockMeterlessWorks(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 4, 6).Value =
$"{reportDto.StandardTimeBarrelPreparation}";
sheet.Cell(startRow + 4, 9).Value =
$"{reportDto.StandardTimeExtension}";
sheet.Cell(startRow + 6, 6).Value =
$"{reportDto.ActualTimeBarrelPreparation}";
sheet.Cell(startRow + 6, 9).Value =
$"{reportDto.ActualTimeExtension}";
return startRow + 9;
}
private int AddBlockDrillingModes(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 2, 6).Value =
$"{string.Join(", ", reportDto.RotorDrillingModes)}";
sheet.Cell(startRow + 3, 9).Value =
$"{string.Join(", ", reportDto.SlideDrillingModes)}";
return startRow + 3;
}
private int AddBlockRotorDrilling(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 3).Value =
$"{reportDto.PenetrationInRotor}";
sheet.Cell(startRow + 3, 5).Value =
$"{reportDto.NumberDrillingHours}";
sheet.Cell(startRow + 3, 9).Value =
$"{reportDto.AVGDiffDropRotor}";
return startRow + 3;
}
private int AddBlockSlideDrilling(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 3).Value =
$"{reportDto.PenetrationInSlide}";
sheet.Cell(startRow + 3, 5).Value =
$"{reportDto.DrillingTimeInRotor}";
sheet.Cell(startRow + 3, 9).Value =
$"{reportDto.AVGDiffPressureSlide}";
return startRow + 3;
}
private int AddBlockROPPlan(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 9).Value =
$"{reportDto.SectionROPPlan}";
return startRow + 3;
}
private int AddBlockSummary(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 7, 7).Value =
$"{reportDto.SectionDrillingTimeTotal}";
sheet.Cell(startRow + 8, 7).Value =
$"{reportDto.SectionPenetrationTotal}";
sheet.Cell(startRow + 9, 7).Value =
$"{reportDto.ExtensionsCount}";
sheet.Cell(startRow + 10, 7).Value =
$"{reportDto.DeviationFromTVD}";
sheet.Cell(startRow + 11, 3).Value =
$"{reportDto.DeclinesReasonsROP}";
return startRow + 13;
}
private int AddBlockSubscribes(IXLWorksheet sheet, int startRow, DailyReportDto reportDto)
{
sheet.Cell(startRow + 3, 9).Value =
$"{reportDto.DrillingMaster}";
sheet.Cell(startRow + 5, 9).Value =
$"{reportDto.Supervisor}";
return startRow + 5;
}
private static string GetColunmLetter(int columnNumber)
{
string letter = "";
while (columnNumber > 0)
{
int modulo = (columnNumber - 1) % 26;
letter = Convert.ToChar('A' + modulo) + letter;
columnNumber = (columnNumber - modulo) / 26;
}
return letter;
}
private static IXLStyle SetBorder(IXLStyle style)
{
style.Border.RightBorder = XLBorderStyleValues.Thin;
style.Border.LeftBorder = XLBorderStyleValues.Thin;
style.Border.TopBorder = XLBorderStyleValues.Thin;
style.Border.BottomBorder = XLBorderStyleValues.Thin;
style.Border.InsideBorder = XLBorderStyleValues.Thin;
return style;
}
private static IXLCell SetDateTime(IXLCell cell)
{
cell.DataType = XLDataType.DateTime;
cell.Style.DateFormat.Format = "DD.MM.YYYY HH:MM:SS";
return cell;
}
private static IXLCell SetNumber(IXLCell cell)
{
cell.DataType = XLDataType.Number;
cell.Style.NumberFormat.Format = "0.00";
return cell;
}
private static IXLCell SetCell(IXLRow row, int colunm, object value, int maxChartsToWrap = 88)
{
var cell = row.Cell(colunm);
cell.Value = value;
SetBorder(cell.Style);
cell.Style.Alignment.WrapText = true;
if (value is string valueString && valueString.Length > maxChartsToWrap)
{
var baseHeight = row.Height;
row.Height = 0.82d * baseHeight * Math.Ceiling(1d + valueString.Length / maxChartsToWrap);
}
if (value is DateTime)
{
SetDateTime(cell);
}
else if (value is IFormattable)
{
SetNumber(cell);
}
return cell;
}
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);
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);
}
}
}

View File

@ -1,14 +1,14 @@
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Mapster;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Mapster;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using System.Collections.Generic;
using AsbCloudApp.Data.DailyReport;
namespace AsbCloudInfrastructure.Services.DailyReport
{
@ -28,45 +28,35 @@ namespace AsbCloudInfrastructure.Services.DailyReport
public async Task<IEnumerable<DailyReportDto>> GetListAsync(int idWell, DateTime? begin, DateTime? end, CancellationToken token)
{
var query = db.DailyReports.Where(r => r.IdWell == idWell);
var offsetHours = wellService.GetTimezone(idWell).Hours;
if (begin is not null)
{
var beginOffset = ((DateTime)begin).ToUtcDateTimeOffset(offsetHours);
query = query.Where(d => d.StartDate >= beginOffset);
}
query = query.Where(d => d.StartDate >= begin.Value.Date);
if (end is not null)
{
var endOffset = ((DateTime)end).ToUtcDateTimeOffset(offsetHours);
query = query.Where(d => d.StartDate <= endOffset);
}
query = query.Where(d => d.StartDate <= end.Value.Date);
var entities = await query
.ToListAsync(token);
return entities.Select(r => Convert(r, offsetHours));
return entities.Select(r => Convert(r));
}
public async Task<DailyReportDto> GetOrGenerateAsync(int idWell, DateTime date, CancellationToken token)
{
var dailyReportDto = await GetAsync(idWell, date, token);
if (dailyReportDto is null)
return await MakeDefaultDailyReportAsync(idWell, date, token);
else
return dailyReportDto;
dailyReportDto = await MakeDefaultDailyReportAsync(idWell, date, token);
return dailyReportDto;
}
public async Task<int> AddAsync(int idWell, DailyReportDto dto, CancellationToken token = default)
{
var offsetHours = wellService.GetTimezone(idWell).Hours;
var reportDateOffset = dto.ReportDate.ToUtcDateTimeOffset(offsetHours);
var info = Convert(dto, offsetHours);
var entity = new AsbCloudDb.Model.DailyReport
var info = Convert(dto);
var entity = new AsbCloudDb.Model.DailyReport.DailyReport
{
IdWell = idWell,
StartDate = reportDateOffset,
Info = info,
StartDate = info.Head.ReportDate,
Info = info
};
db.DailyReports.Add(entity);
var result = await db.SaveChangesAsync(token);
@ -75,8 +65,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
public async Task<int> UpdateAsync(int idWell, DateTime date, DailyReportDto dto, CancellationToken token)
{
var offsetHours = wellService.GetTimezone(idWell).Hours;
var dateOffset = date.ToUtcDateTimeOffset(offsetHours);
var dateOffset = date.Date;
var entity = await db.DailyReports
.FirstOrDefaultAsync(r => r.IdWell == idWell &&
r.StartDate.Year == dateOffset.Year &&
@ -86,9 +75,8 @@ namespace AsbCloudInfrastructure.Services.DailyReport
if (entity is null)
return 0;
entity.Info = Convert(dto, offsetHours);
entity.Info = Convert(dto);
db.DailyReports.Update(entity);
var result = await db.SaveChangesAsync(token);
return result;
}
@ -99,14 +87,13 @@ namespace AsbCloudInfrastructure.Services.DailyReport
if (dailyReportDto is null)
return null;
var memoryStream = dailyReportMaker.MakeReport(dailyReportDto);
var memoryStream = dailyReportMaker.MakeReportFromBlocks(dailyReportDto);
return memoryStream;
}
private async Task<DailyReportDto?> GetAsync(int idWell, DateTime date, CancellationToken token)
{
var offsetHours = wellService.GetTimezone(idWell).Hours;
var dateOffset = date.ToUtcDateTimeOffset(offsetHours);
var dateOffset = date.Date;
var entity = await db.DailyReports
.FirstOrDefaultAsync(r => r.IdWell == idWell &&
r.StartDate.Year == dateOffset.Year &&
@ -115,40 +102,39 @@ namespace AsbCloudInfrastructure.Services.DailyReport
if (entity is null)
return null;
else
return Convert(entity, offsetHours);
var dto = Convert(entity);
return dto;
}
private async Task<DailyReportDto> MakeDefaultDailyReportAsync(int idWell, DateTime date, CancellationToken token)
{
var well = await wellService.GetOrDefaultAsync(idWell, token);
var dto = new DailyReportDto()
{
ReportDate = date,
WellName = well!.Caption,
ClusterName = well.Cluster,
Head = new HeadDto()
{
ReportDate = date.Date,
WellName = well?.Caption ?? "",
ClusterName = well?.Cluster ?? ""
}
};
DailyReportDto result = dto;
return result;
}
private static DailyReportDto Convert(AsbCloudDb.Model.DailyReport entity, double offsetHours)
{
var dto = entity.Info.Adapt<DailyReportDto>();
dto.ReportDate = entity.StartDate
.ToRemoteDateTime(offsetHours);
return dto;
}
private static DailyReportInfo Convert(DailyReportDto dto, double offsetHours)
private static DailyReportDto Convert(AsbCloudDb.Model.DailyReport.DailyReport entity)
{
var dto = entity.Info.Adapt<DailyReportDto>();
dto.Head.ReportDate = entity.StartDate.Date;
return dto;
}
private static DailyReportInfo Convert(DailyReportDto dto)
{
var entity = dto.Adapt<DailyReportInfo>();
entity.ReportDate = dto.ReportDate
.ToUtcDateTimeOffset(offsetHours)
.Date;
entity.Head.ReportDate = dto.Head.ReportDate.Date.Date;
return entity;
}
}
}
#nullable disable
}

View File

@ -0,0 +1,159 @@
using ClosedXML.Excel;
using System;
namespace AsbCloudInfrastructure.Services.DailyReport
{
internal static class XLExtentions
{
public static IXLRange _SetValue(this IXLRange range, object value)
{
var mergedRange = range.Merge();
mergedRange.FirstCell()._SetValue(value);
var colWidth = mergedRange.FirstCell().WorksheetColumn().Width;
var maxCharsToWrap = colWidth / (0.05d * mergedRange.FirstCell().Style.Font.FontSize);
if (value is string valueString && valueString.Length > maxCharsToWrap)
{
var row = mergedRange.FirstCell().WorksheetRow();
var baseHeight = row.Height;
row.Height = 0.45d * baseHeight * Math.Ceiling(1d + valueString.Length / maxCharsToWrap);
}
mergedRange.Style.SetAllBorders()
.Alignment.SetWrapText(true);
return mergedRange;
}
public static IXLCell _SetValue(this IXLCell cell, object value)
{
switch (value)
{
case DateTime dateTime:
cell._SetValue(dateTime);
break;
case IFormattable formattable:
cell._SetValue(formattable);
break;
case string valueString:
cell._SetValue(valueString);
break;
default:
cell.Value = value;
break;
}
return cell;
}
public static IXLCell _SetValue(this IXLCell cell, string value, bool adaptRowHeight = false)
{
cell.Value = value;
cell.Style
.SetAllBorders()
.Alignment.WrapText = true;
cell.Value = value;
if (adaptRowHeight)
{
var colWidth = cell.WorksheetColumn().Width;
var maxCharsToWrap = colWidth / (0.1d * cell.Style.Font.FontSize);
if (value.Length > maxCharsToWrap)
{
var row = cell.WorksheetRow();
var baseHeight = row.Height;
row.Height = 0.52d * baseHeight * Math.Ceiling(1d + value.Length / maxCharsToWrap);
}
}
return cell;
}
public static IXLCell _ValueNoBorder(this IXLCell cell, string value, bool adaptRowHeight = false)
{
cell.Value = value;
cell.Style.Alignment.WrapText = true;
cell.Value = value;
if (adaptRowHeight)
{
var colWidth = cell.WorksheetColumn().Width;
var maxCharsToWrap = colWidth / (0.1d * cell.Style.Font.FontSize);
if (value.Length > maxCharsToWrap)
{
var row = cell.WorksheetRow();
var baseHeight = row.Height;
row.Height = 0.52d * baseHeight * Math.Ceiling(1d + value.Length / maxCharsToWrap);
}
}
return cell;
}
public static IXLCell _SetValue(this IXLCell cell, DateTime value, string dateFormat = "DD.MM.YYYY HH:MM:SS")
{
cell.Value = value;
cell.Style
.SetAllBorders()
.Alignment.WrapText = true;
cell.Value = value;
cell.DataType = XLDataType.DateTime;
cell.Style.DateFormat.Format = "DD.MM.YYYY HH:MM:SS";
return cell;
}
public static IXLCell _SetValue(this IXLCell cell, IFormattable value, string format = "0.00")
{
cell.Value = value;
cell.Style
.SetAllBorders()
.Alignment.WrapText = true;
cell.Value = value;
cell.DataType = XLDataType.Number;
cell.Style.NumberFormat.Format = "0.00";
return cell;
}
public static IXLStyle SetAllBorders(this IXLStyle style, XLBorderStyleValues borderStyle = XLBorderStyleValues.Thin)
{
style.Border.RightBorder = borderStyle;
style.Border.LeftBorder = borderStyle;
style.Border.TopBorder = borderStyle;
style.Border.BottomBorder = borderStyle;
style.Border.InsideBorder = borderStyle;
style.Border.OutsideBorder = borderStyle;
return style;
}
public static IXLStyle SetBaseFont(this IXLStyle style)
{
style.Font.FontName = "Calibri";
style.Font.FontSize = 10;
return style;
}
public static IXLStyle SetH1(this IXLStyle style)
{
style.Font.FontName = "Calibri";
style.Font.FontSize = 14;
return style;
}
/// <summary>
/// Костыль исправляющий проблему в библиотеке IXLRange Range(this IXLWorksheet, IXLAddress, IXLAddress) с кастингом IXLAddress к XLAddress.
/// </summary>
/// <param name="sheet"></param>
/// <param name="begin"></param>
/// <param name="end"></param>
/// <returns></returns>
public static IXLRange _Range(this IXLWorksheet sheet, CellAddress begin, CellAddress end)
=> sheet.Range(begin.RowNumber, begin.ColumnNumber, end.RowNumber, end.ColumnNumber);
}
}

View File

@ -0,0 +1,117 @@
using AsbCloudApp.Data;
using AsbCloudApp.Services;
using AsbCloudDb.Model;
using ClosedXML.Excel;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.DetectOperations
{
internal class DetectedOperationExportService
{
private readonly IAsbCloudDbContext db;
private readonly IWellService wellService;
public DetectedOperationExportService(IAsbCloudDbContext db, IWellService wellService)
{
this.db = db;
this.wellService = wellService;
}
public async Task<Stream> ExportAsync(IEnumerable<int> idsWells, CancellationToken token)
{
using var workbook = new XLWorkbook(XLEventTracking.Disabled);
await AddSheetsAsync(workbook, idsWells, token);
MemoryStream memoryStream = new MemoryStream();
workbook.SaveAs(memoryStream, new SaveOptions { });
memoryStream.Seek(0, SeekOrigin.Begin);
return memoryStream;
}
private async Task AddSheetsAsync(XLWorkbook workbook, IEnumerable<int> idsWells, CancellationToken token)
{
if(!idsWells.Any())
return;
var wells = idsWells.Select(i => wellService.GetOrDefault(i))
.Where(w => w is not null && w.IdTelemetry is not null);
if (!wells.Any())
return;
var idsTelemetries = wells.Select(w => w.IdTelemetry);
if (!idsTelemetries.Any())
return;
var operations = await db.DetectedOperations
.Include(o => o.OperationCategory)
.AsNoTracking()
.Where(o => idsTelemetries.Contains(o.IdTelemetry))
.OrderBy(o => o.IdTelemetry)
.ThenBy(o => o.DateStart)
.ToListAsync(token);
var groups = operations.GroupBy(o => o.IdTelemetry);
foreach (var well in wells)
{
var ops = groups.FirstOrDefault(g => g.Key == well.IdTelemetry)
?.ToList();
if(ops?.Any() != true)
continue;
var sheetName = $"{well.Cluster}_{well.Caption}"
.Replace('.','_');
var sheet = workbook.AddWorksheet(sheetName);
AddHeader(sheet);
const int headerHeight = 1;
for(var i = 0; i< ops.Count; i++ )
AddRow(sheet, ops[i], well, i + 1 + headerHeight);
}
}
private static void AddHeader(IXLWorksheet sheet)
{
var rowNumber = 1;
sheet.Cell(rowNumber, 1).Value = "Name";
sheet.Column(1).Width = 34;
sheet.Cell(rowNumber, 2).Value = "DateStart";
sheet.Column(2).Width = 17;
sheet.Cell(rowNumber, 3).Value = "DateEnd";
sheet.Column(3).Width = 17;
sheet.Cell(rowNumber, 4).Value = "DepthStart";
sheet.Column(4).Width = 9;
sheet.Cell(rowNumber, 5).Value = "DepthEnd";
sheet.Column(5).Width = 9;
sheet.Cell(rowNumber, 6).Value = "KeyValue";
sheet.Column(6).Width = 9;
sheet.SheetView.FreezeRows(rowNumber);
}
private static void AddRow(IXLWorksheet sheet, DetectedOperation operation, WellDto well, int rowNumber)
{
var timezoneoffsetHours = well.Timezone.Hours;
sheet.Cell(rowNumber, 1).Value = operation.OperationCategory.Name;
sheet.Cell(rowNumber, 2).Value = operation.DateStart.ToRemoteDateTime(timezoneoffsetHours);
sheet.Cell(rowNumber, 3).Value = operation.DateEnd.ToRemoteDateTime(timezoneoffsetHours);
sheet.Cell(rowNumber, 4).Value = operation.DepthStart;
sheet.Cell(rowNumber, 5).Value = operation.DepthEnd;
sheet.Cell(rowNumber, 6).Value = operation.Value;
}
}
}

View File

@ -1,4 +1,5 @@
using AsbCloudApp.Data;
using AsbCloudApp.Data.DetectedOperation;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb;
@ -7,12 +8,14 @@ using Mapster;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.DetectOperations
{
#nullable enable
public class DetectedOperationService : IDetectedOperationService
{
public const int IdOperationRotor = 1;
@ -33,27 +36,50 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
this.scheduleService = scheduleService;
}
public async Task<DetectedOperationListDto> GetAsync(DetectedOperationRequest request, CancellationToken token)
public async Task<DetectedOperationListDto?> GetAsync(DetectedOperationRequest request, CancellationToken token)
{
var dtos = await GetOperationsAsync(request, token);
if (dtos?.Any() != true)
return null;
var stats = GetOperationsDrillersStat(dtos);
var result = new DetectedOperationListDto
{
Operations = dtos,
Stats = stats
};
return result;
}
private async Task<IEnumerable<DetectedOperationDto>?> GetOperationsAsync(DetectedOperationRequest request, CancellationToken token)
{
var well = await wellService.GetOrDefaultAsync(request.IdWell, token);
if (well?.IdTelemetry is null || well.Timezone is null)
return null;
var query = BuildQuery(well, request)
.AsNoTracking();
?.AsNoTracking();
if (query is null)
return null;
var data = await query.ToListAsync(token);
var operationValues = await operationValueService.GetByIdWellAsync(request.IdWell, token);
var schedules = await scheduleService.GetByIdWellAsync(request.IdWell, token);
var dtos = data.Select(o => Convert(o, well, operationValues, schedules));
var groups = dtos.GroupBy(o => o.Driller);
return dtos;
}
var stats = new List<DetectedOperationStatDto>(groups.Count());
private static IEnumerable<DetectedOperationDrillersStatDto> GetOperationsDrillersStat(IEnumerable<DetectedOperationDto> operations)
{
var groups = operations.GroupBy(o => o.Driller);
var stats = new List<DetectedOperationDrillersStatDto>(groups.Count());
foreach (var group in groups)
{
var itemsWithTarget = group.Where(i => i.OperationValue is not null);
var stat = new DetectedOperationStatDto
var stat = new DetectedOperationDrillersStatDto
{
Driller = group.Key,
AverageValue = group.Sum(e => e.Value) / group.Count(),
@ -62,20 +88,62 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
if (itemsWithTarget.Any())
{
var itemsOutOfTarget = itemsWithTarget.Where(o => !IsTargetOk(o));
stat.AverageTargetValue = itemsWithTarget.Average(e => e.OperationValue.TargetValue);
stat.AverageTargetValue = itemsWithTarget.Average(e => e.OperationValue?.TargetValue);
stat.Efficiency = 100d * itemsOutOfTarget.Count() / itemsWithTarget.Count();
stat.Loss = itemsOutOfTarget.Sum(DeltaToTarget);
}
stats.Add(stat);
}
return stats;
}
var result = new DetectedOperationListDto
{
Operations = dtos,
Stats = stats
};
return result;
public async Task<IEnumerable<DetectedOperationStatDto>?> GetOperationsStatAsync(DetectedOperationRequest request, CancellationToken token)
{
var well = await wellService.GetOrDefaultAsync(request.IdWell, token);
if (well?.IdTelemetry is null || well.Timezone is null)
return null;
var query = BuildQuery(well, request)
?.AsNoTracking();
if (query is null)
return null;
var entities = await query
.Select(o => new {
o.IdCategory,
DurationMinutes = (o.DateEnd - o.DateStart).TotalMinutes,
o.Value,
})
.ToListAsync(token);
if (!entities.Any())
return null;
var operationValues = await operationValueService.GetByIdWellAsync(request.IdWell, token);
var categories = await query
.Select(o => new {o.IdCategory, o.OperationCategory.Name })
.Distinct()
.ToDictionaryAsync(c=>c.IdCategory, c=>c.Name, token);
var dtos = entities
.GroupBy(o => o.IdCategory)
.OrderBy(g => g.Key)
.Select(g => new DetectedOperationStatDto{
IdCategory = g.Key,
Category = categories[g.Key],
Count = g.Count(),
MinutesAverage = g.Average(o => o.DurationMinutes),
MinutesMin = g.Min(o => o.DurationMinutes),
MinutesMax = g.Max(o => o.DurationMinutes),
MinutesTotal = g.Sum(o => o.DurationMinutes),
ValueAverage = g.Average(o => o.Value),
ValueMax = g.Max(o => o.Value),
ValueMin = g.Min(o => o.Value),
});
return dtos;
}
public async Task<int> DeleteAsync(DetectedOperationRequest request, CancellationToken token)
@ -85,6 +153,10 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
return 0;
var query = BuildQuery(well, request);
if (query is null)
return 0;
db.DetectedOperations.RemoveRange(query);
return await db.SaveChangesAsync(token);
}
@ -93,10 +165,10 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
{
return (op.IdCategory) switch
{
IdOperationRotor => op.Value > op.OperationValue.TargetValue,
IdOperationSlide => op.Value > op.OperationValue.TargetValue,
IdOperationSlipsTime => op.Value > op.OperationValue.TargetValue,
_ => op.Value > op.OperationValue.TargetValue,
IdOperationRotor => op.Value > op.OperationValue?.TargetValue,
IdOperationSlide => op.Value > op.OperationValue?.TargetValue,
IdOperationSlipsTime => op.Value > op.OperationValue?.TargetValue,
_ => op.Value > op.OperationValue?.TargetValue,
};
}
@ -106,12 +178,12 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
{
IdOperationRotor => 0,
IdOperationSlide => 0,
IdOperationSlipsTime => op.Value - op.OperationValue.TargetValue,
IdOperationSlipsTime => op.Value - op.OperationValue?.TargetValue??0,
_ => 0,
};
}
private IQueryable<DetectedOperation> BuildQuery(WellDto well, DetectedOperationRequest request)
private IQueryable<DetectedOperation>? BuildQuery(WellDto well, DetectedOperationRequest request)
{
if (well?.IdTelemetry is null || well.Timezone is null)
return null;
@ -122,7 +194,8 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
if (request is not null)
{
query = query.Where(o => request.IdCategory == o.IdCategory);
if (request.IdsCategories?.Any() == true)
query = query.Where(o => request.IdsCategories.Contains(o.IdCategory));
if (request.GtDate is not null)
query = query.Where(o => o.DateStart >= request.GtDate.Value.ToUtcDateTimeOffset(well.Timezone.Hours));
@ -182,9 +255,9 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
return dto;
}
public async Task<IEnumerable<WellOperationCategoryDto>> GetCategoriesAsync(int? idWell, CancellationToken token)
public async Task<IEnumerable<WellOperationCategoryDto>?> GetCategoriesAsync(int? idWell, CancellationToken token)
{
IQueryable<WellOperationCategory> query = null;
IQueryable<WellOperationCategory> query;
if(idWell is null)
{
query = db.WellOperationCategories;
@ -209,5 +282,12 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
.ToArrayAsync(token);
return result;
}
public Task<Stream> ExportAsync(IEnumerable<int> idsWells, CancellationToken token)
{
var exportService = new DetectedOperationExportService(db, wellService);
return exportService.ExportAsync(idsWells, token);
}
}
#nullable disable
}

Some files were not shown because too many files have changed in this diff Show More