forked from ddrilling/AsbCloudServer
Правки по ревью
This commit is contained in:
parent
ee8f000ab1
commit
921b5f75c0
@ -4,22 +4,22 @@ namespace AsbCloudApp.Data.DailyReport
|
||||
{
|
||||
/// <summary>
|
||||
/// хранение дополнительной информации о записи
|
||||
/// автоматическое формирование данных на серверной стороне
|
||||
/// запись формируется на сервере автоматически
|
||||
/// </summary>
|
||||
public class ItemInfoDto
|
||||
{
|
||||
/// <summary>
|
||||
/// пользователь, внесший изменения
|
||||
/// пользователь, внесший изменения (запись формируется на сервере автоматически)
|
||||
/// </summary>
|
||||
public int? IdUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// имя пользователя, внесшего изменения
|
||||
/// имя пользователя, внесшего изменения (запись формируется на сервере автоматически)
|
||||
/// </summary>
|
||||
public string? UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// дата последнего обновления
|
||||
/// дата последнего обновления (запись формируется на сервере автоматически)
|
||||
/// </summary>
|
||||
public DateTimeOffset? LastUpdateDate { get; set; }
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ namespace AsbCloudApp.Services
|
||||
/// получить список сформированных рапортов по скважине за период времени
|
||||
/// </summary>
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="v1"></param>
|
||||
/// <param name="v2"></param>
|
||||
/// <param name="begin"></param>
|
||||
/// <param name="end"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<DailyReportDto>> GetListAsync(int idWell, DateTime? v1, DateTime? v2, CancellationToken cancellationToken);
|
||||
Task<IEnumerable<DailyReportDto>> GetListAsync(int idWell, DateTime? begin, DateTime? end, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Добавить новый рапорт
|
||||
@ -30,7 +30,7 @@ namespace AsbCloudApp.Services
|
||||
/// <param name="idUser"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> AddAsync(int idWell, DateTime startDate, int idUser, CancellationToken token = default);
|
||||
Task<int> AddAsync(int idWell, DateTime startDate, int idUser, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Сформировать файл рапорта
|
||||
@ -39,7 +39,7 @@ namespace AsbCloudApp.Services
|
||||
/// <param name="date"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<Stream?> MakeReportAsync(int idWell, DateTime date, CancellationToken token = default);
|
||||
Task<Stream?> MakeReportAsync(int idWell, DateTime date, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// изменить блок данных для суточного рапорта
|
||||
|
@ -1,43 +1,50 @@
|
||||
using Microsoft.VisualBasic;
|
||||
using static AsbCloudDb.Model.DefaultData.DefaultContextData;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudDb.Model.DefaultData
|
||||
{
|
||||
internal class EntityFillerWellOperationCategory : EntityFiller<WellOperationCategory>
|
||||
public class EntityFillerWellOperationCategory : EntityFiller<WellOperationCategory>
|
||||
{
|
||||
|
||||
public override WellOperationCategory[] GetData() => new WellOperationCategory[]{
|
||||
|
||||
// Этап работ
|
||||
new () {Id = WellOperationCategory.IdDrilling, Name = "БУРЕНИЕ", KeyValueName = "dT", KeyValueUnits = "м/ч" },
|
||||
new () {Id = 3001, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 3002, Name = "КРЕПЛЕНИЕ", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 3003, Name = "ГФР", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 3004, Name = "Вспомогательные операции", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdNonProductiveTime, Name = "Непроизводительное время (НПВ)", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
/// <summary>
|
||||
/// Этапы работ
|
||||
/// </summary>
|
||||
public static WellOperationCategory[] WorkStages { get; } = new WellOperationCategory[]{
|
||||
new() { Id = WellOperationCategory.IdDrilling, Name = "БУРЕНИЕ", KeyValueName = "dT", KeyValueUnits = "м/ч" },
|
||||
new() { Id = WellOperationCategory.IdSPOStage, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new() { Id = WellOperationCategory.IdFastening, Name = "КРЕПЛЕНИЕ", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new() { Id = WellOperationCategory.IdGFR, Name = "ГФР", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new() { Id = WellOperationCategory.IdAuxiliaryOperations, Name = "Вспомогательные операции", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new() { Id = WellOperationCategory.IdNonProductiveTime, Name = "Непроизводительное время (НПВ)", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
};
|
||||
|
||||
// Виды работ
|
||||
new () {Id = WellOperationCategory.Knbk, IdParent = 3000, Name = "КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
/// <summary>
|
||||
/// Виды работ
|
||||
/// </summary>
|
||||
public static WellOperationCategory[] WorkTypes { get; } = new WellOperationCategory[]{
|
||||
new () {Id = WellOperationCategory.IdKnbk, IdParent = 3000, Name = "КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdMechanicalDrilling, IdParent = 3000, Name = "Механическое. бурение", KeyValueName = "dT", KeyValueUnits = "м/ч" },
|
||||
new () {Id = WellOperationCategory.MeasurementStat, IdParent = 3000, Name = "Статический замер", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.NormalizedWellDiameter, IdParent = 3000, Name = "Нормализация диаметра скважины", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.Building, IdParent = 3000, Name = "Наращивание", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.SPO , IdParent = 3001, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.CasingRunning, IdParent = 3002, Name = "Спуск обсадной колонны", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.Cementing, IdParent = 3002, Name = "Цементирование", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.AuxiliaryWorkFastening, IdParent = 3002, Name = "Вспомогательные работы при креплении", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.AssemblyOrDisassemblyGIS, IdParent = 3003, Name = "Сборка/разборка приборов ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.SPO2, IdParent = 3003, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.GIS, IdParent = 3003, Name = "ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.FlushingOBR, IdParent = 3004, Name = "Промывка, ОБР", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.AuxiliaryWork, IdParent = 3004, Name = "Вспомогательные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.EquipmentRepair, IdParent = 3005, Name = "Ремонт оборудования", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.EmergencyWork, IdParent = 3005, Name = "Аварийные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.Complication, IdParent = 3005, Name = "Осложнение", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.OperationsNotIncludedGGD, IdParent = 3005, Name = "Незаложенные в ГГД операции", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdMeasurementStat, IdParent = 3000, Name = "Статический замер", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdNormalizedWellDiameter, IdParent = 3000, Name = "Нормализация диаметра скважины", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdBuilding, IdParent = 3000, Name = "Наращивание", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdSPO , IdParent = 3001, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdCasingRunning, IdParent = 3002, Name = "Спуск обсадной колонны", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdCementing, IdParent = 3002, Name = "Цементирование", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdAuxiliaryWorkFastening, IdParent = 3002, Name = "Вспомогательные работы при креплении", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdAssemblyOrDisassemblyGIS, IdParent = 3003, Name = "Сборка/разборка приборов ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdSPO2, IdParent = 3003, Name = "СПО", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdGIS, IdParent = 3003, Name = "ГИС", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdFlushingOBR, IdParent = 3004, Name = "Промывка, ОБР", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdAuxiliaryWork, IdParent = 3004, Name = "Вспомогательные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdEquipmentRepair, IdParent = 3005, Name = "Ремонт оборудования", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdEmergencyWork, IdParent = 3005, Name = "Аварийные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdComplication, IdParent = 3005, Name = "Осложнение", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdOperationsNotIncludedGGD, IdParent = 3005, Name = "Незаложенные в ГГД операции", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
};
|
||||
|
||||
//переименованные категории с новым ИД
|
||||
new () {Id = WellOperationCategory.IdBhaDisassembly, IdParent = 4000, Name = "Разборка КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
/// <summary>
|
||||
/// Категории работ
|
||||
/// </summary>
|
||||
public static WellOperationCategory[] WorkCategories { get; } = new WellOperationCategory[]{
|
||||
new () {Id = WellOperationCategory.IdBhaDisassembly, IdParent = 4000, Name = "Разборка КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdBhaAssembly, IdParent = 4000, Name = "Сборка КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdSlide, IdParent = 4001, Name = "Бурение слайдом", KeyValueName = "МСП", KeyValueUnits = "м/ч" },
|
||||
new () {Id = WellOperationCategory.IdRotor, IdParent = 4001, Name = "Бурение ротором", KeyValueName = "МСП", KeyValueUnits = "м/ч" },
|
||||
@ -95,7 +102,7 @@ namespace AsbCloudDb.Model.DefaultData
|
||||
new () {Id = 5055, IdParent = 4013, Name = "Тех.отстой", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5056, IdParent = 4013, Name = "Учебная тревога \"Выброс\"", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5057, IdParent = 4013, Name = "Чистка ЦСГО/емкостного блока", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdEquipmentRepair, IdParent = 4014, Name = "Ремонт бурового оборудования", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = WellOperationCategory.IdEquipmentDrillingRepair, IdParent = 4014, Name = "Ремонт бурового оборудования", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5059, IdParent = 4015, Name = "Ловильные работы", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5060, IdParent = 4015, Name = "Ожидание", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5061, IdParent = 4015, Name = "Определение места прихвата и ЛМ", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
@ -116,7 +123,7 @@ namespace AsbCloudDb.Model.DefaultData
|
||||
new () {Id = 5076, IdParent = 4017, Name = "НПВ / прочее", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5077, IdParent = 4017, Name = "Обработка раствора (несоответствие параметров)", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5078, IdParent = 4017, Name = "подъем ОК", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5079, IdParent = 4017, Name = "Ревизия КНБК/инструмента/ЗТС", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5079, IdParent = 4017, Name = "Ревизия КНБК/инструмента/ЗТС", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5082, IdParent = 4000, Name = "Сборка устройства ориентирования КО", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5083, IdParent = 4003, Name = "Проработка принудительная", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5084, IdParent = 4005, Name = "Шаблонировка подъем БИ, продувка", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
@ -138,5 +145,8 @@ namespace AsbCloudDb.Model.DefaultData
|
||||
new () {Id = 5100, IdParent = 4013, Name = "Смена рабочего переводника ВСП", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
new () {Id = 5101, IdParent = 4014, Name = "Ремонт", KeyValueName = "dT", KeyValueUnits = "мин" },
|
||||
};
|
||||
|
||||
public override WellOperationCategory[] GetData()
|
||||
=> WorkStages.Concat(WorkTypes).Concat(WorkCategories).ToArray();
|
||||
}
|
||||
}
|
||||
|
@ -13,16 +13,122 @@ namespace AsbCloudDb.Model
|
||||
/// БУРЕНИЕ
|
||||
/// </summary>
|
||||
public const int IdDrilling = 3000;
|
||||
|
||||
/// <summary>
|
||||
/// СПО
|
||||
/// </summary>
|
||||
public const int IdSPOStage = 3001;
|
||||
|
||||
/// <summary>
|
||||
/// КРЕПЛЕНИЕ
|
||||
/// </summary>
|
||||
public const int IdFastening = 3002;
|
||||
|
||||
/// <summary>
|
||||
/// ГФР
|
||||
/// </summary>
|
||||
public const int IdGFR = 3003;
|
||||
|
||||
/// <summary>
|
||||
/// Вспомогательные операции
|
||||
/// </summary>
|
||||
public const int IdAuxiliaryOperations = 3004;
|
||||
|
||||
/// <summary>
|
||||
/// Непроизводительное время (НПВ)
|
||||
/// </summary>
|
||||
public const int IdNonProductiveTime = 3005;
|
||||
|
||||
/// <summary>
|
||||
/// КНБК
|
||||
/// </summary>
|
||||
public const int IdKnbk = 4000;
|
||||
|
||||
/// <summary>
|
||||
/// Механическое. бурение
|
||||
/// </summary>
|
||||
public const int IdMechanicalDrilling = 4001;
|
||||
|
||||
/// <summary>
|
||||
/// Статический замер
|
||||
/// </summary>
|
||||
public const int IdMeasurementStat = 4002;
|
||||
|
||||
/// <summary>
|
||||
/// Нормализация диаметра скважины
|
||||
/// </summary>
|
||||
public const int IdNormalizedWellDiameter = 4003;
|
||||
|
||||
/// <summary>
|
||||
/// Наращивание
|
||||
/// </summary>
|
||||
public const int IdBuilding = 4004;
|
||||
|
||||
/// <summary>
|
||||
/// СПО
|
||||
/// </summary>
|
||||
public const int IdSPO = 4005;
|
||||
|
||||
/// <summary>
|
||||
/// Спуск обсадной колонны
|
||||
/// </summary>
|
||||
public const int IdCasingRunning = 4006;
|
||||
|
||||
/// <summary>
|
||||
/// Цементирование
|
||||
/// </summary>
|
||||
public const int IdCementing = 4007;
|
||||
|
||||
/// <summary>
|
||||
/// Вспомогательные работы при креплении
|
||||
/// </summary>
|
||||
public const int IdAuxiliaryWorkFastening = 4008;
|
||||
|
||||
/// <summary>
|
||||
/// Сборка/разборка приборов ГИС
|
||||
/// </summary>
|
||||
public const int IdAssemblyOrDisassemblyGIS = 4009;
|
||||
|
||||
/// <summary>
|
||||
/// СПО2
|
||||
/// </summary>
|
||||
public const int IdSPO2 = 4010;
|
||||
|
||||
/// <summary>
|
||||
/// ГИС
|
||||
/// </summary>
|
||||
public const int IdGIS = 4011;
|
||||
|
||||
/// <summary>
|
||||
/// Промывка, ОБР
|
||||
/// </summary>
|
||||
public const int IdFlushingOBR = 4012;
|
||||
|
||||
/// <summary>
|
||||
/// Вспомогательные работы
|
||||
/// </summary>
|
||||
public const int IdAuxiliaryWork = 4013;
|
||||
|
||||
/// <summary>
|
||||
/// Ремонт оборудования
|
||||
/// </summary>
|
||||
public const int IdEquipmentRepair = 4014;
|
||||
|
||||
/// <summary>
|
||||
/// Аварийные работы
|
||||
/// </summary>
|
||||
public const int IdEmergencyWork = 4015;
|
||||
|
||||
/// <summary>
|
||||
/// Осложнение
|
||||
/// </summary>
|
||||
public const int IdComplication = 4016;
|
||||
|
||||
/// <summary>
|
||||
/// Незаложенные в ГГД операции
|
||||
/// </summary>
|
||||
public const int IdOperationsNotIncludedGGD = 4017;
|
||||
|
||||
/// <summary>
|
||||
/// Разборка КНБК
|
||||
/// </summary>
|
||||
@ -82,98 +188,13 @@ namespace AsbCloudDb.Model
|
||||
/// <summary>
|
||||
/// Ремонт бурового оборудования
|
||||
/// </summary>
|
||||
public const int IdEquipmentRepair = 5058;
|
||||
|
||||
/// <summary>
|
||||
/// КНБК
|
||||
/// </summary>
|
||||
public const int Knbk = 4000;
|
||||
|
||||
/// <summary>
|
||||
/// СПО
|
||||
/// </summary>
|
||||
public const int SPO = 4005;
|
||||
|
||||
/// <summary>
|
||||
/// ГИС
|
||||
/// </summary>
|
||||
public const int GIS = 4011;
|
||||
|
||||
/// <summary>
|
||||
/// Статический замер
|
||||
/// </summary>
|
||||
public const int MeasurementStat = 4002;
|
||||
|
||||
/// <summary>
|
||||
/// Нормализация диаметра скважины
|
||||
/// </summary>
|
||||
public const int NormalizedWellDiameter = 4003;
|
||||
|
||||
/// <summary>
|
||||
/// Наращивание
|
||||
/// </summary>
|
||||
public const int Building = 4004;
|
||||
|
||||
/// <summary>
|
||||
/// Спуск обсадной колонны
|
||||
/// </summary>
|
||||
public const int CasingRunning = 4006;
|
||||
|
||||
/// <summary>
|
||||
/// Цементирование
|
||||
/// </summary>
|
||||
public const int Cementing = 4007;
|
||||
|
||||
/// <summary>
|
||||
/// Вспомогательные работы при креплении
|
||||
/// </summary>
|
||||
public const int AuxiliaryWorkFastening = 4008;
|
||||
|
||||
/// <summary>
|
||||
/// Сборка/разборка приборов ГИС
|
||||
/// </summary>
|
||||
public const int AssemblyOrDisassemblyGIS = 4009;
|
||||
|
||||
/// <summary>
|
||||
/// СПО2
|
||||
/// </summary>
|
||||
public const int SPO2 = 4010;
|
||||
|
||||
/// <summary>
|
||||
/// Промывка, ОБР
|
||||
/// </summary>
|
||||
public const int FlushingOBR = 4012;
|
||||
|
||||
/// <summary>
|
||||
/// Вспомогательные работы
|
||||
/// </summary>
|
||||
public const int AuxiliaryWork = 4013;
|
||||
|
||||
/// <summary>
|
||||
/// Ремонт оборудования
|
||||
/// </summary>
|
||||
public const int EquipmentRepair = 4014;
|
||||
|
||||
/// <summary>
|
||||
/// Аварийные работы
|
||||
/// </summary>
|
||||
public const int EmergencyWork = 4015;
|
||||
|
||||
/// <summary>
|
||||
/// Осложнение
|
||||
/// </summary>
|
||||
public const int Complication = 4016;
|
||||
|
||||
/// <summary>
|
||||
/// Незаложенные в ГГД операции
|
||||
/// </summary>
|
||||
public const int OperationsNotIncludedGGD = 4017;
|
||||
public const int IdEquipmentDrillingRepair = 5058;
|
||||
|
||||
/// <summary>
|
||||
/// Список всех категорий НПВ
|
||||
/// </summary>
|
||||
public static readonly int[] NonProductiveTimeSubIds = {
|
||||
IdEquipmentRepair,
|
||||
IdEquipmentDrillingRepair,
|
||||
5059,
|
||||
5060,
|
||||
5061,
|
||||
|
@ -7,15 +7,45 @@ using System.Linq;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
|
||||
{
|
||||
/// <summary>
|
||||
/// Пострение баланса времени
|
||||
/// </summary>
|
||||
class TimeBalanceBlock : BlockAbstract
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Начальная ячейка
|
||||
/// </summary>
|
||||
public override CellAddress AddressBlockBegin { get; }
|
||||
public Dictionary<int, double> OperationsStatistics { get; set; }
|
||||
public IEnumerable<WellOperationCategoryDto> OperationCategories { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Конечная ячейка
|
||||
/// </summary>
|
||||
public override CellAddress AddressBlockEnd { get; }
|
||||
|
||||
public CellAddress Title { get { return AddressBlockBegin + (1, 3); } }
|
||||
/// <summary>
|
||||
/// Ячейка с заголовком
|
||||
/// </summary>
|
||||
private CellAddress Title { get { return AddressBlockBegin + (1, 3); } }
|
||||
|
||||
/// <summary>
|
||||
/// Статистика по операциям
|
||||
/// </summary>
|
||||
private Dictionary<int, double> OperationsStatistics { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Категории операций
|
||||
/// </summary>
|
||||
private IEnumerable<WellOperationCategoryDto> OperationCategories { get; }
|
||||
|
||||
/// <summary>
|
||||
/// количество стобцов в таблице
|
||||
/// </summary>
|
||||
private readonly int CountColumns = 3;
|
||||
|
||||
/// <summary>
|
||||
/// количество категорий операций
|
||||
/// </summary>
|
||||
private int OperationCategoriesCount { get { return OperationCategories.Count(); } }
|
||||
|
||||
|
||||
public TimeBalanceBlock(CellAddress addressBlockBegin, TimeBalanceDto blockDto, IEnumerable<WellOperationCategoryDto> operationCategories)
|
||||
@ -25,7 +55,9 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
|
||||
OperationsStatistics = blockDto.OperationsStat;
|
||||
OperationCategories = operationCategories;
|
||||
|
||||
AddressBlockEnd = AddressBlockBegin + (7, 6);
|
||||
var rowColumn = (CountColumns * 2) + (OperationCategoriesCount % CountColumns == 0 ? 0 : 2);
|
||||
var cellColumn = OperationCategoriesCount % CountColumns;
|
||||
AddressBlockEnd = AddressBlockBegin + (rowColumn, cellColumn);
|
||||
}
|
||||
|
||||
public override void Draw(IXLWorksheet sheet)
|
||||
@ -35,113 +67,27 @@ namespace AsbCloudInfrastructure.Services.DailyReport.DailyReportBlocks
|
||||
.Merge()
|
||||
.SetValue("БАЛАНС ВРЕМЕНИ");
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (2, 1))
|
||||
._SetValue(GetCaption(WellOperationCategory.Knbk), true);
|
||||
var rowColumn = 2;
|
||||
var cellColumn = 1;
|
||||
var rowsCountInColumn = OperationCategoriesCount / CountColumns;
|
||||
if (OperationCategoriesCount % CountColumns != 0)
|
||||
rowsCountInColumn++;
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (3, 1))
|
||||
._SetValue(GetCaption(WellOperationCategory.IdMechanicalDrilling), true);
|
||||
foreach (var operationCategory in OperationCategories)
|
||||
{
|
||||
sheet.Cell(AddressBlockBegin + (rowColumn, cellColumn))
|
||||
._SetValue(GetCaption(operationCategory.Id), true);
|
||||
sheet.Cell(AddressBlockBegin + (rowColumn, cellColumn + 1))
|
||||
._SetValue(GetValue(operationCategory.Id), true);
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (4, 1))
|
||||
._SetValue(GetCaption(WellOperationCategory.MeasurementStat), true);
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (5, 1))
|
||||
._SetValue(GetCaption(WellOperationCategory.NormalizedWellDiameter), true);
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (6, 1))
|
||||
._SetValue(GetCaption(WellOperationCategory.Building), true);
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (7, 1))
|
||||
._SetValue(GetValue(WellOperationCategory.SPO), true);
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (2, 2))
|
||||
._SetValue(GetValue(WellOperationCategory.Knbk));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (3, 2))
|
||||
._SetValue(GetValue(WellOperationCategory.IdMechanicalDrilling));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (4, 2))
|
||||
._SetValue(GetValue(WellOperationCategory.MeasurementStat));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (5, 2))
|
||||
._SetValue(GetValue(WellOperationCategory.NormalizedWellDiameter));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (6, 2))
|
||||
._SetValue(GetValue(WellOperationCategory.Building));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (7, 2))
|
||||
._SetValue(GetValue(WellOperationCategory.SPO));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (2, 3))
|
||||
._SetValue(GetCaption(WellOperationCategory.CasingRunning));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (3, 3))
|
||||
._SetValue(GetCaption(WellOperationCategory.Cementing));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (4, 3))
|
||||
._SetValue(GetCaption(WellOperationCategory.AuxiliaryWorkFastening));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (5, 3))
|
||||
._SetValue(GetCaption(WellOperationCategory.AssemblyOrDisassemblyGIS));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (6, 3))
|
||||
._SetValue(GetCaption(WellOperationCategory.SPO2));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (7, 3))
|
||||
._SetValue(GetCaption(WellOperationCategory.GIS));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (2, 4))
|
||||
._SetValue(GetValue(WellOperationCategory.CasingRunning));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (3, 4))
|
||||
._SetValue(GetValue(WellOperationCategory.Cementing));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (4, 4))
|
||||
._SetValue(GetValue(WellOperationCategory.AuxiliaryWorkFastening));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (5, 4))
|
||||
._SetValue(GetValue(WellOperationCategory.AssemblyOrDisassemblyGIS));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (6, 4))
|
||||
._SetValue(GetValue(WellOperationCategory.SPO2));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (7, 4))
|
||||
._SetValue(GetValue(WellOperationCategory.GIS));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (2, 5))
|
||||
._SetValue(GetCaption(WellOperationCategory.FlushingOBR));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (3, 5))
|
||||
._SetValue(GetCaption(WellOperationCategory.AuxiliaryWork));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (4, 5))
|
||||
._SetValue(GetCaption(WellOperationCategory.EquipmentRepair));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (5, 5))
|
||||
._SetValue(GetCaption(WellOperationCategory.EmergencyWork));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (6, 5))
|
||||
._SetValue(GetCaption(WellOperationCategory.Complication));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (7, 5))
|
||||
._SetValue(GetCaption(WellOperationCategory.OperationsNotIncludedGGD));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (2, 6))
|
||||
._SetValue(GetValue(WellOperationCategory.FlushingOBR));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (3, 6))
|
||||
._SetValue(GetValue(WellOperationCategory.AuxiliaryWork));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (4, 6))
|
||||
._SetValue(GetValue(WellOperationCategory.EquipmentRepair));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (5, 6))
|
||||
._SetValue(GetValue(WellOperationCategory.EmergencyWork));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (6, 6))
|
||||
._SetValue(GetValue(WellOperationCategory.Complication));
|
||||
|
||||
sheet.Cell(AddressBlockBegin + (7, 6))
|
||||
._SetValue(GetValue(WellOperationCategory.OperationsNotIncludedGGD));
|
||||
if (rowColumn <= rowsCountInColumn)
|
||||
rowColumn++;
|
||||
else
|
||||
{
|
||||
rowColumn = 2;
|
||||
cellColumn = cellColumn + 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string GetValue(int categoryId)
|
||||
|
@ -6,6 +6,7 @@ using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudDb.Model.DailyReport;
|
||||
using AsbCloudDb.Model.DefaultData;
|
||||
using Mapster;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
@ -65,13 +66,9 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var factOperationsForDtos = await GetFactOperationsForDailyReportAsync(idWell, token);
|
||||
var userDtos = await userRepository.GetAllAsync(token);
|
||||
|
||||
var dtos = new List<DailyReportDto>(entities.Length);
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
var dto = await Convert(entity, factOperationsForDtos, token);
|
||||
dtos.Add(dto);
|
||||
}
|
||||
var dtos = entities.Select(entity => Convert(entity, factOperationsForDtos, userDtos));
|
||||
return dtos;
|
||||
}
|
||||
|
||||
@ -93,36 +90,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
||||
return factOperations;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Заполнение DTO-модели данными о пользователях
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<DailyReportDto> SetUserNamesToDailyReportDtoAsync(DailyReportDto dto, CancellationToken token)
|
||||
{
|
||||
var blocks = new ItemInfoDto[] {
|
||||
dto.Head,
|
||||
dto.Bha,
|
||||
dto.NoDrilling,
|
||||
dto.TimeBalance,
|
||||
dto.Saub,
|
||||
dto.Sign
|
||||
};
|
||||
|
||||
foreach (var block in blocks)
|
||||
{
|
||||
if (block.IdUser is not null)
|
||||
{
|
||||
var user = await userRepository.GetOrDefaultAsync(block.IdUser.Value, token);
|
||||
block.UserName = user is not null ? user.MakeDisplayName() : $"userId:{block.IdUser.Value}";
|
||||
}
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
public async Task<int> AddAsync(int idWell, DateTime startDate, int idUser, CancellationToken token = default)
|
||||
public async Task<int> AddAsync(int idWell, DateTime startDate, int idUser, CancellationToken token)
|
||||
{
|
||||
var well = wellService.GetOrDefault(idWell);
|
||||
if (well is null)
|
||||
@ -178,9 +146,12 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<Stream?> MakeReportAsync(int idWell, DateTime date, CancellationToken token = default)
|
||||
public async Task<Stream?> MakeReportAsync(int idWell, DateTime date, CancellationToken token)
|
||||
{
|
||||
var wellOperationCategories = wellOperationRepository.GetCategories(true);
|
||||
var stageIds = EntityFillerWellOperationCategory.WorkStages.Select(w => w.Id).ToArray();
|
||||
var wellOperationCategories = wellOperationRepository.GetCategories(true)
|
||||
.Where(o => o.IdParent is not null)
|
||||
.Where(o => stageIds.Contains(o.IdParent!.Value));
|
||||
|
||||
var dailyReportDto = await GetOrDefaultAsync(idWell, date, token);
|
||||
if (dailyReportDto is null)
|
||||
@ -204,7 +175,8 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
||||
throw new ArgumentInvalidException("Daily report doesn`t exist", nameof(date));
|
||||
|
||||
var factOperationsForDtos = await GetFactOperationsForDailyReportAsync(idWell, token);
|
||||
var dto = await Convert(entity, factOperationsForDtos, token);
|
||||
var userDtos = await userRepository.GetAllAsync(token);
|
||||
var dto = Convert(entity, factOperationsForDtos, userDtos);
|
||||
return dto;
|
||||
}
|
||||
|
||||
@ -213,12 +185,12 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
||||
/// </summary>
|
||||
/// <param name="entity">модель базы данных</param>
|
||||
/// <param name="factOperationsForDtos">список фактичских операций для формирования суточного рапорта</param>
|
||||
/// <param name="token"></param>
|
||||
/// <param name="users">список пользователей для нахождения последнего изменившего запись</param>
|
||||
/// <returns></returns>
|
||||
private async Task<DailyReportDto> Convert(
|
||||
private DailyReportDto Convert(
|
||||
AsbCloudDb.Model.DailyReport.DailyReport entity,
|
||||
IEnumerable<WellOperationDto> factOperationsForDtos,
|
||||
CancellationToken token)
|
||||
IEnumerable<UserExtendedDto> users)
|
||||
{
|
||||
var dto = entity.Info.Adapt<DailyReportDto>();
|
||||
dto.StartDate = entity.StartDate;
|
||||
@ -231,7 +203,23 @@ namespace AsbCloudInfrastructure.Services.DailyReport
|
||||
|
||||
dto.TimeBalance.OperationsStat = dailyFactOperation;
|
||||
|
||||
await SetUserNamesToDailyReportDtoAsync(dto, token);
|
||||
var blocks = new ItemInfoDto[] {
|
||||
dto.Head,
|
||||
dto.Bha,
|
||||
dto.NoDrilling,
|
||||
dto.TimeBalance,
|
||||
dto.Saub,
|
||||
dto.Sign
|
||||
};
|
||||
|
||||
foreach (var block in blocks)
|
||||
{
|
||||
if (block.IdUser is not null)
|
||||
{
|
||||
var user = users.FirstOrDefault(u => u.Id == block.IdUser.Value);
|
||||
block.UserName = user is not null ? user.MakeDisplayName() : $"userId:{block.IdUser.Value}";
|
||||
}
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using AsbCloudApp.Data.DailyReport;
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@ -45,7 +44,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet]
|
||||
//[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<DailyReportDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetListAsync(int idWell, DateTime? begin = null, DateTime? end = null, CancellationToken token = default)
|
||||
public async Task<IActionResult> GetListAsync(int idWell, DateTime? begin, DateTime? end, CancellationToken token)
|
||||
{
|
||||
var result = await dailyReportService.GetListAsync(idWell, begin, end, token);
|
||||
return Ok(result);
|
||||
@ -61,21 +60,14 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpPost]
|
||||
//[Permission]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> AddAsync(int idWell, [Required] DateTime startDate, CancellationToken token = default)
|
||||
public async Task<IActionResult> AddAsync(int idWell, [Required] DateTime startDate, CancellationToken token)
|
||||
{
|
||||
var idUser = User.GetUserId();
|
||||
if (idUser is null)
|
||||
return Forbid();
|
||||
|
||||
try
|
||||
{
|
||||
var result = await dailyReportService.AddAsync(idWell, startDate, (int)idUser, token);
|
||||
return Ok(result);
|
||||
}
|
||||
catch (ArgumentInvalidException ex)
|
||||
{
|
||||
return BadRequest(ex.Message);
|
||||
}
|
||||
var result = await dailyReportService.AddAsync(idWell, startDate, (int)idUser, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -88,10 +80,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPut("{date}/head")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateHeadAsync(int idWell, [Required] DateTime date, [Required] HeadDto dto, CancellationToken token = default)
|
||||
{
|
||||
return await UpdateReportBlockAsync(idWell, date, dto, token);
|
||||
}
|
||||
public Task<IActionResult> UpdateHeadAsync(int idWell, [Required] DateTime date, [Required] HeadDto dto, CancellationToken token)
|
||||
=> UpdateReportBlockAsync(idWell, date, dto, token);
|
||||
|
||||
/// <summary>
|
||||
/// Сохранение изменений набора данных для формирования рапорта (блок КНБК)
|
||||
@ -103,10 +93,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPut("{date}/bha")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateBhaAsync(int idWell, [Required] DateTime date, [Required] BhaDto dto, CancellationToken token = default)
|
||||
{
|
||||
return await UpdateReportBlockAsync(idWell, date, dto, token);
|
||||
}
|
||||
public Task<IActionResult> UpdateBhaAsync(int idWell, [Required] DateTime date, [Required] BhaDto dto, CancellationToken token)
|
||||
=> UpdateReportBlockAsync(idWell, date, dto, token);
|
||||
|
||||
/// <summary>
|
||||
/// Сохранение изменений набора данных для формирования рапорта (безметражные работы)
|
||||
@ -118,10 +106,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPut("{date}/noDrilling")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateNoDrillingAsync(int idWell, [Required] DateTime date, [Required] NoDrillingDto dto, CancellationToken token = default)
|
||||
{
|
||||
return await UpdateReportBlockAsync(idWell, date, dto, token);
|
||||
}
|
||||
public Task<IActionResult> UpdateNoDrillingAsync(int idWell, [Required] DateTime date, [Required] NoDrillingDto dto, CancellationToken token)
|
||||
=> UpdateReportBlockAsync(idWell, date, dto, token);
|
||||
|
||||
/// <summary>
|
||||
/// Сохранение изменений набора данных для формирования рапорта (САУБ)
|
||||
@ -133,10 +119,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPut("{date}/saub")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateSaubAsync(int idWell, [Required] DateTime date, [Required] SaubDto dto, CancellationToken token = default)
|
||||
{
|
||||
return await UpdateReportBlockAsync(idWell, date, dto, token);
|
||||
}
|
||||
public Task<IActionResult> UpdateSaubAsync(int idWell, [Required] DateTime date, [Required] SaubDto dto, CancellationToken token)
|
||||
=> UpdateReportBlockAsync(idWell, date, dto, token);
|
||||
|
||||
/// <summary>
|
||||
/// Сохранение изменений набора данных для формирования рапорта (подпись)
|
||||
@ -148,10 +132,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPut("{date}/sign")]
|
||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> UpdateSignAsync(int idWell, [Required] DateTime date, [Required] SignDto dto, CancellationToken token = default)
|
||||
{
|
||||
return await UpdateReportBlockAsync(idWell, date, dto, token);
|
||||
}
|
||||
public Task<IActionResult> UpdateSignAsync(int idWell, [Required] DateTime date, [Required] SignDto dto, CancellationToken token)
|
||||
=> UpdateReportBlockAsync(idWell, date, dto, token);
|
||||
|
||||
/// <summary>
|
||||
/// Обновление блока суточного рапорта
|
||||
@ -163,29 +145,15 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <returns></returns>
|
||||
private async Task<IActionResult> UpdateReportBlockAsync(int idWell, DateTime date, ItemInfoDto dto, CancellationToken token)
|
||||
{
|
||||
if (!SetEditorIdToDailyReportBlock(dto))
|
||||
if (!await UserHasAccesToWellAsync(idWell, token))
|
||||
return Forbid();
|
||||
|
||||
dto.IdUser = User.GetUserId();
|
||||
|
||||
var result = await dailyReportService.UpdateBlockAsync(idWell, date, dto, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Записать ключ пользователя, вносящего изменения в блок суточного рапорта
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
private bool SetEditorIdToDailyReportBlock(ItemInfoDto dto)
|
||||
{
|
||||
var idUser = User.GetUserId();
|
||||
if (idUser is null)
|
||||
return false;
|
||||
else
|
||||
dto.IdUser = idUser;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Сформировать и скачать рапорт в формате excel
|
||||
/// </summary>
|
||||
@ -196,7 +164,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
[HttpGet("{date}/excel")]
|
||||
//[Permission]
|
||||
[ProducesResponseType(typeof(PhysicalFileResult), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> DownloadAsync(int idWell, DateTime date, CancellationToken token = default)
|
||||
public async Task<IActionResult> DownloadAsync(int idWell, DateTime date, CancellationToken token)
|
||||
{
|
||||
var well = await wellService.GetOrDefaultAsync(idWell, token);
|
||||
var stream = await dailyReportService.MakeReportAsync(idWell, date, token);
|
||||
@ -208,5 +176,15 @@ namespace AsbCloudWebApi.Controllers
|
||||
else
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
protected async Task<bool> UserHasAccesToWellAsync(int idWell, CancellationToken token)
|
||||
{
|
||||
var idCompany = User.GetCompanyId();
|
||||
if (idCompany is not null &&
|
||||
await wellService.IsCompanyInvolvedInWellAsync((int)idCompany, idWell, token)
|
||||
.ConfigureAwait(false))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user