forked from ddrilling/AsbCloudServer
Рефакторинг, удаление лишнего
This commit is contained in:
parent
19117d988f
commit
a1ce37b00f
@ -107,7 +107,7 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
|||||||
return null;
|
return null;
|
||||||
var depthInterval = GetDepthInterval(detectedOperations);
|
var depthInterval = GetDepthInterval(detectedOperations);
|
||||||
|
|
||||||
var statList = CalcStat(data,depthInterval, request);
|
var statList = CalcStat(data,depthInterval);
|
||||||
return statList;
|
return statList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,9 +118,11 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
|||||||
if (data is null)
|
if (data is null)
|
||||||
return Enumerable.Empty<DateTime>();
|
return Enumerable.Empty<DateTime>();
|
||||||
|
|
||||||
var dateRanges = new List<DateTime>();
|
var dateRanges = new List<DateTime>
|
||||||
dateRanges.Add(data.Min(d => d.DateStart));
|
{
|
||||||
dateRanges.Add(data.Max(d => d.DateEnd));
|
data.Min(d => d.DateStart),
|
||||||
|
data.Max(d => d.DateEnd)
|
||||||
|
};
|
||||||
|
|
||||||
return dateRanges.AsEnumerable();
|
return dateRanges.AsEnumerable();
|
||||||
}
|
}
|
||||||
@ -161,8 +163,7 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
|||||||
|
|
||||||
private IEnumerable<SubsystemStatDto> CalcStat(
|
private IEnumerable<SubsystemStatDto> CalcStat(
|
||||||
IEnumerable<SubsystemOperationTimeDto> dtos,
|
IEnumerable<SubsystemOperationTimeDto> dtos,
|
||||||
(double depthIntervalRotor, double depthIntervalSlide) depthInterval,
|
(double depthIntervalRotor, double depthIntervalSlide) depthInterval)
|
||||||
SubsystemOperationTimeRequest? request = null)
|
|
||||||
{
|
{
|
||||||
var groupedDataSubsystems = dtos
|
var groupedDataSubsystems = dtos
|
||||||
.OrderBy(o => o.Id)
|
.OrderBy(o => o.Id)
|
||||||
@ -172,7 +173,6 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
|||||||
var result = groupedDataSubsystems.Select(g =>
|
var result = groupedDataSubsystems.Select(g =>
|
||||||
{
|
{
|
||||||
var depthIntervalSubsystem = GetDepthIntervalSubsystem(g.Key, depthInterval);
|
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 periodGroup = g.Sum(o => (o.DateEnd - o.DateStart).TotalHours);
|
||||||
var periodGroupDepth = g.Sum(o => o.DepthEnd - o.DepthStart);
|
var periodGroupDepth = g.Sum(o => o.DepthEnd - o.DepthStart);
|
||||||
var subsystemStat = new SubsystemStatDto()
|
var subsystemStat = new SubsystemStatDto()
|
||||||
@ -183,7 +183,6 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
|||||||
//% использования = суммарная проходка АПД в слайде
|
//% использования = суммарная проходка АПД в слайде
|
||||||
/// суммарную проходку автоопределенных операций в слайде.
|
/// суммарную проходку автоопределенных операций в слайде.
|
||||||
KUsage = periodGroupDepth / depthIntervalSubsystem,
|
KUsage = periodGroupDepth / depthIntervalSubsystem,
|
||||||
//KUsage = depthIntervalSubsystem / ((request?.LtDepth ?? 0) - (request?.GtDepth ?? 0)),
|
|
||||||
SumDepthInterval = periodGroupDepth,
|
SumDepthInterval = periodGroupDepth,
|
||||||
OperationCount = g.Count(),
|
OperationCount = g.Count(),
|
||||||
};
|
};
|
||||||
@ -210,33 +209,6 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double CalcInterval(double? gtDepth, double? ltDepth, IGrouping<int, SubsystemOperationTimeDto> 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<DetectedOperationDto> detectedOperations)
|
private static (double depthIntervalRotor, double depthIntervalSlide) GetDepthInterval (IEnumerable<DetectedOperationDto> detectedOperations)
|
||||||
{
|
{
|
||||||
var depthIntervalRotor = detectedOperations.Where(o => o.IdCategory == WellOperationCategory.IdRotor)
|
var depthIntervalRotor = detectedOperations.Where(o => o.IdCategory == WellOperationCategory.IdRotor)
|
||||||
|
Loading…
Reference in New Issue
Block a user