public void InitClient() { try { _proxyFactory = null; _proxyFactory = new ProxyFactory(this); _cmmCtrl = _proxyFactory.GetCmmControl(CmmSvrConfig); _partConfigService = _proxyFactory.GetPartConfigService(CmmSvrConfig); _IsInitialed = _cmmCtrl.IsInitialed(); // 返回服务器端是否初始化 _connected = true; if (_IsInitialed) { State = ClientState.CS_Idle; string cmmError = string.Format($"三坐标{CmmSvrConfig.ServerID} 初始化成功"); ClientUICommon.RefreshCmmEventLog(cmmError); } else { State = ClientState.CS_InitError; // string cmmError = string.Format($"三坐标{CmmSvrConfig.ServerID}没有初始化"); ClientUICommon.RefreshCmmEventLog(cmmError); } } catch (Exception ex) { _IsInitialed = false; // 初始化不成功 //string cmmError = string.Format($"三坐标{CmmSvrConfig.ServerID} 连接错误"); //_connected = false; //ClientUICommon.RefreshCmmEventLog(cmmError); //State = ClientState.CS_ConnectError; ReportConnectError(ex); } }
/// <summary> /// 启动cmm测量工作流 /// </summary> /// <param name="partId"></param> public void StartMeasureWorkFlow(string partId) { //CurPartId = partId; //if (!FindPart(partId)) //{ // // 提示未发现工件 // return; //} // 添加工件标识Dictionary到记录相同工件个数 lock (syncObj) { if (!_partNbSet.ContainsKey(partId)) { _partNbSet.Add(partId, 0); } } try { bool ok = SetServerPartConfig(partId); if (!ok) { Trace.Write("文件部署失败,请检查"); //State = State | ClientState.Error; return; } if (!_cmmCtrl.IsInitialed()) { Trace.Write("PCDMIS未初始化"); return; } // 启动测量 _cmmCtrl.MeasurePart(partId); } catch (Exception ex) { ReportConnectError(ex); } }