РТК план выход статического замера

This commit is contained in:
Olga Nemt 2024-06-26 17:48:15 +05:00
parent bdf8d114bb
commit f9b1884a39
10 changed files with 205 additions and 0 deletions

View File

@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план противоаварийное вращение
/// </summary>
public class ProcessMapPlanFunctionsAnticrashRotationDto : ProcessMapPlanBaseDto
{
/// <summary>
/// Минимальные обороты ВСП, об/мин
/// </summary>
[Range(0.0, 250.0)]
public double MinRPM { get; set; }
/// <summary>
/// Минимальный расход для запуска оборотов ВСП, л/сек
/// </summary>
[Range(1.0, 100.0)]
public double MinСonsumptionStartingFlowRate { get; set; }
/// <summary>
/// Максимально допустимый момент на ВСП при противоаварийном вращении, кН*м
/// </summary>
[Range(1.0, 35.0)]
public double TopDriveTorqueLimitMax { get; set; }
}

View File

@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план выход статического замера
/// </summary>
public class ProcessMapPlanFunctionsStaticMeasureDto : ProcessMapPlanBaseDto
{
/// <summary>
/// Время ожидания выхода сигнала с ТМС, сек.
/// </summary>
[Range(0.0, 1800.0)]
public double SignalWaitingTime { get; set; }
}

View File

@ -39,6 +39,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanFunctionsUpgradeNoload> ProcessMapPlanFunctionsUpgradeNoload => Set<ProcessMapPlanFunctionsUpgradeNoload>();
public virtual DbSet<ProcessMapPlanFunctionsOscillation> ProcessMapPlanFunctionsOscillation => Set<ProcessMapPlanFunctionsOscillation>();
public virtual DbSet<ProcessMapPlanFunctionsAnticrashRotation> ProcessMapPlanFunctionsAnticrashRotation => Set<ProcessMapPlanFunctionsAnticrashRotation>();
public virtual DbSet<ProcessMapPlanFunctionsStaticMeasure> ProcessMapPlanFunctionsStaticMeasure => Set<ProcessMapPlanFunctionsStaticMeasure>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
@ -557,6 +558,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsStaticMeasure>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -652,6 +658,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsStaticMeasure>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

@ -100,6 +100,7 @@ namespace AsbCloudDb.Model
DbSet<ProcessMapPlanFunctionsUpgradeNoload> ProcessMapPlanFunctionsUpgradeNoload { get; }
DbSet<ProcessMapPlanFunctionsOscillation> ProcessMapPlanFunctionsOscillation { get; }
DbSet<ProcessMapPlanFunctionsAnticrashRotation> ProcessMapPlanFunctionsAnticrashRotation { get; }
DbSet<ProcessMapPlanFunctionsStaticMeasure> ProcessMapPlanFunctionsStaticMeasure { get; }
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);
Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token) where TEntity : class;

View File

