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

54 lines
1.8 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using AsbCloudApp.Data.Trajectory;
using ClosedXML.Excel;
namespace AsbCloudInfrastructure.Services.Trajectory.Parser;
public class TrajectoryFactManualParser : TrajectoryParser<TrajectoryGeoFactDto>
{
#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 columnComment = 6;
#endregion
public TrajectoryFactManualParser(IServiceProvider serviceProvider)
: base(serviceProvider)
{
}
protected override string SheetName => "Фактическая траектория";
protected override string TemplateFileName => "TrajectoryFactManualTemplate.xlsx";
protected override IDictionary<string, int> PropertyColumnNumbers => new Dictionary<string, int>
{
{ nameof(TrajectoryGeoFactDto.WellboreDepth), columnWellboreDepth },
{ nameof(TrajectoryGeoFactDto.ZenithAngle), columnZenithAngle },
{ nameof(TrajectoryGeoFactDto.AzimuthGeo), columnAzimuthGeo },
{ nameof(TrajectoryGeoFactDto.AzimuthMagnetic), columnAzimuthMagnetic },
{ nameof(TrajectoryGeoFactDto.VerticalDepth), columnVerticalDepth },
{ nameof(TrajectoryGeoFactDto.Comment), columnComment }
};
protected override TrajectoryGeoFactDto ParseRow(IXLRow row)
{
var dto = new TrajectoryGeoFactDto
{
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>(),
Comment = row.Cell(columnComment).GetCellValue<string?>()
};
return dto;
}
}