/// <summary> /// PCDMIS测量完成事件, 在这里异步执行PCDMIS分析过程 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public async void _pcdmisCore_PCDmisMeasureEvent(object sender, PCDmisEventArgs e) { if (!e.IsCompleted) { LogCollector.Instance.PostSvrErrorMessage("PCDMIS没有完成执行或执行出错"); if (e.FaultType == PCDmisFaultType.FT_FatalError) { ReinitialPCDmist(); } _serverInError = true; return; } LogCollector.Instance.PostSvrWorkStatus("PCDMIS执行完成"); if (!IsBladeMeasure) { return; } // 开启Blade异步分析 string bladeExe = ServerSettings.BladeExe; bool ok = await Task.Run(() => { bool result = _bladeMeasAssist.PCDmisRtfToBladeRpt(); // 转换rtf到rpt文件 if (!result) { _serverInError = true; return(result); } PathManager.Instance.RptFilePath = _bladeMeasAssist.RptFileName; // rptfilename 全路径 return(_bladeContext.StartBlade(bladeExe, _bladeMeasAssist.RptFileName)); }); if (ok) { LogCollector.Instance.PostSvrWorkStatus("Blade分析完成"); // 执行结果分析, 分析CMM文件 PathManager.Instance.ReportsPath = _bladeContext.CMMFileFullPath; bool measResult = _bladeMeasAssist.VerifyAnalysisResult(_bladeContext.CMMFileFullPath); // 如果客户端断开,跳出异常 try { _eventNotify?.WorkCompleted(measResult); // 通知客户端测量结果是否合格 LogCollector.Instance.PostSvrWorkStatus("检测流完成"); } catch (Exception) { LocalLogCollector.WriteMessage("与客户端连接异常"); } } else { LogCollector.Instance.PostSvrErrorMessage("Blade分析失败"); _serverInError = true; } }
private async Task <bool> RunBlade() { bool ok = await Task.Run(() => { string be = @"C:\Program Files (x86)\Hexagon\PC-DMIS Blade 5.0 (Release)\Blade.exe"; string rpt = @"D:\ServerPathRoot\blades\TestPart\Results\blade190121033341.rpt"; BladeContext bc = new BladeContext(10); return(bc.StartBlade(be, rpt)); }); return(ok); }