@ -0,0 +1,18 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using AsbCloudDb.Model.ProcessMapPlan;
using Microsoft.EntityFrameworkCore;
namespace AsbCloudDb.Model.ProcessMaps;
[Table("t_process_map_plan_functions_static_measure"), Comment("Выход статического замера")]
public class ProcessMapPlanFunctionsStaticMeasure : ProcessMapPlanBase
{
[Column("signal_waiting_time"), Comment("Время ожидания выхода сигнала с ТМС, сек.")]
[Range(0.0, 1800.0)]
[Required]
public double SignalWaitingTime { get; set; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanFunctionsStaticMeasure? Previous { get; set; }
}

View File

@ -264,6 +264,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanFunctionsAnticrashRotationDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanFunctionsStaticMeasureDto>>.NewConfig()
.Include<ProcessMapPlanFunctionsStaticMeasure, ChangeLogDto<ProcessMapPlanFunctionsStaticMeasureDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanFunctionsStaticMeasureDto>()
{
Item = src.Adapt<ProcessMapPlanFunctionsStaticMeasureDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -401,6 +408,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanFunctionsAnticrashRotationDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsAnticrashRotation, ProcessMapPlanFunctionsAnticrashRotationDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanFunctionsStaticMeasureDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsStaticMeasure, ProcessMapPlanFunctionsStaticMeasureDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -465,6 +476,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsUpgradeNoloadDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsOscillationDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsAnticrashRotationDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsStaticMeasureDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -538,6 +550,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsUpgradeNoloadParser>();
services.AddTransient<ProcessMapPlanFunctionsOscillationParser>();
services.AddTransient<ProcessMapPlanFunctionsAnticrashRotationParser>();
services.AddTransient<ProcessMapPlanFunctionsStaticMeasureParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -563,6 +576,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsUpgradeNoloadExportService>();
services.AddTransient<ProcessMapPlanFunctionsOscillationExportService>();
services.AddTransient<ProcessMapPlanFunctionsAnticrashRotationExportService>();
services.AddTransient<ProcessMapPlanFunctionsStaticMeasureExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
public class ProcessMapPlanFunctionsStaticMeasureTemplate : ITemplateParameters
{
public string SheetName => "Выход статического замера";
public int HeaderRowsCount => 2;
public string FileName => "ProcessMapPlanFunctionsStaticMeasureTemplate.xlsx";
public IDictionary<string, Cell> Cells => new Dictionary<string, Cell>
{
};
}

View File

@ -0,0 +1,30 @@
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Requests.ExportOptions;
using AsbCloudApp.Services;
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 ProcessMapPlanFunctionsStaticMeasureExportService : ProcessMapPlanExportService<ProcessMapPlanFunctionsStaticMeasureDto>
{
public ProcessMapPlanFunctionsStaticMeasureExportService(
IChangeLogRepository<ProcessMapPlanFunctionsStaticMeasureDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
IWellService wellService)
: base(processMapPlanRepository, wellService)
{
}
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanFunctionsStaticMeasureTemplate();
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
{
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
return $"{caption}_РТК_План_выход_статическогоамера.xlsx";
}
}

View File

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories;
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
public class ProcessMapPlanFunctionsStaticMeasureParser : ProcessMapPlanParser<ProcessMapPlanFunctionsStaticMeasureDto>
{
public ProcessMapPlanFunctionsStaticMeasureParser(IWellOperationRepository wellOperationRepository)
: base(wellOperationRepository)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanFunctionsStaticMeasureTemplate();
protected override ProcessMapPlanFunctionsStaticMeasureDto BuildDto(IDictionary<string, object?> row, int rowNumber)
{
var dto = base.BuildDto(row, rowNumber);
var section = sections.FirstOrDefault(s =>
string.Equals(s.Caption.Trim(), dto.Section?.Trim(), StringComparison.CurrentCultureIgnoreCase));
if (section is null)
{
var message = string.Format(XLExtentions.ProblemDetailsTemplate,
TemplateParameters.SheetName,
rowNumber,
TemplateParameters.Cells[nameof(ProcessMapPlanBaseDto.Section)],
"Указана некорректная секция");
throw new FileFormatException(message);
}
dto.IdWellSectionType = section.Id;
return dto;
}
}

View File

@ -0,0 +1,28 @@
using AsbCloudApp.Data.ProcessMaps;
using AsbCloudApp.Repositories;
using AsbCloudApp.Requests;
using AsbCloudApp.Services;
using AsbCloudDb.Model.ProcessMaps;
using AsbCloudInfrastructure.Services.ProcessMapPlan.Export;
using AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
namespace AsbCloudWebApi.Controllers.ProcessMaps;
/// <summary>
/// РТК план выход статического замера
/// </summary>
public class ProcessMapPlanFunctionsStaticMeasureController :
ProcessMapPlanBaseController<ProcessMapPlanFunctionsStaticMeasure, ProcessMapPlanFunctionsStaticMeasureDto>
{
public ProcessMapPlanFunctionsStaticMeasureController(
IChangeLogRepository<ProcessMapPlanFunctionsStaticMeasureDto, ProcessMapPlanBaseRequestWithWell> repository,
IWellService wellService,
ProcessMapPlanFunctionsStaticMeasureParser parserService,
ITelemetryService telemetryService,
ProcessMapPlanFunctionsStaticMeasureExportService processMapPlanExportService)
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
{
}
protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_выход_статическогоамера.xlsx";
}