forked from ddrilling/AsbCloudServer
Фикс репозиториев
This commit is contained in:
parent
0c7aac40ff
commit
b6b1220561
@ -55,14 +55,4 @@ public class TelemetryDataRequest
|
||||
/// </summary>
|
||||
[Range(1, MaxTake)]
|
||||
public int Take { get; set; } = 1024;
|
||||
|
||||
/// <summary>
|
||||
/// Больше или равно высоте талевого блока
|
||||
/// </summary>
|
||||
public double? GeBlockPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Меньше или равно высоте талевого блока
|
||||
/// </summary>
|
||||
public double? LeBlockPosition { get; set; }
|
||||
}
|
||||
|
@ -36,15 +36,10 @@ public class DetectedOperationRepository
|
||||
IdTelemetry = g.Key,
|
||||
LastDetectedOperation = g.OrderBy(o => o.DateEnd).Last()
|
||||
})
|
||||
.ToDictionaryAsync(x => x.IdTelemetry, x => x.LastDetectedOperation, token);
|
||||
.ToArrayAsync(token);
|
||||
|
||||
var dtos = entities.ToDictionary(x => x.Key, x =>
|
||||
{
|
||||
if (x.Value == null)
|
||||
throw new ArgumentNullException(nameof(x.Value), "The value of the last detected operation cannot be null");
|
||||
|
||||
return Convert(x.Value);
|
||||
});
|
||||
var dtos = entities.ToDictionary(x => x.IdTelemetry,
|
||||
x => Convert(x.LastDetectedOperation));
|
||||
|
||||
return dtos;
|
||||
}
|
||||
|
@ -204,19 +204,21 @@ public class DetectedOperationService : IDetectedOperationService
|
||||
|
||||
var detectedOperations = new List<DetectedOperationDto>();
|
||||
|
||||
var detectableTelemetries = telemetries.Select(t => new DetectableTelemetry
|
||||
{
|
||||
DateTime = new DateTimeOffset(t.DateTime, timezone.Offset),
|
||||
IdUser = t.IdUser,
|
||||
Mode = t.Mode,
|
||||
WellDepth = t.WellDepth,
|
||||
Pressure = t.Pressure,
|
||||
HookWeight = t.HookWeight,
|
||||
BlockPosition = t.BlockPosition,
|
||||
BitDepth = t.BitDepth,
|
||||
RotorSpeed = t.RotorSpeed,
|
||||
AxialLoad = t.AxialLoad,
|
||||
}).ToArray();
|
||||
var detectableTelemetries = telemetries
|
||||
.Where(t => t.BlockPosition >= 0)
|
||||
.Select(t => new DetectableTelemetry
|
||||
{
|
||||
DateTime = new DateTimeOffset(t.DateTime, timezone.Offset),
|
||||
IdUser = t.IdUser,
|
||||
Mode = t.Mode,
|
||||
WellDepth = t.WellDepth,
|
||||
Pressure = t.Pressure,
|
||||
HookWeight = t.HookWeight,
|
||||
BlockPosition = t.BlockPosition,
|
||||
BitDepth = t.BitDepth,
|
||||
RotorSpeed = t.RotorSpeed,
|
||||
AxialLoad = t.AxialLoad,
|
||||
}).ToArray();
|
||||
|
||||
var positionBegin = 0;
|
||||
var positionEnd = detectableTelemetries.Length - gap;
|
||||
|
@ -74,8 +74,7 @@ public class WorkOperationDetection : Work
|
||||
{
|
||||
GeDate = dateBegin,
|
||||
Take = pointsCount,
|
||||
Order = 0,
|
||||
GeBlockPosition = 0
|
||||
Order = 0
|
||||
};
|
||||
|
||||
var detectedOperations =
|
||||
|
@ -176,7 +176,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
||||
return dtos;
|
||||
}
|
||||
|
||||
protected virtual IQueryable<TEntity> BuildQuery(int idTelemetry, TelemetryDataRequest request)
|
||||
private IQueryable<TEntity> BuildQuery(int idTelemetry, TelemetryDataRequest request)
|
||||
{
|
||||
var dbSet = db.Set<TEntity>();
|
||||
|
||||
|
@ -176,17 +176,4 @@ public class TelemetryDataSaubService : TelemetryDataBaseService<TelemetryDataSa
|
||||
outStream.Seek(0, SeekOrigin.Begin);
|
||||
return outStream;
|
||||
}
|
||||
|
||||
protected override IQueryable<TelemetryDataSaub> BuildQuery(int idTelemetry, TelemetryDataRequest request)
|
||||
{
|
||||
var query = base.BuildQuery(idTelemetry, request);
|
||||
|
||||
if (request.GeBlockPosition.HasValue)
|
||||
query = query.Where(e => e.BlockPosition >= request.GeBlockPosition);
|
||||
|
||||
if (request.LeBlockPosition.HasValue)
|
||||
query = query.Where(e => e.BlockPosition <= request.LeBlockPosition);
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user