forked from ddrilling/AsbCloudServer
логика расчета сумм глубин по конкретной подсистеме и ее идентификации вынесены в отдельный метод
This commit is contained in:
parent
fcb1bb92d9
commit
5a23853cdf
@ -128,28 +128,12 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
||||
var groupedDataSubsystems = dtos
|
||||
.GroupBy(o => o.IdSubsystem);
|
||||
var periodGroupTotal = dtos.Sum(o => (o.DateEnd - o.DateStart).TotalHours);
|
||||
|
||||
var result = groupedDataSubsystems.Select(g =>
|
||||
{
|
||||
double depthIntervalSubsystem = 0;
|
||||
//AKB - MSE
|
||||
if (g.Key == 1 | g.Key == 2)
|
||||
{
|
||||
depthIntervalSubsystem = depthInterval.depthIntervalRotor + depthInterval.depthIntervalSlide;
|
||||
}
|
||||
//Spin
|
||||
if (g.Key == 65536)
|
||||
{
|
||||
depthIntervalSubsystem = depthInterval.depthIntervalSlide;
|
||||
}
|
||||
//Torque
|
||||
if (g.Key == 65537)
|
||||
{
|
||||
depthIntervalSubsystem = depthInterval.depthIntervalRotor;
|
||||
}
|
||||
|
||||
var depthIntervalSubsystem = GetDepthIntervalSubsystem(g.Key, depthInterval);
|
||||
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()
|
||||
{
|
||||
IdSubsystem = g.Key,
|
||||
@ -177,6 +161,27 @@ namespace AsbCloudInfrastructure.Services.Subsystems
|
||||
.Sum(o => o.DepthEnd - o.DepthStart);
|
||||
return depthInterval;
|
||||
}
|
||||
private double GetDepthIntervalSubsystem(int idSubsystem, (double depthIntervalRotor, double depthIntervalSlide) depthInterval)
|
||||
{
|
||||
double depthIntervalSubsystem = 0;
|
||||
//AKB - MSE
|
||||
if (idSubsystem == 1 | idSubsystem == 2)
|
||||
{
|
||||
depthIntervalSubsystem = depthInterval.depthIntervalRotor + depthInterval.depthIntervalSlide;
|
||||
}
|
||||
//Spin
|
||||
if (idSubsystem == 65536)
|
||||
{
|
||||
depthIntervalSubsystem = depthInterval.depthIntervalSlide;
|
||||
}
|
||||
//Torque
|
||||
if (idSubsystem == 65537)
|
||||
{
|
||||
depthIntervalSubsystem = depthInterval.depthIntervalRotor;
|
||||
}
|
||||
return depthIntervalSubsystem;
|
||||
|
||||
}
|
||||
|
||||
private IQueryable<SubsystemOperationTime>? BuildQuery(SubsystemOperationTimeRequest request)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user