diff --git a/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanFunctionsDrillTestDto.cs b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanFunctionsDrillTestDto.cs
new file mode 100644
index 00000000..f7d359d0
--- /dev/null
+++ b/AsbCloudApp/Data/ProcessMaps/ProcessMapPlanFunctionsDrillTestDto.cs
@@ -0,0 +1,52 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace AsbCloudApp.Data.ProcessMaps;
+
+///
+/// РТК план дрилтест
+///
+public class ProcessMapPlanFunctionsDrillTestDto : ProcessMapPlanBaseDto
+{
+ ///
+ /// Нагрузка минимальная, т
+ ///
+ [Range(1.0, 30.0)]
+ public double WeightOnBitMin { get; set; }
+
+ ///
+ /// Количество шагов по нагрузке
+ ///
+ [Range(1, 5)]
+ public int NumberOfStepsBit { get; set; }
+
+ ///
+ /// Минимальные обороты на ВСП, об/мин.
+ ///
+ [Range(5, 200)]
+ public int RevolutionPerMinuteMin { get; set; }
+
+ ///
+ /// Количество шагов оборотов на ВСП, шт.
+ ///
+ [Range(1, 5)]
+ public int NumberOfStepsRPM { get; set; }
+
+ ///
+ /// Величина проходки шага, м.
+ ///
+ [Range(0.1, 2.0)]
+ public double LengthStep { get; set; }
+
+ ///
+ /// Автозапуск или Предупреждение
+ ///
+ [Required]
+ public int IdAutostartOrWarning { 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 c1e551f7..1efbb45d 100644
--- a/AsbCloudDb/Model/AsbCloudDbContext.cs
+++ b/AsbCloudDb/Model/AsbCloudDbContext.cs
@@ -32,6 +32,7 @@ namespace AsbCloudDb.Model
public virtual DbSet ProcessMapPlanOperationSwitchPump => Set();
public virtual DbSet ProcessMapPlanOperationSwitchMode => Set();
public virtual DbSet ProcessMapPlanFunctionsDrillTest => Set();
+ public virtual DbSet ProcessMapPlanFunctionsShockTest => Set();
public virtual DbSet DrillingProgramParts => Set();
public virtual DbSet FileCategories => Set();
public virtual DbSet Files => Set();
@@ -514,6 +515,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()
@@ -574,6 +580,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 ea266d6f..81610a3b 100644
--- a/AsbCloudDb/Model/IAsbCloudDbContext.cs
+++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs
@@ -93,6 +93,7 @@ namespace AsbCloudDb.Model
DbSet ProcessMapPlanOperationSwitchPump { get; }
DbSet ProcessMapPlanOperationSwitchMode { get; }
DbSet ProcessMapPlanFunctionsDrillTest { get; }
+ DbSet ProcessMapPlanFunctionsShockTest { get; }
Task RefreshMaterializedViewAsync(string mwName, CancellationToken token);
Task RefreshMaterializedViewAsync(CancellationToken token) where TEntity : class;
diff --git a/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanFunctionsShockTest.cs b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanFunctionsShockTest.cs
new file mode 100644
index 00000000..484c1777
--- /dev/null
+++ b/AsbCloudDb/Model/ProcessMapPlan/ProcessMapPlanFunctionsShockTest.cs
@@ -0,0 +1,50 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using AsbCloudDb.Model.ProcessMapPlan;
+using Microsoft.EntityFrameworkCore;
+
+namespace AsbCloudDb.Model.ProcessMaps;
+
+[Table("t_process_map_functions_shock_test"), Comment("ShockTest")]
+public class ProcessMapPlanFunctionsShockTest : ProcessMapPlanBase
+{
+ [Column("stickslip"), Comment("StickSlip")]
+ [Range(0.0, 1000.0)]
+ [Required]
+ public double StickSlip { get; set; }
+
+ [Column("whirl"), Comment("Whirl")]
+ [Range(0.0, 1000.0)]
+ [Required]
+ public double Whirl { get; set; }
+
+ [Column("axial_vibrations"), Comment("Осевые вибрации")]
+ [Range(0.0, 1000.0)]
+ [Required]
+ public double AxialVibrations { get; set; }
+
+ [Column("combined_vibrations"), Comment("Комбинированные вибрации")]
+ [Range(0.0, 1000.0)]
+ [Required]
+ public double CombinedVibrations { get; set; }
+
+ [Column("weight_on_bit_min"), Comment("Нагрузка минимальная, т")]
+ [Range(1.0, 30.0)]
+ [Required]
+ public double WeightOnBitMin { get; set; }
+
+ [Column("revolution_per_minute_min"), Comment("Минимальные обороты на ВСП, об/мин.")]
+ [Range(5, 200)]
+ [Required]
+ public int RevolutionPerMinuteMin { get; set; }
+
+ [Column("id_autostart_or_warning"), Comment("Автозапуск или Предупреждение")]
+ [Required]
+ public int IdAutostartOrWarning { get; set; }
+
+ [Column("note"), Comment("Примечание"), StringLength(1024)]
+ public string Note { get; set; } = string.Empty;
+
+ [ForeignKey(nameof(IdPrevious))]
+ public virtual ProcessMapPlanFunctionsShockTest? Previous { get; set; }
+}
\ No newline at end of file
diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs
index 41c25885..b9ce1119 100644
--- a/AsbCloudInfrastructure/DependencyInjection.cs
+++ b/AsbCloudInfrastructure/DependencyInjection.cs
@@ -215,6 +215,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)
@@ -324,6 +331,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository,
ProcessMapPlanBaseRepository>();
+ services.AddTransient<
+ IChangeLogRepository,
+ ProcessMapPlanBaseRepository>();
+
services.AddTransient();
services.AddTransient();
@@ -381,6 +392,7 @@ namespace AsbCloudInfrastructure
services.AddTransient>();
services.AddTransient>();
services.AddTransient>();
+ services.AddTransient>();
services.AddTransient();
services.AddTransient();
services.AddTransient();
@@ -447,6 +459,7 @@ namespace AsbCloudInfrastructure
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
@@ -465,6 +478,7 @@ namespace AsbCloudInfrastructure
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
services.AddTransient();
services.AddTransient();
diff --git a/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanFunctionsShockTestTemplate.cs b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanFunctionsShockTestTemplate.cs
new file mode 100644
index 00000000..e110136a
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/ExcelServices/Templates/ProcessMapPlanTemplates/ProcessMapPlanFunctionsShockTestTemplate.cs
@@ -0,0 +1,17 @@
+using System.Collections.Generic;
+
+namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
+
+public class ProcessMapPlanFunctionsShockTestTemplate : ITemplateParameters
+{
+ public string SheetName => "Запись shock test";
+
+ public int HeaderRowsCount => 2;
+
+ public string FileName => "ProcessMapPlanFunctionsShockTestTemplate.xlsx";
+
+ public IDictionary Cells => new Dictionary
+ {
+
+ };
+}
\ No newline at end of file
diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanFunctionsShockTestExportService.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanFunctionsShockTestExportService.cs
new file mode 100644
index 00000000..fd5865f8
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Export/ProcessMapPlanFunctionsShockTestExportService.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 ProcessMapPlanFunctionsShockTestExportService : ProcessMapPlanExportService
+{
+ public ProcessMapPlanFunctionsShockTestExportService(
+ IChangeLogRepository processMapPlanRepository,
+ IWellService wellService)
+ : base(processMapPlanRepository, wellService)
+ {
+ }
+
+ protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanFunctionsShockTestTemplate();
+
+ protected override async Task BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
+ {
+ var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
+
+ return $"{caption}_РТК_План_shock_test.xlsx";
+ }
+}
\ No newline at end of file
diff --git a/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanFunctionsShockTestParser.cs b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanFunctionsShockTestParser.cs
new file mode 100644
index 00000000..5de14184
--- /dev/null
+++ b/AsbCloudInfrastructure/Services/ProcessMapPlan/Parser/ProcessMapPlanFunctionsShockTestParser.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 ProcessMapPlanFunctionsShockTestParser : ProcessMapPlanParser
+{
+ public ProcessMapPlanFunctionsShockTestParser(IWellOperationRepository wellOperationRepository)
+ : base(wellOperationRepository)
+ {
+ }
+
+ protected override ITemplateParameters TemplateParameters => new ProcessMapPlanFunctionsShockTestTemplate();
+
+ protected override ProcessMapPlanFunctionsShockTestDto 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/ProcessMapPlanFunctionsShockTestController.cs b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanFunctionsShockTestController.cs
new file mode 100644
index 00000000..4ee12c1b
--- /dev/null
+++ b/AsbCloudWebApi/Controllers/ProcessMaps/ProcessMapPlanFunctionsShockTestController.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;
+
+///
+/// РТК план shock test
+///
+public class ProcessMapPlanFunctionsShockTestController :
+ ProcessMapPlanBaseController
+{
+ public ProcessMapPlanFunctionsShockTestController(
+ IChangeLogRepository repository,
+ IWellService wellService,
+ ProcessMapPlanFunctionsShockTestParser parserService,
+ ITelemetryService telemetryService,
+ ProcessMapPlanFunctionsShockTestExportService processMapPlanExportService)
+ : base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
+ {
+ }
+
+ protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_shock_test.xlsx";
+}
\ No newline at end of file