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 { #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 PropertyColumnNumbers => new Dictionary { { 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(), ZenithAngle = row.Cell(columnZenithAngle).GetCellValue(), AzimuthGeo = row.Cell(columnAzimuthGeo).GetCellValue(), AzimuthMagnetic = row.Cell(columnAzimuthMagnetic).GetCellValue(), VerticalDepth = row.Cell(columnVerticalDepth).GetCellValue(), Radius = row.Cell(columnRadius).GetCellValue(), Comment = row.Cell(columnComment).GetCellValue() }; return dto; } }