2024-06-26 13:01:06 +05:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using AsbCloudApp.Data.ProcessMaps;
|
2024-06-30 21:02:55 +05:00
|
|
|
using AsbCloudApp.Data.ProcessMaps.Functions;
|
2024-06-26 13:01:06 +05:00
|
|
|
using AsbCloudApp.Repositories;
|
|
|
|
using AsbCloudInfrastructure.Services.ExcelServices.Templates;
|
|
|
|
using AsbCloudInfrastructure.Services.ExcelServices.Templates.ProcessMapPlanTemplates;
|
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
|
|
|
|
|
2024-06-29 23:32:34 +05:00
|
|
|
public class ProcessMapPlanDamperParser : ProcessMapPlanParser<ProcessMapPlanDamperDto>
|
2024-06-26 13:01:06 +05:00
|
|
|
{
|
2024-07-04 11:02:45 +05:00
|
|
|
public ProcessMapPlanDamperParser(IWellOperationRepository wellOperationRepository)
|
|
|
|
: base(wellOperationRepository)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override ITemplateParameters TemplateParameters => new ProcessMapPlanDamperTemplate();
|
|
|
|
|
|
|
|
protected override ProcessMapPlanDamperDto 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;
|
|
|
|
}
|
2024-06-26 13:01:06 +05:00
|
|
|
}
|