DD.WellWorkover.Cloud/AsbCloudInfrastructure/Services/Trajectory/Parser/TrajectoryPlanParser.cs

58 lines
2.0 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using AsbCloudApp.Data;
using AsbCloudApp.Data.Trajectory;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.Trajectory.Parser;
public class TrajectoryPlanParser : TrajectoryParser<TrajectoryGeoPlanDto>
{
#region Columns
private const int columnWellboreDepth = 1;
private const int columnZenithAngle = 2;
private const int columnAzimuthGeo = 3;
private const int columnAzimuthMagnetic = 4;
private const int columnVerticalDepth = 5;
private const int columnRadius = 6;
private const int columnComment = 7;
#endregion
public TrajectoryPlanParser(IServiceProvider serviceProvider)
: base(serviceProvider)
{
}
protected override string SheetName => "Плановая траектория";
protected override string TemplateFileName => "TrajectoryPlanTemplate.xlsx";
protected override IDictionary<string, int> PropertyColumnNumbers => new Dictionary<string, int>
{
{ nameof(TrajectoryGeoPlanDto.WellboreDepth), columnWellboreDepth },
{ nameof(TrajectoryGeoPlanDto.ZenithAngle), columnZenithAngle },
{ nameof(TrajectoryGeoPlanDto.AzimuthGeo), columnAzimuthGeo },
{ nameof(TrajectoryGeoPlanDto.AzimuthMagnetic), columnAzimuthMagnetic },
{ nameof(TrajectoryGeoPlanDto.VerticalDepth), columnVerticalDepth },
{ nameof(TrajectoryGeoPlanDto.Radius), columnRadius },
{ nameof(TrajectoryGeoPlanDto.Comment), columnComment }
};
protected override TrajectoryGeoPlanDto ParseRow(IXLRow row)
{
var dto = new TrajectoryGeoPlanDto
{
WellboreDepth = row.Cell(columnWellboreDepth).GetCellValue<double>(),
ZenithAngle = row.Cell(columnZenithAngle).GetCellValue<double>(),
AzimuthGeo = row.Cell(columnAzimuthGeo).GetCellValue<double>(),
AzimuthMagnetic = row.Cell(columnAzimuthMagnetic).GetCellValue<double>(),
VerticalDepth = row.Cell(columnVerticalDepth).GetCellValue<double>(),
Radius = row.Cell(columnRadius).GetCellValue<double>(),
Comment = row.Cell(columnComment).GetCellValue<string?>()
};
return dto;
}
}