Проверка наличия телеметрии

1. При получении наработки, возвращается пустой список если у скважины нет телеметрии. Попутно удалил неиспользуемую зависимость
2. При получении РТК отчёт, возвращается пустой список если у скважины нет телеметрии
This commit is contained in:
Степанов Дмитрий 2023-12-25 16:16:06 +05:00
parent ebf512e3e9
commit b7bb7ef31f
2 changed files with 6 additions and 6 deletions

View File

@ -40,7 +40,7 @@ public class ProcessMapReportWellDrillingService : IProcessMapReportWellDrilling
?? throw new ArgumentInvalidException(nameof(idWell), $"Скважина с Id: {idWell} не найдена"); ?? throw new ArgumentInvalidException(nameof(idWell), $"Скважина с Id: {idWell} не найдена");
if (!well.IdTelemetry.HasValue) if (!well.IdTelemetry.HasValue)
throw new ArgumentInvalidException(nameof(idWell), $"Скважина с Id: {idWell} не имеет телеметрии"); return Enumerable.Empty<ProcessMapReportWellDrillingDto>();
var processMapPlanWellDrillings = await processMapPlanWellDrillingRepository.GetByIdWellAsync(idWell, token); var processMapPlanWellDrillings = await processMapPlanWellDrillingRepository.GetByIdWellAsync(idWell, token);

View File

@ -25,19 +25,16 @@ internal class SubsystemService : ISubsystemService
private readonly IWellService wellService; private readonly IWellService wellService;
private readonly IDetectedOperationService detectedOperationService; private readonly IDetectedOperationService detectedOperationService;
private readonly ITelemetryDataSaubService telemetryDataSaubService;
private IDictionary<int, SubsystemDto> subsystems = new Dictionary<int, SubsystemDto>(); private IDictionary<int, SubsystemDto> subsystems = new Dictionary<int, SubsystemDto>();
public SubsystemService(ICrudRepository<SubsystemDto> subsystemRepository, public SubsystemService(ICrudRepository<SubsystemDto> subsystemRepository,
IWellService wellService, IWellService wellService,
IDetectedOperationService detectedOperationService, IDetectedOperationService detectedOperationService)
ITelemetryDataSaubService telemetryDataSaubService)
{ {
this.wellService = wellService; this.wellService = wellService;
this.subsystemRepository = subsystemRepository; this.subsystemRepository = subsystemRepository;
this.detectedOperationService = detectedOperationService; this.detectedOperationService = detectedOperationService;
this.telemetryDataSaubService = telemetryDataSaubService;
} }
public async Task<IEnumerable<SubsystemStatDto>> GetStatAsync(SubsystemRequest request, CancellationToken token) public async Task<IEnumerable<SubsystemStatDto>> GetStatAsync(SubsystemRequest request, CancellationToken token)
@ -45,10 +42,13 @@ internal class SubsystemService : ISubsystemService
var well = await wellService.GetOrDefaultAsync(request.IdWell, token) var well = await wellService.GetOrDefaultAsync(request.IdWell, token)
?? throw new ArgumentInvalidException(nameof(request.IdWell), $"Well Id: {request.IdWell} does not exist"); ?? throw new ArgumentInvalidException(nameof(request.IdWell), $"Well Id: {request.IdWell} does not exist");
if(!well.IdTelemetry.HasValue)
return Enumerable.Empty<SubsystemStatDto>();
var detectedOperationSummaryRequest = new DetectedOperationRequest var detectedOperationSummaryRequest = new DetectedOperationRequest
{ {
IdWell = request.IdWell, IdWell = request.IdWell,
IdsTelemetries = new[] { well.IdTelemetry!.Value }, IdsTelemetries = new[] { well.IdTelemetry.Value },
IdsCategories = WellOperationCategory.MechanicalDrillingSubIds, IdsCategories = WellOperationCategory.MechanicalDrillingSubIds,
GeDateStart = request.GeDate, GeDateStart = request.GeDate,