исправление мелких ошибок

This commit is contained in:
eugeniy_ivanov 2022-11-03 14:02:56 +05:00
parent f3e5e27511
commit f10201d3ef

View File

@ -170,17 +170,17 @@ namespace AsbCloudInfrastructure.Services.Subsystems
{ {
var depthIntervalSubsystem = 0d; var depthIntervalSubsystem = 0d;
//AKB - MSE //AKB - MSE
if (idSubsystem == 1 | idSubsystem == 2) if (idSubsystem == IdSubsystemAKB | idSubsystem == IdSubsystemMSE)
{ {
depthIntervalSubsystem = depthInterval.depthIntervalRotor + depthInterval.depthIntervalSlide; depthIntervalSubsystem = depthInterval.depthIntervalRotor + depthInterval.depthIntervalSlide;
} }
//Spin //Spin
if (idSubsystem == 65536) if (idSubsystem == IdSubsystemSpin)
{ {
depthIntervalSubsystem = depthInterval.depthIntervalSlide; depthIntervalSubsystem = depthInterval.depthIntervalSlide;
} }
//Torque //Torque
if (idSubsystem == 65537) if (idSubsystem == IdSubsystemTorque)
{ {
depthIntervalSubsystem = depthInterval.depthIntervalRotor; depthIntervalSubsystem = depthInterval.depthIntervalRotor;
} }
@ -217,13 +217,10 @@ namespace AsbCloudInfrastructure.Services.Subsystems
query = query.Where(d => d.DateStart >= beginUTC); query = query.Where(d => d.DateStart >= beginUTC);
query = query.Where(o => o.DateEnd <= endUTC); query = query.Where(o => o.DateEnd <= endUTC);
var depthIntervals = await detectedOperationService.GetDepthIntervalAllOperationsAsync(beginUTC, endUTC, token); var depthIntervals = await detectedOperationService.GetDepthIntervalAllOperationsAsync(beginUTC, endUTC, token);
var result = new List<SubsystemActiveWellStatDto>(); var result = new List<SubsystemActiveWellStatDto>();
var subsystemsOperationTime = await query.ToListAsync(token); var subsystemsOperationTime = await query.ToListAsync(token);
var groupingSubsystemsOperationTime = subsystemsOperationTime.GroupBy(g => g.IdTelemetry); var groupingSubsystemsOperationTime = subsystemsOperationTime.GroupBy(g => g.IdTelemetry);
foreach (var group in groupingSubsystemsOperationTime) foreach (var group in groupingSubsystemsOperationTime)
{ {
var well = activeWell.Where(w => w.IdTelemetry == group.Key).FirstOrDefault(); var well = activeWell.Where(w => w.IdTelemetry == group.Key).FirstOrDefault();
@ -236,7 +233,6 @@ namespace AsbCloudInfrastructure.Services.Subsystems
if (depthIntervals is not null) if (depthIntervals is not null)
{ {
var depthInterval = depthIntervals.Where(o => o.Item1 == well.IdTelemetry).Select(o => (o.Item2, o.Item3)).FirstOrDefault(); var depthInterval = depthIntervals.Where(o => o.Item1 == well.IdTelemetry).Select(o => (o.Item2, o.Item3)).FirstOrDefault();
//var groupSubsystem = group.GroupBy(g => g.IdSubsystem);
var dto = group.Select(s => s.Adapt<SubsystemOperationTimeDto>()); var dto = group.Select(s => s.Adapt<SubsystemOperationTimeDto>());
var subsystemStat = CalcStat(dto, depthInterval); var subsystemStat = CalcStat(dto, depthInterval);
wellStat.SubsystemAKB = subsystemStat.FirstOrDefault(s => s.IdSubsystem == IdSubsystemAKB); wellStat.SubsystemAKB = subsystemStat.FirstOrDefault(s => s.IdSubsystem == IdSubsystemAKB);
@ -245,14 +241,11 @@ namespace AsbCloudInfrastructure.Services.Subsystems
wellStat.SubsystemTorqueMaster = subsystemStat.FirstOrDefault(s => s.IdSubsystem == IdSubsystemTorque); wellStat.SubsystemTorqueMaster = subsystemStat.FirstOrDefault(s => s.IdSubsystem == IdSubsystemTorque);
result.Add(wellStat); result.Add(wellStat);
} }
} }
} }
return result; return result;
} }
/// <inheritdoc/> /// <inheritdoc/>
public async Task<DatesRangeDto?> GetDateRangeOperationTimeAsync(SubsystemOperationTimeRequest request, CancellationToken token) public async Task<DatesRangeDto?> GetDateRangeOperationTimeAsync(SubsystemOperationTimeRequest request, CancellationToken token)
{ {