РТК план автоудержание

This commit is contained in:
Olga Nemt 2024-06-26 13:21:16 +05:00
parent 515cd6ecdb
commit 936ebd980a
9 changed files with 185 additions and 0 deletions

View File

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план демпфер
/// </summary>
public class ProcessMapPlanFunctionsDamperDto : ProcessMapPlanBaseDto
{
/// <summary>
/// StickSlip
/// </summary>
[Range(0.0, 1000.0)]
public double StickSlip { get; set; }
/// <summary>
/// Примечание
/// </summary>
[StringLength(1024)]
public string Note { get; set; } = string.Empty;
}

View File

@ -34,6 +34,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanFunctionsDrillTest> ProcessMapPlanFunctionsDrillTest => Set<ProcessMapPlanFunctionsDrillTest>();
public virtual DbSet<ProcessMapPlanFunctionsShockTest> ProcessMapPlanFunctionsShockTest => Set<ProcessMapPlanFunctionsShockTest>();
public virtual DbSet<ProcessMapPlanFunctionsDamper> ProcessMapPlanFunctionsDamper => Set<ProcessMapPlanFunctionsDamper>();
public virtual DbSet<ProcessMapPlanFunctionsAutoHold> ProcessMapPlanFunctionsAutoHold => Set<ProcessMapPlanFunctionsAutoHold>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
@ -526,6 +527,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsAutoHold>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -596,6 +602,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsAutoHold>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

@ -95,6 +95,7 @@ namespace AsbCloudDb.Model
DbSet<ProcessMapPlanFunctionsDrillTest> ProcessMapPlanFunctionsDrillTest { get; }
DbSet<ProcessMapPlanFunctionsShockTest> ProcessMapPlanFunctionsShockTest { get; }
DbSet<ProcessMapPlanFunctionsDamper> ProcessMapPlanFunctionsDamper { get; }
DbSet<ProcessMapPlanFunctionsAutoHold> ProcessMapPlanFunctionsAutoHold { 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_autohold"), Comment("Автоудержание")]
public class ProcessMapPlanFunctionsAutoHold : ProcessMapPlanBase
{
[Column("zenit_angle"), Comment("Зенитный угол, градусы")]
[Range(0.0, 100.0)]
[Required]
public double ZenithAngle { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanFunctionsAutoHold? Previous { get; set; }
}

View File

@ -229,6 +229,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanFunctionsDamperDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanFunctionsAutoHoldDto>>.NewConfig()
.Include<ProcessMapPlanFunctionsAutoHold, ChangeLogDto<ProcessMapPlanFunctionsAutoHoldDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanFunctionsAutoHoldDto>()
{
Item = src.Adapt<ProcessMapPlanFunctionsAutoHoldDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -346,6 +353,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanFunctionsDamperDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsDamper, ProcessMapPlanFunctionsDamperDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanFunctionsAutoHoldDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsAutoHold, ProcessMapPlanFunctionsAutoHoldDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -405,6 +416,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsDrillTestDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsShockTestDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsDamperDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsAutoHoldDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -473,6 +485,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsDrillTestParser>();
services.AddTransient<ProcessMapPlanFunctionsShockTestParser>();
services.AddTransient<ProcessMapPlanFunctionsDamperParser>();
services.AddTransient<ProcessMapPlanFunctionsAutoHoldParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -493,6 +506,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsDrillTestExportService>();
services.AddTransient<ProcessMapPlanFunctionsShockTestExportService>();
services.AddTransient<ProcessMapPlanFunctionsDamperExportService>();
services.AddTransient<ProcessMapPlanFunctionsAutoHoldExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

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