forked from ddrilling/AsbCloudServer
#5996638 Подсвечивать не оптимальные режимы
This commit is contained in:
parent
80dd30aa6f
commit
2334beb971
@ -42,6 +42,11 @@ namespace AsbCloudApp.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double AxialLoadMax { get; set; }
|
public double AxialLoadMax { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// axial load
|
||||||
|
/// </summary>
|
||||||
|
public MinMaxExtendedViewDto AxialLoad { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// pressure min.
|
/// pressure min.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -57,6 +62,11 @@ namespace AsbCloudApp.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double PressureMax { get; set; }
|
public double PressureMax { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// pressure
|
||||||
|
/// </summary>
|
||||||
|
public MinMaxExtendedViewDto Pressure { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// rotor torque min.
|
/// rotor torque min.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -72,6 +82,11 @@ namespace AsbCloudApp.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double RotorTorqueMax { get; set; }
|
public double RotorTorqueMax { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// rotor torque
|
||||||
|
/// </summary>
|
||||||
|
public MinMaxExtendedViewDto RotorTorque { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// rotor speed min.
|
/// rotor speed min.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -87,6 +102,11 @@ namespace AsbCloudApp.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double RotorSpeedMax { get; set; }
|
public double RotorSpeedMax { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// rotor speed
|
||||||
|
/// </summary>
|
||||||
|
public MinMaxExtendedViewDto RotorSpeed { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// flow min.
|
/// flow min.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -101,5 +121,10 @@ namespace AsbCloudApp.Data
|
|||||||
/// flow max.
|
/// flow max.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double FlowMax { get; set; }
|
public double FlowMax { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// flow
|
||||||
|
/// </summary>
|
||||||
|
public MinMaxExtendedViewDto Flow { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
26
AsbCloudApp/Data/MinMaxDto.cs
Normal file
26
AsbCloudApp/Data/MinMaxDto.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace AsbCloudApp.Data
|
||||||
|
{
|
||||||
|
#nullable enable
|
||||||
|
/// <summary>
|
||||||
|
/// Минимальное и максимальное значение
|
||||||
|
/// </summary>
|
||||||
|
public class MinMaxDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Минимальное значение
|
||||||
|
/// </summary>
|
||||||
|
public double Min { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// максимальное значение
|
||||||
|
/// </summary>
|
||||||
|
public double Max { get; set; }
|
||||||
|
}
|
||||||
|
#nullable disable
|
||||||
|
}
|
31
AsbCloudApp/Data/MinMaxExtendedViewDto.cs
Normal file
31
AsbCloudApp/Data/MinMaxExtendedViewDto.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace AsbCloudApp.Data
|
||||||
|
{
|
||||||
|
#nullable enable
|
||||||
|
/// <summary>
|
||||||
|
/// Расширение для класса MinMaxDto
|
||||||
|
/// </summary>
|
||||||
|
public class MinMaxExtendedViewDto : MinMaxDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Среднее значение
|
||||||
|
/// </summary>
|
||||||
|
public double Avg { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Является максимальным
|
||||||
|
/// </summary>
|
||||||
|
public bool IsMax { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Является минимальным
|
||||||
|
/// </summary>
|
||||||
|
public bool IsMin { get; set; }
|
||||||
|
}
|
||||||
|
#nullable disable
|
||||||
|
}
|
@ -4,6 +4,7 @@ using AsbCloudDb.Model;
|
|||||||
using AsbCloudInfrastructure.Repository;
|
using AsbCloudInfrastructure.Repository;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Org.BouncyCastle.Crypto;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -85,6 +86,16 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
public async Task<IEnumerable<DrillParamsDto>> GetCompositeAllAsync(int idWell,
|
public async Task<IEnumerable<DrillParamsDto>> GetCompositeAllAsync(int idWell,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
|
var allDrillParams =
|
||||||
|
await (from p in db.DrillParams
|
||||||
|
from c in db.WellComposites
|
||||||
|
where p.IdWell == c.IdWellSrc &&
|
||||||
|
p.IdWellSectionType == c.IdWellSectionType
|
||||||
|
select p)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync(token)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
var compositeWellDrillParams =
|
var compositeWellDrillParams =
|
||||||
await (from p in db.DrillParams
|
await (from p in db.DrillParams
|
||||||
from c in db.WellComposites
|
from c in db.WellComposites
|
||||||
@ -98,7 +109,8 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
var compositeDrillParamsDtos = compositeWellDrillParams.Adapt<IEnumerable<DrillParamsDto>>();
|
var compositeDrillParamsDtos = compositeWellDrillParams.Adapt<IEnumerable<DrillParamsDto>>();
|
||||||
|
|
||||||
return compositeDrillParamsDtos;
|
var result = compositeDrillParamsDtos.Select(x => Convert(x, allDrillParams));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> InsertAsync(int idWell, DrillParamsDto dto,
|
public async Task<int> InsertAsync(int idWell, DrillParamsDto dto,
|
||||||
@ -143,5 +155,49 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
var result = await base.UpdateAsync(dto, token).ConfigureAwait(false);
|
var result = await base.UpdateAsync(dto, token).ConfigureAwait(false);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static DrillParamsDto Convert(DrillParamsDto dto, IEnumerable<DrillParams> drillParams)
|
||||||
|
{
|
||||||
|
return new DrillParamsDto
|
||||||
|
{
|
||||||
|
Id = dto.Id,
|
||||||
|
IdWellSectionType = dto.IdWellSectionType,
|
||||||
|
AxialLoad = GetMinMaxExtended(dto, drillParams.Select(x => (x.AxialLoadMin, x.AxialLoadMax))),
|
||||||
|
AxialLoadAvg = dto.AxialLoadAvg,
|
||||||
|
AxialLoadMax = dto.AxialLoadMax,
|
||||||
|
AxialLoadMin = dto.AxialLoadMin,
|
||||||
|
DepthEnd = dto.DepthEnd,
|
||||||
|
DepthStart = dto.DepthStart,
|
||||||
|
Flow = GetMinMaxExtended(dto, drillParams.Select(x => (x.FlowMin, x.FlowMax))),
|
||||||
|
FlowAvg = dto.FlowAvg,
|
||||||
|
FlowMax = dto.FlowMax,
|
||||||
|
FlowMin = dto.FlowMin,
|
||||||
|
IdWell = dto.IdWell,
|
||||||
|
Pressure = GetMinMaxExtended(dto, drillParams.Select(x => (x.PressureMin, x.PressureMax))),
|
||||||
|
PressureAvg = dto.PressureAvg,
|
||||||
|
PressureMax = dto.PressureMax,
|
||||||
|
PressureMin = dto.PressureMin,
|
||||||
|
RotorSpeed = GetMinMaxExtended(dto, drillParams.Select(x => (x.RotorSpeedMin, x.RotorSpeedMax))),
|
||||||
|
RotorSpeedAvg = dto.RotorSpeedAvg,
|
||||||
|
RotorSpeedMax = dto.RotorSpeedMax,
|
||||||
|
RotorSpeedMin = dto.RotorSpeedMin,
|
||||||
|
RotorTorque = GetMinMaxExtended(dto, drillParams.Select(x => (x.RotorTorqueMin, x.RotorTorqueMax))),
|
||||||
|
RotorTorqueAvg = dto.RotorTorqueAvg,
|
||||||
|
RotorTorqueMax = dto.RotorTorqueMax,
|
||||||
|
RotorTorqueMin = dto.RotorTorqueMin
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MinMaxExtendedViewDto GetMinMaxExtended(DrillParamsDto x, IEnumerable<(double min, double max)> allDrillParams)
|
||||||
|
{
|
||||||
|
return new MinMaxExtendedViewDto
|
||||||
|
{
|
||||||
|
Avg = x.AxialLoadAvg,
|
||||||
|
Max = x.AxialLoadMax,
|
||||||
|
Min = x.AxialLoadMin,
|
||||||
|
IsMax = allDrillParams.Max(mx => mx.max) < x.AxialLoadMax,
|
||||||
|
IsMin = allDrillParams.Min(mn => mn.min) > x.AxialLoadMin
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user