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