Example #1
0
        public IEnumerable <SummaryViewDto> GetBladeSurfaceData(Guid nodeId, NodeType nodeType, Surface surface)
        {
            var defects = _defectService.GetDefectsForNode(nodeId, nodeType).Where(x => x.Surface == surface);

            var maxSeverityDictionarty = new Dictionary <int, Defect>();

            foreach (var defect in defects)
            {
                if (!defect.DistanceToRoot.HasValue)
                {
                    continue;
                }

                var meter = (int)Math.Floor(defect.DistanceToRoot.Value) + 1;

                if (!maxSeverityDictionarty.ContainsKey(meter))
                {
                    maxSeverityDictionarty.Add(meter, defect);
                }
                else
                {
                    if (maxSeverityDictionarty[meter].Severity < defect.Severity)
                    {
                        maxSeverityDictionarty[meter] = defect;
                    }
                }
            }

            var result = _mapper.Map <IEnumerable <SummaryViewDto> >(maxSeverityDictionarty.Values);

            return(result);
        }
Example #2
0
        public BladeOverviewDto Overview(Guid turbineId, BladePosition position, FindingsDataTableFilterModelDto findingsDataTableFilter)
        {
            FindingsQuery       query       = _mapper.Map <FindingsQuery>(findingsDataTableFilter);
            Blade               blade       = _bladeService.GetBlade(turbineId, position);
            IQueryable <Defect> defects     = _defectApiService.GetDefectsForNode(NodeType.Blade, blade.Id, query);
            BladeOverviewDto    overviewDto = new BladeOverviewDto
            {
                Id    = blade.Id.ToString(),
                Value = $"{blade.Position} - {blade.SerialNumber}"
            };

            AssignNumberOfDefectsPerSeverity(defects, overviewDto);

            return(overviewDto);
        }
        public IEnumerable <BladeMapDefectDto> GetData(NodeDto filter)
        {
            var defectQuery = _mapper.Map <FindingsQuery>(filter);

            defectQuery.UserId = CurrentUserId.Value;

            var defects = _defectService.GetDefectsForNode <BladeMapDefectDto>(filter.NodeId, filter.NodeType, defectQuery);

            return(defects);
        }
Example #4
0
        public async Task GetDataExtractReport(GetDataExtractReportDto extractReportDto)
        {
            var query = _mapper.Map <FindingsQuery>(extractReportDto);

            var defects = _defectService.GetDefectsForNode(extractReportDto.NodeId, extractReportDto.NodeType, query);

            var groupedDefects =
                defects.GroupBy(def => def.DefectGroupItem?.DefectGroupId ?? Guid.NewGuid())
                .SelectMany(deg => deg.OrderBy(def => def.Order).Take(1)).ToList();

            var imageLinks    = new Dictionary <string, string>();
            var deepZoomLinks = new Dictionary <string, string>();

            var excelTemplate = HttpContext.Current.Server.MapPath("~/App_Data/DataExtractReportTemplate.xltx");
            await _reportGeneratorManagerService.GenerateDataExtractReport(
                extractReportDto.GenerateImages,
                groupedDefects,
                excelTemplate,
                extractReportDto.TaskId,
                LocalUrlHelper.GetDefectImageOverviewLink,
                LocalUrlHelper.GetDefectDeepZoomLink);
        }