Правки - 2

This commit is contained in:
Olga Nemt 2024-02-14 11:33:35 +05:00
parent e649d1f61c
commit d5d97acb7d
3 changed files with 40 additions and 32 deletions

View File

@ -6,14 +6,9 @@
public class ProcessMapReportDataSaubStatParamsDto public class ProcessMapReportDataSaubStatParamsDto
{ {
/// <summary> /// <summary>
/// Уставка план (максимум) /// Уставка план
/// </summary> /// </summary>
public double? SetpointPlanMax { get; set; } public double? SetpointPlan { get; set; }
/// <summary>
/// Уставка план (минимум)
/// </summary>
public double? SetpointPlanMin { get; set; }
/// <summary> /// <summary>
/// Уставка факт /// Уставка факт

View File

@ -73,9 +73,16 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report
if (!dataSaubStats.Any()) if (!dataSaubStats.Any())
return Enumerable.Empty<ProcessMapReportDataSaubStatDto>(); return Enumerable.Empty<ProcessMapReportDataSaubStatDto>();
var wellOperationCategories = wellOperationRepository.GetCategories(false); var wellOperationCategories = wellOperationCategoryRepository.Get(false);
var wellSectionTypes = wellOperationRepository.GetSectionTypes();
var result = CalcByIntervals(request, processMapPlanWellDrillings, dataSaubStats, wellOperations, wellOperationCategories); var result = CalcByIntervals(
request,
processMapPlanWellDrillings,
dataSaubStats,
wellOperations,
wellOperationCategories,
wellSectionTypes);
return result; return result;
} }
@ -84,7 +91,9 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report
DataSaubStatRequest request, DataSaubStatRequest request,
IEnumerable<ProcessMapPlanDrillingDto> processMapPlanWellDrillings, IEnumerable<ProcessMapPlanDrillingDto> processMapPlanWellDrillings,
Span<DataSaubStatDto> dataSaubStats, Span<DataSaubStatDto> dataSaubStats,
IEnumerable<WellOperationDto> wellOperations IEnumerable<WellOperationDto> wellOperations,
IEnumerable<WellOperationCategoryDto> wellOperationCategories,
IEnumerable<WellSectionTypeDto> wellSectionTypes
) )
{ {
var list = new List<ProcessMapReportDataSaubStatDto>(); var list = new List<ProcessMapReportDataSaubStatDto>();
@ -98,7 +107,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report
.Where(p => p.IdWellSectionType == idWellSectionType) .Where(p => p.IdWellSectionType == idWellSectionType)
.Where(p => p.DepthStart <= data.DepthStart) .Where(p => p.DepthStart <= data.DepthStart)
.Where(p => p.DepthEnd >= data.DepthStart) .Where(p => p.DepthEnd >= data.DepthStart)
.Where(p => IsModeMatchOperationCategory(p.IdMode, data.IdCategory)) //.Where(p => IsModeMatchOperationCategory(p.IdMode, data.IdCategory))
.WhereActualAtMoment(data.DateStart) .WhereActualAtMoment(data.DateStart)
.FirstOrDefault(); .FirstOrDefault();
@ -125,7 +134,15 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report
var firstElemInSpan = span[0]; var firstElemInSpan = span[0];
var lastElemInISpan = span[^1]; var lastElemInISpan = span[^1];
var elem = CalcStat(processMapPlan, idWellSectionType, span); var wellOperationCategoryName = wellOperationCategories
.Where(c => c.Id == firstElemInSpan.IdCategory)
.FirstOrDefault()?.Name ?? string.Empty;
var wellSectionTypeName = wellSectionTypes
.Where(c => c.Id == idWellSectionType)
.FirstOrDefault()?.Caption ?? string.Empty;
var elem = CalcStat(processMapPlan, span, idWellSectionType, wellOperationCategoryName, wellSectionTypeName);
if (elem is not null) if (elem is not null)
list.Add(elem); list.Add(elem);
} }
@ -140,8 +157,10 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report
private ProcessMapReportDataSaubStatDto? CalcStat( private ProcessMapReportDataSaubStatDto? CalcStat(
ProcessMapPlanDrillingDto? processMapPlanFilteredByDepth, ProcessMapPlanDrillingDto? processMapPlanFilteredByDepth,
Span<DataSaubStatDto> span,
int idWellSectionType, int idWellSectionType,
Span<DataSaubStatDto> span string wellOperationCategoryName,
string wellSectionTypeName
) )
{ {
var firstElemInInterval = span[0]; var firstElemInInterval = span[0];
@ -155,7 +174,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report
return new ProcessMapReportDataSaubStatDto() return new ProcessMapReportDataSaubStatDto()
{ {
DateStart = firstElemInInterval.DateStart.DateTime, DateStart = firstElemInInterval.DateStart.DateTime,
WellSectionTypeName = nearestOperation.WellSectionTypeName ?? string.Empty, WellSectionTypeName = wellSectionTypeName,
DepthStart = firstElemInInterval.DepthStart, DepthStart = firstElemInInterval.DepthStart,
DepthEnd = lastElemInInterval.DepthEnd, DepthEnd = lastElemInInterval.DepthEnd,
DeltaDepth = deltaDepth, DeltaDepth = deltaDepth,
@ -163,57 +182,51 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report
DrillingMode = wellOperationCategoryName, DrillingMode = wellOperationCategoryName,
PressureDiff = new ProcessMapReportDataSaubStatParamsDto() PressureDiff = new ProcessMapReportDataSaubStatParamsDto()
{ {
SetpointPlanMax = processMapPlanFilteredByDepth?.DeltaPressurePlan, SetpointPlan = processMapPlanFilteredByDepth?.DeltaPressurePlan,
SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.DeltaPressurePlan),
SetpointFact = firstElemInInterval.PressureSp - firstElemInInterval.PressureIdle, SetpointFact = firstElemInInterval.PressureSp - firstElemInInterval.PressureIdle,
FactWavg = aggregatedValues.Pressure, FactWavg = aggregatedValues.Pressure,
Limit = processMapPlanFilteredByDepth.Max(p => p.DeltaPressureLimitMax), Limit = processMapPlanFilteredByDepth?.DeltaPressureLimitMax,
SetpointUsage = aggregatedValues.SetpointUsagePressure SetpointUsage = aggregatedValues.SetpointUsagePressure
}, },
AxialLoad = new ProcessMapReportDataSaubStatParamsDto() AxialLoad = new ProcessMapReportDataSaubStatParamsDto()
{ {
SetpointPlanMax = processMapPlanFilteredByDepth.Max(p => p.AxialLoadPlan), SetpointPlan = processMapPlanFilteredByDepth?.AxialLoadPlan,
SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.AxialLoadPlan),
SetpointFact = aggregatedValues.AxialLoadSp, SetpointFact = aggregatedValues.AxialLoadSp,
FactWavg = aggregatedValues.AxialLoad, FactWavg = aggregatedValues.AxialLoad,
Limit = processMapPlanFilteredByDepth.Max(p => p.AxialLoadLimitMax), Limit = processMapPlanFilteredByDepth?.AxialLoadLimitMax,
SetpointUsage = aggregatedValues.SetpointUsageAxialLoad SetpointUsage = aggregatedValues.SetpointUsageAxialLoad
}, },
TopDriveTorque = new ProcessMapReportDataSaubStatParamsDto() TopDriveTorque = new ProcessMapReportDataSaubStatParamsDto()
{ {
SetpointPlanMax = processMapPlanFilteredByDepth.Max(p => p.TopDriveTorquePlan), SetpointPlan = processMapPlanFilteredByDepth?.TopDriveTorquePlan,
SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.TopDriveTorquePlan),
SetpointFact = aggregatedValues.RotorTorqueSp, SetpointFact = aggregatedValues.RotorTorqueSp,
FactWavg = aggregatedValues.RotorTorque, FactWavg = aggregatedValues.RotorTorque,
FactMax = aggregatedValues.RotorTorqueMax, FactMax = aggregatedValues.RotorTorqueMax,
Limit = processMapPlanFilteredByDepth.Max(p => p.TopDriveTorqueLimitMax), Limit = processMapPlanFilteredByDepth?.TopDriveTorqueLimitMax,
SetpointUsage = aggregatedValues.SetpointUsageRotorTorque SetpointUsage = aggregatedValues.SetpointUsageRotorTorque
}, },
SpeedLimit = new ProcessMapReportDataSaubStatParamsDto SpeedLimit = new ProcessMapReportDataSaubStatParamsDto
{ {
SetpointPlanMax = processMapPlanFilteredByDepth.Max(p => p.RopPlan), SetpointPlan = processMapPlanFilteredByDepth?.RopPlan,
SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.RopPlan),
SetpointFact = aggregatedValues.BlockSpeedSp, SetpointFact = aggregatedValues.BlockSpeedSp,
FactWavg = deltaDepth / aggregatedValues.DrilledTime, FactWavg = deltaDepth / aggregatedValues.DrilledTime,
SetpointUsage = aggregatedValues.SetpointUsageRopPlan SetpointUsage = aggregatedValues.SetpointUsageRopPlan
}, },
Turnover = new ProcessMapReportDataSaubStatParamsDto Turnover = new ProcessMapReportDataSaubStatParamsDto
{ {
SetpointPlanMax = processMapPlanFilteredByDepth.Max(p => p.TopDriveSpeedPlan), SetpointPlan = processMapPlanFilteredByDepth?.TopDriveSpeedPlan,
SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.TopDriveSpeedPlan),
FactWavg = aggregatedValues.RotorSpeed, FactWavg = aggregatedValues.RotorSpeed,
FactMax = aggregatedValues.RotorSpeedMax FactMax = aggregatedValues.RotorSpeedMax
}, },
Flow = new ProcessMapReportDataSaubStatParamsDto Flow = new ProcessMapReportDataSaubStatParamsDto
{ {
SetpointPlanMax = processMapPlanFilteredByDepth.Max(p => p.FlowPlan), SetpointPlan = processMapPlanFilteredByDepth?.FlowPlan,
SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.FlowPlan),
FactWavg = aggregatedValues.MaxFlow, FactWavg = aggregatedValues.MaxFlow,
Limit = processMapPlanFilteredByDepth.Max(p => p.FlowLimitMax), Limit = processMapPlanFilteredByDepth?.FlowLimitMax,
}, },
Rop = new PlanFactDto<double?> Rop = new PlanFactDto<double?>
{ {
Plan = CalcRopPlan(processMapPlanFilteredByDepth), //Plan = CalcRopPlan(processMapPlanFilteredByDepth),
Fact = deltaDepth / aggregatedValues.DrilledTime Fact = deltaDepth / aggregatedValues.DrilledTime
}, },
}; };

View File

@ -57,7 +57,7 @@ public class ProcessMapWellDrillingController : ProcessMapBaseController<Process
/// <param name="request">параметры запроса</param> /// <param name="request">параметры запроса</param>
/// <param name="cancellationToken"></param> /// <param name="cancellationToken"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("report")] [HttpPost("report")]
[ProducesResponseType(typeof(IEnumerable<ProcessMapReportDataSaubStatDto>), StatusCodes.Status200OK)] [ProducesResponseType(typeof(IEnumerable<ProcessMapReportDataSaubStatDto>), StatusCodes.Status200OK)]
public async Task<IActionResult> GetReportAsync(int idWell, DataSaubStatRequest request, CancellationToken cancellationToken) public async Task<IActionResult> GetReportAsync(int idWell, DataSaubStatRequest request, CancellationToken cancellationToken)
{ {