Подход к забою в роторе

This commit is contained in:
Olga Nemt 2024-06-30 19:43:25 +05:00
parent 85123cace8
commit 1ffe0d6df8
5 changed files with 148 additions and 0 deletions

View File

@ -0,0 +1,31 @@
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_rotor_lowering_bit"), Comment("РТК подход к забою в роторе")]
public class ProcessMapPlanRotorLoweringBit : ProcessMapPlanBase
{
[Column("time_load_capacity_min"), Comment("Время выработки минимальное, сек")]
[Range(0.0, 800.0)]
[Required]
public double TimeLoadCapacityMin { get; set; }
[Column("differential_pressure_min"), Comment("Перепад давления минимальный, атм")]
[Range(0.1, 400.0)]
[Required]
public double DifferentialPressureMin { get; set; }
[Column("weight_on_bit_min"), Comment("Нагрузка минимальная, т")]
[Range(0.1, 99.0)]
[Required]
public double WeightOnBitMin { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanLoadCapacity? Previous { get; set; }
}

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
public class ProcessMapPlanRotorLoweringBitTemplate : ITemplateParameters
{
public string SheetName => "Подход к забою в роторе";
public int HeaderRowsCount => 2;
public string FileName => "ProcessMapPlanRotorLoweringBitTemplate.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 ProcessMapPlanRotorLoweringBitExportService : ProcessMapPlanExportService<ProcessMapPlanRotorLoweringBitDto>
{
public ProcessMapPlanRotorLoweringBitExportService(
IChangeLogRepository<ProcessMapPlanRotorLoweringBitDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
IWellService wellService)
: base(processMapPlanRepository, wellService)
{
}
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanRotorLoweringBitTemplate();
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 ProcessMapPlanRotorLoweringBitParser : ProcessMapPlanParser<ProcessMapPlanRotorLoweringBitDto>
{
public ProcessMapPlanRotorLoweringBitParser(IWellOperationRepository wellOperationRepository)
: base(wellOperationRepository)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanLoadCapacityTemplate();
protected override ProcessMapPlanRotorLoweringBitDto 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.Operations;
/// <summary>
/// РТК план подход к забою в роторе
/// </summary>
public class ProcessMapPlanRotorLoweringBitController :
ProcessMapPlanBaseController<ProcessMapPlanRotorLoweringBit, ProcessMapPlanRotorLoweringBitDto>
{
public ProcessMapPlanRotorLoweringBitController(
IChangeLogRepository<ProcessMapPlanRotorLoweringBitDto, ProcessMapPlanBaseRequestWithWell> repository,
IWellService wellService,
ProcessMapPlanRotorLoweringBitParser parserService,
ITelemetryService telemetryService,
ProcessMapPlanRotorLoweringBitExportService processMapPlanExportService)
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
{
}
protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_подход_к_забою_в_роторе.xlsx";
}