небольшие корректировки интерфейса IDetectedOperationService и сервиса расчета статистики по наработке подсистем

This commit is contained in:
eugeniy_ivanov 2022-09-22 17:13:53 +05:00
parent 5a23853cdf
commit a457da8ead
2 changed files with 10 additions and 9 deletions

View File

@ -45,7 +45,6 @@ namespace AsbCloudApp.Services
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="token"></param> /// <param name="token"></param>
/// <returns></returns> /// <returns></returns>
Task<int> DeleteAsync(DetectedOperationRequest request, CancellationToken token); Task<int> DeleteAsync(DetectedOperationRequest request, CancellationToken token);
/// <summary> /// <summary>

View File

@ -97,6 +97,8 @@ namespace AsbCloudInfrastructure.Services.Subsystems
GtDate = request.GtDate, GtDate = request.GtDate,
}; };
var detectedOperations = await detectedOperationService.GetOperationsAsync(detectedOperationsRequest, token); var detectedOperations = await detectedOperationService.GetOperationsAsync(detectedOperationsRequest, token);
if(detectedOperations?.Any() != true)
return null;
var depthInterval = GetDepthInterval(detectedOperations); var depthInterval = GetDepthInterval(detectedOperations);
var statList = CalcStat(data,depthInterval,request, token); var statList = CalcStat(data,depthInterval,request, token);
@ -150,20 +152,20 @@ namespace AsbCloudInfrastructure.Services.Subsystems
return result; return result;
} }
private (double,double) GetDepthInterval (IEnumerable<DetectedOperationDto>? detectedOperations) private (double depthIntervalRotor, double depthIntervalSlide) GetDepthInterval (IEnumerable<DetectedOperationDto> detectedOperations)
{ {
var depthInterval = (depthIntervalRotor:(double)0, depthIntervalSlide: (double)0);
if (detectedOperations is null) var depthIntervalRotor = detectedOperations.Where(o => o.IdCategory == 1)
return depthInterval;
depthInterval.depthIntervalRotor = detectedOperations.Where(o => o.IdCategory == 1)
.Sum(o => o.DepthEnd - o.DepthStart); .Sum(o => o.DepthEnd - o.DepthStart);
depthInterval.depthIntervalSlide = detectedOperations.Where(o => o.IdCategory == 3) var depthIntervalSlide = detectedOperations.Where(o => o.IdCategory == 3)
.Sum(o => o.DepthEnd - o.DepthStart); .Sum(o => o.DepthEnd - o.DepthStart);
var depthInterval = (depthIntervalRotor, depthIntervalSlide);
return depthInterval; return depthInterval;
} }
private double GetDepthIntervalSubsystem(int idSubsystem, (double depthIntervalRotor, double depthIntervalSlide) depthInterval) private double GetDepthIntervalSubsystem(int idSubsystem, (double depthIntervalRotor, double depthIntervalSlide) depthInterval)
{ {
double depthIntervalSubsystem = 0; var depthIntervalSubsystem = 0d;
//AKB - MSE //AKB - MSE
if (idSubsystem == 1 | idSubsystem == 2) if (idSubsystem == 1 | idSubsystem == 2)
{ {