forked from ddrilling/AsbCloudServer
38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using AsbCloudApp.Data;
|
|
using AsbCloudApp.Data.ProcessMaps;
|
|
using AsbCloudApp.Repositories;
|
|
using AsbCloudApp.Requests.ParserOptions;
|
|
using AsbCloudInfrastructure.Services.ExcelServices;
|
|
|
|
namespace AsbCloudInfrastructure.Services.ProcessMapPlan.Parser;
|
|
|
|
public abstract class ProcessMapPlanParser<TDto> : ParserExcelService<TDto, WellRelatedParserRequest>
|
|
where TDto : ProcessMapPlanBaseDto
|
|
{
|
|
protected readonly IEnumerable<WellSectionTypeDto> sections;
|
|
|
|
protected ProcessMapPlanParser(IWellOperationRepository wellOperationRepository)
|
|
{
|
|
sections = wellOperationRepository.GetSectionTypes();
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
protected static int? GetIdMode(string? modeName) =>
|
|
modeName?.Trim().ToLower() switch
|
|
{
|
|
"ротор" => 1,
|
|
"слайд" => 2,
|
|
_ => null
|
|
};
|
|
} |