From a1ce37b00fc6148af5f46df95c6bf1115b1af228 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Fri, 1 Sep 2023 11:03:03 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3,=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=B8=D1=88=D0=BD=D0=B5=D0=B3=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SubsystemOperationTimeService.cs | 42 ++++--------------- 1 file changed, 7 insertions(+), 35 deletions(-) diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs index 45b4c3fd..4be75fa6 100644 --- a/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs +++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs @@ -107,7 +107,7 @@ namespace AsbCloudInfrastructure.Services.Subsystems return null; var depthInterval = GetDepthInterval(detectedOperations); - var statList = CalcStat(data,depthInterval, request); + var statList = CalcStat(data,depthInterval); return statList; } @@ -118,9 +118,11 @@ namespace AsbCloudInfrastructure.Services.Subsystems if (data is null) return Enumerable.Empty(); - var dateRanges = new List(); - dateRanges.Add(data.Min(d => d.DateStart)); - dateRanges.Add(data.Max(d => d.DateEnd)); + var dateRanges = new List + { + data.Min(d => d.DateStart), + data.Max(d => d.DateEnd) + }; return dateRanges.AsEnumerable(); } @@ -161,8 +163,7 @@ namespace AsbCloudInfrastructure.Services.Subsystems private IEnumerable CalcStat( IEnumerable dtos, - (double depthIntervalRotor, double depthIntervalSlide) depthInterval, - SubsystemOperationTimeRequest? request = null) + (double depthIntervalRotor, double depthIntervalSlide) depthInterval) { var groupedDataSubsystems = dtos .OrderBy(o => o.Id) @@ -172,7 +173,6 @@ namespace AsbCloudInfrastructure.Services.Subsystems var result = groupedDataSubsystems.Select(g => { var depthIntervalSubsystem = GetDepthIntervalSubsystem(g.Key, depthInterval); - //var depthIntervalSubsystem = CalcInterval(request?.GtDepth, request?.LtDepth, g); var periodGroup = g.Sum(o => (o.DateEnd - o.DateStart).TotalHours); var periodGroupDepth = g.Sum(o => o.DepthEnd - o.DepthStart); var subsystemStat = new SubsystemStatDto() @@ -183,7 +183,6 @@ namespace AsbCloudInfrastructure.Services.Subsystems //% использования = суммарная проходка АПД в слайде /// суммарную проходку автоопределенных операций в слайде. KUsage = periodGroupDepth / depthIntervalSubsystem, - //KUsage = depthIntervalSubsystem / ((request?.LtDepth ?? 0) - (request?.GtDepth ?? 0)), SumDepthInterval = periodGroupDepth, OperationCount = g.Count(), }; @@ -210,33 +209,6 @@ namespace AsbCloudInfrastructure.Services.Subsystems return result; } - private double CalcInterval(double? gtDepth, double? ltDepth, IGrouping g) - { - var operations = g.ToList(); - double sum = 0; - foreach(var operation in operations) - { - var start = operation.DepthStart; - if(gtDepth.HasValue) - { - if (operation.DepthStart < gtDepth) - { - start = (double)gtDepth; - } - } - var end = operation.DepthEnd; - if (ltDepth.HasValue) - { - if (operation.DepthEnd > ltDepth) - { - start = (double)ltDepth; - } - } - sum += (end - start); - } - return sum; - } - private static (double depthIntervalRotor, double depthIntervalSlide) GetDepthInterval (IEnumerable detectedOperations) { var depthIntervalRotor = detectedOperations.Where(o => o.IdCategory == WellOperationCategory.IdRotor)