diff --git a/AsbCloudApp/Data/Subsystems/SubsystemActiveWellStatDto.cs b/AsbCloudApp/Data/Subsystems/SubsystemActiveWellStatDto.cs
index 8636c252..04a7bce1 100644
--- a/AsbCloudApp/Data/Subsystems/SubsystemActiveWellStatDto.cs
+++ b/AsbCloudApp/Data/Subsystems/SubsystemActiveWellStatDto.cs
@@ -14,9 +14,9 @@ public class SubsystemActiveWellStatDto
///
public SubsystemStatDto? SubsystemAPD { get; set; }
///
- /// Наработки подсистемы СПИН
+ /// Наработки подсистемы с осцилляцией
///
- public SubsystemStatDto? SubsystemSpinMaster { get; set; }
+ public SubsystemStatDto? SubsystemOscillation { get; set; }
///
/// Наработки подсистемы ТОРК
///
diff --git a/AsbCloudApp/Requests/SubsystemRequest.cs b/AsbCloudApp/Requests/SubsystemRequest.cs
index 5749750a..79c88530 100644
--- a/AsbCloudApp/Requests/SubsystemRequest.cs
+++ b/AsbCloudApp/Requests/SubsystemRequest.cs
@@ -20,22 +20,22 @@ namespace AsbCloudApp.Requests
///
/// Больше или равно дате
///
- public DateTime? GeDate { get; set; }
+ public DateTimeOffset? GeDate { get; set; }
///
/// Меньше или равно дате
///
- public DateTime? LtDate { get; set; }
+ public DateTimeOffset? LeDate { get; set; }
///
/// Больше или равно глубины забоя
///
- public double? GtDepth { get; set; }
+ public double? GeDepth { get; set; }
///
/// Меньше или равно глубины забоя
///
- public double? LtDepth { get; set; }
+ public double? LeDepth { get; set; }
///
public IEnumerable Validate(ValidationContext validationContext)
@@ -45,20 +45,20 @@ namespace AsbCloudApp.Requests
$"Должно быть больше {validationMinDate:O})",
new[] { nameof(GeDate) });
- if (LtDate.HasValue && GeDate.HasValue)
+ if (LeDate.HasValue && GeDate.HasValue)
{
- if (LtDate < GeDate)
+ if (LeDate < GeDate)
yield return new ValidationResult(
- $"{nameof(LtDate)} должно быть больше {nameof(GeDate)}. ({LtDate:O} < {GeDate:O})",
- new[] { nameof(LtDate), nameof(GeDate) });
+ $"{nameof(LeDate)} должно быть больше {nameof(GeDate)}. ({LeDate:O} < {GeDate:O})",
+ new[] { nameof(LeDate), nameof(GeDate) });
}
- if (LtDepth.HasValue && GtDepth.HasValue)
+ if (LeDepth.HasValue && GeDepth.HasValue)
{
- if (LtDepth < GtDepth)
+ if (LeDepth < GeDepth)
yield return new ValidationResult(
- $"{nameof(LtDepth)} должно быть больше {nameof(GtDepth)}. ({LtDepth} < {GtDepth})",
- new[] { nameof(LtDepth), nameof(GtDepth) });
+ $"{nameof(LeDepth)} должно быть больше {nameof(GeDepth)}. ({LeDepth} < {GeDepth})",
+ new[] { nameof(LeDepth), nameof(GeDepth) });
}
yield break;
diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
index a1bea561..99a213d9 100644
--- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
+++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
@@ -319,7 +319,7 @@ public class DailyReportService : IDailyReportService
{
IdWell = dailyReport.IdWell,
GeDate = dailyReport.Date,
- LtDate = dailyReport.Date.AddHours(24)
+ LeDate = dailyReport.Date.AddHours(24)
}, cancellationToken);
var subsystems = subsystemsStatPerWell
diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs
index 3180c63b..6b5970b9 100644
--- a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs
+++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs
@@ -10,17 +10,16 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using AsbCloudInfrastructure.Services.DetectOperations;
namespace AsbCloudInfrastructure.Services.Subsystems;
internal class SubsystemService : ISubsystemService
{
- private const int IdEnabledSubsystemSpinMaster = 128;
-
private const int IdSubsystemAPD = 1;
private const int IdSubsystemAPDRotor = 11;
private const int IdSubsystemAPDSlide = 12;
- private const int IdSubsystemSpinMaster = 65536;
+ private const int IdSubsystemOscillation = 65536;
private readonly ICrudRepository subsystemRepository;
@@ -50,10 +49,10 @@ internal class SubsystemService : ISubsystemService
IdsOperationCategories = WellOperationCategory.MechanicalDrillingSubIds,
GeDateStart = request.GeDate,
- LeDateStart = request.LtDate,
+ LeDateStart = request.LeDate,
- GeDepthStart = request.GtDepth,
- LeDepthStart = request.LtDepth,
+ GeDepthStart = request.GeDepth,
+ LeDepthStart = request.LeDepth,
};
var operations = await detectedOperationService.GetOperationSummaryAsync(detectedOperationSummaryRequest,
@@ -66,7 +65,9 @@ internal class SubsystemService : ISubsystemService
return stat;
}
- public async Task> GetStatByActiveWells(int idCompany, DateTime? gtDate, DateTime? ltDate,
+ public async Task> GetStatByActiveWells(int idCompany,
+ DateTime? gtDate,
+ DateTime? ltDate,
CancellationToken token)
{
var activeWells = await wellService.GetAsync(new() { IdCompany = idCompany, IdState = 1 }, token);
@@ -98,7 +99,10 @@ internal class SubsystemService : ISubsystemService
nameof(groupOperations.Key)),
};
- var operationsWithEnableSubsystems = groupOperations.Where(o => o.EnabledSubsystems >= 1);
+ var operationsWithEnableSubsystems = groupOperations.Where(o =>
+ (EnabledSubsystemsFlags.AutoRotor |
+ EnabledSubsystemsFlags.AutoSlide |
+ EnabledSubsystemsFlags.AutoOscillation).HasEnabledSubsystems(o.EnabledSubsystems));
var subsystemStat = new SubsystemStatDto
{
@@ -120,17 +124,18 @@ internal class SubsystemService : ISubsystemService
if (apdSlidePart is not null)
{
- var operationsWithSpinMaster = operations.Where(s => s.EnabledSubsystems == IdEnabledSubsystemSpinMaster);
-
+ var operationsWithOscillation =
+ operations.Where(o => EnabledSubsystemsFlags.AutoOscillation.HasEnabledSubsystems(o.EnabledSubsystems));
+
var spinMaster = new SubsystemStatDto
{
- IdSubsystem = IdSubsystemSpinMaster,
- SubsystemName = subsystems.FirstOrDefault(s => s.Id == IdSubsystemSpinMaster)?.Name ?? "unknown",
- UsedTimeHours = operationsWithSpinMaster.Sum(o => o.SumDurationHours),
+ IdSubsystem = IdSubsystemOscillation,
+ SubsystemName = subsystems.FirstOrDefault(s => s.Id == IdSubsystemOscillation)?.Name ?? "unknown",
+ UsedTimeHours = operationsWithOscillation.Sum(o => o.SumDurationHours),
SumOperationDepthInterval = apdSlidePart.SumOperationDepthInterval,
SumOperationDurationHours = apdSlidePart.SumOperationDurationHours,
- SumDepthInterval = operationsWithSpinMaster.Sum(o => o.SumDepthIntervals),
- OperationCount = operationsWithSpinMaster.Sum(s => s.Count)
+ SumDepthInterval = operationsWithOscillation.Sum(o => o.SumDepthIntervals),
+ OperationCount = operationsWithOscillation.Sum(s => s.Count)
};
spinMaster.KUsage = spinMaster.SumDepthInterval / spinMaster.SumOperationDepthInterval;
@@ -161,7 +166,9 @@ internal class SubsystemService : ISubsystemService
return stat;
}
- private async Task> GetStatAsync(IEnumerable wells, DateTime? gtDate, DateTime? ltDate,
+ private async Task> GetStatAsync(IEnumerable wells,
+ DateTime? gtDate,
+ DateTime? ltDate,
CancellationToken token)
{
if (!wells.Any())
@@ -210,7 +217,7 @@ internal class SubsystemService : ISubsystemService
continue;
wellStat.SubsystemAPD = subsystemStat.FirstOrDefault(s => s.IdSubsystem == IdSubsystemAPD);
- wellStat.SubsystemSpinMaster = subsystemStat.FirstOrDefault(s => s.IdSubsystem == IdSubsystemSpinMaster);
+ wellStat.SubsystemOscillation = subsystemStat.FirstOrDefault(s => s.IdSubsystem == IdSubsystemOscillation);
}
return wellsStat;
diff --git a/AsbCloudInfrastructure/Services/WellInfoService.cs b/AsbCloudInfrastructure/Services/WellInfoService.cs
index 6caa2c08..1bdd8ad9 100644
--- a/AsbCloudInfrastructure/Services/WellInfoService.cs
+++ b/AsbCloudInfrastructure/Services/WellInfoService.cs
@@ -156,7 +156,7 @@ public class WellInfoService
var wellSubsystemStat = subsystemStat.FirstOrDefault(s => s.Well.Id == well.Id);
wellMapInfo.SaubUsage = wellSubsystemStat?.SubsystemAPD?.KUsage ?? 0d;
- wellMapInfo.SpinUsage = wellSubsystemStat?.SubsystemSpinMaster?.KUsage ?? 0d;
+ wellMapInfo.SpinUsage = wellSubsystemStat?.SubsystemOscillation?.KUsage ?? 0d;
wellMapInfo.TorqueKUsage = wellSubsystemStat?.SubsystemTorqueMaster?.KUsage ?? 0d;
wellMapInfo.TvdLagDays = wellOperationsStat?.TvdLagDays;
wellMapInfo.TvdDrillingDays = wellOperationsStat?.TvdDrillingDays;