forked from ddrilling/AsbCloudServer
#8103063 Подтягивание режимов при формировании композитной скважины
This commit is contained in:
parent
d8b131622f
commit
ccbc499754
@ -1,4 +1,5 @@
|
|||||||
using AsbCloudApp.Data.ProcessMap;
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Data.ProcessMap;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -19,6 +20,14 @@ namespace AsbCloudApp.Services
|
|||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<ProcessMapReportDto>> GetProcessMapAsync(int idWell, CancellationToken token);
|
Task<IEnumerable<ProcessMapReportDto>> GetProcessMapAsync(int idWell, CancellationToken token);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Получение РТК по композитной скважине
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dtos"></param>
|
||||||
|
/// <param name="token"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<ProcessMapDto>> GetCompositeData(int idWell, CancellationToken token);
|
||||||
}
|
}
|
||||||
#nullable disable
|
#nullable disable
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
|||||||
private readonly ITelemetryDataSaubService telemetryDataSaubService;
|
private readonly ITelemetryDataSaubService telemetryDataSaubService;
|
||||||
private readonly ILimitingParameterRepository limitingParameterRepository;
|
private readonly ILimitingParameterRepository limitingParameterRepository;
|
||||||
private readonly ISubsystemOperationTimeService subsystemOperationTimeService;
|
private readonly ISubsystemOperationTimeService subsystemOperationTimeService;
|
||||||
|
private readonly IWellCompositeRepository wellCompositeRepository;
|
||||||
|
|
||||||
public ProcessMapService(
|
public ProcessMapService(
|
||||||
IWellService wellService,
|
IWellService wellService,
|
||||||
@ -33,7 +34,8 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
|||||||
IProcessMapRepository processMapRepository,
|
IProcessMapRepository processMapRepository,
|
||||||
ITelemetryDataSaubService telemetryDataSaubService,
|
ITelemetryDataSaubService telemetryDataSaubService,
|
||||||
ILimitingParameterRepository limitingParameterRepository,
|
ILimitingParameterRepository limitingParameterRepository,
|
||||||
ISubsystemOperationTimeService subsystemOperationTimeService)
|
ISubsystemOperationTimeService subsystemOperationTimeService,
|
||||||
|
IWellCompositeRepository wellCompositeRepository)
|
||||||
{
|
{
|
||||||
this.wellService = wellService;
|
this.wellService = wellService;
|
||||||
this.wellOperationRepository = wellOperationService;
|
this.wellOperationRepository = wellOperationService;
|
||||||
@ -41,6 +43,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
|||||||
this.telemetryDataSaubService = telemetryDataSaubService;
|
this.telemetryDataSaubService = telemetryDataSaubService;
|
||||||
this.limitingParameterRepository = limitingParameterRepository;
|
this.limitingParameterRepository = limitingParameterRepository;
|
||||||
this.subsystemOperationTimeService = subsystemOperationTimeService;
|
this.subsystemOperationTimeService = subsystemOperationTimeService;
|
||||||
|
this.wellCompositeRepository = wellCompositeRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<ProcessMapReportDto>> GetProcessMapAsync(int idWell, CancellationToken token)
|
public async Task<IEnumerable<ProcessMapReportDto>> GetProcessMapAsync(int idWell, CancellationToken token)
|
||||||
@ -68,6 +71,48 @@ namespace AsbCloudInfrastructure.Services.ProcessMap
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<ProcessMapDto>> GetCompositeData(int idWell, CancellationToken token)
|
||||||
|
{
|
||||||
|
var result = new List<ProcessMapDto>();
|
||||||
|
|
||||||
|
var dtos = await wellCompositeRepository.GetAsync(idWell, token);
|
||||||
|
foreach (var dto in dtos)
|
||||||
|
{
|
||||||
|
var processMaps = (await processMapRepository.GetByIdWellAsync(dto.IdWellSrc, 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 ?? 0
|
||||||
|
},
|
||||||
|
Pressure = new PlanFactDto
|
||||||
|
{
|
||||||
|
Plan = x.Pressure.Fact ?? 0
|
||||||
|
},
|
||||||
|
TopDriveSpeed = new PlanFactDto
|
||||||
|
{
|
||||||
|
Plan = x.TopDriveSpeed.Fact ?? 0
|
||||||
|
},
|
||||||
|
TopDriveTorque = new PlanFactDto
|
||||||
|
{
|
||||||
|
Plan = x.TopDriveTorque.Fact ?? 0
|
||||||
|
},
|
||||||
|
LastUpdate = DateTime.UtcNow
|
||||||
|
});
|
||||||
|
result.AddRange(processMaps);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private Task<IEnumerable<SubsystemOperationTimeDto>?> GetOperationTimeAsync(int idWell, CancellationToken token)
|
private Task<IEnumerable<SubsystemOperationTimeDto>?> GetOperationTimeAsync(int idWell, CancellationToken token)
|
||||||
{
|
{
|
||||||
var request = new SubsystemOperationTimeRequest
|
var request = new SubsystemOperationTimeRequest
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using AsbCloudApp.Data;
|
using AsbCloudApp.Data;
|
||||||
|
using AsbCloudApp.Data.ProcessMap;
|
||||||
using AsbCloudApp.Repositories;
|
using AsbCloudApp.Repositories;
|
||||||
using AsbCloudApp.Services;
|
using AsbCloudApp.Services;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@ -20,11 +21,15 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
{
|
{
|
||||||
private readonly IWellCompositeRepository wellCompositeRepository;
|
private readonly IWellCompositeRepository wellCompositeRepository;
|
||||||
private readonly IWellService wellService;
|
private readonly IWellService wellService;
|
||||||
|
private readonly IProcessMapService processMapService;
|
||||||
|
|
||||||
public WellCompositeController(IWellCompositeRepository wellCompositeRepository, IWellService wellService)
|
public WellCompositeController(IWellCompositeRepository wellCompositeRepository,
|
||||||
|
IWellService wellService,
|
||||||
|
IProcessMapService processMapService)
|
||||||
{
|
{
|
||||||
this.wellCompositeRepository = wellCompositeRepository;
|
this.wellCompositeRepository = wellCompositeRepository;
|
||||||
this.wellService = wellService;
|
this.wellService = wellService;
|
||||||
|
this.processMapService = processMapService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -63,6 +68,15 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("getCompositeData")]
|
||||||
|
[Permission]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<ProcessMapDto>), (int)System.Net.HttpStatusCode.OK)]
|
||||||
|
public async Task<IActionResult> GetCompositeData(int idWell, CancellationToken token = default)
|
||||||
|
{
|
||||||
|
var result = await processMapService.GetCompositeData(idWell, token).ConfigureAwait(false);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
|
private async Task<bool> CanUserAccessToWellAsync(int idWell, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
int? idCompany = User.GetCompanyId();
|
int? idCompany = User.GetCompanyId();
|
||||||
|
Loading…
Reference in New Issue
Block a user