2024-03-14 10:03:57 +05:00
|
|
|
using System.Collections.Generic;
|
2024-03-12 12:01:33 +05:00
|
|
|
using System.IO;
|
|
|
|
using AsbCloudApp.Data;
|
2024-02-21 15:08:51 +05:00
|
|
|
using AsbCloudApp.Data.ProcessMaps;
|
2024-03-14 10:03:57 +05:00
|
|
|
using AsbCloudApp.Repositories;
|
2024-03-12 12:01:33 +05:00
|
|
|
using AsbCloudApp.Requests.ParserOptions;
|
2024-03-14 10:03:57 +05:00
|
|
|
using AsbCloudInfrastructure.Services.ExcelServices;
|
2024-02-09 11:32:31 +05:00
|
|
|
|
|
|
|
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
|
|
|
|
|
2024-03-12 12:01:33 +05:00
|
|
|
public abstract class ProcessMapPlanParser<TDto> : ParserExcelService<TDto, WellRelatedParserRequest>
|
2024-02-09 11:32:31 +05:00
|
|
|
where TDto : ProcessMapPlanBaseDto
|
|
|
|
{
|
2024-03-14 10:03:57 +05:00
|
|
|
protected readonly IEnumerable<WellSectionTypeDto> sections;
|
|
|
|
|
|
|
|
protected ProcessMapPlanParser(IWellOperationRepository wellOperationRepository)
|
|
|
|
{
|
|
|
|
sections = wellOperationRepository.GetSectionTypes();
|
|
|
|
}
|
|
|
|
|
2024-03-12 12:01:33 +05:00
|
|
|
public override ParserResultDto<TDto> Parse(Stream file, WellRelatedParserRequest options)
|
|
|
|
{
|
|
|
|
var result = base.Parse(file, options);
|
|
|
|
|
|
|
|
foreach (var item in result.Item)
|
|
|
|
item.Item.IdWell = options.IdWell;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2024-02-09 11:32:31 +05:00
|
|
|
protected static int? GetIdMode(string? modeName) =>
|
|
|
|
modeName?.Trim().ToLower() switch
|
|
|
|
{
|
|
|
|
"ротор" => 1,
|
|
|
|
"слайд" => 2,
|
|
|
|
_ => null
|
|
|
|
};
|
|
|
|
}
|