РТК план обновление холостого хода

This commit is contained in:
Olga Nemt 2024-06-26 15:43:16 +05:00
parent d1c58dda73
commit 3266f9f207
9 changed files with 190 additions and 0 deletions

View File

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

View File

@ -36,6 +36,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanFunctionsDamper> ProcessMapPlanFunctionsDamper => Set<ProcessMapPlanFunctionsDamper>();
public virtual DbSet<ProcessMapPlanFunctionsAutoHold> ProcessMapPlanFunctionsAutoHold => Set<ProcessMapPlanFunctionsAutoHold>();
public virtual DbSet<ProcessMapPlanFunctionsJarrDrillTool> ProcessMapPlanFunctionsJarrDrillTool => Set<ProcessMapPlanFunctionsJarrDrillTool>();
public virtual DbSet<ProcessMapPlanFunctionsUpgradeNoload> ProcessMapPlanFunctionsUpgradeNoload => Set<ProcessMapPlanFunctionsUpgradeNoload>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
@ -538,6 +539,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsUpgradeNoload>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -618,6 +624,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsUpgradeNoload>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

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

View File

@ -0,0 +1,19 @@
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_upgrade_no_load"), Comment("Обновление холостого хода")]
public class ProcessMapPlanFunctionsUpgradeNoload : ProcessMapPlanBase
{
[Column("id_decline_socket_column"), Comment("СПУСК ОК Да/Нет")]
public double IdDeclineSocketColumn { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanFunctionsUpgradeNoload? Previous { get; set; }
}

View File

@ -243,6 +243,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanFunctionsJarrDrillToolDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanFunctionsUpgradeNoloadDto>>.NewConfig()
.Include<ProcessMapPlanFunctionsUpgradeNoload, ChangeLogDto<ProcessMapPlanFunctionsUpgradeNoloadDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanFunctionsUpgradeNoloadDto>()
{
Item = src.Adapt<ProcessMapPlanFunctionsUpgradeNoloadDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -368,6 +375,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanFunctionsJarrDrillToolDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsJarrDrillTool, ProcessMapPlanFunctionsJarrDrillToolDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanFunctionsUpgradeNoloadDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsUpgradeNoload, ProcessMapPlanFunctionsUpgradeNoloadDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -429,6 +440,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsDamperDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsAutoHoldDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsJarrDrillToolDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsUpgradeNoloadDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -499,6 +511,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsDamperParser>();
services.AddTransient<ProcessMapPlanFunctionsAutoHoldParser>();
services.AddTransient<ProcessMapPlanFunctionsJarrDrillToolParser>();
services.AddTransient<ProcessMapPlanFunctionsUpgradeNoloadParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -521,6 +534,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsDamperExportService>();
services.AddTransient<ProcessMapPlanFunctionsAutoHoldExportService>();
services.AddTransient<ProcessMapPlanFunctionsJarrDrillToolExportService>();
services.AddTransient<ProcessMapPlanFunctionsUpgradeNoloadExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

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