РТК план осцилляция

This commit is contained in:
Olga Nemt 2024-06-26 16:17:19 +05:00
parent 3266f9f207
commit fc3566a60b
9 changed files with 208 additions and 0 deletions

View File

@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data.ProcessMaps;
/// <summary>
/// РТК план обновление холостого хода
/// </summary>
public class ProcessMapPlanFunctionsUpgradeNoloadDto : ProcessMapPlanBaseDto
{
/// <summary>
/// СПУСК ОК Да/Нет
/// </summary>
public double IdDeclineSocketColumn { get; set; }
/// <summary>
/// Примечание
/// </summary>
[StringLength(1024)]
public string Note { get; set; } = string.Empty;
}

View File

@ -37,6 +37,7 @@ namespace AsbCloudDb.Model
public virtual DbSet<ProcessMapPlanFunctionsAutoHold> ProcessMapPlanFunctionsAutoHold => Set<ProcessMapPlanFunctionsAutoHold>();
public virtual DbSet<ProcessMapPlanFunctionsJarrDrillTool> ProcessMapPlanFunctionsJarrDrillTool => Set<ProcessMapPlanFunctionsJarrDrillTool>();
public virtual DbSet<ProcessMapPlanFunctionsUpgradeNoload> ProcessMapPlanFunctionsUpgradeNoload => Set<ProcessMapPlanFunctionsUpgradeNoload>();
public virtual DbSet<ProcessMapPlanFunctionsOscillation> ProcessMapPlanFunctionsOscillation => Set<ProcessMapPlanFunctionsOscillation>();
public virtual DbSet<DrillingProgramPart> DrillingProgramParts => Set<DrillingProgramPart>();
public virtual DbSet<FileCategory> FileCategories => Set<FileCategory>();
public virtual DbSet<FileInfo> Files => Set<FileInfo>();
@ -544,6 +545,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsOscillation>()
.HasOne(p => p.Author)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanRotor>()
.HasOne(p => p.Editor)
.WithMany()
@ -629,6 +635,11 @@ namespace AsbCloudDb.Model
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProcessMapPlanFunctionsOscillation>()
.HasOne(p => p.Editor)
.WithMany()
.OnDelete(DeleteBehavior.Restrict);
DefaultData.DefaultContextData.Fill(modelBuilder);
}

View File

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

View File

@ -0,0 +1,45 @@
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_oscillation"), Comment("Осцилляция")]
public class ProcessMapPlanFunctionsOscillation : ProcessMapPlanBase
{
[Column("optimal_oscillation_angle"), Comment("Оптимальный угол осцилляции, градусы")]
[Range(0.0, 6000.0)]
[Required]
public double OptimalOscillationAngle { get; set; }
[Column("RPM_right"), Comment("Скорость вправо, об/мин")]
[Range(0.0, 270.0)]
[Required]
public double RPMRight { get; set; }
[Column("RPM_left"), Comment("Скорость влево, об/мин")]
[Range(0.0, 270.0)]
[Required]
public double RPMLeft { get; set; }
[Column("torque_limit_right"), Comment("Ограничение момента вправо, кН*м")]
[Range(0.0, 35.0)]
[Required]
public double TorqueLimitRight { get; set; }
[Column("torque_limit_left"), Comment("Ограничение момента влево, кН*м")]
[Range(0.0, 35.0)]
[Required]
public double TorqueLimitLeft { get; set; }
[Column("id_mode"), Comment("Режим Авто/Руч")]
[Required]
public double Mode { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanFunctionsOscillation? Previous { get; set; }
}

View File

@ -250,6 +250,13 @@ namespace AsbCloudInfrastructure
{
Item = src.Adapt<ProcessMapPlanFunctionsUpgradeNoloadDto>()
});
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanFunctionsOscillationDto>>.NewConfig()
.Include<ProcessMapPlanFunctionsOscillation, ChangeLogDto<ProcessMapPlanFunctionsOscillationDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanFunctionsOscillationDto>()
{
Item = src.Adapt<ProcessMapPlanFunctionsOscillationDto>()
});
}
public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
@ -379,6 +386,10 @@ namespace AsbCloudInfrastructure
IChangeLogRepository<ProcessMapPlanFunctionsUpgradeNoloadDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsUpgradeNoload, ProcessMapPlanFunctionsUpgradeNoloadDto>>();
services.AddTransient<
IChangeLogRepository<ProcessMapPlanFunctionsOscillationDto, ProcessMapPlanBaseRequestWithWell>,
ProcessMapPlanBaseRepository<ProcessMapPlanFunctionsOscillation, ProcessMapPlanFunctionsOscillationDto>>();
services.AddTransient<IProcessMapReportDrillingService, ProcessMapReportDrillingService>();
services.AddTransient<TrajectoryService>();
@ -441,6 +452,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsAutoHoldDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsJarrDrillToolDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsUpgradeNoloadDto>>();
services.AddTransient<IWellCompositeRepository, WellCompositeRepository<ProcessMapPlanFunctionsOscillationDto>>();
services.AddTransient<IUserRoleRepository, UserRoleRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<ILimitingParameterRepository, LimitingParameterRepository>();
@ -512,6 +524,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsAutoHoldParser>();
services.AddTransient<ProcessMapPlanFunctionsJarrDrillToolParser>();
services.AddTransient<ProcessMapPlanFunctionsUpgradeNoloadParser>();
services.AddTransient<ProcessMapPlanFunctionsOscillationParser>();
services.AddTransient<TrajectoryPlanExportService>();
services.AddTransient<TrajectoryFactManualExportService>();
@ -535,6 +548,7 @@ namespace AsbCloudInfrastructure
services.AddTransient<ProcessMapPlanFunctionsAutoHoldExportService>();
services.AddTransient<ProcessMapPlanFunctionsJarrDrillToolExportService>();
services.AddTransient<ProcessMapPlanFunctionsUpgradeNoloadExportService>();
services.AddTransient<ProcessMapPlanFunctionsOscillationExportService>();
services.AddTransient<WellOperationParserFactory>();
services.AddTransient<WellOperationExportServiceFactory>();

View File

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