РТК план противоаварийное обсуживание

This commit is contained in:
Olga Nemt 2024-06-26 17:09:30 +05:00
parent fc3566a60b
commit bdf8d114bb
9 changed files with 223 additions and 0 deletions

View File

@ -0,0 +1,51 @@
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план осцилляция
/// </summary>
public class ProcessMapPlanFunctionsOscillationDto : ProcessMapPlanBaseDto
{
/// <summary>
/// Оптимальный угол осцилляции, градусы
/// </summary>
[Range(0.0, 6000.0)]
public double OptimalOscillationAngle { get; set; }
/// <summary>
/// Скорость вправо, об/мин
/// </summary>
[Range(0.0, 270.0)]
public double RPMRight { get; set; }
/// <summary>
/// Скорость влево, об/мин
/// </summary>
[Range(0.0, 270.0)]
public double RPMLeft { get; set; }
/// <summary>
/// Ограничение момента вправо, кН*м
/// </summary>
[Range(0.0, 35.0)]
public double TorqueLimitRight { get; set; }
/// <summary>
/// Ограничение момента влево, кН*м
/// </summary>
[Range(0.0, 35.0)]
public double TorqueLimitLeft { get; set; }
/// <summary>
/// Режим Авто/Руч
/// </summary>
[Required]
public double Mode { get; set; }
/// <summary>
/// Примечание
/// </summary>
[StringLength(1024)]
public string Note { get; set; } = string.Empty;
}

View File

@ -38,6 +38,8 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanFunctionsJarrDrillTool> ProcessMapPlanFunctionsJarrDrillTool => Set<ProcessMapPlanFunctionsJarrDrillTool>();
public virtual DbSet<ProcessMapPlanFunctionsUpgradeNoload> ProcessMapPlanFunctionsUpgradeNoload => Set<ProcessMapPlanFunctionsUpgradeNoload>();
public virtual DbSet<ProcessMapPlanFunctionsOscillation> ProcessMapPlanFunctionsOscillation => Set<ProcessMapPlanFunctionsOscillation>();
public virtual DbSet<ProcessMapPlanFunctionsAnticrashRotation> ProcessMapPlanFunctionsAnticrashRotation => Set<ProcessMapPlanFunctionsAnticrashRotation>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
@ -550,6 +552,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsAnticrashRotation>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -640,6 +647,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsAnticrashRotation>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

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

View File

@ -0,0 +1,28 @@
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_anticrash_rotation"), Comment("Противоаварийное вращение")]
public class ProcessMapPlanFunctionsAnticrashRotation : ProcessMapPlanBase
{
[Column("min_RPM"), Comment("Минимальные обороты ВСП, об/мин")]
[Range(0.0, 250.0)]
[Required]
public double MinRPM { get; set; }
[Column("min_consumption_starting_flow_rate"), Comment("Минимальный расход для запуска оборотов ВСП, л/сек")]
[Range(1.0, 100.0)]
[Required]
public double MinСonsumptionStartingFlowRate { get; set; }
[Column("top_drive_torque_limit_max"), Comment("Максимально допустимый момент на ВСП при противоаварийном вращении, кН*м")]
[Range(1.0, 35.0)]
[Required]
public double TopDriveTorqueLimitMax { get; set; }
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanFunctionsAnticrashRotation? Previous { get; set; }
}

View File

@ -257,6 +257,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanFunctionsOscillationDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanFunctionsAnticrashRotationDto>>.NewConfig()
.Include<ProcessMapPlanFunctionsAnticrashRotation, ChangeLogDto<ProcessMapPlanFunctionsAnticrashRotationDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanFunctionsAnticrashRotationDto>()
{
Item = src.Adapt<ProcessMapPlanFunctionsAnticrashRotationDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -390,6 +397,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanFunctionsOscillationDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsOscillation, ProcessMapPlanFunctionsOscillationDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanFunctionsAnticrashRotationDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsAnticrashRotation, ProcessMapPlanFunctionsAnticrashRotationDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -453,6 +464,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsJarrDrillToolDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsUpgradeNoloadDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsOscillationDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsAnticrashRotationDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -525,6 +537,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsJarrDrillToolParser>();
services.AddTransient<ProcessMapPlanFunctionsUpgradeNoloadParser>();
services.AddTransient<ProcessMapPlanFunctionsOscillationParser>();
services.AddTransient<ProcessMapPlanFunctionsAnticrashRotationParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -549,6 +562,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsJarrDrillToolExportService>();
services.AddTransient<ProcessMapPlanFunctionsUpgradeNoloadExportService>();
services.AddTransient<ProcessMapPlanFunctionsOscillationExportService>();
services.AddTransient<ProcessMapPlanFunctionsAnticrashRotationExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
public class ProcessMapPlanFunctionsAnticrashRotationTemplate : ITemplateParameters
{
public string SheetName => "Противоаварийное вращение";
public int HeaderRowsCount => 2;
public string FileName => "ProcessMapPlanFunctionsAnticrashRotationTemplate.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 ProcessMapPlanFunctionsAnticrashRotationExportService : ProcessMapPlanExportService<ProcessMapPlanFunctionsAnticrashRotationDto>
{
public ProcessMapPlanFunctionsAnticrashRotationExportService(
IChangeLogRepository<ProcessMapPlanFunctionsAnticrashRotationDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
IWellService wellService)
: base(processMapPlanRepository, wellService)
{
}
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanFunctionsAnticrashRotationTemplate();
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 ProcessMapPlanFunctionsAnticrashRotationParser : ProcessMapPlanParser<ProcessMapPlanFunctionsAnticrashRotationDto>
{
public ProcessMapPlanFunctionsAnticrashRotationParser(IWellOperationRepository wellOperationRepository)
: base(wellOperationRepository)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanFunctionsAnticrashRotationTemplate();
protected override ProcessMapPlanFunctionsAnticrashRotationDto 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 ProcessMapPlanFunctionsAnticrashRotationController :
ProcessMapPlanBaseController<ProcessMapPlanFunctionsAnticrashRotation, ProcessMapPlanFunctionsAnticrashRotationDto>
{
public ProcessMapPlanFunctionsAnticrashRotationController(
IChangeLogRepository<ProcessMapPlanFunctionsAnticrashRotationDto, ProcessMapPlanBaseRequestWithWell> repository,
IWellService wellService,
ProcessMapPlanFunctionsAnticrashRotationParser parserService,
ITelemetryService telemetryService,
ProcessMapPlanFunctionsAnticrashRotationExportService processMapPlanExportService)
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
{
}
protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_противоаварийноеращение.xlsx";
}