//异步,通信设备连接
        private void AsyCommDevConnect()
        {
            string reStr = "";

            devConnOK = true;
            //通信连接
            for (int i = 0; i < rfidRWs.Count(); i++)
            {
                string logStr = "";
                {
                    //  byte[] rfidRevBuf = null;
                    // if (!rfidRWs[i].Connect(ref rfidRevBuf))
                    if (!rfidRWs[i].Connect())
                    {
                        logStr = string.Format("{0} 号读卡器连接失败", rfidRWs[i].ReaderID);
                        logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.错误));
                        //devConnOK = false;
                    }
                    else
                    {
                        logStr = string.Format("{0} 号读卡器连接成功!", rfidRWs[i].ReaderID);
                        logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.提示));
                    }
                    view.WelcomeAddStartinfo(logStr);
                }
            }
            for (int i = 0; i < barcodeRWs.Count(); i++)
            {
                string logStr = "";
                if (!barcodeRWs[i].StartMonitor(ref reStr))
                {
                    logStr = string.Format("{0} 号条码枪连接失败{1}", barcodeRWs[i].ReaderID, reStr);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.错误));
                    //devConnOK = false;
                }
                else
                {
                    logStr = string.Format("{0} 号条码枪连接成功!", barcodeRWs[i].ReaderID);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.提示));
                }
                view.WelcomeAddStartinfo(logStr);
            }
            foreach (MingmeiDeviceAcc ccdDev in ccdRWs)
            {
                string logStr = "";
                if (!ccdDev.Connect(ref reStr))
                {
                    logStr = string.Format("CCD设备:{0} 连接失败{1}", ccdDev.Role, reStr);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.错误));
                }
                else
                {
                    logStr = string.Format("CCD设备:{0} 连接成功", ccdDev.Role);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.提示));
                }
            }


            view.WelcomeDispCurinfo("正在连接PLC...");
            for (int i = 0; i < plcRWs.Count(); i++)
            {
                string logStr = "";

                if (!plcRWs[i].ConnectPLC(ref reStr))
                {
                    if (!SysCfgModel.SimMode)
                    {
                        logStr = string.Format("{0} PLC连接失败,{1}", (plcRWs[i] as OmlPlcRW).PlcRole, reStr);
                        logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.错误));
                    }
                }
                else
                {
                    if (!SysCfgModel.SimMode)
                    {
                        logStr = string.Format("{0} PLC连接成功", (plcRWs[i] as OmlPlcRW).PlcRole);
                        logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.提示));
                    }
                }
            }
        }
        //异步,通信设备连接
        private void AsyCommDevConnect()
        {
            string reStr = "";

            devConnOK = true;
            //通信连接
            for (int i = 0; i < rfidRWs.Count(); i++)
            {
                string logStr = "";
                if ((rfidRWs[i] as SgrfidRW).ReaderIF.commType == SygoleHFReaderIF.EnumCommType.URAT)
                {
                    if (!(rfidRWs[i] as SgrfidRW).ReaderIF.OpenComport(ref reStr))
                    {
                        logStr = string.Format("{0} 号读卡器打卡端口失败,{1}", i + 1, reStr);
                        logRecorder.AddLog(new LogModel(objectName, reStr, EnumLoglevel.错误));
                        view.WelcomeAddStartinfo(logStr);
                        devConnOK = false;
                    }
                    if (!rfidRWs[i].Connect())
                    {
                        logStr = string.Format("{0} 号读卡器连接失败", i + 1);
                        logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.错误));
                        devConnOK = false;
                    }
                    else
                    {
                        logStr = string.Format("{0} 号读卡器连接成功!", i + 1);
                        logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.提示));
                    }
                    view.WelcomeAddStartinfo(logStr);
                }
                else
                {
                    //  byte[] rfidRevBuf = null;
                    // if (!rfidRWs[i].Connect(ref rfidRevBuf))
                    if (!rfidRWs[i].Connect())
                    {
                        logStr = string.Format("{0} 号读卡器连接失败", i + 1);
                        logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.错误));
                        devConnOK = false;
                    }
                    else
                    {
                        logStr = string.Format("{0} 号读卡器连接成功!", i + 1);
                        logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.提示));
                    }
                    view.WelcomeAddStartinfo(logStr);
                }
            }
            for (int i = 0; i < barcodeRWs.Count(); i++)
            {
                string logStr = "";
                if (!barcodeRWs[i].StartMonitor(ref reStr))
                {
                    logStr = string.Format("{0} 号条码枪端口打开失败,{1}", barcodeRWs[i].ReaderID, reStr);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.错误));
                    devConnOK = false;
                }
                else
                {
                    logStr = string.Format("{0} 号条码枪端口打开成功!", barcodeRWs[i].ReaderID);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.提示));
                }
                view.WelcomeAddStartinfo(logStr);
            }
            for (int i = 0; i < airDetectRWs.Count(); i++)
            {
                string logStr = "";
                if (!airDetectRWs[i].StartMonitor(ref reStr))
                {
                    logStr = string.Format("{0} 号气密仪端口打开失败,{1}", airDetectRWs[i].ReaderID, reStr);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.错误));
                    devConnOK = false;
                }
                else
                {
                    logStr = string.Format("{0} 号气密仪端口打开成功", airDetectRWs[i].ReaderID);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.提示));
                }
                view.WelcomeAddStartinfo(logStr);
            }
            for (int i = 0; i < printerRWs.Count(); i++)
            {
                string logStr = "";
                if (!printerRWs[i].Connect(ref reStr))
                {
                    logStr = string.Format("{0} 号打标机连接失败,{1}", printerRWs[i].ReaderID, reStr);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.错误));
                }
                else
                {
                    logStr = string.Format("{0} 号打标机连接成功", printerRWs[i].ReaderID);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.提示));
                }

                view.WelcomeAddStartinfo(logStr);
            }

            view.WelcomeDispCurinfo("正在连接主控PLC...");
            for (int i = 0; i < plcRWs.Count(); i++)
            {
                string logStr = "";
                if (!plcRWs[i].ConnectPLC(ref reStr))
                {
                    logStr = string.Format("{0} 号PLC连接失败,{1}", plcRWs[i].PlcID, reStr);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.错误));
                }
                else
                {
                    logStr = string.Format("{0} 号PLC连接成功", plcRWs[i].PlcID);
                    logRecorder.AddLog(new LogModel(objectName, logStr, EnumLoglevel.提示));
                }
            }
            //  devConnOK = true;//临时
            //if(!devConnOK)
            //{
            //    view.DispCommInfo("通信设备自检故障,可尝试重新自检");
            //}
        }