forked from ddrilling/AsbCloudServer
#8103063 fix
This commit is contained in:
parent
7be6173f73
commit
9410508213
@ -35,7 +35,7 @@ namespace AsbCloudApp.Repositories
|
||||
/// <param name="idWell"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<ProcessMapDto>> GetCompositeProcessMap(int idWell, CancellationToken token);
|
||||
Task<IEnumerable<ProcessMapDto>?> GetCompositeProcessMap(int idWell, CancellationToken token);
|
||||
}
|
||||
#nullable disable
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
namespace AsbCloudApp.Requests
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AsbCloudApp.Requests
|
||||
{
|
||||
#nullable enable
|
||||
/// <summary>
|
||||
@ -9,12 +11,12 @@
|
||||
/// <summary>
|
||||
/// Идентификатор скважины
|
||||
/// </summary>
|
||||
public int IdWell { get; set; }
|
||||
public IEnumerable<int> IdWells { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Тип секции
|
||||
/// </summary>
|
||||
public int? IdWellSectionType { get; set; }
|
||||
public IEnumerable<int>? IdWellSectionTypes { get; set; } = null!;
|
||||
}
|
||||
#nullable disable
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.ProcessMap;
|
||||
using AsbCloudApp.Data.ProcessMap;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -43,10 +43,10 @@ namespace AsbCloudInfrastructure.Repository
|
||||
|
||||
public async Task<IEnumerable<ProcessMapDto>?> GetByRequesProcessMaplAsync(WellCompositeRequest request, CancellationToken token)
|
||||
{
|
||||
var query = GetQuery().Where(e => e.IdWell == request.IdWell);
|
||||
if (request.IdWellSectionType is not null)
|
||||
var query = GetQuery().Where(e => request.IdWells.Contains(e.IdWell));
|
||||
if (request.IdWellSectionTypes is not null)
|
||||
{
|
||||
query.Where(e => e.IdWellSectionType == request.IdWellSectionType);
|
||||
query.Where(e => request.IdWellSectionTypes.Contains(e.IdWellSectionType));
|
||||
}
|
||||
|
||||
var entities = await query
|
||||
|
@ -51,53 +51,49 @@ namespace AsbCloudInfrastructure.Repository
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task<IEnumerable<ProcessMapDto>> GetCompositeProcessMap(int idWell, CancellationToken token)
|
||||
public async Task<IEnumerable<ProcessMapDto>?> GetCompositeProcessMap(int idWell, CancellationToken token)
|
||||
{
|
||||
var result = new List<ProcessMapDto>();
|
||||
|
||||
var dtos = await GetAsync(idWell, token);
|
||||
foreach (var dto in dtos)
|
||||
{
|
||||
var processMaps = (await processMapRepository.GetByRequesProcessMaplAsync(new WellCompositeRequest
|
||||
{
|
||||
IdWell = dto.IdWellSrc,
|
||||
IdWellSectionType = dto.IdWellSectionType
|
||||
}
|
||||
, token))?
|
||||
.Where(x => x.IdWellSectionType == dto.IdWellSectionType)
|
||||
.Select(x => new ProcessMapDto
|
||||
{
|
||||
IdWell = dto.IdWell,
|
||||
IdWellSectionType = dto.IdWellSectionType,
|
||||
RopPlan = x.RopPlan,
|
||||
DepthStart = x.DepthStart,
|
||||
DepthEnd = x.DepthEnd,
|
||||
AxialLoad = new PlanFactDto
|
||||
{
|
||||
Plan = x.AxialLoad.Fact ?? 0
|
||||
},
|
||||
Flow = new PlanFactDto
|
||||
{
|
||||
Plan = x.Flow.Fact ?? x.Flow.Plan
|
||||
},
|
||||
Pressure = new PlanFactDto
|
||||
{
|
||||
Plan = x.Pressure.Fact ?? x.Pressure.Plan
|
||||
},
|
||||
TopDriveSpeed = new PlanFactDto
|
||||
{
|
||||
Plan = x.TopDriveSpeed.Fact ?? x.TopDriveSpeed.Plan
|
||||
},
|
||||
TopDriveTorque = new PlanFactDto
|
||||
{
|
||||
Plan = x.TopDriveTorque.Fact ?? x.TopDriveTorque.Plan
|
||||
},
|
||||
LastUpdate = DateTime.UtcNow
|
||||
});
|
||||
var idWells = dtos.Select(c => c.IdWellSrc);
|
||||
var idWellSectionTypes = dtos.Select(c => c.IdWellSectionType);
|
||||
|
||||
var processMap = (await processMapRepository.GetByRequesProcessMaplAsync(new WellCompositeRequest
|
||||
{
|
||||
IdWells = idWells,
|
||||
IdWellSectionTypes = idWellSectionTypes
|
||||
},
|
||||
token));
|
||||
|
||||
var result = processMap?.Select(x => new ProcessMapDto
|
||||
{
|
||||
IdWell = x.IdWell,
|
||||
IdWellSectionType = x.IdWellSectionType,
|
||||
RopPlan = x.RopPlan,
|
||||
DepthStart = x.DepthStart,
|
||||
DepthEnd = x.DepthEnd,
|
||||
AxialLoad = new PlanFactDto
|
||||
{
|
||||
Plan = x.AxialLoad.Fact ?? x.AxialLoad.Plan,
|
||||
},
|
||||
Flow = new PlanFactDto
|
||||
{
|
||||
Plan = x.Flow.Fact ?? x.Flow.Plan
|
||||
},
|
||||
Pressure = new PlanFactDto
|
||||
{
|
||||
Plan = x.Pressure.Fact ?? x.Pressure.Plan
|
||||
},
|
||||
TopDriveSpeed = new PlanFactDto
|
||||
{
|
||||
Plan = x.TopDriveSpeed.Fact ?? x.TopDriveSpeed.Plan
|
||||
},
|
||||
TopDriveTorque = new PlanFactDto
|
||||
{
|
||||
Plan = x.TopDriveTorque.Fact ?? x.TopDriveTorque.Plan
|
||||
},
|
||||
LastUpdate = DateTime.UtcNow
|
||||
});
|
||||
|
||||
if (processMaps is not null)
|
||||
result.AddRange(processMaps);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
||||
private readonly ITelemetryDataSaubService telemetryDataSaubService;
|
||||
private readonly ILimitingParameterRepository limitingParameterRepository;
|
||||
private readonly ISubsystemOperationTimeService subsystemOperationTimeService;
|
||||
private readonly IWellCompositeRepository wellCompositeRepository;
|
||||
|
||||
public ProcessMapService(
|
||||
IWellService wellService,
|
||||
@ -34,8 +33,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
||||
IProcessMapRepository processMapRepository,
|
||||
ITelemetryDataSaubService telemetryDataSaubService,
|
||||
ILimitingParameterRepository limitingParameterRepository,
|
||||
ISubsystemOperationTimeService subsystemOperationTimeService,
|
||||
IWellCompositeRepository wellCompositeRepository)
|
||||
ISubsystemOperationTimeService subsystemOperationTimeService)
|
||||
{
|
||||
this.wellService = wellService;
|
||||
this.wellOperationRepository = wellOperationService;
|
||||
@ -43,7 +41,6 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
||||
this.telemetryDataSaubService = telemetryDataSaubService;
|
||||
this.limitingParameterRepository = limitingParameterRepository;
|
||||
this.subsystemOperationTimeService = subsystemOperationTimeService;
|
||||
this.wellCompositeRepository = wellCompositeRepository;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
Loading…
Reference in New Issue
Block a user