forked from ddrilling/AsbCloudServer
Правки по результатам ревью
This commit is contained in:
parent
46271f2bc2
commit
9322d2874b
@ -2,7 +2,6 @@
|
||||
using AsbCloudApp.Requests;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -11,7 +10,7 @@ namespace AsbCloudApp.Repositories;
|
||||
/// <summary>
|
||||
/// Репозиторий для записей с историей
|
||||
/// </summary>
|
||||
public interface IChangeLogRepository<TEntity, TDto, TRequest>
|
||||
public interface IChangeLogRepository<TDto, TRequest>
|
||||
where TDto : IId
|
||||
{
|
||||
/// <summary>
|
||||
@ -93,7 +92,7 @@ public interface IChangeLogRepository<TEntity, TDto, TRequest>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<TDto>> GetCurrent(TRequest request, CancellationToken token);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Получение объекта, реализующего интерфейс IChangeLogRepositoryBuilder
|
||||
|
@ -86,4 +86,10 @@ public abstract class ChangeLogAbstract
|
||||
/// </summary>
|
||||
[Column("id_previous"), Comment("ИД состояния записи: \n0 - актуальная\n1 - замененная\n2 - удаленная")]
|
||||
public int? IdPrevious { get; set; }
|
||||
|
||||
[ForeignKey(nameof(IdAuthor))]
|
||||
public virtual User Author { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(IdEditor))]
|
||||
public virtual User? Editor { get; set; }
|
||||
}
|
||||
|
@ -20,12 +20,6 @@ public abstract class ProcessMapPlanBase : ChangeLogAbstract, IId, IWellRelated
|
||||
[ForeignKey(nameof(IdWell))]
|
||||
public virtual Well Well { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(IdAuthor))]
|
||||
public virtual User Author { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(IdEditor))]
|
||||
public virtual User? Editor { get; set; }
|
||||
|
||||
[ForeignKey(nameof(IdWellSectionType))]
|
||||
public virtual WellSectionType WellSectionType { get; set; } = null!;
|
||||
}
|
@ -196,11 +196,11 @@ namespace AsbCloudInfrastructure
|
||||
services.AddTransient<IDataSaubStatRepository, DataSaubStatRepository>();
|
||||
|
||||
services.AddTransient<
|
||||
IChangeLogRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell>,
|
||||
IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell>,
|
||||
ProcessMapPlanBaseRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto>>();
|
||||
|
||||
services.AddTransient<
|
||||
IChangeLogRepository<ProcessMapPlanReam, ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell>,
|
||||
IChangeLogRepository<ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell>,
|
||||
ProcessMapPlanBaseRepository<ProcessMapPlanReam, ProcessMapPlanReamDto>>();
|
||||
|
||||
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
|
||||
|
@ -3,12 +3,9 @@ using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudDb.Model;
|
||||
using iText.Signatures;
|
||||
using iText.StyledXmlParser.Jsoup.Nodes;
|
||||
using Mapster;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Npgsql;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -17,7 +14,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Repository;
|
||||
|
||||
public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : IChangeLogRepository<TEntity, TDto, TRequest>
|
||||
public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : IChangeLogRepository<TDto, TRequest>
|
||||
where TDto : AsbCloudApp.Data.IId
|
||||
where TEntity : ChangeLogAbstract
|
||||
{
|
||||
@ -38,13 +35,15 @@ public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : ICh
|
||||
ChangeLogRequest request)
|
||||
{
|
||||
this.Repository = repository;
|
||||
this.Query = repository.db.Set<TEntity>();
|
||||
this.Query = repository.db.Set<TEntity>()
|
||||
.Include(e => e.Author)
|
||||
.Include(e => e.Editor);
|
||||
|
||||
if (request.Moment.HasValue)
|
||||
{
|
||||
var momentUtc = request.Moment.Value.ToUniversalTime();
|
||||
|
||||
this.Query = this.Query
|
||||
this.Query = this.Query
|
||||
.Where(e => e.Creation <= momentUtc)
|
||||
.Where(e => e.Obsolete == null || e.Obsolete >= momentUtc);
|
||||
}
|
||||
@ -58,7 +57,7 @@ public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : ICh
|
||||
|
||||
public async Task<IEnumerable<TDto>> GetData(TimeSpan offset, CancellationToken token)
|
||||
{
|
||||
|
||||
|
||||
var dtos = await this.Query.Select(e => Repository.Convert(e, offset))
|
||||
.ToArrayAsync(token);
|
||||
return dtos;
|
||||
@ -323,7 +322,12 @@ public abstract class ChangeLogRepositoryAbstract<TEntity, TDto, TRequest> : ICh
|
||||
|
||||
protected abstract TimeSpan GetTimezoneOffset(TRequest request);
|
||||
|
||||
protected abstract IQueryable<TEntity> BuildQuery(TRequest request, IQueryable<TEntity>? query = null);
|
||||
private IQueryable<TEntity> BuildQuery(TRequest request) =>
|
||||
BuildQuery(request, db.Set<TEntity>()
|
||||
.Include(e => e.Author)
|
||||
.Include(e => e.Editor));
|
||||
|
||||
protected abstract IQueryable<TEntity> BuildQuery(TRequest request, IQueryable<TEntity> query);
|
||||
|
||||
protected virtual TEntity Convert(TDto dto)
|
||||
{
|
||||
|
@ -1,5 +0,0 @@
|
||||
namespace AsbCloudInfrastructure.Repository;
|
||||
|
||||
internal interface IChangeLogReposiroryBuilder
|
||||
{
|
||||
}
|
@ -21,18 +21,12 @@ public class ProcessMapPlanBaseRepository<TEntity, TDto> : ChangeLogRepositoryAb
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
protected override IQueryable<TEntity> BuildQuery(ProcessMapPlanBaseRequestWithWell request, IQueryable<TEntity>? query = null)
|
||||
protected override IQueryable<TEntity> BuildQuery(ProcessMapPlanBaseRequestWithWell request, IQueryable<TEntity> query)
|
||||
{
|
||||
if(query is null)
|
||||
{
|
||||
query = db.Set<TEntity>();
|
||||
}
|
||||
|
||||
query = query.Include(e => e.Author)
|
||||
.Include(e => e.Editor)
|
||||
.Include(e => e.Well)
|
||||
.Include(e => e.WellSectionType)
|
||||
.Where(e => e.IdWell == request.IdWell);
|
||||
query = query
|
||||
.Include(e => e.Well)
|
||||
.Include(e => e.WellSectionType)
|
||||
.Where(e => e.IdWell == request.IdWell);
|
||||
|
||||
if (request.UpdateFrom.HasValue)
|
||||
{
|
||||
@ -60,8 +54,6 @@ public class ProcessMapPlanBaseRepository<TEntity, TDto> : ChangeLogRepositoryAb
|
||||
protected override TEntity Convert(TDto dto)
|
||||
{
|
||||
var entity = base.Convert(dto);
|
||||
//entity.Author = null;
|
||||
//entity.Editor = null;
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ using AsbCloudApp.Data.ProcessMaps;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudDb.Model.ProcessMaps;
|
||||
using Mapster;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
@ -17,11 +16,11 @@ namespace AsbCloudInfrastructure.Repository;
|
||||
public class WellCompositeRepository : IWellCompositeRepository
|
||||
{
|
||||
private readonly IAsbCloudDbContext db;
|
||||
private readonly IChangeLogRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanDrillingRepository;
|
||||
private readonly IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanDrillingRepository;
|
||||
|
||||
public WellCompositeRepository(
|
||||
IAsbCloudDbContext db,
|
||||
IChangeLogRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanDrillingRepository)
|
||||
IAsbCloudDbContext db,
|
||||
IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanDrillingRepository)
|
||||
{
|
||||
this.db = db;
|
||||
this.processMapPlanDrillingRepository = processMapPlanDrillingRepository;
|
||||
|
@ -43,10 +43,6 @@ public class WorkOperationDetection: Work
|
||||
var telemetryId = telemetryIds[i];
|
||||
|
||||
var beginDate = lastDetectedDates.TryGetValue(telemetryId, out var date) ? date : (DateTimeOffset?)null;
|
||||
if(telemetryId == 939)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
onProgressCallback($"Start detecting telemetry: {telemetryId} from {beginDate}", i / telemetryIds.Length);
|
||||
var detectedOperations = await detectedOperationService.DetectOperationsAsync(telemetryId, beginDate, token);
|
||||
|
@ -8,16 +8,15 @@ using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Requests.ExportOptions;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model.ProcessMaps;
|
||||
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
|
||||
using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
||||
|
||||
public class ProcessMapPlanDrillingExportService : ProcessMapPlanExportService<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto>
|
||||
public class ProcessMapPlanDrillingExportService : ProcessMapPlanExportService<ProcessMapPlanDrillingDto>
|
||||
{
|
||||
public ProcessMapPlanDrillingExportService(
|
||||
IChangeLogRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IWellService wellService)
|
||||
: base(processMapPlanRepository, wellService)
|
||||
{
|
||||
|
@ -1,36 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Requests.ExportOptions;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudInfrastructure.Services.ExcelServices;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
||||
|
||||
public abstract class ProcessMapPlanExportService<TEntity, TDto> : ExportExcelService<TDto, WellRelatedExportRequest>
|
||||
where TDto : ProcessMapPlanBaseDto
|
||||
public abstract class ProcessMapPlanExportService<TDto> : ExportExcelService<TDto, WellRelatedExportRequest>
|
||||
where TDto : ProcessMapPlanBaseDto
|
||||
{
|
||||
protected readonly IWellService wellService;
|
||||
protected readonly IWellService wellService;
|
||||
|
||||
private readonly IChangeLogRepository<TEntity, TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository;
|
||||
private readonly IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository;
|
||||
|
||||
protected ProcessMapPlanExportService(IChangeLogRepository<TEntity, TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IWellService wellService)
|
||||
{
|
||||
this.processMapPlanRepository = processMapPlanRepository;
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
protected override async Task<IEnumerable<TDto>> GetDtosAsync(WellRelatedExportRequest options, CancellationToken token)
|
||||
{
|
||||
var request = new ProcessMapPlanBaseRequestWithWell(options.IdWell);
|
||||
|
||||
var dtos = await processMapPlanRepository.GetCurrent(request, token);
|
||||
return dtos;
|
||||
}
|
||||
protected ProcessMapPlanExportService(IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IWellService wellService)
|
||||
{
|
||||
this.processMapPlanRepository = processMapPlanRepository;
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
protected override async Task<IEnumerable<TDto>> GetDtosAsync(WellRelatedExportRequest options, CancellationToken token)
|
||||
{
|
||||
var request = new ProcessMapPlanBaseRequestWithWell(options.IdWell);
|
||||
|
||||
var dtos = await processMapPlanRepository.GetCurrent(request, token);
|
||||
return dtos;
|
||||
}
|
||||
}
|
@ -1,31 +1,30 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Requests.ExportOptions;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model.ProcessMaps;
|
||||
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
|
||||
using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
|
||||
|
||||
public class ProcessMapPlanReamExportService : ProcessMapPlanExportService<ProcessMapPlanReam, ProcessMapPlanReamDto>
|
||||
public class ProcessMapPlanReamExportService : ProcessMapPlanExportService<ProcessMapPlanReamDto>
|
||||
{
|
||||
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanReamTemplate();
|
||||
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanReamTemplate();
|
||||
|
||||
public ProcessMapPlanReamExportService(
|
||||
IChangeLogRepository<ProcessMapPlanReam, ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IWellService wellService)
|
||||
: base(processMapPlanRepository, wellService)
|
||||
{
|
||||
}
|
||||
|
||||
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
|
||||
{
|
||||
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
|
||||
public ProcessMapPlanReamExportService(
|
||||
IChangeLogRepository<ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
|
||||
IWellService wellService)
|
||||
: base(processMapPlanRepository, wellService)
|
||||
{
|
||||
}
|
||||
|
||||
return $"{caption}_РТК_План_проработка.xlsx";
|
||||
}
|
||||
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
|
||||
{
|
||||
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
|
||||
|
||||
return $"{caption}_РТК_План_проработка.xlsx";
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.ProcessMaps;
|
||||
using AsbCloudApp.Data.ProcessMaps.Report;
|
||||
using AsbCloudApp.Data.WellOperation;
|
||||
using AsbCloudApp.Exceptions;
|
||||
using AsbCloudApp.Extensions;
|
||||
using AsbCloudApp.Repositories;
|
||||
@ -13,21 +14,19 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudApp.Data.WellOperation;
|
||||
using AsbCloudDb.Model.ProcessMaps;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.ProcessMaps.Report;
|
||||
|
||||
public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
{
|
||||
private readonly IWellService wellService;
|
||||
private readonly IChangeLogRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanBaseRepository;
|
||||
private readonly IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanBaseRepository;
|
||||
private readonly IDataSaubStatRepository dataSaubStatRepository;
|
||||
private readonly IWellOperationRepository wellOperationRepository;
|
||||
private readonly IWellOperationCategoryRepository wellOperationCategoryRepository;
|
||||
|
||||
public ProcessMapReportDrillingService(IWellService wellService,
|
||||
IChangeLogRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanBaseRepository,
|
||||
IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanBaseRepository,
|
||||
IDataSaubStatRepository dataSaubStatRepository,
|
||||
IWellOperationRepository wellOperationRepository,
|
||||
IWellOperationCategoryRepository wellOperationCategoryRepository
|
||||
@ -86,10 +85,10 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
var wellSectionTypes = wellOperationRepository.GetSectionTypes();
|
||||
|
||||
var result = CalcByIntervals(
|
||||
request,
|
||||
changeLogProcessMaps,
|
||||
request,
|
||||
changeLogProcessMaps,
|
||||
dataSaubStats,
|
||||
orderedWellOperations,
|
||||
orderedWellOperations,
|
||||
wellOperationCategories,
|
||||
wellSectionTypes);
|
||||
|
||||
@ -116,17 +115,17 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
|
||||
int GetSection(DataSaubStatDto data)
|
||||
{
|
||||
if(lastFoundIndex < orderedWellOperations.Length - 1)
|
||||
if (lastFoundIndex < orderedWellOperations.Length - 1)
|
||||
{
|
||||
lastFoundIndex = Array.FindIndex(orderedWellOperations, lastFoundIndex, o => o.DateStart > data.DateStart) - 1;
|
||||
lastFoundIndex = lastFoundIndex < 0 ? orderedWellOperations.Length - 1 : lastFoundIndex;
|
||||
}
|
||||
|
||||
|
||||
var operation = orderedWellOperations[lastFoundIndex];
|
||||
return operation.IdWellSectionType;
|
||||
}
|
||||
}
|
||||
|
||||
ProcessMapPlanDrillingDto? GetProcessMapPlan(int idWellSectionType, DataSaubStatDto data)
|
||||
ProcessMapPlanDrillingDto? GetProcessMapPlan(int idWellSectionType, DataSaubStatDto data)
|
||||
=> changeLogProcessMaps
|
||||
.Where(p => p.Item.IdWellSectionType == idWellSectionType)
|
||||
.Where(p => p.Item.DepthStart <= data.DepthStart)
|
||||
@ -170,7 +169,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
var elem = CalcStat(processMapPlan, span, wellOperationCategoryName, wellSectionType);
|
||||
|
||||
if (elem is not null)
|
||||
list.Add(elem);
|
||||
list.Add(elem);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@ -335,7 +334,7 @@ public class ProcessMapReportDrillingService : IProcessMapReportDrillingService
|
||||
SetpointUsagePressure: sumDiffDepthByPressure * 100 / diffDepthTotal,
|
||||
SetpointUsageAxialLoad: sumDiffDepthByAxialLoad * 100 / diffDepthTotal,
|
||||
SetpointUsageRotorTorque: sumDiffDepthByRotorTorque * 100 / diffDepthTotal,
|
||||
SetpointUsageRopPlan: sumDiffDepthByRopPlan * 100/ diffDepthTotal,
|
||||
SetpointUsageRopPlan: sumDiffDepthByRopPlan * 100 / diffDepthTotal,
|
||||
DrilledTime: drilledTime
|
||||
);
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ using AsbCloudApp.IntegrationEvents.Interfaces;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model.ProcessMaps;
|
||||
using AsbCloudInfrastructure.Background;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -33,7 +32,7 @@ public class WellInfoService
|
||||
{
|
||||
var wellService = services.GetRequiredService<IWellService>();
|
||||
var operationsStatService = services.GetRequiredService<IOperationsStatService>();
|
||||
var processMapPlanWellDrillingRepository = services.GetRequiredService<IChangeLogRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell>>();
|
||||
var processMapPlanWellDrillingRepository = services.GetRequiredService<IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell>>();
|
||||
var subsystemService = services.GetRequiredService<ISubsystemService>();
|
||||
var telemetryDataSaubCache = services.GetRequiredService<ITelemetryDataCache<TelemetryDataSaubDto>>();
|
||||
var messageHub = services.GetRequiredService<IIntegrationEventHandler<UpdateWellInfoEvent>>();
|
||||
@ -98,14 +97,14 @@ public class WellInfoService
|
||||
int? idSection = wellLastFactSection?.Id;
|
||||
ProcessMapPlanDrillingDto? processMapPlanWellDrilling = null;
|
||||
|
||||
if(idSection.HasValue && currentDepth.HasValue)
|
||||
if (idSection.HasValue && currentDepth.HasValue)
|
||||
{
|
||||
processMapPlanWellDrilling = wellProcessMaps
|
||||
.Where(p => p.IdWellSectionType == idSection)
|
||||
.Where(p => p.DepthStart <= currentDepth.Value && p.DepthEnd >= currentDepth.Value)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
else if(currentDepth.HasValue)
|
||||
}
|
||||
else if (currentDepth.HasValue)
|
||||
{
|
||||
processMapPlanWellDrilling = wellProcessMaps.FirstOrDefault(p => p.DepthStart <= currentDepth.Value && p.DepthEnd >= currentDepth.Value);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace AsbCloudInfrastructure
|
||||
|
||||
var backgroundWorker = provider.GetRequiredService<PeriodicBackgroundWorker>();
|
||||
backgroundWorker.Add<WorkToDeleteOldReports>(TimeSpan.FromDays(1));
|
||||
backgroundWorker.Add<WellInfoService.WorkWellInfoUpdate>(TimeSpan.FromMinutes(0));
|
||||
backgroundWorker.Add<WellInfoService.WorkWellInfoUpdate>(TimeSpan.FromMinutes(30));
|
||||
backgroundWorker.Add<WorkOperationDetection>(TimeSpan.FromMinutes(0));
|
||||
backgroundWorker.Add<WorkDataSaubStat>(TimeSpan.FromMinutes(0));
|
||||
backgroundWorker.Add<WorkLimitingParameterCalc>(TimeSpan.FromMinutes(0));
|
||||
|
@ -5,7 +5,6 @@ using AsbCloudApp.Repositories;
|
||||
using AsbCloudApp.Requests;
|
||||
using AsbCloudApp.Services;
|
||||
using AsbCloudDb.Model;
|
||||
using AsbCloudDb.Model.ProcessMaps;
|
||||
using AsbCloudInfrastructure.Services.ProcessMaps.Report;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
@ -24,8 +23,8 @@ public class ProcessMapReportDataSaubStatServiceTest
|
||||
private IWellService wellService
|
||||
= Substitute.For<IWellService>();
|
||||
|
||||
private IChangeLogRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanBaseRepository
|
||||
= Substitute.For<IChangeLogRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell>>();
|
||||
private IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> processMapPlanBaseRepository
|
||||
= Substitute.For<IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell>>();
|
||||
|
||||
private IWellOperationRepository wellOperationRepository
|
||||
= Substitute.For<IWellOperationRepository>();
|
||||
|
@ -9,10 +9,8 @@ using AsbCloudApp.Services;
|
||||
using AsbCloudApp.Services.Export;
|
||||
using AsbCloudApp.Services.Parsers;
|
||||
using AsbCloudDb.Model.ProcessMapPlan;
|
||||
using DocumentFormat.OpenXml.Drawing;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -34,13 +32,13 @@ public abstract class ProcessMapPlanBaseController<TEntity, TDto> : ControllerBa
|
||||
where TEntity : ProcessMapPlanBase
|
||||
where TDto : ProcessMapPlanBaseDto
|
||||
{
|
||||
private readonly IChangeLogRepository<TEntity, TDto, ProcessMapPlanBaseRequestWithWell> repository;
|
||||
private readonly IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> repository;
|
||||
private readonly IWellService wellService;
|
||||
private readonly IParserService<TDto, WellRelatedParserRequest> parserService;
|
||||
private readonly ITelemetryService telemetryService;
|
||||
private readonly IExportService<WellRelatedExportRequest> processMapPlanExportService;
|
||||
|
||||
protected ProcessMapPlanBaseController(IChangeLogRepository<TEntity, TDto, ProcessMapPlanBaseRequestWithWell> repository,
|
||||
protected ProcessMapPlanBaseController(IChangeLogRepository<TDto, ProcessMapPlanBaseRequestWithWell> repository,
|
||||
IWellService wellService,
|
||||
IParserService<TDto, WellRelatedParserRequest> parserService,
|
||||
IExportService<WellRelatedExportRequest> processMapPlanExportService,
|
||||
|
@ -13,7 +13,7 @@ namespace AsbCloudWebApi.Controllers.ProcessMaps;
|
||||
/// </summary>
|
||||
public class ProcessMapPlanDrillingController : ProcessMapPlanBaseController<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto>
|
||||
{
|
||||
public ProcessMapPlanDrillingController(IChangeLogRepository<ProcessMapPlanDrilling, ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> repository,
|
||||
public ProcessMapPlanDrillingController(IChangeLogRepository<ProcessMapPlanDrillingDto, ProcessMapPlanBaseRequestWithWell> repository,
|
||||
IWellService wellService,
|
||||
ProcessMapPlanDrillingParser parserService,
|
||||
ITelemetryService telemetryService,
|
||||
|
@ -13,7 +13,7 @@ namespace AsbCloudWebApi.Controllers.ProcessMaps;
|
||||
/// </summary>
|
||||
public class ProcessMapPlanReamController : ProcessMapPlanBaseController<ProcessMapPlanReam, ProcessMapPlanReamDto>
|
||||
{
|
||||
public ProcessMapPlanReamController(IChangeLogRepository<ProcessMapPlanReam, ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell> repository,
|
||||
public ProcessMapPlanReamController(IChangeLogRepository<ProcessMapPlanReamDto, ProcessMapPlanBaseRequestWithWell> repository,
|
||||
IWellService wellService,
|
||||
ProcessMapPlanReamParser parserService,
|
||||
ITelemetryService telemetryService,
|
||||
|
@ -79,7 +79,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
var result = wellCompositeRepository.GetCompositeProcessMap(idWell, token);
|
||||
var result = await wellCompositeRepository.GetCompositeProcessMap(idWell, token).ConfigureAwait(false);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user