forked from ddrilling/AsbCloudServer
Merge branch 'fix/create-workers' of http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer into fix/create-workers
This commit is contained in:
commit
2526fc0bb5
@ -1,5 +1,7 @@
|
||||
using AsbCloudApp.Data.SAUB;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
@ -37,6 +39,11 @@ namespace AsbCloudApp.Data
|
||||
/// Дата полседнего получения данных от станции контроля параметров цементирования (СКЦ)
|
||||
/// </summary>
|
||||
public DateTime? LastDataCpmsDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Компании
|
||||
/// </summary>
|
||||
public IEnumerable<CompanyDto> Companies { get; set; } = Enumerable.Empty<CompanyDto>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
9115
AsbCloudDb/Migrations/20231226070850_Update_Table_WellOperation_set_Categories.Designer.cs
generated
Normal file
9115
AsbCloudDb/Migrations/20231226070850_Update_Table_WellOperation_set_Categories.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,21 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class Update_Table_WellOperation_set_Categories : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql
|
||||
(@"UPDATE public.t_well_operation SET id_category=5010 WHERE id_category=4004; " +
|
||||
@"UPDATE public.t_well_operation SET id_category=5019 WHERE id_category=4007; ");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -242,7 +242,8 @@ namespace AsbCloudInfrastructure
|
||||
new CrudCacheRepositoryBase<DepositDto, Deposit>(
|
||||
s.GetRequiredService<IAsbCloudDbContext>(),
|
||||
s.GetRequiredService<IMemoryCache>(),
|
||||
dbSet => dbSet.Include(d => d.Clusters)));
|
||||
dbSet => dbSet.Include(d => d.Clusters)
|
||||
.ThenInclude(c => c.Wells)));
|
||||
services.AddTransient<ICrudRepository<CompanyDto>, CrudCacheRepositoryBase<CompanyDto, Company>>(s =>
|
||||
new CrudCacheRepositoryBase<CompanyDto, Company>(
|
||||
s.GetRequiredService<IAsbCloudDbContext>(),
|
||||
|
@ -12,6 +12,7 @@ using AsbCloudApp.Data.DetectedOperation;
|
||||
using AsbCloudInfrastructure.Services.DetectOperations.Detectors;
|
||||
using AsbCloudApp.Repositories;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
using AsbCloudApp.Exceptions;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.DetectOperations;
|
||||
|
||||
@ -57,21 +58,21 @@ public class DetectedOperationExportService
|
||||
/// <param name="host">хост</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="ArgumentInvalidException"></exception>
|
||||
public async Task<Stream> ExportAsync(int idWell, string host, CancellationToken cancellationToken)
|
||||
{
|
||||
var well = await dbContext.Wells
|
||||
var well = await dbContext.Set<Well>()
|
||||
.Include(w => w.Cluster)
|
||||
.ThenInclude(c => c.Deposit)
|
||||
.SingleOrDefaultAsync(w => w.Id == idWell, cancellationToken);
|
||||
.FirstOrDefaultAsync(w => w.Id == idWell, cancellationToken);
|
||||
|
||||
if (well is null)
|
||||
throw new ArgumentNullException(nameof(well));
|
||||
throw new ArgumentInvalidException(nameof(idWell), $"Well {idWell} does not exist");
|
||||
|
||||
if (!well.IdTelemetry.HasValue)
|
||||
throw new ArgumentNullException(nameof(well));
|
||||
throw new ArgumentInvalidException(nameof(idWell), $"Well {idWell} has no telemetry");
|
||||
|
||||
var operations = await DetectOperationsAsync(well.IdTelemetry.Value, DateTime.UnixEpoch, cancellationToken);
|
||||
var operations = await DetectOperationsAsync(well.IdTelemetry.Value, DateTime.UnixEpoch, cancellationToken);
|
||||
|
||||
return await GenerateExcelFileStreamAsync(well, host, operations, cancellationToken);
|
||||
}
|
||||
|
@ -161,14 +161,14 @@ namespace AsbCloudInfrastructure.Services.DetectOperations.Detectors
|
||||
{
|
||||
var enabledSubsystems = 0;
|
||||
|
||||
if (extraData.TryGetValue(DetectorDrilling.ExtraDataKeyHasOscillation, out var hasOscillation)
|
||||
&& hasOscillation is true)
|
||||
enabledSubsystems |= (int)EnabledSubsystemsFlags.AutoOscillation;
|
||||
|
||||
for (var i = begin; i < end; i += 2)
|
||||
{
|
||||
var mode = telemetry[i].Mode;
|
||||
|
||||
if (extraData.TryGetValue(DetectorDrilling.ExtraDataKeyHasOscillation, out var hasOscillation)
|
||||
&& hasOscillation is true)
|
||||
enabledSubsystems |= (int)EnabledSubsystemsFlags.AutoOscillation;
|
||||
|
||||
if(mode == 1)
|
||||
enabledSubsystems |= (int)EnabledSubsystemsFlags.AutoRotor;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class ProcessMapReportWellDrillingService : IProcessMapReportWellDrilling
|
||||
?? throw new ArgumentInvalidException(nameof(idWell), $"Скважина с Id: {idWell} не найдена");
|
||||
|
||||
if (!well.IdTelemetry.HasValue)
|
||||
throw new ArgumentInvalidException(nameof(idWell), $"Скважина с Id: {idWell} не имеет телеметрии");
|
||||
return Enumerable.Empty<ProcessMapReportWellDrillingDto>();
|
||||
|
||||
var processMapPlanWellDrillings = await processMapPlanWellDrillingRepository.GetByIdWellAsync(idWell, token);
|
||||
|
||||
|
Binary file not shown.
@ -39,6 +39,8 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
||||
var timezoneOffset = TimeSpan.FromHours(timezone.Hours);
|
||||
int[] modes = new int[] { 0, 1, 3 };
|
||||
|
||||
db.Database.SetCommandTimeout(TimeSpan.FromMinutes(1.5));
|
||||
|
||||
var query = db.Set<TelemetryDataSaub>()
|
||||
.Where(t => t.IdTelemetry == idTelemetry)
|
||||
.Where(t => t.BlockPosition > 0.0001)
|
||||
|
@ -25,19 +25,16 @@ internal class SubsystemService : ISubsystemService
|
||||
|
||||
private readonly IWellService wellService;
|
||||
private readonly IDetectedOperationService detectedOperationService;
|
||||
private readonly ITelemetryDataSaubService telemetryDataSaubService;
|
||||
|
||||
private IDictionary<int, SubsystemDto> subsystems = new Dictionary<int, SubsystemDto>();
|
||||
|
||||
public SubsystemService(ICrudRepository<SubsystemDto> subsystemRepository,
|
||||
IWellService wellService,
|
||||
IDetectedOperationService detectedOperationService,
|
||||
ITelemetryDataSaubService telemetryDataSaubService)
|
||||
IDetectedOperationService detectedOperationService)
|
||||
{
|
||||
this.wellService = wellService;
|
||||
this.subsystemRepository = subsystemRepository;
|
||||
this.detectedOperationService = detectedOperationService;
|
||||
this.telemetryDataSaubService = telemetryDataSaubService;
|
||||
}
|
||||
|
||||
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)
|
||||
?? 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
|
||||
{
|
||||
IdWell = request.IdWell,
|
||||
IdsTelemetries = new[] { well.IdTelemetry!.Value },
|
||||
IdsTelemetries = new[] { well.IdTelemetry.Value },
|
||||
IdsCategories = WellOperationCategory.MechanicalDrillingSubIds,
|
||||
|
||||
GeDateStart = request.GeDate,
|
||||
|
@ -97,6 +97,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
dto ??= well.Adapt<WellMapInfoWithTelemetryStat>();
|
||||
dto.Latitude ??= gCluster.Key.Latitude ?? gDeposit.Key.Latitude;
|
||||
dto.Longitude ??= gCluster.Key.Longitude ?? gDeposit.Key.Longitude;
|
||||
dto.Companies = well.RelationCompaniesWells.Select(r => Convert(r.Company));
|
||||
return dto;
|
||||
}),
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user