РТЕК план демпфер

This commit is contained in:
Olga Nemt 2024-06-26 13:01:06 +05:00
parent 7496ac2161
commit 515cd6ecdb
10 changed files with 221 additions and 1 deletions

View File

@ -1,5 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudApp.Data.ProcessMaps;

View File

@ -0,0 +1,57 @@
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план shocktest
/// </summary>
public class ProcessMapPlanFunctionsShockTestDto : ProcessMapPlanBaseDto
{
/// <summary>
/// StickSlip
/// </summary>
[Range(0.0, 1000.0)]
public double StickSlip { get; set; }
/// <summary>
/// Whirl
/// </summary>
[Range(0.0, 1000.0)]
public double Whirl { get; set; }
/// <summary>
/// Осевые вибрации
/// </summary>
[Range(0.0, 1000.0)]
public double AxialVibrations { get; set; }
/// <summary>
/// Комбинированные вибрации
/// </summary>
[Range(0.0, 1000.0)]
public double CombinedVibrations { get; set; }
/// <summary>
/// Нагрузка минимальная, т
/// </summary>
[Range(1.0, 30.0)]
public double WeightOnBitMin { get; set; }
/// <summary>
/// Минимальные обороты на ВСП, об/мин.
/// </summary>
[Range(5, 200)]
public int RevolutionPerMinuteMin { get; set; }
/// <summary>
/// Автозапуск или Предупреждение
/// </summary>
[Required]
public int IdAutostartOrWarning { get; set; }
/// <summary>
/// Примечание
/// </summary>
[StringLength(1024)]
public string Note { get; set; } = string.Empty;
}

View File

@ -33,6 +33,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanOperationSwitchMode> ProcessMapPlanOperationSwitchMode => Set<ProcessMapPlanOperationSwitchMode>();
public virtual DbSet<ProcessMapPlanFunctionsDrillTest> ProcessMapPlanFunctionsDrillTest => Set<ProcessMapPlanFunctionsDrillTest>();
public virtual DbSet<ProcessMapPlanFunctionsShockTest> ProcessMapPlanFunctionsShockTest => Set<ProcessMapPlanFunctionsShockTest>();
public virtual DbSet<ProcessMapPlanFunctionsDamper> ProcessMapPlanFunctionsDamper => Set<ProcessMapPlanFunctionsDamper>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
@ -520,6 +521,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsDamper>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -585,6 +591,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsDamper>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

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

View File

@ -0,0 +1,21 @@
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_damper"), Comment("Демпфер")]
public class ProcessMapPlanFunctionsDamper : ProcessMapPlanBase
{
[Column("stickslip"), Comment("StickSlip")]
[Range(0.0, 1000.0)]
[Required]
public double StickSlip { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanFunctionsDamper? Previous { get; set; }
}

View File

@ -222,6 +222,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanFunctionsShockTestDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanFunctionsDamperDto>>.NewConfig()
.Include<ProcessMapPlanFunctionsDamper, ChangeLogDto<ProcessMapPlanFunctionsDamperDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanFunctionsDamperDto>()
{
Item = src.Adapt<ProcessMapPlanFunctionsDamperDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -335,6 +342,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanFunctionsShockTestDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsShockTest, ProcessMapPlanFunctionsShockTestDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanFunctionsDamperDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsDamper, ProcessMapPlanFunctionsDamperDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -393,6 +404,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanOperationSwitchModeDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsDrillTestDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsShockTestDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsDamperDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -460,6 +472,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanOperationSwitchModeParser>();
services.AddTransient<ProcessMapPlanFunctionsDrillTestParser>();
services.AddTransient<ProcessMapPlanFunctionsShockTestParser>();
services.AddTransient<ProcessMapPlanFunctionsDamperParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -479,6 +492,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanOperationSwitchModeExportService>();
services.AddTransient<ProcessMapPlanFunctionsDrillTestExportService>();
services.AddTransient<ProcessMapPlanFunctionsShockTestExportService>();
services.AddTransient<ProcessMapPlanFunctionsDamperExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

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