diff --git a/AsbCloudApp/CyclycArray.cs b/AsbCloudApp/CyclicArray.cs
similarity index 98%
rename from AsbCloudApp/CyclycArray.cs
rename to AsbCloudApp/CyclicArray.cs
index b551d1c2..384b0fdd 100644
--- a/AsbCloudApp/CyclycArray.cs
+++ b/AsbCloudApp/CyclicArray.cs
@@ -6,7 +6,7 @@ namespace System.Collections.Generic
/// Цикличный массив
///
///
- public class CyclycArray : IEnumerable
+ public class CyclicArray : IEnumerable
{
readonly T[] array;
int used, current = -1;
@@ -15,7 +15,7 @@ namespace System.Collections.Generic
/// constructor
///
///
- public CyclycArray(int capacity)
+ public CyclicArray(int capacity)
{
array = new T[capacity];
}
diff --git a/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs b/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs
index aba5593f..16a9749c 100644
--- a/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs
+++ b/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportWellDrillingDto.cs
@@ -94,5 +94,5 @@ public class ProcessMapReportWellDrillingDto
///
/// Механическая скорость, м/ч
///
- public PlanFactDto Rop { get; set; }
+ public PlanFactDto Rop { get; set; } = new();
}
\ No newline at end of file
diff --git a/AsbCloudApp/Data/SectionByOperationsDto.cs b/AsbCloudApp/Data/SectionByOperationsDto.cs
index 8123ad11..80b1fc3f 100644
--- a/AsbCloudApp/Data/SectionByOperationsDto.cs
+++ b/AsbCloudApp/Data/SectionByOperationsDto.cs
@@ -35,14 +35,18 @@ public class SectionByOperationsDto
public DateTimeOffset DateStart { get; set; }
///
- /// Глубина после завершения последней операции операции в секции, м
+ /// Глубина после завершения последней операции в секции, м
///
[Range(0, 50_000)]
public double DepthEnd { get; set; }
///
- /// Дата после завершения последней операции операции в секции
+ /// Дата после завершения последней операции в секции
///
public DateTimeOffset DateEnd { get; set; }
- public string Caption { get; set; }
+
+ ///
+ /// Название
+ ///
+ public string Caption { get; set; } = string.Empty;
}
diff --git a/AsbCloudApp/Repositories/ITelemetryDataCache.cs b/AsbCloudApp/Repositories/ITelemetryDataCache.cs
index c31a0fbd..bce8d328 100644
--- a/AsbCloudApp/Repositories/ITelemetryDataCache.cs
+++ b/AsbCloudApp/Repositories/ITelemetryDataCache.cs
@@ -20,7 +20,7 @@ namespace AsbCloudApp.Repositories
void AddRange(int idTelemetry, IEnumerable range);
///
- /// вернуть последнюю записть
+ /// вернуть последнюю запись
///
///
///
@@ -49,7 +49,7 @@ namespace AsbCloudApp.Repositories
///
///
///
- DatesRangeDto? GetOrDefaultCachedaDateRange(int idTelemetry);
+ DatesRangeDto? GetOrDefaultCachedDateRange(int idTelemetry);
///
/// Получить диапазон дат телеметрии.
diff --git a/AsbCloudApp/Services/IWellFinalDocumentsService.cs b/AsbCloudApp/Services/IWellFinalDocumentsService.cs
index 1d6196ca..8169b890 100644
--- a/AsbCloudApp/Services/IWellFinalDocumentsService.cs
+++ b/AsbCloudApp/Services/IWellFinalDocumentsService.cs
@@ -18,7 +18,7 @@ namespace AsbCloudApp.Services
///
///
///
- Task UpdateRangeAsync(int idWell, IEnumerable? dtos, CancellationToken token);
+ Task UpdateRangeAsync(int idWell, IEnumerable dtos, CancellationToken token);
///
/// Получение истории файлов
diff --git a/AsbCloudDb/EFExtentions.cs b/AsbCloudDb/EFExtensions.cs
similarity index 93%
rename from AsbCloudDb/EFExtentions.cs
rename to AsbCloudDb/EFExtensions.cs
index 575480e3..9da4c626 100644
--- a/AsbCloudDb/EFExtentions.cs
+++ b/AsbCloudDb/EFExtensions.cs
@@ -12,14 +12,13 @@ using System.Threading.Tasks;
namespace AsbCloudDb
{
- public static class EFExtentions
+ public static class EFExtensions
{
- private static readonly System.Text.Json.JsonSerializerOptions jsonSerializerOptions = new()
+ private static readonly JsonSerializerOptions jsonSerializerOptions = new()
{
AllowTrailingCommas = true,
WriteIndented = true,
- NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString |
- System.Text.Json.Serialization.JsonNumberHandling.AllowNamedFloatingPointLiterals,
+ NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.AllowNamedFloatingPointLiterals,
};
public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasJsonConversion(
@@ -28,11 +27,11 @@ namespace AsbCloudDb
public static Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasJsonConversion(
this Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder builder,
- System.Text.Json.JsonSerializerOptions jsonSerializerOptions)
+ JsonSerializerOptions jsonSerializerOptions)
{
builder.HasConversion(
- s => System.Text.Json.JsonSerializer.Serialize(s, jsonSerializerOptions),
- s => System.Text.Json.JsonSerializer.Deserialize(s, jsonSerializerOptions)!);
+ s => JsonSerializer.Serialize(s, jsonSerializerOptions),
+ s => JsonSerializer.Deserialize(s, jsonSerializerOptions)!);
ValueComparer valueComparer = new (
(a,b) =>
@@ -102,7 +101,7 @@ namespace AsbCloudDb
return factory.Columns;
}
- public static Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry Upsert(this DbSet dbSet, T value)
+ public static EntityEntry Upsert(this DbSet dbSet, T value)
where T : class
{
return dbSet.Contains(value)
diff --git a/AsbCloudDb/EFExtentionsInnitialization.cs b/AsbCloudDb/EFExtensionsInitialization.cs
similarity index 92%
rename from AsbCloudDb/EFExtentionsInnitialization.cs
rename to AsbCloudDb/EFExtensionsInitialization.cs
index 110a75ae..7c265b82 100644
--- a/AsbCloudDb/EFExtentionsInnitialization.cs
+++ b/AsbCloudDb/EFExtensionsInitialization.cs
@@ -5,9 +5,9 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
namespace AsbCloudDb
{
- public static class EFExtentionsInnitialization
+ public static class EFExtensionsInitialization
{
- public static void EnshureCreatedAndMigrated(this DatabaseFacade db)
+ public static void EnsureCreatedAndMigrated(this DatabaseFacade db)
{
db.SetCommandTimeout(TimeSpan.FromMinutes(5));
if (db.EnsureCreated())
diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs
index bd1e1690..43ede314 100644
--- a/AsbCloudDb/Model/AsbCloudDbContext.cs
+++ b/AsbCloudDb/Model/AsbCloudDbContext.cs
@@ -349,6 +349,10 @@ namespace AsbCloudDb.Model
.HasJsonConversion();
});
+ modelBuilder.Entity(entity => entity
+ .Property(p=>p.ExtraData)
+ .HasJsonConversion());
+
modelBuilder.Entity(entity =>
{
entity.HasNoKey()
diff --git a/AsbCloudDb/Model/WellOperationCategory.cs b/AsbCloudDb/Model/WellOperationCategory.cs
index 28acc79e..edba3581 100644
--- a/AsbCloudDb/Model/WellOperationCategory.cs
+++ b/AsbCloudDb/Model/WellOperationCategory.cs
@@ -42,7 +42,7 @@ namespace AsbCloudDb.Model
///
/// КНБК
///
- public const int IdKnbk = 4000;
+ public const int IdBha = 4000;
///
/// Механическое. бурение
@@ -246,7 +246,7 @@ namespace AsbCloudDb.Model
/// Виды работ
///
public static WellOperationCategory[] WorkTypes { get; } = new WellOperationCategory[]{
- new () {Id = IdKnbk, IdParent = 3000, Name = "КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
+ new () {Id = IdBha, IdParent = 3000, Name = "КНБК", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = IdMechanicalDrilling, IdParent = 3000, Name = "Механическое. бурение", KeyValueName = "dT", KeyValueUnits = "м/ч" },
new () {Id = IdMeasurementStat, IdParent = 3000, Name = "Статический замер", KeyValueName = "dT", KeyValueUnits = "мин" },
new () {Id = IdNormalizedWellDiameter, IdParent = 3000, Name = "Нормализация диаметра скважины", KeyValueName = "dT", KeyValueUnits = "мин" },
diff --git a/AsbCloudInfrastructure/Background/BackgroundWorker.cs b/AsbCloudInfrastructure/Background/BackgroundWorker.cs
index 1c641019..861c8a47 100644
--- a/AsbCloudInfrastructure/Background/BackgroundWorker.cs
+++ b/AsbCloudInfrastructure/Background/BackgroundWorker.cs
@@ -36,12 +36,12 @@ public class BackgroundWorker : BackgroundService
///
/// последние 16 завершившиеся с ошибкой
///
- public CyclycArray Felled { get; } = new(16);
+ public CyclicArray Felled { get; } = new(16);
///
/// последние 16 успешно завершенных
///
- public CyclycArray Done { get; } = new(16);
+ public CyclicArray Done { get; } = new(16);
///
/// Ошибка в главном цикле, никогда не должна появляться
diff --git a/AsbCloudInfrastructure/Background/PeriodicWorks/WorkSubsystemOscillationOperationTimeCalc.cs b/AsbCloudInfrastructure/Background/PeriodicWorks/WorkSubsystemOscillationOperationTimeCalc.cs
index 1135385c..b2a6800f 100644
--- a/AsbCloudInfrastructure/Background/PeriodicWorks/WorkSubsystemOscillationOperationTimeCalc.cs
+++ b/AsbCloudInfrastructure/Background/PeriodicWorks/WorkSubsystemOscillationOperationTimeCalc.cs
@@ -167,7 +167,6 @@ public class WorkSubsystemOscillationOperationTimeCalc : WorkSubsystemOperationT
.Where(d => d.IdTelemetry == idTelemetry)
.Where(d => d.DateTime >= dateBegin)
.Where(d => d.DateTime <= dateEnd)
- .Where(d => d.WellDepth != null)
.Where(d => d.WellDepth > 0)
.GroupBy(d => Math.Ceiling(d.WellDepth * 10))
.Select(g => new
diff --git a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs
index 8c72be8e..9864ef4d 100644
--- a/AsbCloudInfrastructure/Repository/WellOperationRepository.cs
+++ b/AsbCloudInfrastructure/Repository/WellOperationRepository.cs
@@ -111,7 +111,8 @@ public class WellOperationRepository : IWellOperationRepository
.ConfigureAwait(false);
if (lastFactOperation is not null)
- return DateTime.SpecifyKind(lastFactOperation.OperationPlan.DateStart.UtcDateTime + timeZoneOffset, DateTimeKind.Unspecified);
+ return DateTime.SpecifyKind(lastFactOperation.OperationPlan!.DateStart.UtcDateTime + timeZoneOffset, DateTimeKind.Unspecified);
+
return null;
}
diff --git a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
index ae4aa1a9..92878495 100644
--- a/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
+++ b/AsbCloudInfrastructure/Services/DailyReport/DailyReportService.cs
@@ -95,12 +95,10 @@ public class DailyReportService : IDailyReportService
public async Task GetAsync(int idWell, DateTime dateDailyReport, CancellationToken cancellationToken)
{
- var well = await wellService.GetOrDefaultAsync(idWell, cancellationToken);
+ var well = await wellService.GetOrDefaultAsync(idWell, cancellationToken)
+ ?? throw new ArgumentNullException(nameof(idWell), $"Скважина с Id: {idWell} не найдена");
- if (well is null)
- throw new ArgumentNullException(nameof(idWell), $"Скважина с Id: {idWell} не найдена");
-
- if (!await IsDateDailyReportInRangeAsync(idWell, dateDailyReport, cancellationToken))
+ if (!await IsDateDailyReportInRangeAsync(idWell, dateDailyReport, cancellationToken))
throw new ArgumentInvalidException(nameof(dateDailyReport), "Невозможно получить суточный отчёт");
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorDrilling.cs b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorDrilling.cs
index 3806e380..b9c7d201 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorDrilling.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/Detectors/DetectorDrilling.cs
@@ -61,10 +61,12 @@ public class DetectorDrilling : DetectorAbstract
{
var (avgRotorSpeed, dispersionOfNormalizedRotorSpeed) = CalcCriteries(telemetry, begin, end);
var idCategory = GetIdOperation(avgRotorSpeed, dispersionOfNormalizedRotorSpeed);
- var extraData = new Dictionary();
- extraData[ExtraDataKeyAvgRotorSpeed] = avgRotorSpeed;
- extraData[ExtraDataKeyDispersionOfNormalizedRotorSpeed] = dispersionOfNormalizedRotorSpeed;
- extraData[ExtraDataKeyHasOscillation] = dispersionOfNormalizedRotorSpeed > dispersionOfNormalizedRotorSpeedThreshold;
+ var extraData = new Dictionary
+ {
+ [ExtraDataKeyAvgRotorSpeed] = avgRotorSpeed,
+ [ExtraDataKeyDispersionOfNormalizedRotorSpeed] = dispersionOfNormalizedRotorSpeed,
+ [ExtraDataKeyHasOscillation] = dispersionOfNormalizedRotorSpeed > dispersionOfNormalizedRotorSpeedThreshold
+ };
return (idCategory, extraData);
}
diff --git a/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs b/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs
index 36b5cbf8..84e34f4c 100644
--- a/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs
+++ b/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs
@@ -118,6 +118,7 @@ public class WorkOperationDetection: Work
{
var data = await query
.Where(d => d.DateTime > startDate)
+ .Take(take)
.ToArrayAsync(token);
if (data.Length < gap)
diff --git a/AsbCloudInfrastructure/Services/ReportService.cs b/AsbCloudInfrastructure/Services/ReportService.cs
index e4094c34..e1cd558a 100644
--- a/AsbCloudInfrastructure/Services/ReportService.cs
+++ b/AsbCloudInfrastructure/Services/ReportService.cs
@@ -13,203 +13,201 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
-namespace AsbCloudInfrastructure.Services
+namespace AsbCloudInfrastructure.Services;
+
+public class ReportService : IReportService
{
+ private readonly IAsbCloudDbContext db;
+ private readonly ITelemetryService telemetryService;
+ private readonly FileService fileService;
+ private readonly IWellService wellService;
+ private readonly BackgroundWorker backgroundWorkerService;
- public class ReportService : IReportService
+ public int ReportCategoryId { get; private set; }
+
+ public ReportService(IAsbCloudDbContext db,
+ ITelemetryService telemetryService,
+ IWellService wellService,
+ FileService fileService,
+ BackgroundWorker backgroundWorkerService)
{
- private readonly IAsbCloudDbContext db;
- private readonly ITelemetryService telemetryService;
- private readonly FileService fileService;
- private readonly IWellService wellService;
- private readonly BackgroundWorker backgroundWorkerService;
-
- public int ReportCategoryId { get; private set; }
-
- public ReportService(IAsbCloudDbContext db,
- ITelemetryService telemetryService,
- IWellService wellService,
- FileService fileService,
- BackgroundWorker backgroundWorkerService)
- {
- this.db = db;
- this.wellService = wellService;
- this.backgroundWorkerService = backgroundWorkerService;
- this.telemetryService = telemetryService;
- this.fileService = fileService;
- ReportCategoryId = db.FileCategories
- .AsNoTracking()
- .First(c => c.Name.Equals("Рапорт"))
- .Id;
- }
-
- public string EnqueueCreateReportWork(int idWell, int idUser, int stepSeconds, int format, DateTime begin,
- DateTime end, Action
[ApiController]
[Authorize]
- public abstract class TrajectoryEditableController : TrajectoryController
- where Tdto : TrajectoryGeoDto
+ public abstract class TrajectoryEditableController : TrajectoryController
+ where TDto : TrajectoryGeoDto
{
- protected override string fileName { get; set; }
-
- private readonly TrajectoryParserService trajectoryImportService;
- private readonly TrajectoryExportService trajectoryExportService;
- private readonly ITrajectoryEditableRepository trajectoryRepository;
+ private readonly TrajectoryParserService trajectoryImportService;
+ private readonly TrajectoryExportService trajectoryExportService;
+ private readonly ITrajectoryEditableRepository trajectoryRepository;
public TrajectoryEditableController(IWellService wellService,
- TrajectoryParserService trajectoryImportService,
- TrajectoryExportService trajectoryExportService,
- ITrajectoryEditableRepository trajectoryRepository)
+ TrajectoryParserService trajectoryImportService,
+ TrajectoryExportService trajectoryExportService,
+ ITrajectoryEditableRepository trajectoryRepository)
: base(
wellService,
trajectoryExportService,
@@ -118,7 +116,7 @@ namespace AsbCloudWebApi.Controllers.Trajectory
/// количество успешно записанных строк в БД
[HttpPost]
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
- public async Task AddAsync(int idWell, [FromBody] Tdto row,
+ public async Task AddAsync(int idWell, [FromBody] TDto row,
CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
@@ -141,7 +139,7 @@ namespace AsbCloudWebApi.Controllers.Trajectory
/// количество успешно записанных строк в БД
[HttpPost("range")]
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
- public async Task AddRangeAsync(int idWell, [FromBody] IEnumerable rows,
+ public async Task AddRangeAsync(int idWell, [FromBody] IEnumerable rows,
CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
@@ -169,7 +167,7 @@ namespace AsbCloudWebApi.Controllers.Trajectory
[HttpPut("{idRow}")]
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
public async Task UpdateAsync(int idWell, int idRow,
- [FromBody] Tdto row, CancellationToken token)
+ [FromBody] TDto row, CancellationToken token)
{
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
return Forbid();
diff --git a/AsbCloudWebApi/Controllers/Trajectory/TrajectoryFactManualController.cs b/AsbCloudWebApi/Controllers/Trajectory/TrajectoryFactManualController.cs
index f8823da5..e3020342 100644
--- a/AsbCloudWebApi/Controllers/Trajectory/TrajectoryFactManualController.cs
+++ b/AsbCloudWebApi/Controllers/Trajectory/TrajectoryFactManualController.cs
@@ -14,7 +14,7 @@ namespace AsbCloudWebApi.Controllers.Trajectory;
[Route("api/well/{idWell}/[controller]")]
public class TrajectoryFactManualController : TrajectoryEditableController
{
- protected override string fileName { get; set; }
+ protected override string fileName => "ЕЦП_шаблон_файла_фактическая_траектория.xlsx";
public TrajectoryFactManualController(IWellService wellService,
TrajectoryFactManualParserService factTrajectoryImportService,
TrajectoryFactManualExportService factTrajectoryExportService,
@@ -24,7 +24,5 @@ public class TrajectoryFactManualController : TrajectoryEditableController
{
- protected override string fileName { get; set; }
+ protected override string fileName => "ЕЦП_шаблон_файла_фактическая_ннб_траектория.xlsx";
public TrajectoryFactNnbController(
ITrajectoryNnbRepository trajectoryNnbRepository,
TrajectoryFactNnbExportService trajectoryExportService,
@@ -24,7 +24,5 @@ public class TrajectoryFactNnbController : TrajectoryController "ЕЦП_шаблон_файла_плановая_траектория.xlsx";
+
public TrajectoryPlanController(IWellService wellService,
TrajectoryPlanParserService trajectoryPlanImportService,
TrajectoryPlanExportService trajectoryPlanExportService,
@@ -32,7 +34,6 @@ namespace AsbCloudWebApi.Controllers.Trajectory
trajectoryPlanExportService,
trajectoryPlanRepository)
{
- fileName = "ЕЦП_шаблон_файла_плановая_траектория.xlsx";
this.trajectoryVisualizationService = trajectoryVisualizationService;
}
diff --git a/SignalRTestClient/Program.cs b/SignalRTestClient/Program.cs
index 9ae72e04..aa61b859 100644
--- a/SignalRTestClient/Program.cs
+++ b/SignalRTestClient/Program.cs
@@ -6,7 +6,7 @@ namespace SignalRTestClient;
internal class Program
{
- static void Main(string[] args)
+ static void Main()
{
var connectionBuilder = new HubConnectionBuilder();
var connection = connectionBuilder
@@ -47,7 +47,7 @@ internal class Program
builder.AddProvider(provider);
}
- private static Task AccessTokenProvider()
+ private static Task AccessTokenProvider()
{
return Task.FromResult("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.eyJpZCI6IjEiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiZGV2IiwiaWRDb21wYW55IjoiMSIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6InJvb3QiLCJuYmYiOjE2NjI1NDgxNjIsImV4cCI6MTY5NDEwNTc2MiwiaXNzIjoiYSIsImF1ZCI6ImEifQ.OEAlNzxi7Jat6pzDBTAjTbChskc-tdJthJexyWwwUKE");
}