diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanFunctionsOscillationDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanFunctionsOscillationDto.cs
new file mode 100644
index 00000000..baf0c56a
--- /dev/null
+++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanFunctionsOscillationDto.cs
@@ -0,0 +1,51 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace AsbCloudApp.Data.ProcessMaps;
+
+///
+/// РТК план осцилляция
+///
+public class ProcessMapPlanFunctionsOscillationDto : ProcessMapPlanBaseDto
+{
+ ///
+ /// Оптимальный угол осцилляции, градусы
+ ///
+ [Range(0.0, 6000.0)]
+ public double OptimalOscillationAngle { get; set; }
+
+ ///
+ /// Скорость вправо, об/мин
+ ///
+ [Range(0.0, 270.0)]
+ public double RPMRight { get; set; }
+
+ ///
+ /// Скорость влево, об/мин
+ ///
+ [Range(0.0, 270.0)]
+ public double RPMLeft { get; set; }
+
+ ///
+ /// Ограничение момента вправо, кН*м
+ ///
+ [Range(0.0, 35.0)]
+ public double TorqueLimitRight { get; set; }
+
+ ///
+ /// Ограничение момента влево, кН*м
+ ///
+ [Range(0.0, 35.0)]
+ public double TorqueLimitLeft { get; set; }
+
+ ///
+ /// Режим Авто/Руч
+ ///
+ [Required]
+ public double Mode { get; set; }
+
+ ///
+ /// Примечание
+ ///
+ [StringLength(1024)]
+ public string Note { get; set; } = string.Empty;
+}
\ No newline at end of file
diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs
index 54e9acba..7ffece5e 100644
--- a/AsbCloudDb/Model/AsbCloudDbContext.cs
+++ b/AsbCloudDb/Model/AsbCloudDbContext.cs
@@ -38,6 +38,8 @@ namespace AsbCloudDb.Model
public virtual DbSet ProcessMapPlanFunctionsJarrDrillTool => Set();
public virtual DbSet ProcessMapPlanFunctionsUpgradeNoload => Set();
public virtual DbSet ProcessMapPlanFunctionsOscillation => Set();
+ public virtual DbSet ProcessMapPlanFunctionsAnticrashRotation => Set();
+
public virtual DbSet DrillingProgramParts => Set();
public virtual DbSet FileCategories => Set();
public virtual DbSet Files => Set();
@@ -550,6 +552,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
+ modelBuilder.Entity()
+ .HasOne(p => p.Author)
+ .WithMany()
+ .OnDelete(DeleteBehavior.Restrict);
+
modelBuilder.Entity()
.HasOne(p => p.Editor)
.WithMany()
@@ -640,6 +647,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
+ modelBuilder.Entity()
+ .HasOne(p => p.Editor)
+ .WithMany()
+ .OnDelete(DeleteBehavior.Restrict);
+
DefaultData.DefaultContextData.Fill(modelBuilder);
}
diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs
index f662f31a..68b7b7a4 100644
--- a/AsbCloudDb/Model/IAsbCloudDbContext.cs
+++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs
@@ -99,6 +99,7 @@ namespace AsbCloudDb.Model
DbSet ProcessMapPlanFunctionsJarrDrillTool { get; }
DbSet ProcessMapPlanFunctionsUpgradeNoload { get; }
DbSet ProcessMapPlanFunctionsOscillation { get; }
+ DbSet ProcessMapPlanFunctionsAnticrashRotation { get; }
Task RefreshMaterializedViewAsync(string mwName, CancellationToken token);
Task RefreshMaterializedViewAsync(CancellationToken token) where TEntity : class;
diff --git a/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanFunctionsAnticrashRotation.cs b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanFunctionsAnticrashRotation.cs
new file mode 100644
index 00000000..427ebab4
--- /dev/null
+++ b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanFunctionsAnticrashRotation.cs
@@ -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; }
+}
\ No newline at end of file
diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs
index 22e9078a..94ad1a35 100644
--- a/AsbCloudInfrastructure/DependencyInjection.cs
+++ b/AsbCloudInfrastructure/DependencyInjection.cs
@@ -257,6 +257,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt()
});
+
+ TypeAdapterConfig>.NewConfig()
+ .Include>()
+ .Map(dest => dest, src => new ChangeLogDto()
+ {
+ Item = src.Adapt()
+ });
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@@ -390,6 +397,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository,
ProcessMapPlanBaseRepository>();
+ services.AddTransient<
+ IChangeLogRepository,
+ ProcessMapPlanBaseRepository>();
+
services.AddTransient();
services.AddTransient();
@@ -453,6 +464,7 @@ namespace AsbCloudInfrastructure
services.AddTransient>();
services.AddTransient>();
services.AddTransient>();
+ services.AddTransient>();
services.AddTransient();
services.AddTransient();
services.AddTransient();
@@ -525,6 +537,7 @@ namespace AsbCloudInfrastructure
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
@@ -549,6 +562,7 @@ namespace AsbCloudInfrastructure
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
diff --git a/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanFunctionsAnticrashRotationTemplate.cs b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanFunctionsAnticrashRotationTemplate.cs
new file mode 100644
index 00000000..6bdbde3a
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanFunctionsAnticrashRotationTemplate.cs
@@ -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 Cells => new Dictionary
+ {
+
+ };
+}
\ No newline at end of file
diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanFunctionsAnticrashRotationExportService.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanFunctionsAnticrashRotationExportService.cs
new file mode 100644
index 00000000..09b9b89d
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanFunctionsAnticrashRotationExportService.cs
@@ -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
+{
+ public ProcessMapPlanFunctionsAnticrashRotationExportService(
+ IChangeLogRepository processMapPlanRepository,
+ IWellService wellService)
+ : base(processMapPlanRepository, wellService)
+ {
+ }
+
+ protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanFunctionsAnticrashRotationTemplate();
+
+ protected override async Task BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
+ {
+ var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
+
+ return $"{caption}_РТК_План_противоаварийное вращение.xlsx";
+ }
+}
\ No newline at end of file
diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanFunctionsAnticrashRotationParser.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanFunctionsAnticrashRotationParser.cs
new file mode 100644
index 00000000..9a159cbd
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanFunctionsAnticrashRotationParser.cs
@@ -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
+{
+ public ProcessMapPlanFunctionsAnticrashRotationParser(IWellOperationRepository wellOperationRepository)
+ : base(wellOperationRepository)
+ {
+ }
+
+ protected override ITemplateParameters TemplateParameters => new ProcessMapPlanFunctionsAnticrashRotationTemplate();
+
+ protected override ProcessMapPlanFunctionsAnticrashRotationDto BuildDto(IDictionary 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;
+ }
+}
\ No newline at end of file
diff --git a/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanFunctionsAnticrashRotationController.cs b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanFunctionsAnticrashRotationController.cs
new file mode 100644
index 00000000..2f17555f
--- /dev/null
+++ b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanFunctionsAnticrashRotationController.cs
@@ -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;
+
+///
+/// РТК план противоаварийное вращение
+///
+public class ProcessMapPlanFunctionsAnticrashRotationController :
+ ProcessMapPlanBaseController
+{
+ public ProcessMapPlanFunctionsAnticrashRotationController(
+ IChangeLogRepository repository,
+ IWellService wellService,
+ ProcessMapPlanFunctionsAnticrashRotationParser parserService,
+ ITelemetryService telemetryService,
+ ProcessMapPlanFunctionsAnticrashRotationExportService processMapPlanExportService)
+ : base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
+ {
+ }
+
+ protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_противоаварийное_вращение.xlsx";
+}
\ No newline at end of file