РТК план встряхивание бурового инструмента

This commit is contained in:
Olga Nemt 2024-06-26 15:17:24 +05:00
parent 936ebd980a
commit d1c58dda73
9 changed files with 190 additions and 0 deletions

View File

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план автоудержание
/// </summary>
public class ProcessMapPlanFunctionsAutoHoldDto : ProcessMapPlanBaseDto
{
/// <summary>
/// Зенитный угол, градусы
/// </summary>
[Range(0.0, 100.0)]
public double ZenithAngle { get; set; }
/// <summary>
/// Примечание
/// </summary>
[StringLength(1024)]
public string Note { get; set; } = string.Empty;
}

View File

@ -35,6 +35,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanFunctionsShockTest> ProcessMapPlanFunctionsShockTest => Set<ProcessMapPlanFunctionsShockTest>();
public virtual DbSet<ProcessMapPlanFunctionsDamper> ProcessMapPlanFunctionsDamper => Set<ProcessMapPlanFunctionsDamper>();
public virtual DbSet<ProcessMapPlanFunctionsAutoHold> ProcessMapPlanFunctionsAutoHold => Set<ProcessMapPlanFunctionsAutoHold>();
public virtual DbSet<ProcessMapPlanFunctionsJarrDrillTool> ProcessMapPlanFunctionsJarrDrillTool => Set<ProcessMapPlanFunctionsJarrDrillTool>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
@ -532,6 +533,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsJarrDrillTool>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -607,6 +613,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsJarrDrillTool>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

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

View File

@ -0,0 +1,26 @@
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_jarr_drill_tool"), Comment("Встряхивание бурового инструмента")]
public class ProcessMapPlanFunctionsJarrDrillTool : ProcessMapPlanBase
{
[Column("zenit_angle"), Comment("Зенитный угол, градусы")]
[Range(0.0, 100.0)]
[Required]
public double ZenithAngle { get; set; }
[Column("buckling"), Comment("Складывание, м")]
[Range(0.0, 20.0)]
[Required]
public double Buckling { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanFunctionsJarrDrillTool? Previous { get; set; }
}

View File

@ -236,6 +236,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanFunctionsAutoHoldDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanFunctionsJarrDrillToolDto>>.NewConfig()
.Include<ProcessMapPlanFunctionsJarrDrillTool, ChangeLogDto<ProcessMapPlanFunctionsJarrDrillToolDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanFunctionsJarrDrillToolDto>()
{
Item = src.Adapt<ProcessMapPlanFunctionsJarrDrillToolDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -357,6 +364,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanFunctionsAutoHoldDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsAutoHold, ProcessMapPlanFunctionsAutoHoldDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanFunctionsJarrDrillToolDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsJarrDrillTool, ProcessMapPlanFunctionsJarrDrillToolDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -417,6 +428,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsShockTestDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsDamperDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsAutoHoldDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsJarrDrillToolDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -486,6 +498,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsShockTestParser>();
services.AddTransient<ProcessMapPlanFunctionsDamperParser>();
services.AddTransient<ProcessMapPlanFunctionsAutoHoldParser>();
services.AddTransient<ProcessMapPlanFunctionsJarrDrillToolParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -507,6 +520,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsShockTestExportService>();
services.AddTransient<ProcessMapPlanFunctionsDamperExportService>();
services.AddTransient<ProcessMapPlanFunctionsAutoHoldExportService>();
services.AddTransient<ProcessMapPlanFunctionsJarrDrillToolExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

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