forked from ddrilling/AsbCloudServer
Доработаны автотесты + Метод, который отдает на фронт данные о качестве
This commit is contained in:
parent
808ab7e18f
commit
edb7d93a62
@ -14,14 +14,14 @@ public interface IDataSaubStatRepository<TDto> : ITelemetryDataEditorService
|
||||
where TDto : IDataSaubStatDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение записей по ключу телеметрии
|
||||
/// Получение записей по ключам телеметрий
|
||||
/// </summary>
|
||||
/// <param name="idTelemetry">ключ телеметрии</param>
|
||||
/// <param name="idsTelemetries">ключи телеметрий</param>
|
||||
/// <param name="geDate">начальная дата</param>
|
||||
/// <param name="leDate">конечная дата</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<TDto>> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token);
|
||||
Task<IEnumerable<TDto>> GetAsync(IEnumerable<int> idsTelemetries, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение последних по дате окончания бурения записей в разрезе телеметрий
|
||||
|
27
AsbCloudApp/Requests/DrillingQualityRequest.cs
Normal file
27
AsbCloudApp/Requests/DrillingQualityRequest.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace AsbCloudApp.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Запрос на получение записей качества бурения
|
||||
/// </summary>
|
||||
public class DrillingQualityRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// идентификаторы скважин
|
||||
/// </summary>
|
||||
[Required]
|
||||
public IEnumerable<int> IdsWell { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Больше или равно дате
|
||||
/// </summary>
|
||||
public DateTimeOffset GeDate { get; set; } = DateTimeOffset.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// Меньше или равно дате
|
||||
/// </summary>
|
||||
public DateTimeOffset LeDate { get; set; } = DateTimeOffset.MaxValue;
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Requests;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
@ -34,4 +35,11 @@ public interface IDataSaubStatDrillingQualityService
|
||||
DateTimeOffset geDate,
|
||||
CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение записей DrillingQualityDto по параметрам
|
||||
/// </summary>
|
||||
/// <param name="request">параметры запроса</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<DrillingQualityDto>> GetStatAsync(DrillingQualityRequest request, CancellationToken token);
|
||||
}
|
||||
|
@ -9,6 +9,10 @@
|
||||
<ItemGroup>
|
||||
<None Remove="Services\DataSaubStat\test1.csv" />
|
||||
<None Remove="Services\DataSaubStat\test1_result.csv" />
|
||||
<None Remove="Services\DataSaubStat\test2.csv" />
|
||||
<None Remove="Services\DataSaubStat\test2_result.csv" />
|
||||
<None Remove="Services\DataSaubStat\test3.csv" />
|
||||
<None Remove="Services\DataSaubStat\test3_result.csv" />
|
||||
<None Remove="Services\Trajectory\PlannedTrajectoryTemplate.xlsx" />
|
||||
<None Remove="Services\Trajectory\Templates\TrajectoryFactManualTemplate.xlsx" />
|
||||
</ItemGroup>
|
||||
@ -16,6 +20,10 @@
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Services\DataSaubStat\test1.csv" />
|
||||
<EmbeddedResource Include="Services\DataSaubStat\test1_result.csv" />
|
||||
<EmbeddedResource Include="Services\DataSaubStat\test2.csv" />
|
||||
<EmbeddedResource Include="Services\DataSaubStat\test2_result.csv" />
|
||||
<EmbeddedResource Include="Services\DataSaubStat\test3.csv" />
|
||||
<EmbeddedResource Include="Services\DataSaubStat\test3_result.csv" />
|
||||
<EmbeddedResource Include="Services\Trajectory\Templates\TrajectoryFactManualTemplate.xlsx" />
|
||||
<EmbeddedResource Include="Services\Trajectory\Templates\TrajectoryPlanTemplate.xlsx" />
|
||||
</ItemGroup>
|
||||
|
@ -1,16 +1,22 @@
|
||||
using AsbCloudApp.Data;
|
||||
using CsvHelper.Configuration;
|
||||
using CsvHelper.Configuration.Attributes;
|
||||
|
||||
namespace AsbCloudInfrastructure.Tests.MapData
|
||||
{
|
||||
public class DataSaubStatDrillingQualityDtoMap : ClassMap<DataSaubStatDrillingQualityDto>
|
||||
public class DataSaubStatDrillingQualityDtoMap
|
||||
{
|
||||
public DataSaubStatDrillingQualityDtoMap()
|
||||
{
|
||||
Map(m => m.IdTelemetry).Name("id_telemetry");
|
||||
Map(m => m.DepthStart).Name("depth_start");
|
||||
Map(m => m.DepthEnd).Name("depth_end");
|
||||
Map(m => m.DepthDrillingQuality).Name("depth_drilling_quality");
|
||||
}
|
||||
[Name("id_telemetry")]
|
||||
public int IdTelemetry { get; set; }
|
||||
|
||||
[Name("depth_start")]
|
||||
public float DepthStart { get; set; }
|
||||
|
||||
[Name("depth_end")]
|
||||
public float DepthEnd { get; set; }
|
||||
|
||||
[Name("depth_drilling_quality")]
|
||||
public float DepthDrillingQuality { get; set; }
|
||||
|
||||
[Name("id_feed_regulator")]
|
||||
public short? IdFeedRegulator { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,54 +1,47 @@
|
||||
using AsbCloudApp.Data.SAUB;
|
||||
using CsvHelper.Configuration;
|
||||
using CsvHelper.Configuration.Attributes;
|
||||
using System;
|
||||
|
||||
namespace AsbCloudInfrastructure.Tests.MapData
|
||||
{
|
||||
public class TelemetryDataSaubMap : ClassMap<TelemetryDataSaubDto>
|
||||
public class TelemetryDataSaubMap
|
||||
{
|
||||
public TelemetryDataSaubMap()
|
||||
{
|
||||
Map(m => m.AxialLoad).Name("axial_load");
|
||||
Map(m => m.AxialLoadLimitMax).Name("axial_load_limit_max");
|
||||
Map(m => m.AxialLoadSp).Name("axial_load_sp");
|
||||
Map(m => m.BitDepth).Name("bit_depth");
|
||||
Map(m => m.BlockPosition).Name("block_position");
|
||||
Map(m => m.BlockPositionMax).Name("block_position_max");
|
||||
Map(m => m.BlockPositionMin).Name("block_position_min");
|
||||
Map(m => m.BlockSpeed).Name("block_speed");
|
||||
Map(m => m.BlockSpeedSp).Name("block_speed_sp");
|
||||
Map(m => m.BlockSpeedSpDevelop).Name("block_speed_sp_develop");
|
||||
Map(m => m.BlockSpeedSpRotor).Name("block_speed_sp_rotor");
|
||||
Map(m => m.BlockSpeedSpSlide).Name("block_speed_sp_slide");
|
||||
Map(m => m.DateTime).Name("date");
|
||||
Map(m => m.Flow).Name("flow");
|
||||
Map(m => m.FlowDeltaLimitMax).Name("flow_delta_limit_max");
|
||||
Map(m => m.FlowIdle).Name("flow_idle");
|
||||
Map(m => m.HookWeight).Name("hook_weight");
|
||||
Map(m => m.HookWeightIdle).Name("hook_weight_idle");
|
||||
Map(m => m.HookWeightLimitMax).Name("hook_weight_limit_max");
|
||||
Map(m => m.HookWeightLimitMin).Name("hook_weight_limit_min");
|
||||
Map(m => m.IdFeedRegulator).Name("id_feed_regulator");
|
||||
Map(m => m.IdTelemetry).Name("id_telemetry");
|
||||
Map(m => m.Mode).Name("mode");
|
||||
Map(m => m.Mse).Name("mse");
|
||||
Map(m => m.MseState).Name("mse_state");
|
||||
Map(m => m.Pressure).Name("pressure");
|
||||
Map(m => m.PressureDeltaLimitMax).Name("pressure_delta_limit_max");
|
||||
Map(m => m.PressureIdle).Name("pressure_idle");
|
||||
Map(m => m.PressureSp).Name("pressure_sp");
|
||||
Map(m => m.PressureSpDevelop).Name("pressure_sp_develop");
|
||||
Map(m => m.PressureSpRotor).Name("pressure_sp_rotor");
|
||||
Map(m => m.PressureSpSlide).Name("pressure_sp_slide");
|
||||
Map(m => m.Pump1Flow).Name("pump1_flow");
|
||||
Map(m => m.Pump0Flow).Name("pump0_flow");
|
||||
Map(m => m.Pump2Flow).Name("pump2_flow");
|
||||
Map(m => m.RotorSpeed).Name("rotor_speed");
|
||||
Map(m => m.RotorTorque).Name("rotor_torque");
|
||||
Map(m => m.RotorTorqueIdle).Name("rotor_torque_idle");
|
||||
Map(m => m.RotorTorqueLimitMax).Name("rotor_torque_limit_max");
|
||||
Map(m => m.RotorTorqueSp).Name("rotor_torque_sp");
|
||||
Map(m => m.WellDepth).Name("well_depth");
|
||||
[Name("id_telemetry")]
|
||||
public int IdTelemetry { get; set; }
|
||||
|
||||
}
|
||||
[Name("date")]
|
||||
public DateTime DateTime { get; set; }
|
||||
|
||||
[Name("well_depth")]
|
||||
public float WellDepth { get; set; }
|
||||
|
||||
[Name("bit_depth")]
|
||||
public float BitDepth { get; set; }
|
||||
|
||||
[Name("block_speed")]
|
||||
public float? BlockSpeed { get; set; }
|
||||
|
||||
[Name("block_speed_sp")]
|
||||
public float? BlockSpeedSp { get; set; }
|
||||
|
||||
[Name("pressure")]
|
||||
public float Pressure { get; set; }
|
||||
|
||||
[Name("pressure_sp")]
|
||||
public float? PressureSp { get; set; }
|
||||
|
||||
[Name("axial_load")]
|
||||
public float AxialLoad { get; set; }
|
||||
|
||||
[Name("axial_load_sp")]
|
||||
public float? AxialLoadSp { get; set; }
|
||||
|
||||
[Name("rotor_torque")]
|
||||
public float RotorTorque { get; set; }
|
||||
|
||||
[Name("rotor_torque_sp")]
|
||||
public float? RotorTorqueSp { get; set; }
|
||||
|
||||
[Name("id_feed_regulator")]
|
||||
public short? IdFeedRegulator { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services;
|
||||
using AsbCloudInfrastructure.Tests.MapData;
|
||||
using CsvHelper;
|
||||
using Mapster;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
@ -22,6 +23,7 @@ public class DataSaubStatDtillingQualityServiceTest
|
||||
private readonly IDataSaubStatRepository<DataSaubStatDrillingQualityDto> dataSaubStatRepositoryMock = Substitute.For<IDataSaubStatRepository<DataSaubStatDrillingQualityDto>>();
|
||||
private readonly ITelemetryDataCache<TelemetryDataSaubDto> telemetryDataCacheMock = Substitute.For<ITelemetryDataCache<TelemetryDataSaubDto>>();
|
||||
private readonly ITelemetryDataSaubService dataSaubServiceMock = Substitute.For<ITelemetryDataSaubService>();
|
||||
private readonly ITelemetryService telemetryServiceMock = Substitute.For<ITelemetryService>();
|
||||
|
||||
private DataSaubStatDrillingQualityService dataSaubStatService;
|
||||
|
||||
@ -30,11 +32,14 @@ public class DataSaubStatDtillingQualityServiceTest
|
||||
dataSaubStatService = new DataSaubStatDrillingQualityService(
|
||||
dataSaubStatRepositoryMock,
|
||||
telemetryDataCacheMock,
|
||||
dataSaubServiceMock);
|
||||
dataSaubServiceMock,
|
||||
telemetryServiceMock);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("DataSaubStat.test1.csv", "DataSaubStat.test1_result.csv")]
|
||||
[InlineData("DataSaubStat.test3.csv", "DataSaubStat.test3_result.csv")]
|
||||
[InlineData("DataSaubStat.test2.csv", "DataSaubStat.test2_result.csv")]
|
||||
//[InlineData("DataSaubStat.test1.csv", "DataSaubStat.test1_result.csv")]
|
||||
public async Task Create_DataSaubStatDrillingQuality_From_CSVFile_ShouldReturn_Success(
|
||||
string pathMockData,
|
||||
string pathResult
|
||||
@ -51,20 +56,21 @@ public class DataSaubStatDtillingQualityServiceTest
|
||||
using var stream = Assembly.GetExecutingAssembly()
|
||||
.GetManifestResourceStream(resourceName)!;
|
||||
|
||||
var actual = Enumerable.Empty<DataSaubStatDrillingQualityDto>();
|
||||
var actualData = Enumerable.Empty<DataSaubStatDrillingQualityDto>();
|
||||
|
||||
using (var reader = new StreamReader(stream))
|
||||
using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
|
||||
{
|
||||
csv.Context.RegisterClassMap<TelemetryDataSaubMap>();
|
||||
var records = csv.GetRecords<TelemetryDataSaubDto>().ToList();
|
||||
var dataSaubMaps = csv.GetRecords<TelemetryDataSaubMap>().ToList();
|
||||
|
||||
var dtos = dataSaubMaps.Select(x => x.Adapt<TelemetryDataSaubDto>()).ToArray();
|
||||
|
||||
dataSaubServiceMock
|
||||
.Get(Arg.Any<int>(), Arg.Any<bool>(), Arg.Any<DateTimeOffset>(), Arg.Any<DateTimeOffset>(), Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||
.Returns(records);
|
||||
.Returns(dtos);
|
||||
|
||||
//act
|
||||
actual = await dataSaubStatService.CreateStatDrillingQualityForTelemetry(1, DateTimeOffset.UnixEpoch, CancellationToken.None);
|
||||
actualData = await dataSaubStatService.CreateStatDrillingQualityForTelemetry(1, DateTimeOffset.UnixEpoch, CancellationToken.None);
|
||||
}
|
||||
|
||||
resourceName = Assembly.GetExecutingAssembly()
|
||||
@ -81,19 +87,32 @@ public class DataSaubStatDtillingQualityServiceTest
|
||||
using (var reader = new StreamReader(stream2))
|
||||
using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
|
||||
{
|
||||
csv.Context.RegisterClassMap<DataSaubStatDrillingQualityDtoMap>();
|
||||
var expected = csv.GetRecords<DataSaubStatDrillingQualityDto>().ToList();
|
||||
var dataSaubMaps = csv.GetRecords<DataSaubStatDrillingQualityDtoMap>().ToList();
|
||||
var expectedData = dataSaubMaps.Select(x => x.Adapt<DataSaubStatDrillingQualityDto>()).ToArray();
|
||||
|
||||
//assert
|
||||
var actual = actualData
|
||||
.OrderBy(d => d.IdFeedRegulator)
|
||||
.ToArray();
|
||||
|
||||
var expected = expectedData
|
||||
.OrderBy(d => d.IdFeedRegulator)
|
||||
.ToArray();
|
||||
|
||||
Assert.Equal(expected.Count(), actual.Count());
|
||||
|
||||
var expectedItem = expected.FirstOrDefault()!;
|
||||
var actualItem = actual.FirstOrDefault()!;
|
||||
for (var i = 0; i < actual.Count(); i++)
|
||||
{
|
||||
var expectedItem = expected[i];
|
||||
var actualItem = actual[i];
|
||||
|
||||
Assert.True(Math.Abs(expectedItem.DepthStart - actualItem.DepthStart) < 0.000001);
|
||||
Assert.True(Math.Abs(expectedItem.DepthEnd - actualItem.DepthEnd) < 0.000001);
|
||||
Assert.True(Math.Abs(expectedItem.DepthDrillingQuality - actualItem.DepthDrillingQuality) < 0.000001);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,21 @@
|
||||
"id_telemetry","date","mode","id_user","well_depth","bit_depth","block_position","block_position_min","block_position_max","block_speed","block_speed_sp","block_speed_sp_rotor","block_speed_sp_slide","block_speed_sp_develop","pressure","pressure_idle","pressure_sp","pressure_sp_rotor","pressure_sp_slide","pressure_sp_develop","pressure_delta_limit_max","axial_load","axial_load_sp","axial_load_limit_max","hook_weight","hook_weight_idle","hook_weight_limit_min","hook_weight_limit_max","rotor_torque","rotor_torque_idle","rotor_torque_sp","rotor_torque_limit_max","rotor_speed","flow","flow_idle","flow_delta_limit_max","id_feed_regulator","mse_state","mse","pump0_flow","pump1_flow","pump2_flow"
|
||||
419,2023-02-24 06:52:03.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.2787943,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.296837,25.0,0.0,0.0,0.9,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.62367916,,,
|
||||
419,2023-02-24 06:52:27.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0.0,100.0,100.0,50.0,100.0,3.2657084,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.288881,25.0,0.0,0.0,0.7005794,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.58552027,,,
|
||||
419,2023-02-24 06:52:01.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.281889,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.290037,25.0,0.0,0.0,1.1,0.0,24.0,28.0,20.0,0.0,0.0,3.0,1,0,0.6230831,,,
|
||||
419,2023-02-24 06:52:02.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.2758698,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.298437,25.0,0.0,0.0,0.8,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.61103106,,,
|
||||
419,2023-02-24 06:52:04.000 +0500,0,1,46.0,46.0,18.561,0.0,0.0,0,100.0,100.0,50.0,100.0,3.2403529,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.283327,25.0,0.0,0.0,0.99897236,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.5451977,,,
|
||||
419,2023-02-24 06:52:28.000 +0500,1,1,46.0,46.0,18.561,0.0,0.0,0.0,100.0,100.0,50.0,100.0,3.2521386,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.271387,25.0,0.0,0.0,0.9986298,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.5644083,,,
|
||||
419,2023-02-24 06:52:29.000 +0500,0,1,46.0,46.0,18.559,0.0,0.0,0.0,100.0,100.0,50.0,100.0,3.2965276,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.279978,25.0,0.0,0.0,0.7880506,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.6650865,,,
|
||||
419,2023-02-24 06:52:49.000 +0500,1,1,46.0,46.0,18.347,0.0,0.0,0.02323297,100.0,100.0,50.0,100.0,3.3215039,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.196453,25.0,0.0,0.0,0.8,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.7197559,,,
|
||||
419,2023-02-24 06:52:50.000 +0500,1,1,46.0,46.0,18.347,0.0,0.0,0.008542753,100.0,100.0,50.0,100.0,3.2545505,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.18471,25.0,0.0,0.0,0.8,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.5640507,,,
|
||||
419,2023-02-24 06:52:53.000 +0500,1,1,46.0,46.0,18.207,0.0,0.0,11.310025,100.0,100.0,50.0,100.0,3.271237,3.0,35.0,35.0,21.0,18.0,45.0,0.0,4.0,4.5,25.770308,25.0,0.0,0.0,0.99922925,0.0,24.0,28.0,20.1,0.0,0.0,3.0,1,0,0.60237646,,,
|
||||
419,2023-02-24 15:29:12.000 +0500,1,1,251.28,251.28,11.062,0.5,0.0,52.383633,53.0,53.0,50.0,50.0,46.114864,32.0,68.0,68.0,50.0,47.0,45.0,0.5221672,8.0,11.0,28.4907,29.0,0.0,0.0,5.401707,0.0,24.0,28.0,19.8,0.0,0.0,3.0,1,0,26.786428,,,
|
||||
"id_telemetry","date","well_depth","bit_depth","block_speed","block_speed_sp","pressure","pressure_sp","axial_load","axial_load_sp","rotor_torque","rotor_torque_sp","id_feed_regulator"
|
||||
618,2023-02-24 06:52:03.000 +0500,303.545989990234,64.1760025024414,45.00,50.00,3.71015930175781,52.00,2.8034496307373,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,313.545989990234,63.5940017700195,46.00,50.00,3.69481015205383,52.00,2.04865455627441,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,323.545989990234,63.0130004882813,47.00,50.00,3.7329523563385,52.00,2.90703392028809,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,333.545989990234,62.4309997558594,48.00,50.00,3.70306921005249,52.00,2.17815017700195,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,343.545989990234,61.8499984741211,49.00,50.00,3.69618034362793,52.00,2.45234489440918,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,353.545989990234,61.2560005187988,50.00,50.00,3.72630000114441,52.00,3.2121467590332,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,363.545989990234,60.6679992675781,51.00,50.00,3.70950126647949,52.00,2.8408260345459,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,373.545989990234,60.0870018005371,52.00,50.00,3.73658561706543,52.00,1.16445922851563,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,383.545989990234,59.4939994812012,53.00,50.00,3.68171286582947,52.00,2.30134773254395,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,393.545989990234,58.9070014953613,54.00,50.00,3.72104644775391,52.00,1.91220664978027,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,403.545989990234,58.3199996948242,55.00,50.00,3.75041079521179,52.00,1.29618453979492,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,413.545989990234,57.7270011901856,56.00,50.00,3.71274995803833,52.00,2.0904655456543,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,423.545989990234,57.1389999389648,57.00,50.00,3.73990893363953,52.00,2.42434310913086,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,433.545989990234,56.5460014343262,58.00,50.00,3.7690634727478,52.00,2.07949066162109,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,443.545989990234,55.9589996337891,59.00,50.00,3.7951807975769,52.00,1.98602676391602,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,453.545989990234,55.3660011291504,60.00,50.00,3.84931874275208,52.00,2.41486930847168,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,463.545989990234,54.7719993591309,61.00,50.00,3.91031193733215,52.00,2.98539924621582,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,473.545989990234,54.1790008544922,62.00,50.00,3.95907807350159,52.00,2.65116500854492,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,483.545989990234,53.5919990539551,63.00,50.00,3.98743534088135,52.00,1.92432594299316,8.00,0.00,23.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,493.545989990234,53.0050010681152,64.00,50.00,4.02055215835571,52.00,2.56299781799316,8.00,0.00,23.00,1
|
||||
|
|
32
AsbCloudInfrastructure.Tests/Services/DataSaubStat/test2.csv
Normal file
32
AsbCloudInfrastructure.Tests/Services/DataSaubStat/test2.csv
Normal file
@ -0,0 +1,32 @@
|
||||
"id_telemetry","date","well_depth","bit_depth","block_speed","block_speed_sp","pressure","pressure_sp","axial_load","axial_load_sp","rotor_torque","rotor_torque_sp","id_feed_regulator"
|
||||
618,2023-02-24 06:52:03.000 +0500,205.00,204.00,100.00,80.00,80.00,105.00,0.00,10.00,10.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,205.00,204.99,90.00,80.00,70.00,105.00,0.00,10.00,10.00,13.00,0
|
||||
618,2023-02-24 06:52:03.000 +0500,205.00,205.00,80.00,80.00,150.00,105.00,3.00,10.00,10.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,207.00,207.00,70.00,80.00,57.00,105.00,4.00,10.00,10.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,210.00,210.00,78.00,80.00,62.00,105.00,8.00,10.00,10.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,210.00,209.00,82.00,80.00,93.00,105.00,0.00,10.00,10.00,13.00,0
|
||||
618,2023-02-24 06:52:03.000 +0500,210.00,209.77,81.00,80.00,32.00,105.00,0.30,10.00,10.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,210.00,210.00,90.00,80.00,66.00,70.00,7.00,10.00,11.00,13.00,2
|
||||
618,2023-02-24 06:52:03.000 +0500,213.00,213.00,90.00,80.00,33.00,70.00,6.00,10.00,12.00,13.00,2
|
||||
618,2023-02-24 06:52:03.000 +0500,216.00,216.00,30.00,80.00,74.00,70.00,5.00,10.00,12.00,13.00,2
|
||||
618,2023-02-24 06:52:03.000 +0500,219.00,219.00,5.00,80.00,35.00,70.00,7.00,10.00,12.50,13.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,222.00,222.00,90.00,80.00,99.00,70.00,2.00,10.00,13.60,13.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,222.00,221.00,33.00,80.00,20.00,70.00,0.00,10.00,13.00,13.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,222.00,222.00,100.00,100.00,96.00,70.00,4.00,10.00,12.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,225.00,225.00,106.00,100.00,78.00,70.00,5.00,10.00,11.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,228.00,228.00,102.00,100.00,77.00,70.00,6.00,10.00,12.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,231.00,231.00,98.00,100.00,85.00,70.00,8.00,12.00,11.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,234.00,234.00,200.00,100.00,32.00,70.00,5.00,12.00,10.00,15.00,0
|
||||
618,2023-02-24 06:52:03.000 +0500,237.00,237.00,200.00,100.00,88.00,70.00,9.00,12.00,10.00,15.00,0
|
||||
618,2023-02-24 06:52:03.000 +0500,240.00,240.00,94.00,100.00,63.00,70.00,6.00,12.00,11.00,15.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,240.00,233.00,96.00,100.00,66.00,70.00,0.00,12.00,10.00,15.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,240.00,240.00,82.00,80.00,92.00,105.00,0.50,12.00,11.00,15.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,243.00,243.00,12.00,80.00,100.00,105.00,11.50,12.00,12.00,15.00,3
|
||||
618,2023-02-24 06:52:03.000 +0500,246.00,246.00,15.00,80.00,92.00,105.00,11.00,12.00,11.00,15.00,3
|
||||
618,2023-02-24 06:52:03.000 +0500,249.00,249.00,36.00,80.00,90.00,105.00,12.00,12.00,14.00,15.00,3
|
||||
618,2023-02-24 06:52:03.000 +0500,252.00,252.00,55.00,80.00,60.00,105.00,12.50,12.00,13.00,15.00,3
|
||||
618,2023-02-24 06:52:03.000 +0500,255.00,255.00,78.00,80.00,90.00,105.00,12.00,12.00,14.00,15.00,3
|
||||
618,2023-02-24 06:52:03.000 +0500,258.00,258.00,33.00,80.00,80.00,105.00,10.00,12.00,14.70,15.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,261.00,261.00,54.00,80.00,70.00,105.00,10.00,12.00,18.00,15.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,262.00,262.00,55.00,80.00,90.00,105.00,10.00,12.00,13.00,15.00,0
|
||||
618,2023-02-24 06:52:03.000 +0500,262.00,261.00,57.00,80.00,90.00,105.00,0.00,12.00,10.00,15.00,0
|
|
@ -0,0 +1,8 @@
|
||||
"id_telemetry","depth_start","depth_end","id_feed_regulator","depth_drilling_quality"
|
||||
618,205.00,210.00,1,2.00
|
||||
618,210.00,219.00,2,6.00
|
||||
618,219.00,222.00,4,3.00
|
||||
618,222.00,234.00,1,9.00
|
||||
618,240.00,243.00,1,3.00
|
||||
618,243.00,258.00,3,12.00
|
||||
618,258.00,262.00,4,3.00
|
|
33
AsbCloudInfrastructure.Tests/Services/DataSaubStat/test3.csv
Normal file
33
AsbCloudInfrastructure.Tests/Services/DataSaubStat/test3.csv
Normal file
@ -0,0 +1,33 @@
|
||||
"id_telemetry","date","well_depth","bit_depth","block_speed","block_speed_sp","pressure","pressure_sp","axial_load","axial_load_sp","rotor_torque","rotor_torque_sp","id_feed_regulator"
|
||||
618,2023-02-24 06:52:03.000 +0500,326.00,325.00,100.00,80.00,80.00,105.00,0.00,10.00,10.00,13.00,0
|
||||
618,2023-02-24 06:52:03.000 +0500,326.00,325.99,90.00,80.00,70.00,105.00,0.00,10.00,10.00,13.00,0
|
||||
618,2023-02-24 06:52:03.000 +0500,326.00,326.00,87.00,90.00,150.00,105.00,3.00,10.00,10.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,328.00,328.00,70.00,80.00,57.00,105.00,4.00,10.00,10.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,331.00,331.00,92.00,90.00,62.00,105.00,8.00,10.00,10.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,331.00,330.00,82.00,80.00,93.00,105.00,0.00,10.00,10.00,13.00,0
|
||||
618,2023-02-24 06:52:03.000 +0500,331.00,330.77,81.00,80.00,32.00,105.00,9.90,10.00,10.00,13.00,3
|
||||
618,2023-02-24 06:52:03.000 +0500,331.00,331.00,90.00,80.00,66.00,70.00,7.00,10.00,11.00,13.00,3
|
||||
618,2023-02-24 06:52:03.000 +0500,334.00,334.00,90.00,80.00,33.00,70.00,10.30,10.00,12.00,13.00,3
|
||||
618,2023-02-24 06:52:03.000 +0500,337.00,337.00,79.00,80.00,74.00,70.00,5.00,10.00,12.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,340.00,340.00,83.00,80.00,35.00,70.00,7.00,10.00,12.50,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,343.00,343.00,90.00,80.00,99.00,70.00,2.00,10.00,13.60,13.00,2
|
||||
618,2023-02-24 06:52:03.000 +0500,343.00,342.00,33.00,80.00,20.00,70.00,0.00,10.00,13.00,13.00,2
|
||||
618,2023-02-24 06:52:03.000 +0500,343.00,343.00,100.00,100.00,96.00,70.00,4.00,10.00,12.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,346.00,346.00,106.00,100.00,78.00,70.00,5.00,10.00,11.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,349.00,349.00,102.00,100.00,77.00,70.00,6.00,10.00,12.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,352.00,352.00,98.00,100.00,85.00,70.00,8.00,12.00,11.00,13.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,355.00,355.00,200.00,100.00,69.00,70.00,5.00,12.00,10.00,15.00,2
|
||||
618,2023-02-24 06:52:03.000 +0500,358.00,358.00,200.00,100.00,72.00,70.00,9.00,12.00,10.00,15.00,2
|
||||
618,2023-02-24 06:52:03.000 +0500,361.00,361.00,94.00,100.00,63.00,70.00,6.00,12.00,11.00,15.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,361.00,354.00,96.00,100.00,66.00,70.00,0.00,12.00,15.00,15.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,361.00,361.00,82.00,80.00,92.00,105.00,0.50,12.00,15.20,15.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,364.00,364.00,12.00,80.00,100.00,105.00,11.50,12.00,14.50,15.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,367.00,367.00,15.00,80.00,92.00,105.00,11.00,12.00,11.00,15.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,370.00,370.00,81.00,80.00,90.00,105.00,12.00,12.00,14.00,15.00,1
|
||||
618,2023-02-24 06:52:03.000 +0500,373.00,373.00,55.00,80.00,60.00,105.00,12.50,12.00,13.00,15.00,3
|
||||
618,2023-02-24 06:52:03.000 +0500,376.00,376.00,78.00,80.00,90.00,105.00,12.00,12.00,14.00,15.00,3
|
||||
618,2023-02-24 06:52:03.000 +0500,379.00,379.00,33.00,80.00,80.00,105.00,10.00,12.00,14.70,15.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,382.00,382.00,54.00,80.00,70.00,105.00,10.00,12.00,18.00,15.00,4
|
||||
618,2023-02-24 06:52:03.000 +0500,383.00,383.00,55.00,80.00,90.00,105.00,10.00,12.00,13.00,15.00,0
|
||||
618,2023-02-24 06:52:03.000 +0500,383.00,382.00,57.00,80.00,90.00,105.00,0.00,12.00,10.00,15.00,0
|
||||
|
|
@ -0,0 +1,10 @@
|
||||
"id_telemetry","depth_start","depth_end","id_feed_regulator","depth_drilling_quality"
|
||||
618,326.00,331.00,1,2.00
|
||||
618,331.00,337.00,3,3.00
|
||||
618,337.00,343.00,1,6.00
|
||||
618,343.00,355.00,1,9.00
|
||||
618,355.00,361.00,2,6.00
|
||||
618,361.00,370.00,4,6.00
|
||||
618,370.00,373.00,1,3.00
|
||||
618,373.00,379.00,3,6.00
|
||||
618,379.00,383.00,4,3.00
|
|
@ -40,19 +40,28 @@ public class DataSaubStatRepository<TEntity, TDto> : IDataSaubStatRepository<TDt
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<TDto>> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token)
|
||||
public async Task<IEnumerable<TDto>> GetAsync(IEnumerable<int> idsTelemetries, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token)
|
||||
{
|
||||
//todo
|
||||
var timeSpanDict = new Dictionary<int, TimeSpan>();
|
||||
|
||||
idsTelemetries = idsTelemetries.Distinct();
|
||||
foreach (var idTelemetry in idsTelemetries)
|
||||
{
|
||||
var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours);
|
||||
timeSpanDict.Add(idTelemetry, timeSpan);
|
||||
}
|
||||
|
||||
var geDateUtc = geDate.ToUniversalTime();
|
||||
var leDateUtc = leDate.ToUniversalTime();
|
||||
|
||||
var stats = await db.Set<TEntity>()
|
||||
.Where(s => s.IdTelemetry == idTelemetry)
|
||||
.Where(s => idsTelemetries.Contains(s.IdTelemetry))
|
||||
.Where(s => s.DateStart >= geDateUtc)
|
||||
.Where(s => s.DateEnd <= leDateUtc)
|
||||
.ToArrayAsync(token);
|
||||
|
||||
var result = stats.Select(s => ConvertToDto(s, timeSpan));
|
||||
var result = stats.Select(s => ConvertToDto(s, timeSpanDict[s.IdTelemetry]));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -17,25 +17,33 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe
|
||||
private IDataSaubStatRepository<DataSaubStatDrillingQualityDto> dataSaubStatDrillingQualityRepository;
|
||||
private ITelemetryDataSaubService dataSaubService;
|
||||
private ITelemetryDataCache<TelemetryDataSaubDto> telemetryDataCache;
|
||||
private ITelemetryService telemetryService;
|
||||
|
||||
private static int IdFeedRegulatorRop = 1;
|
||||
private static int IdFeedRegulatorPressureDelta = 2;
|
||||
private static int IdFeedRegulatorAxialLoad = 3;
|
||||
private static int IdFeedRegulatorTorque = 4;
|
||||
|
||||
public Dictionary<int, Predicate<TelemetryDataSaubDto>> QualitySettingsForFeedRegulators { get; }
|
||||
|
||||
public DataSaubStatDrillingQualityService(
|
||||
IDataSaubStatRepository<DataSaubStatDrillingQualityDto> dataSaubStatDrillingQualityRepository,
|
||||
ITelemetryDataCache<TelemetryDataSaubDto> telemetryDataCache,
|
||||
ITelemetryDataSaubService dataSaubService)
|
||||
ITelemetryDataSaubService dataSaubService,
|
||||
ITelemetryService telemetryService)
|
||||
{
|
||||
this.dataSaubStatDrillingQualityRepository = dataSaubStatDrillingQualityRepository;
|
||||
this.dataSaubService = dataSaubService;
|
||||
this.telemetryDataCache = telemetryDataCache;
|
||||
this.telemetryService = telemetryService;
|
||||
|
||||
Predicate<TelemetryDataSaubDto> hasQualityWithIdFeedRegulator1 = (TelemetryDataSaubDto spanItem)
|
||||
=> (spanItem.BlockSpeed >= spanItem.BlockSpeedSp * 0.95
|
||||
&& spanItem.BlockSpeed <= spanItem.BlockSpeedSp * 1.05);
|
||||
|
||||
Predicate<TelemetryDataSaubDto> hasQualityWithIdFeedRegulator2 = (TelemetryDataSaubDto spanItem)
|
||||
=> (spanItem.Pressure >= (spanItem.PressureSp - spanItem.PressureIdle) - 5
|
||||
&& spanItem.Pressure <= (spanItem.PressureSp - spanItem.PressureIdle) + 5);
|
||||
=> (spanItem.Pressure >= (spanItem.PressureSp) - 5
|
||||
&& spanItem.Pressure <= (spanItem.PressureSp) + 5);
|
||||
|
||||
Predicate<TelemetryDataSaubDto> hasQualityWithIdFeedRegulator3 = (TelemetryDataSaubDto spanItem)
|
||||
=> (spanItem.AxialLoad >= (spanItem.AxialLoadSp - 0.5)
|
||||
@ -46,10 +54,10 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe
|
||||
&& spanItem.RotorTorque <= (spanItem.RotorTorqueSp + 0.5));
|
||||
|
||||
QualitySettingsForFeedRegulators = new Dictionary<int, Predicate<TelemetryDataSaubDto>>() {
|
||||
{ 1, hasQualityWithIdFeedRegulator1 },
|
||||
{ 2, hasQualityWithIdFeedRegulator2 },
|
||||
{ 3, hasQualityWithIdFeedRegulator3 },
|
||||
{ 4, hasQualityWithIdFeedRegulator4 },
|
||||
{ IdFeedRegulatorRop, hasQualityWithIdFeedRegulator1 },
|
||||
{ IdFeedRegulatorPressureDelta, hasQualityWithIdFeedRegulator2 },
|
||||
{ IdFeedRegulatorAxialLoad, hasQualityWithIdFeedRegulator3 },
|
||||
{ IdFeedRegulatorTorque, hasQualityWithIdFeedRegulator4 },
|
||||
};
|
||||
}
|
||||
|
||||
@ -125,16 +133,11 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe
|
||||
indexEnd = FindIndexEnd(indexStart, idFeedRegulator, dataSaub);
|
||||
|
||||
var length = indexEnd - indexStart + 1;
|
||||
|
||||
if (length <= 2)
|
||||
continue;
|
||||
|
||||
var subset = dataSaub.AsSpan(indexStart, length);
|
||||
|
||||
if ((subset[^1].WellDepth - subset[0].WellDepth) < 0.15)
|
||||
continue; // мелкие выборки не учитываем.
|
||||
|
||||
|
||||
var stats = CalcStatsDrillingQuality(idFeedRegulator, subset, checkQuality);
|
||||
result.Add(stats);
|
||||
|
||||
@ -151,9 +154,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe
|
||||
{
|
||||
indexEnd = i;
|
||||
}
|
||||
else if (dataSaub[i].IdFeedRegulator != idFeedRegulator)
|
||||
break;
|
||||
else
|
||||
if (dataSaub[i].IdFeedRegulator != idFeedRegulator)
|
||||
break;
|
||||
}
|
||||
return indexEnd;
|
||||
@ -185,4 +186,45 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatDrillingQualitySe
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DrillingQualityDto>> GetStatAsync(DrillingQualityRequest request, CancellationToken token)
|
||||
{
|
||||
var telemetries = telemetryService.GetOrDefaultTelemetriesByIdsWells(request.IdsWell);
|
||||
var idsTelemetriesWithIdWell = telemetries
|
||||
.Where(t => t.IdWell.HasValue)
|
||||
.ToDictionary(t => t.Id, t => t.IdWell!.Value);
|
||||
|
||||
var dataSaubStatDrillingQuality = await dataSaubStatDrillingQualityRepository.GetAsync(idsTelemetriesWithIdWell.Keys, request.GeDate, request.LeDate, token);
|
||||
|
||||
var dtosGroupedByIdTelemetries = dataSaubStatDrillingQuality
|
||||
.GroupBy(s => new { s.IdTelemetry, s.IdFeedRegulator })
|
||||
.Select(stat => new
|
||||
{
|
||||
IdFeedRegulator = stat.Key.IdFeedRegulator,
|
||||
IdTelemetry = stat.Key.IdTelemetry,
|
||||
Kpd = (stat.Sum(s => s.DepthDrillingQuality) / stat.Sum(s => s.DepthEnd - s.DepthStart)) * 100,
|
||||
})
|
||||
.GroupBy(stat => stat.IdTelemetry);
|
||||
|
||||
var result = new List<DrillingQualityDto>();
|
||||
foreach (var dtos in dtosGroupedByIdTelemetries)
|
||||
{
|
||||
var kpdValuesByIdFeedRegulator = dtos
|
||||
.GroupBy(d => d.IdFeedRegulator)
|
||||
.ToDictionary(d => d.Key, d => d.FirstOrDefault()!.Kpd);
|
||||
|
||||
var item = new DrillingQualityDto()
|
||||
{
|
||||
IdWell = idsTelemetriesWithIdWell[dtos.Key],
|
||||
KpdAxialLoad = kpdValuesByIdFeedRegulator.GetValueOrDefault(IdFeedRegulatorAxialLoad),
|
||||
KpdPressureDelta = kpdValuesByIdFeedRegulator.GetValueOrDefault(IdFeedRegulatorPressureDelta),
|
||||
KpdRop = kpdValuesByIdFeedRegulator.GetValueOrDefault(IdFeedRegulatorRop),
|
||||
KpdTorque = kpdValuesByIdFeedRegulator.GetValueOrDefault(IdFeedRegulatorTorque)
|
||||
};
|
||||
|
||||
result.Add(item);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
var geDate = wellOperations.Min(p => p.DateStart);
|
||||
var leDate = wellOperations.Max(p => (p.DateStart.AddHours(p.DurationHours)));
|
||||
var dataSaubStats =
|
||||
(await dataSaubStatRepository.GetAsync(well.IdTelemetry.Value, geDate, leDate, token)).ToArray();
|
||||
(await dataSaubStatRepository.GetAsync([well.IdTelemetry.Value], geDate, leDate, token)).ToArray();
|
||||
|
||||
if (!dataSaubStats.Any())
|
||||
return Enumerable.Empty<ProcessMapReportDataSaubStatDto>();
|
||||
|
59
AsbCloudWebApi/Controllers/ServiceOperationController.cs
Normal file
59
AsbCloudWebApi/Controllers/ServiceOperationController.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Services.WellReport;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using AsbCloudApp.Repositories;
|
||||
using System.Linq;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudInfrastructure.Services;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
//[Authorize]
|
||||
public class ServiceOperationController : ControllerBase
|
||||
{
|
||||
private readonly IWellService wellService;
|
||||
private readonly IDataSaubStatRepository<DataSaubStatDrillingQualityDto> dataSaubStatRepository;
|
||||
private readonly ITelemetryService telemetryService;
|
||||
private readonly IDataSaubStatDrillingQualityService dataSaubStatDrillingQualityService;
|
||||
|
||||
public ServiceOperationController(
|
||||
IWellService wellService,
|
||||
ITelemetryService telemetryService,
|
||||
IDataSaubStatDrillingQualityService dataSaubStatDrillingQualityService,
|
||||
IDataSaubStatRepository<DataSaubStatDrillingQualityDto> dataSaubStatRepository)
|
||||
{
|
||||
this.wellService = wellService;
|
||||
this.dataSaubStatRepository = dataSaubStatRepository;
|
||||
this.telemetryService = telemetryService;
|
||||
this.dataSaubStatDrillingQualityService = dataSaubStatDrillingQualityService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает данные для страницы "Качество"
|
||||
/// </summary>
|
||||
/// <param name="request">Параметры запроса</param>
|
||||
/// <param name="token"> Токен отмены задачи </param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("drillingQuality")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(IEnumerable<DrillingQualityDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetDataSaubStatDrillingQualityAsync(
|
||||
[FromQuery] DrillingQualityRequest request, CancellationToken token)
|
||||
{
|
||||
var result = await dataSaubStatDrillingQualityService.GetStatAsync(request, token);
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user