diff --git a/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportDataSaubStatParamsDto.cs b/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportDataSaubStatParamsDto.cs index 2029b805..1ed34027 100644 --- a/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportDataSaubStatParamsDto.cs +++ b/AsbCloudApp/Data/ProcessMaps/Report/ProcessMapReportDataSaubStatParamsDto.cs @@ -6,14 +6,9 @@ public class ProcessMapReportDataSaubStatParamsDto { /// - /// Уставка план (максимум) + /// Уставка план /// - public double? SetpointPlanMax { get; set; } - - /// - /// Уставка план (минимум) - /// - public double? SetpointPlanMin { get; set; } + public double? SetpointPlan { get; set; } /// /// Уставка факт diff --git a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDataSaubStatService.cs b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDataSaubStatService.cs index 2f26c594..cc958a01 100644 --- a/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDataSaubStatService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMaps/Report/ProcessMapReportDataSaubStatService.cs @@ -73,9 +73,16 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report if (!dataSaubStats.Any()) return Enumerable.Empty(); - 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; } @@ -84,7 +91,9 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report DataSaubStatRequest request, IEnumerable processMapPlanWellDrillings, Span dataSaubStats, - IEnumerable wellOperations + IEnumerable wellOperations, + IEnumerable wellOperationCategories, + IEnumerable wellSectionTypes ) { var list = new List(); @@ -98,7 +107,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report .Where(p => p.IdWellSectionType == idWellSectionType) .Where(p => p.DepthStart <= 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) .FirstOrDefault(); @@ -125,7 +134,15 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report var firstElemInSpan = span[0]; 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) list.Add(elem); } @@ -140,8 +157,10 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report private ProcessMapReportDataSaubStatDto? CalcStat( ProcessMapPlanDrillingDto? processMapPlanFilteredByDepth, + Span span, int idWellSectionType, - Span span + string wellOperationCategoryName, + string wellSectionTypeName ) { var firstElemInInterval = span[0]; @@ -155,7 +174,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report return new ProcessMapReportDataSaubStatDto() { DateStart = firstElemInInterval.DateStart.DateTime, - WellSectionTypeName = nearestOperation.WellSectionTypeName ?? string.Empty, + WellSectionTypeName = wellSectionTypeName, DepthStart = firstElemInInterval.DepthStart, DepthEnd = lastElemInInterval.DepthEnd, DeltaDepth = deltaDepth, @@ -163,57 +182,51 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report DrillingMode = wellOperationCategoryName, PressureDiff = new ProcessMapReportDataSaubStatParamsDto() { - SetpointPlanMax = processMapPlanFilteredByDepth?.DeltaPressurePlan, - SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.DeltaPressurePlan), + SetpointPlan = processMapPlanFilteredByDepth?.DeltaPressurePlan, SetpointFact = firstElemInInterval.PressureSp - firstElemInInterval.PressureIdle, FactWavg = aggregatedValues.Pressure, - Limit = processMapPlanFilteredByDepth.Max(p => p.DeltaPressureLimitMax), + Limit = processMapPlanFilteredByDepth?.DeltaPressureLimitMax, SetpointUsage = aggregatedValues.SetpointUsagePressure }, AxialLoad = new ProcessMapReportDataSaubStatParamsDto() { - SetpointPlanMax = processMapPlanFilteredByDepth.Max(p => p.AxialLoadPlan), - SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.AxialLoadPlan), + SetpointPlan = processMapPlanFilteredByDepth?.AxialLoadPlan, SetpointFact = aggregatedValues.AxialLoadSp, FactWavg = aggregatedValues.AxialLoad, - Limit = processMapPlanFilteredByDepth.Max(p => p.AxialLoadLimitMax), + Limit = processMapPlanFilteredByDepth?.AxialLoadLimitMax, SetpointUsage = aggregatedValues.SetpointUsageAxialLoad }, TopDriveTorque = new ProcessMapReportDataSaubStatParamsDto() { - SetpointPlanMax = processMapPlanFilteredByDepth.Max(p => p.TopDriveTorquePlan), - SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.TopDriveTorquePlan), + SetpointPlan = processMapPlanFilteredByDepth?.TopDriveTorquePlan, SetpointFact = aggregatedValues.RotorTorqueSp, FactWavg = aggregatedValues.RotorTorque, FactMax = aggregatedValues.RotorTorqueMax, - Limit = processMapPlanFilteredByDepth.Max(p => p.TopDriveTorqueLimitMax), + Limit = processMapPlanFilteredByDepth?.TopDriveTorqueLimitMax, SetpointUsage = aggregatedValues.SetpointUsageRotorTorque }, SpeedLimit = new ProcessMapReportDataSaubStatParamsDto { - SetpointPlanMax = processMapPlanFilteredByDepth.Max(p => p.RopPlan), - SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.RopPlan), + SetpointPlan = processMapPlanFilteredByDepth?.RopPlan, SetpointFact = aggregatedValues.BlockSpeedSp, FactWavg = deltaDepth / aggregatedValues.DrilledTime, SetpointUsage = aggregatedValues.SetpointUsageRopPlan }, Turnover = new ProcessMapReportDataSaubStatParamsDto { - SetpointPlanMax = processMapPlanFilteredByDepth.Max(p => p.TopDriveSpeedPlan), - SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.TopDriveSpeedPlan), + SetpointPlan = processMapPlanFilteredByDepth?.TopDriveSpeedPlan, FactWavg = aggregatedValues.RotorSpeed, FactMax = aggregatedValues.RotorSpeedMax }, Flow = new ProcessMapReportDataSaubStatParamsDto { - SetpointPlanMax = processMapPlanFilteredByDepth.Max(p => p.FlowPlan), - SetpointPlanMin = processMapPlanFilteredByDepth.Min(p => p.FlowPlan), + SetpointPlan = processMapPlanFilteredByDepth?.FlowPlan, FactWavg = aggregatedValues.MaxFlow, - Limit = processMapPlanFilteredByDepth.Max(p => p.FlowLimitMax), + Limit = processMapPlanFilteredByDepth?.FlowLimitMax, }, Rop = new PlanFactDto { - Plan = CalcRopPlan(processMapPlanFilteredByDepth), + //Plan = CalcRopPlan(processMapPlanFilteredByDepth), Fact = deltaDepth / aggregatedValues.DrilledTime }, }; diff --git a/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapWellDrillingController.cs b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapWellDrillingController.cs index 94f99db6..857e4a68 100644 --- a/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapWellDrillingController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapWellDrillingController.cs @@ -57,7 +57,7 @@ public class ProcessMapWellDrillingController : ProcessMapBaseControllerпараметры запроса /// /// - [HttpGet("report")] + [HttpPost("report")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] public async Task GetReportAsync(int idWell, DataSaubStatRequest request, CancellationToken cancellationToken) {