diff --git a/AsbCloudApp/Data/ProcessMaps/Operations/ProcessMapPlanRotorDto.cs b/AsbCloudApp/Data/ProcessMaps/Operations/ProcessMapPlanRotorDto.cs
index 9835772a..590cb0ab 100644
--- a/AsbCloudApp/Data/ProcessMaps/Operations/ProcessMapPlanRotorDto.cs
+++ b/AsbCloudApp/Data/ProcessMaps/Operations/ProcessMapPlanRotorDto.cs
@@ -46,13 +46,13 @@ public class ProcessMapPlanRotorDto : ProcessMapPlanBaseDto
///
/// Момент на ВСП, кН*м. Уставка
///
- [Range(0.0, 35.0, ErrorMessage = "Момент на ВСП, кН*м., уставка, должно быть в пределах от 0 до 35.0")]
+ [Range(0.0, 55.0, ErrorMessage = "Момент на ВСП, кН*м., уставка, должно быть в пределах от 0 до 35.0")]
public double TopDriveTorque { get; set; }
///
/// Момент на ВСП, кН*м. Ограничение
///
- [Range(0.0, 35.0, ErrorMessage = "Момент на ВСП, кН*м., ограничение, должно быть в пределах от 0 до 35.0")]
+ [Range(0.0, 55.0, ErrorMessage = "Момент на ВСП, кН*м., ограничение, должно быть в пределах от 0 до 35.0")]
public double TopDriveTorqueMax { get; set; }
///
diff --git a/AsbCloudApp/Services/ITelemetryDataSaubService.cs b/AsbCloudApp/Services/ITelemetryDataSaubService.cs
index fc4bbda8..72aee988 100644
--- a/AsbCloudApp/Services/ITelemetryDataSaubService.cs
+++ b/AsbCloudApp/Services/ITelemetryDataSaubService.cs
@@ -15,15 +15,24 @@ public interface ITelemetryDataSaubService : ITelemetryDataService
/// Получение телеметрии для РТК статистики
///
- ///
+ ///
///
///
///
///
///
- ///
///
- Task> Get(IEnumerable idsTelemetries, bool isBitOnBottom, DateTimeOffset geDate, DateTimeOffset leDate, int take, CancellationToken token, IEnumerable? idsFeedRegulators = null);
+ Task> Get(int idTelemetry, bool isBitOnBottom, DateTimeOffset geDate, DateTimeOffset leDate, int take, CancellationToken token);
+
+ ///
+ /// Получение минимальных и максимальных глубин скважин на определенную дату для заданных телеметрий
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task> GetMinAndMaxWellDepths(IEnumerable idsTelemetries, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token);
///
/// усредненная статистика по 1м за весь период
diff --git a/AsbCloudDb/Model/ProcessMapPlan/Operations/ProcessMapPlanRotor.cs b/AsbCloudDb/Model/ProcessMapPlan/Operations/ProcessMapPlanRotor.cs
index 3f0d5218..3dd83d5a 100644
--- a/AsbCloudDb/Model/ProcessMapPlan/Operations/ProcessMapPlanRotor.cs
+++ b/AsbCloudDb/Model/ProcessMapPlan/Operations/ProcessMapPlanRotor.cs
@@ -39,12 +39,12 @@ public class ProcessMapPlanRotor : ProcessMapPlanBase
public double WeightOnBitMax { get; set; }
[Column("top_drive_torque"), Comment("Момент на ВСП, кН*м. Уставка")]
- [Range(0.0, 35.0)]
+ [Range(0.0, 55.0)]
[Required]
public double TopDriveTorque { get; set; }
[Column("top_drive_torque_max"), Comment("Момент на ВСП, кН*м. Ограничение")]
- [Range(0.0, 35.0)]
+ [Range(0.0, 55.0)]
[Required]
public double TopDriveTorqueMax { get; set; }
diff --git a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs b/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs
index 2246dc54..2c7cf7ce 100644
--- a/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs
+++ b/AsbCloudInfrastructure.Tests/Services/DataSaubStatServiceTest.cs
@@ -220,7 +220,7 @@ public class DataSaubStatServiceTest
}
dataSaubServiceMock
- .Get(Arg.Any>(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any())
+ .Get(Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any(), Arg.Any())
.Returns(telemetryDataSaubDtos);
dataSaubStatService = new DataSaubStatService(
diff --git a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs
index 14be5340..d5279a69 100644
--- a/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs
+++ b/AsbCloudInfrastructure/Services/DataSaubStatDrillingQualityService.cs
@@ -83,7 +83,7 @@ public class DataSaubStatDrillingQualityService : IDataSaubStatService
{
var leDate = DateTimeOffset.UtcNow;
- var dataSaub = await dataSaubService.Get([idTelemetry], true, geDate, leDate, 100_000, token);
+ var dataSaub = await dataSaubService.Get(idTelemetry, true, geDate, leDate, 100_000, token);
if (!dataSaub.Any())
return 0;
diff --git a/AsbCloudInfrastructure/Services/DataSaubStatService.cs b/AsbCloudInfrastructure/Services/DataSaubStatService.cs
index ab0492d3..84c51b56 100644
--- a/AsbCloudInfrastructure/Services/DataSaubStatService.cs
+++ b/AsbCloudInfrastructure/Services/DataSaubStatService.cs
@@ -78,7 +78,7 @@ public class DataSaubStatService : IDataSaubStatService
var geDate = detectedOperations.First().DateStart;
var leDate = detectedOperations.OrderByDescending(d => d.DateEnd).First().DateEnd;
- var dataSaub = await dataSaubService.Get([idTelemetry], true, geDate, leDate, 100_000, token);
+ var dataSaub = await dataSaubService.Get(idTelemetry, true, geDate, leDate, 100_000, token);
if (!dataSaub.Any())
return 0;
diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Templates/ProcessMapPlanRotor.xlsx b/AsbCloudInfrastructure/Services/ProcessMapPlan/Templates/ProcessMapPlanRotor.xlsx
index c6afa71a..2a670c42 100644
Binary files a/AsbCloudInfrastructure/Services/ProcessMapPlan/Templates/ProcessMapPlanRotor.xlsx and b/AsbCloudInfrastructure/Services/ProcessMapPlan/Templates/ProcessMapPlanRotor.xlsx differ
diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs
index c864eb7d..4405d026 100644
--- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs
+++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs
@@ -13,8 +13,6 @@ using System.Linq;
using System.Text.Csv;
using System.Threading;
using System.Threading.Tasks;
-using AsbCloudApp.Data;
-using AsbCloudApp.Requests;
namespace AsbCloudInfrastructure.Services.SAUB;
@@ -37,46 +35,50 @@ public class TelemetryDataSaubService : TelemetryDataBaseService> Get(
- IEnumerable idsTelemetries,
- bool isBitOnBottom,
- DateTimeOffset geDate,
- DateTimeOffset leDate,
- int take,
- CancellationToken token,
- IEnumerable? idsFeedRegulators)
+ public async Task> Get(int idTelemetry, bool isBitOnBottom, DateTimeOffset geDate, DateTimeOffset leDate, int take, CancellationToken token)
{
- var offsetDict = new Dictionary();
- foreach (var idTelemetry in idsTelemetries)
- {
- offsetDict.Add(idTelemetry, telemetryService.GetTimezone(idTelemetry).Offset);
- }
-
+ var offset = telemetryService.GetTimezone(idTelemetry).Offset;
var geDateUtc = geDate.ToUniversalTime();
var leDateUtc = leDate.ToUniversalTime();
var query = db.Set()
- .Where(t => idsTelemetries.Contains(t.IdTelemetry))
+ .Where(t => t.IdTelemetry == idTelemetry)
.Where(t => t.DateTime >= geDateUtc)
.Where(t => t.DateTime <= leDateUtc);
if (isBitOnBottom)
query = query.Where(t => Math.Abs(t.BitDepth - t.WellDepth) < 0.0001);
- if (idsFeedRegulators != null && idsFeedRegulators.Any())
- query = query
- .Where(t => t.IdFeedRegulator.HasValue)
- .Where(t => idsFeedRegulators.Contains(t.IdFeedRegulator!.Value));
-
query = query
.OrderBy(t => t.DateTime)
.Take(take);
var entities = await query.ToArrayAsync(token);
- var dtos = entities.Select(e => Convert(e, offsetDict.GetValueOrDefault(e.IdTelemetry).TotalHours));
+
+ var dtos = entities.Select(e => Convert(e, offset.TotalHours));
return dtos;
}
+ public async Task> GetMinAndMaxWellDepths(IEnumerable idsTelemetries, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token)
+ {
+ var geDateUtc = geDate.ToUniversalTime();
+ var leDateUtc = leDate.ToUniversalTime();
+
+ var query = db.Set()
+ .Where(t => idsTelemetries.Contains(t.IdTelemetry))
+ .Where(t => t.DateTime >= geDateUtc)
+ .Where(t => t.DateTime <= leDateUtc)
+ .GroupBy(t => t.IdTelemetry);
+
+ var result = await query
+ .ToDictionaryAsync(t => t.Key, t => (
+ t.MinBy(x => x.WellDepth)!.WellDepth,
+ t.MaxBy(x => x.WellDepth)!.WellDepth
+ ));
+
+ return result;
+ }
+
public async Task> GetTelemetryDataStatAsync(int idTelemetry, CancellationToken token)
{
var timezone = telemetryService.GetTimezone(idTelemetry);
diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs
index f5acee31..0292d126 100644
--- a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs
+++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs
@@ -141,26 +141,20 @@ public class SubsystemService : ISubsystemService
.GetOrDefaultTelemetriesByIdsWells(request.IdsWell)
.ToDictionary(t => t.Id, t => t.IdWell);
- var dtNow = DateTimeOffset.UtcNow;
var geDate = request.GeDate ?? SubsystemPlanFactRequest.ValidationMinDate;
var leDate = request.LeDate ?? DateTimeOffset.UtcNow;
- var telemetryDataSaub = await telemetryDataSaubService.Get(telemetriesDict.Keys, false, geDate, leDate, 100_000, token);
-
- var groupedTelemetryDataSaub = telemetryDataSaub
- .GroupBy(t => t.IdTelemetry)
- .ToDictionary(t => t.Key, t => new
- {
- IdWell = telemetriesDict.GetValueOrDefault(t.Key)!,
- MinDepth = t.MinBy(x => x.WellDepth)!.WellDepth,
- MaxDepth = t.MaxBy(x => x.WellDepth)!.WellDepth
- });
+ var groupedTelemetryDataSaub = await telemetryDataSaubService.GetMinAndMaxWellDepths(telemetriesDict.Keys, geDate, leDate, token);
var result = new List();
foreach (var telemetryDataSaubItem in groupedTelemetryDataSaub)
{
+ var idWell = telemetriesDict.GetValueOrDefault(telemetryDataSaubItem.Key);
+ if (!idWell.HasValue)
+ continue;
+
var telemetryDataSaubInfo = telemetryDataSaubItem.Value;
- var requestProcessMapPlan = new ProcessMapPlanBaseRequestWithWell(telemetryDataSaubInfo.IdWell!.Value, telemetryDataSaubInfo.MinDepth, telemetryDataSaubInfo.MaxDepth);
+ var requestProcessMapPlan = new ProcessMapPlanBaseRequestWithWell(idWell.Value, telemetryDataSaubInfo.MinDepth, telemetryDataSaubInfo.MaxDepth);
var processMapPlanSubsystems = await processMapPlanRepository.GetCurrent(requestProcessMapPlan, token);
foreach (var processMapPlanSubsystem in processMapPlanSubsystems)