РТК план shock test

This commit is contained in:
Olga Nemt 2024-06-26 11:42:10 +05:00
parent 38559d65ae
commit 7496ac2161
9 changed files with 245 additions and 0 deletions

View File

@ -0,0 +1,52 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план дрилтест
/// </summary>
public class ProcessMapPlanFunctionsDrillTestDto : ProcessMapPlanBaseDto
{
/// <summary>
/// Нагрузка минимальная, т
/// </summary>
[Range(1.0, 30.0)]
public double WeightOnBitMin { get; set; }
/// <summary>
/// Количество шагов по нагрузке
/// </summary>
[Range(1, 5)]
public int NumberOfStepsBit { get; set; }
/// <summary>
/// Минимальные обороты на ВСП, об/мин.
/// </summary>
[Range(5, 200)]
public int RevolutionPerMinuteMin { get; set; }
/// <summary>
/// Количество шагов оборотов на ВСП, шт.
/// </summary>
[Range(1, 5)]
public int NumberOfStepsRPM { get; set; }
/// <summary>
/// Величина проходки шага, м.
/// </summary>
[Range(0.1, 2.0)]
public double LengthStep { get; set; }
/// <summary>
/// Автозапуск или Предупреждение
/// </summary>
[Required]
public int IdAutostartOrWarning { get; set; }
/// <summary>
/// Примечание
/// </summary>
[StringLength(1024)]
public string Note { get; set; } = string.Empty;
}

View File

@ -32,6 +32,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanOperationSwitchPump> ProcessMapPlanOperationSwitchPump => Set<ProcessMapPlanOperationSwitchPump>();
public virtual DbSet<ProcessMapPlanOperationSwitchMode> ProcessMapPlanOperationSwitchMode => Set<ProcessMapPlanOperationSwitchMode>();
public virtual DbSet<ProcessMapPlanFunctionsDrillTest> ProcessMapPlanFunctionsDrillTest => Set<ProcessMapPlanFunctionsDrillTest>();
public virtual DbSet<ProcessMapPlanFunctionsShockTest> ProcessMapPlanFunctionsShockTest => Set<ProcessMapPlanFunctionsShockTest>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
@ -514,6 +515,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsShockTest>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -574,6 +580,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsShockTest>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

@ -93,6 +93,7 @@ namespace AsbCloudDb.Model
DbSet<ProcessMapPlanOperationSwitchPump> ProcessMapPlanOperationSwitchPump { get; }
DbSet<ProcessMapPlanOperationSwitchMode> ProcessMapPlanOperationSwitchMode { get; }
DbSet<ProcessMapPlanFunctionsDrillTest> ProcessMapPlanFunctionsDrillTest { get; }
DbSet<ProcessMapPlanFunctionsShockTest> ProcessMapPlanFunctionsShockTest { get; }
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);
Task<int> RefreshMaterializedViewAsync<TEntity>(CancellationToken token) where TEntity : class;

View File

@ -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; }
}

View File

@ -215,6 +215,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanFunctionsDrillTestDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanFunctionsShockTestDto>>.NewConfig()
.Include<ProcessMapPlanOperationSwitchMode, ChangeLogDto<ProcessMapPlanFunctionsShockTestDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanFunctionsShockTestDto>()
{
Item = src.Adapt<ProcessMapPlanFunctionsShockTestDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -324,6 +331,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanFunctionsDrillTestDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsDrillTest, ProcessMapPlanFunctionsDrillTestDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanFunctionsShockTestDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsShockTest, ProcessMapPlanFunctionsShockTestDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -381,6 +392,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationSwitchPumpDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationSwitchModeDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsDrillTestDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsShockTestDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -447,6 +459,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanOperationSwitchPumpParser>();
services.AddTransient<ProcessMapPlanOperationSwitchModeParser>();
services.AddTransient<ProcessMapPlanFunctionsDrillTestParser>();
services.AddTransient<ProcessMapPlanFunctionsShockTestParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -465,6 +478,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanOperationSwitchPumpExportService>();
services.AddTransient<ProcessMapPlanOperationSwitchModeExportService>();
services.AddTransient<ProcessMapPlanFunctionsDrillTestExportService>();
services.AddTransient<ProcessMapPlanFunctionsShockTestExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

@ -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<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 ProcessMapPlanFunctionsShockTestExportService : ProcessMapPlanExportService<ProcessMapPlanFunctionsShockTestDto>
{
public ProcessMapPlanFunctionsShockTestExportService(
IChangeLogRepository<ProcessMapPlanFunctionsShockTestDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
IWellService wellService)
: base(processMapPlanRepository, wellService)
{
}
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanFunctionsShockTestTemplate();
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
{
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
return $"{caption}_РТК_План_shock_test.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 ProcessMapPlanFunctionsShockTestParser : ProcessMapPlanParser<ProcessMapPlanFunctionsShockTestDto>
{
public ProcessMapPlanFunctionsShockTestParser(IWellOperationRepository wellOperationRepository)
: base(wellOperationRepository)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanFunctionsShockTestTemplate();
protected override ProcessMapPlanFunctionsShockTestDto 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>
/// РТК план shock test
/// </summary>
public class ProcessMapPlanFunctionsShockTestController :
ProcessMapPlanBaseController<ProcessMapPlanFunctionsShockTest, ProcessMapPlanFunctionsShockTestDto>
{
public ProcessMapPlanFunctionsShockTestController(
IChangeLogRepository<ProcessMapPlanFunctionsShockTestDto, ProcessMapPlanBaseRequestWithWell> repository,
IWellService wellService,
ProcessMapPlanFunctionsShockTestParser parserService,
ITelemetryService telemetryService,
ProcessMapPlanFunctionsShockTestExportService processMapPlanExportService)
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
{
}
protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_shock_test.xlsx";
}