forked from ddrilling/AsbCloudServer
#5996638 Исправление замечаний
This commit is contained in:
parent
c87acfdd59
commit
07eb1bd878
@ -24,7 +24,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
this.telemetryService = telemetryService;
|
this.telemetryService = telemetryService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DrillParamsDto> GetDefaultDrillParamsAsync(int idWell,
|
public async Task<DrillParamsDto?> GetDefaultDrillParamsAsync(int idWell,
|
||||||
double startDepth, double endDepth, CancellationToken token = default)
|
double startDepth, double endDepth, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
var idTelemetry = telemetryService.GetIdTelemetryByIdWell(idWell);
|
var idTelemetry = telemetryService.GetIdTelemetryByIdWell(idWell);
|
||||||
@ -40,32 +40,38 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
select new DrillParamsDto()
|
select new DrillParamsDto()
|
||||||
{
|
{
|
||||||
IdWell = idWell,
|
IdWell = idWell,
|
||||||
Depth = new MinMaxDto<double> {
|
Depth = new MinMaxDto<double>
|
||||||
|
{
|
||||||
Min = endDepth,
|
Min = endDepth,
|
||||||
Max = startDepth
|
Max = startDepth
|
||||||
},
|
},
|
||||||
IdWellSectionType = 0,
|
IdWellSectionType = 0,
|
||||||
AxialLoad = new MinMaxExtendedViewDto {
|
AxialLoad = new MinMaxExtendedViewDto
|
||||||
|
{
|
||||||
Min = g.Min(t => t.AxialLoad) ?? double.NaN,
|
Min = g.Min(t => t.AxialLoad) ?? double.NaN,
|
||||||
Avg = g.Average(t => t.AxialLoad) ?? double.NaN,
|
Avg = g.Average(t => t.AxialLoad) ?? double.NaN,
|
||||||
Max = g.Max(t => t.AxialLoad) ?? double.NaN
|
Max = g.Max(t => t.AxialLoad) ?? double.NaN
|
||||||
},
|
},
|
||||||
Pressure = new MinMaxExtendedViewDto {
|
Pressure = new MinMaxExtendedViewDto
|
||||||
|
{
|
||||||
Min = g.Min(t => t.Pressure) ?? double.NaN,
|
Min = g.Min(t => t.Pressure) ?? double.NaN,
|
||||||
Avg = g.Average(t => t.Pressure) ?? double.NaN,
|
Avg = g.Average(t => t.Pressure) ?? double.NaN,
|
||||||
Max = g.Max(t => t.Pressure) ?? double.NaN
|
Max = g.Max(t => t.Pressure) ?? double.NaN
|
||||||
},
|
},
|
||||||
RotorTorque = new MinMaxExtendedViewDto {
|
RotorTorque = new MinMaxExtendedViewDto
|
||||||
|
{
|
||||||
Min = g.Min(t => t.RotorTorque) ?? double.NaN,
|
Min = g.Min(t => t.RotorTorque) ?? double.NaN,
|
||||||
Avg = g.Average(t => t.RotorTorque) ?? double.NaN,
|
Avg = g.Average(t => t.RotorTorque) ?? double.NaN,
|
||||||
Max = g.Max(t => t.RotorTorque) ?? double.NaN
|
Max = g.Max(t => t.RotorTorque) ?? double.NaN
|
||||||
},
|
},
|
||||||
RotorSpeed = new MinMaxExtendedViewDto {
|
RotorSpeed = new MinMaxExtendedViewDto
|
||||||
|
{
|
||||||
Min = g.Min(t => t.RotorSpeed) ?? double.NaN,
|
Min = g.Min(t => t.RotorSpeed) ?? double.NaN,
|
||||||
Avg = g.Average(t => t.RotorSpeed) ?? double.NaN,
|
Avg = g.Average(t => t.RotorSpeed) ?? double.NaN,
|
||||||
Max = g.Max(t => t.RotorSpeed) ?? double.NaN
|
Max = g.Max(t => t.RotorSpeed) ?? double.NaN
|
||||||
},
|
},
|
||||||
Flow = new MinMaxExtendedViewDto {
|
Flow = new MinMaxExtendedViewDto
|
||||||
|
{
|
||||||
Min = g.Min(t => t.Flow) ?? double.NaN,
|
Min = g.Min(t => t.Flow) ?? double.NaN,
|
||||||
Avg = g.Min(t => t.Flow) ?? double.NaN,
|
Avg = g.Min(t => t.Flow) ?? double.NaN,
|
||||||
Max = g.Min(t => t.Flow) ?? double.NaN
|
Max = g.Min(t => t.Flow) ?? double.NaN
|
||||||
@ -170,31 +176,27 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
{
|
{
|
||||||
Id = entity.Id,
|
Id = entity.Id,
|
||||||
IdWellSectionType = entity.IdWellSectionType,
|
IdWellSectionType = entity.IdWellSectionType,
|
||||||
AxialLoad = GetMinMaxExtended(entity, drillParams.Select(x => (x.AxialLoadMin, x.AxialLoadMax))),
|
AxialLoad = GetMinMaxExtended(entity.AxialLoadAvg, entity.AxialLoadMax, entity.AxialLoadMin, drillParams.Select(x => (x.AxialLoadMin, x.AxialLoadMax))),
|
||||||
Depth = new MinMaxDto<double>
|
Depth = new MinMaxDto<double> {
|
||||||
{
|
|
||||||
Min = entity.DepthEnd,
|
Min = entity.DepthEnd,
|
||||||
Max = entity.DepthStart
|
Max = entity.DepthStart
|
||||||
},
|
},
|
||||||
Flow = GetMinMaxExtended(entity, drillParams.Select(x => (x.FlowMin, x.FlowMax))),
|
Flow = GetMinMaxExtended(entity.FlowAvg, entity.FlowMax, entity.FlowMin, drillParams.Select(x => (x.FlowMin, x.FlowMax))),
|
||||||
IdWell = entity.IdWell,
|
IdWell = entity.IdWell,
|
||||||
Pressure = GetMinMaxExtended(entity, drillParams.Select(x => (x.PressureMin, x.PressureMax))),
|
Pressure = GetMinMaxExtended(entity.PressureAvg, entity.PressureMax, entity.PressureMin, drillParams.Select(x => (x.PressureMin, x.PressureMax))),
|
||||||
RotorSpeed = GetMinMaxExtended(entity, drillParams.Select(x => (x.RotorSpeedMin, x.RotorSpeedMax))),
|
RotorSpeed = GetMinMaxExtended(entity.RotorSpeedAvg, entity.RotorSpeedMax, entity.RotorSpeedMin, drillParams.Select(x => (x.RotorSpeedMin, x.RotorSpeedMax))),
|
||||||
RotorTorque = GetMinMaxExtended(entity, drillParams.Select(x => (x.RotorTorqueMin, x.RotorTorqueMax)))
|
RotorTorque = GetMinMaxExtended(entity.RotorTorqueAvg, entity.RotorTorqueMax, entity.RotorTorqueMin, drillParams.Select(x => (x.RotorTorqueMin, x.RotorTorqueMax)))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MinMaxExtendedViewDto GetMinMaxExtended(DrillParams x, IEnumerable<(double min, double max)> allDrillParams)
|
private static MinMaxExtendedViewDto GetMinMaxExtended(double avg, double max, double min, IEnumerable<(double min, double max)> allDrillParams)
|
||||||
{
|
=> new MinMaxExtendedViewDto {
|
||||||
return new MinMaxExtendedViewDto
|
Avg = avg,
|
||||||
{
|
Max = max,
|
||||||
Avg = x.AxialLoadAvg,
|
Min = min,
|
||||||
Max = x.AxialLoadMax,
|
IsMax = allDrillParams.Any(mx => mx.max > max),
|
||||||
Min = x.AxialLoadMin,
|
IsMin = allDrillParams.Any(mn => mn.min < min)
|
||||||
IsMax = allDrillParams.Max(mx => mx.max) < x.AxialLoadMax,
|
};
|
||||||
IsMin = allDrillParams.Min(mn => mn.min) > x.AxialLoadMin
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#nullable disable
|
#nullable disable
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user