From 371083bd3882273a3b02aa96442a99575e09daed Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Tue, 5 Dec 2023 12:10:30 +0500 Subject: [PATCH] DetectedOperationExportService fix comment --- .../DetectedOperationExportService.cs | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationExportService.cs b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationExportService.cs index bb5f2663..15dab40f 100644 --- a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationExportService.cs +++ b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationExportService.cs @@ -6,12 +6,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; -using System.Text; using System.Threading; using System.Threading.Tasks; using AsbCloudInfrastructure.Services.DetectOperations.Detectors; using AsbCloudApp.Repositories; -using AsbCloudInfrastructure.Repository; namespace AsbCloudInfrastructure.Services.DetectOperations; @@ -69,8 +67,7 @@ public class DetectedOperationExportService if (!well.IdTelemetry.HasValue) throw new ArgumentNullException(nameof(well)); - var operations = await DetectOperationsAsync(well.IdTelemetry.Value, new DateTime(2023, 10, 14) - .ToUtcDateTimeOffset(well.Timezone.Hours), cancellationToken); + var operations = await DetectOperationsAsync(well.IdTelemetry.Value, DateTime.UnixEpoch, cancellationToken); return await GenerateExcelFileStreamAsync(well, idDomain, operations, cancellationToken); } @@ -200,19 +197,15 @@ public class DetectedOperationExportService { case WellOperationCategory.IdRotor: case WellOperationCategory.IdSlide: - { - var avgRotorSpeed = operation.ExtraData[DetectorDrilling.ExtraDataKeyAvgRotorSpeed]; - var dispersionOfNormalizedRotorSpeed = operation.ExtraData[DetectorDrilling.ExtraDataKeyDispersionOfNormalizedRotorSpeed]; - var isAfbEnabledObject = operation.ExtraData[DetectorDrilling.ExtraDataKeyIsAfbEnabled]; - var AfbState = ""; - if (isAfbEnabledObject is bool isAfbEnabled && isAfbEnabled) - AfbState = "АКБ - вкл"; + var comment = ""; + if (operation.ExtraData.TryGetValue(DetectorDrilling.ExtraDataKeyAvgRotorSpeed, out object? oAvgRotorSpeed)) + comment += $"Средняя скорость оборотов ротора: {oAvgRotorSpeed}\r\n"; - var comment = $"Средняя скорость оборотов ротора: {avgRotorSpeed}\r\n" + - $"Дисперсия нормированных оборотов ротора: {dispersionOfNormalizedRotorSpeed} \r\n" + - $"{AfbState}"; + if (operation.ExtraData.TryGetValue(DetectorDrilling.ExtraDataKeyDispersionOfNormalizedRotorSpeed, out object? oDispersionOfNormalizedRotorSpeed)) + comment += $"Дисперсия нормированных оборотов ротора: {oDispersionOfNormalizedRotorSpeed}"; + return comment; - } + default: return string.Empty; }