Esempio n. 1
0
        public async Task GetBladeHealthReport(Guid nodeId, NodeType nodeType, Guid taskId)
        {
            if (nodeType != NodeType.Site && nodeType != NodeType.Turbine && nodeType != NodeType.Blade)
            {
                throw new NotSupportedException($@"Node type {nodeType} is not supported for report generation.");
            }

            if (nodeType == NodeType.Blade)
            {
                var blade = _bladeService.GetBlade(nodeId);
                if (blade != null)
                {
                    nodeId   = blade.TurbineId;
                    nodeType = NodeType.Turbine;
                }
                else
                {
                    throw new Exception($@"There is no report for the selected tree nodeId: {nodeId} and nodeType: {nodeType}!");
                }
            }

            var defects = _defectService.GetDefectsForNodeLastInspection(nodeId, nodeType);

            if (!defects.Any())
            {
                throw new Exception($@"There is no report for the selected tree nodeId: {nodeId} and nodeType: {nodeType}!");
            }

            string bladeMapImagePath = HttpContext.Current.Server.MapPath("~/App_Data/blade_outline.png");
            string reportTemplate    = HttpContext.Current.Server.MapPath("~/App_Data/SiemensBladeHealthReport.docx");

            await _reportGeneratorManagerService.GenerateBladeHealthReport(
                defects.ToList(),
                bladeMapImagePath,
                reportTemplate,
                taskId,
                nodeType,
                nodeId);
        }
Esempio n. 2
0
        public BladeBreadcrumbDto GetBladeBreadcrumb(Guid bladeId)
        {
            Blade blade = _bladeService.GetBlade(bladeId);

            return(_mapper.Map <BladeBreadcrumbDto>(blade));
        }
Esempio n. 3
0
 public IdValue GetSiteByBladeId(Guid bladeId)
 {
     return(_mapper.Map <IdValue>(_bladeService.GetBlade(bladeId).Turbine.Site));
 }
Esempio n. 4
0
 public string Name(Guid bladeId)
 {
     return(_bladeService.GetBlade(bladeId).SerialNumber);
 }