Подход к забою в слайде

This commit is contained in:
Olga Nemt 2024-06-30 20:31:19 +05:00
parent b84bb9f45b
commit 350052bd16
6 changed files with 169 additions and 1 deletions

View File

@ -0,0 +1,51 @@
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_slide_lowering_bit"), Comment("РТК подход к забою в слайде")]
public class ProcessMapPlanSlideLoweringBit : ProcessMapPlanBase
{
[Column("pressure_max"), Comment("Максимально допустимое давление, атм.")]
[Range(0.0, 400.0)]
[Required]
public double PressureMax { get; set; }
[Column("differential_pressure"), Comment("Перепад давления уставка, атм.")]
[Range(0.0, 60.0)]
[Required]
public double DifferentialPressure { get; set; }
[Column("slacking_off"), Comment("Посадка, т.")]
[Range(0.0, 20.0)]
[Required]
public double SlackingOff { get; set; }
[Column("torque_max"), Comment("Максимально допустимый момент, кН*м.")]
[Range(0.0, 35.0)]
[Required]
public double TorqueMax { get; set; }
[Column("rop_down"), Comment("Скорость вниз, м/ч.")]
[Range(0.0, 999.0)]
[Required]
public double RopDown { get; set; }
[Column("rpm_down"), Comment("Обороты вниз, об/мин.")]
[Range(0.0, 270.0)]
[Required]
public double RpmDown { get; set; }
[Column("flow_rate_down"), Comment("Расход вниз, л/с.")]
[Range(0.0, 100.0)]
[Required]
public double FlowRateDown { get; set; }
[Column("note"), Comment("Примечание"), StringLength(1024)]
public string Note { get; set; } = string.Empty;
[ForeignKey(nameof(IdPrevious))]
public virtual ProcessMapPlanRotorLoweringBit? Previous { get; set; }
}

View File

@ -0,0 +1,17 @@
using System.Collections.Generic;
namespace AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
public class ProcessMapPlanSlideLoweringBitTemplate : ITemplateParameters
{
public string SheetName => "Подход к забою в слайде";
public int HeaderRowsCount => 2;
public string FileName => "ProcessMapPlanSlideLoweringBitTemplate.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 ProcessMapPlanSlideLoweringBitExportService : ProcessMapPlanExportService<ProcessMapPlanSlideLoweringBitDto>
{
public ProcessMapPlanSlideLoweringBitExportService(
IChangeLogRepository<ProcessMapPlanSlideLoweringBitDto, ProcessMapPlanBaseRequestWithWell> processMapPlanRepository,
IWellService wellService)
: base(processMapPlanRepository, wellService)
{
}
protected override ITemplateParameters TemplateParameters { get; } = new ProcessMapPlanSlideLoweringBitTemplate();
protected override async Task<string> BuildFileNameAsync(WellRelatedExportRequest options, CancellationToken token)
{
var caption = await wellService.GetWellCaptionByIdAsync(options.IdWell, token);
return $"{caption}_РТК_План_подход_к_забою_в_слайде.xlsx";
}
}

View File

@ -16,7 +16,7 @@ public class ProcessMapPlanRotorLoweringBitParser : ProcessMapPlanParser<Process
{ {
} }
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanLoadCapacityTemplate(); protected override ITemplateParameters TemplateParameters => new ProcessMapPlanRotorLoweringBitTemplate();
protected override ProcessMapPlanRotorLoweringBitDto BuildDto(IDictionary<string, object?> row, int rowNumber) protected override ProcessMapPlanRotorLoweringBitDto BuildDto(IDictionary<string, object?> row, int rowNumber)
{ {

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 ProcessMapPlanSlideLoweringBitParser : ProcessMapPlanParser<ProcessMapPlanSlideLoweringBitDto>
{
public ProcessMapPlanSlideLoweringBitParser(IWellOperationRepository wellOperationRepository)
: base(wellOperationRepository)
{
}
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanSlideLoweringBitTemplate();
protected override ProcessMapPlanSlideLoweringBitDto 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 ProcessMapPlanSlideLoweringBitController :
ProcessMapPlanBaseController<ProcessMapPlanSlideLoweringBit, ProcessMapPlanSlideLoweringBitDto>
{
public ProcessMapPlanSlideLoweringBitController(
IChangeLogRepository<ProcessMapPlanSlideLoweringBitDto, ProcessMapPlanBaseRequestWithWell> repository,
IWellService wellService,
ProcessMapPlanSlideLoweringBitParser parserService,
ITelemetryService telemetryService,
ProcessMapPlanSlideLoweringBitExportService processMapPlanExportService)
: base(repository, wellService, parserService, processMapPlanExportService, telemetryService)
{
}
protected override string TemplateFileName => "ЕЦП_шаблон_файла_РТК_план_подход_к_забою_в_слайде.xlsx";
}