Exemplo n.º 1
0
 public void SetUserInfoToPLC()
 {
     try
     {
         PlcOmronTypeNJ plc = (PlcOmronTypeNJ)HardwareManage.dicHardwareDriver[HardwareName.PLC1];
         if (!plc.IsConnected())
         {
             MainModule.alarmManage.InsertAlarm(AppAlarmKeys.用户信息传输失败, "用户信息发送至PLC失败,PLC连接异常!");
             return;
         }
         plc.WriteData(PLC1.用户账户, WorldGeneralLib.Login.LoginManage.strCurrUserName);
         plc.WriteData(PLC1.用户等级, WorldGeneralLib.Login.LoginManage.iCurrUserLevel);
     }
     catch
     {
         MainModule.alarmManage.InsertAlarm(AppAlarmKeys.用户信息传输失败, "用户信息发送至PLC失败!");
     }
 }
Exemplo n.º 2
0
        public override void Process()
        {
            if (taskInfo.bTaskAlarm || MainModule.alarmManage.IsAlarm || IOManage.bEStop || !MainModule.formMain.bRunFlag)
            {
                taskInfo.iTaskStep           = MainModule.formMain.macHomeSta != MacHomeSta.Reseted ? 0 : taskInfo.iTaskStep;
                taskInfo.bTaskAlarm          = MainModule.formMain.bClrFlag ? false : taskInfo.bTaskAlarm;
                taskInfo.bTaskFinish         = false;
                taskInfo.bTaskOnGoing        = false;
                MainModule.formMain.bRunFlag = false;

                return;
            }

            taskInfo.bTaskAlarm   = false;
            taskInfo.bTaskOnGoing = true;
            switch (taskInfo.iTaskStep)
            {
            case 0:
                if (MainModule.formMain.bRunFlag)
                {
                    taskInfo.bTaskFinish  = false;
                    taskInfo.bTaskAlarm   = false;
                    taskInfo.bTaskOnGoing = true;
                    taskInfo.htTimer.Start();

                    _bMESRet = false;
                    taskHiperTimer.Start();
                    taskInfo.iTaskStep = 11;
                }
                break;

            case 11:
                taskGroup.AddRunMessage("等待清洗开始或者清洗完成...", OutputLevel.Trace);
                taskInfo.iTaskStep = 12;
                break;

            case 12:
                int iSta = 0;
                Int32.TryParse(mainPLC.plcData.dicScanItems[PLC1.工位4清洗状态].strValue, out iSta);

                if (100 == iSta || 101 == iSta)
                {
                    if (100 == iSta)
                    {
                        //通知PLC PC已经收到清洗开始信号
                        mainPLC.WriteData(PLC1.工位4清洗状态, 101);
                    }
                    //电芯清洗中开始采集数据
                    float fTemp1 = 0;
                    float fTemp2 = 0;
                    float.TryParse(remotePLC.plcData.dicScanItems[PLC2.工位4喷淋压力].strValue, out fTemp1);
                    float.TryParse(remotePLC.plcData.dicScanItems[PLC2.工位4干燥压力].strValue, out fTemp2);

                    fSprayingPressure = fTemp1 > fSprayingPressure ? fTemp1 : fSprayingPressure;
                    fDryingPressure   = fTemp2 > fDryingPressure ? fTemp2 : fDryingPressure;

                    break;
                }
                else if (110 == iSta)
                {
                    //电芯清洗完成
                    taskInfo.iTaskStep = 21;
                }
                else
                {
                    break;
                }
                mainPLC.WriteData(PLC1.工位4清洗状态, 0);
                taskGroup.AddRunMessage("电芯清洗完成,从PLC获取二维码信息...", OutputLevel.Trace);
                break;

            case 21:
                //获取二维码
                strInsideCode  = "";
                strOutsideCode = "";
                mainPLC.omronFinsAPI.ReadString(mainPLC.plcData.dicScanItems[PLC1.工位4二维码1], 32, ref strInsideCode);
                mainPLC.omronFinsAPI.ReadString(mainPLC.plcData.dicScanItems[PLC1.工位4二维码2], 32, ref strOutsideCode);

                strInsideCode  = strInsideCode.Replace('\0', ' ').Trim();
                strOutsideCode = strOutsideCode.Replace('\0', ' ').Trim();
                if (strInsideCode.Length < 1 || strOutsideCode.Length < 1)
                {
                    mainPLC.WriteData(PLC1.工位4清洗状态, 301);
                    strErr             = "从PLC获取二维码失败!";
                    taskInfo.iTaskStep = 501;
                    break;
                }

                taskGroup.AddRunMessage("获取二维码成功:", OutputLevel.Trace);
                taskGroup.AddRunMessage("内线二维码:" + strInsideCode, OutputLevel.Trace);
                taskGroup.AddRunMessage("外线二维码:" + strOutsideCode, OutputLevel.Trace);

                if (!Program.formStart.bMesSwitch)
                {
                    //MES屏蔽
                    mainPLC.WriteData(PLC1.工位4清洗状态, 200);

                    taskInfo.iTaskStep = 41;
                    break;
                }

                taskGroup.AddRunMessage("内线电芯MES数据上载开始...", OutputLevel.Trace);
                taskInfo.iTaskStep = 31;
                break;

            case 31:
                //上载内线电芯清洗数据
                MESRes       res;
                SprayingInfo info = new SprayingInfo();
                info.strSprayingPressure         = fSprayingPressure.ToString("0.0");
                info.strSprayingTime             = remotePLC.plcData.dicScanItems[PLC2.喷淋时间].strValue;
                info.strDryingPressure           = fDryingPressure.ToString("0.0");
                info.strBlowingResidualFluidTime = remotePLC.plcData.dicScanItems[PLC2.吹残液时间].strValue;
                info.strDryingTime = remotePLC.plcData.dicScanItems[PLC2.干燥时间].strValue;
                info.strOilTemp    = remotePLC.plcData.dicScanItems[PLC2.油温].strValue;

                res = MainModule.formMain.mes.DataCollectForSfcEx(strInsideCode, info);
                if (!res.bSuccess || null == res.miCheckResponse.@return || [email protected] != 0)
                {
                    //MES NG
                    mainPLC.WriteData(PLC1.工位4清洗状态, 302);
                    strErr = "内线电芯MES数据上载失败";
                    taskGroup.AddRunMessage("内线电芯MES数据上载失败!", OutputLevel.Warn);
                    taskInfo.iTaskStep = 41;

                    break;
                }

                taskGroup.AddRunMessage("内线电芯清洗数据上载成功,开始上载外线电芯清洗数据...", OutputLevel.Trace);
                res = MainModule.formMain.mes.DataCollectForSfcEx(strOutsideCode, info);
                if (!res.bSuccess || null == res.miCheckResponse.@return || [email protected] != 0)
                {
                    //MES NG
                    mainPLC.WriteData(PLC1.工位4清洗状态, 302);
                    strErr = "外线电芯清洗数据上载失败";
                    taskGroup.AddRunMessage("外线电芯清洗数据上载失败!", OutputLevel.Warn);
                    taskInfo.iTaskStep = 41;

                    break;
                }

                _bMESRet = true;
                mainPLC.WriteData(PLC1.工位4清洗状态, 200);
                taskGroup.AddRunMessage("上载完成,正常终了。", OutputLevel.Trace);
                taskInfo.iTaskStep = 41;
                break;

            case 41:
                taskGroup.AddRunMessage("写出csv文件...");

                MESLocalData data = new MESLocalData();

                #region Set MES local data1
                data.strBarcode    = strInsideCode;
                data.strTime       = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace('/', '-');
                data.strResourceID = DataManage.StrValue(DataGroups.DataGroupMESDataCollectParam, DataItemMESDataCollectParam.resource);
                if (!Program.formStart.bMesSwitch)
                {
                    data.strMESResult = "Disable";
                }
                else
                {
                    data.strMESResult = _bMESRet ? "OK" : "NG";
                }
                data.strCleanResult           = remotePLC.plcData.dicScanItems[PLC2.清洗结果].strValue.Equals("1") ? "OK" : "NG";
                data.strSprPre                = fSprayingPressure.ToString("0.0");
                data.strSprPreMaxSettingVal   = remotePLC.plcData.dicScanItems[PLC2.清洗喷淋压力设定上限].strValue;
                data.strSprPreMinSettingVal   = remotePLC.plcData.dicScanItems[PLC2.清洗喷淋压力设定下限].strValue;
                data.strSprTime               = remotePLC.plcData.dicScanItems[PLC2.喷淋时间].strValue;
                data.strSprTimeSettingVal     = data.strSprTime;
                data.strDryPre                = fDryingPressure.ToString("0.0");
                data.strDryPreMaxSettingVal   = remotePLC.plcData.dicScanItems[PLC2.干燥压力设定上限].strValue;
                data.strDryPreMinSettingVal   = remotePLC.plcData.dicScanItems[PLC2.干燥压力设定下限].strValue;
                data.strDryTime               = remotePLC.plcData.dicScanItems[PLC2.干燥时间].strValue;
                data.strDryTimeSettingVal     = data.strDryTime;
                data.strBlowingTime           = remotePLC.plcData.dicScanItems[PLC2.吹残液时间].strValue;
                data.strBlowingTimeSettingVal = data.strBlowingTime;
                data.strOilTemp               = remotePLC.plcData.dicScanItems[PLC2.油温].strValue;
                data.strOilTempSettingVal     = data.strOilTemp;
                #endregion

                WriteMesFile.WriteToCsvFile(data);
                data.strBarcode = strOutsideCode;
                WriteMesFile.WriteToCsvFile(data);

                Program.formStart.ShowCleanResult(strInsideCode, "Station 1", fSprayingPressure.ToString("0.0"), remotePLC.plcData.dicScanItems[PLC2.喷淋时间].strValue,
                                                  fDryingPressure.ToString("0.0"), remotePLC.plcData.dicScanItems[PLC2.吹残液时间].strValue, remotePLC.plcData.dicScanItems[PLC2.干燥时间].strValue, remotePLC.plcData.dicScanItems[PLC2.油温].strValue, _bMESRet);
                Program.formStart.ShowCleanResult(strOutsideCode, "Station 1", fSprayingPressure.ToString("0.0"), remotePLC.plcData.dicScanItems[PLC2.喷淋时间].strValue,
                                                  fDryingPressure.ToString("0.0"), remotePLC.plcData.dicScanItems[PLC2.吹残液时间].strValue, remotePLC.plcData.dicScanItems[PLC2.干燥时间].strValue, remotePLC.plcData.dicScanItems[PLC2.油温].strValue, _bMESRet);

                if (_bMESRet || !Program.formStart.bMesSwitch)
                {
                    taskInfo.iTaskStep = 601;
                }
                else
                {
                    taskInfo.iTaskStep = 501;
                }
                break;

                #region Error 501-600
            case 501:     //致命异常,需重新开始
                taskInfo.bTaskOnGoing = false;
                taskInfo.bTaskFinish  = false;
                taskInfo.bTaskAlarm   = true;
                taskInfo.iTaskStep    = 0;

                fSprayingPressure = 0;
                fDryingPressure   = 0;

                mainPLC.plcData.dicScanItems[PLC1.工位4清洗状态].strValue = "0";
                taskGroup.AddRunMessage(strErr, OutputLevel.Warn);
                MainModule.alarmManage.InsertAlarm(AppAlarmKeys.扫码异常, strErr);
                break;

            case 502:       //一般异常,解除后按下开始可以继续
                taskInfo.bTaskOnGoing = false;
                taskInfo.bTaskFinish  = false;
                taskInfo.bTaskAlarm   = true;
                taskInfo.strTaskMes   = "异常报警解除后,可以继续执行。";
                taskInfo.iTaskStep    = taskInfo.iTaskAlarmStep;

                fSprayingPressure = 0;
                fDryingPressure   = 0;

                mainPLC.plcData.dicScanItems[PLC1.工位4清洗状态].strValue = "0";
                taskGroup.AddRunMessage(strErr, OutputLevel.Warn);
                MainModule.alarmManage.InsertAlarm(AppAlarmKeys.扫码异常, strErr);
                break;

                #endregion
                #region Success 601 - 999
            case 601:
                taskInfo.bTaskOnGoing   = false;
                taskInfo.bTaskFinish    = true;
                taskInfo.bTaskAlarm     = false;
                taskInfo.iTaskStep      = 0;
                taskInfo.iTaskAlarmStep = 0;

                fSprayingPressure = 0;
                fDryingPressure   = 0;

                mainPLC.plcData.dicScanItems[PLC1.工位4清洗状态].strValue = "0";
                taskGroup.AddRunMessage("正常终了。", OutputLevel.Trace);
                break;

                #endregion
            default:
                taskInfo.iTaskStep  = 0;
                taskInfo.bTaskAlarm = true;
                break;
            }
        }
Exemplo n.º 3
0
        public override void Process()
        {
            if (taskInfo.bTaskAlarm || MainModule.alarmManage.IsAlarm || IOManage.bEStop || !MainModule.formMain.bRunFlag || null == _plcDriver)
            {
                taskInfo.iTaskStep           = MainModule.formMain.macHomeSta != MacHomeSta.Reseted ? 0 : taskInfo.iTaskStep;
                taskInfo.bTaskAlarm          = MainModule.formMain.bClrFlag ? false : taskInfo.bTaskAlarm;
                taskInfo.bTaskFinish         = false;
                taskInfo.bTaskOnGoing        = false;
                MainModule.formMain.bRunFlag = false;

                return;
            }

            taskInfo.bTaskAlarm   = false;
            taskInfo.bTaskOnGoing = true;
            switch (taskInfo.iTaskStep)
            {
            case 0:
                if (MainModule.formMain.bRunFlag)
                {
                    taskInfo.bTaskFinish  = false;
                    taskInfo.bTaskAlarm   = false;
                    taskInfo.bTaskOnGoing = true;
                    taskInfo.htTimer.Start();

                    taskInfo.iTaskStep = 1;
                }
                break;

            case 1:
                taskGroup.AddRunMessage("等待扫码开始...", OutputLevel.Trace);
                taskInfo.iTaskStep = 10;
                break;

            case 10:
                if (!_plcDriver.plcData.dicScanItems[PLC1.内线扫码触发].strValue.Equals("100") || !_plcDriver.plcData.dicScanItems[PLC1.外线扫码触发].strValue.Equals("100"))
                {
                    break;
                }
                taskGroup.AddRunMessage("收到扫码触发信号,开始扫码...", OutputLevel.Trace);
                taskInfo.iTaskStep = 21;
                break;

            case 21:
                //开始读码
                if (null == insideCodeReader || null == outsideCodeReader)
                {
                    _plcDriver.WriteData(PLC1.内线扫码触发, 300);
                    _plcDriver.WriteData(PLC1.外线扫码触发, 300);

                    strErr             = "未发现读码器";
                    taskInfo.iTaskStep = 501;
                    break;
                }

                insideCodeReader.RecvData  = string.Empty;
                outsideCodeReader.RecvData = string.Empty;
                CodeReaderRes res1 = insideCodeReader.Read();     //以异步方式读取内线二维码
                CodeReaderRes res2 = outsideCodeReader.Read();    //以异步方式读取外线二维码
                if (res1 != CodeReaderRes.SUCCESS || res2 != CodeReaderRes.SUCCESS)
                {
                    //读码命令发送失败
                    _plcDriver.WriteData(PLC1.内线扫码触发, 300);
                    _plcDriver.WriteData(PLC1.外线扫码触发, 300);

                    strErr             = GetErrMsg(res1, res2);
                    taskInfo.iTaskStep = 501;
                    Program.formStart.formProductInfo.iScanNgCount++;
                    Program.formStart.ShowScanResult(false, 0, insideCodeReader.RecvData, outsideCodeReader.RecvData, strErr);

                    break;
                }
                taskGroup.AddRunMessage("读码命令发送成功,等待读码完成...", OutputLevel.Trace);
                taskHiperTimer.Start();
                taskInfo.iTaskStep = 22;
                break;

            case 22:
                //等待读码完成
                int iTimeout = 500;
                if (DataManage.docData.dicDataGroup.ContainsKey(DataGroups.DataGroupSystem) &&
                    DataManage.docData.dicDataGroup[DataGroups.DataGroupSystem].dicDataItem.ContainsKey(DataItemSystem.等待读码完成时间))
                {
                    iTimeout = DataManage.IntValue(DataGroups.DataGroupSystem, DataItemSystem.等待读码完成时间);
                }
                if (!string.IsNullOrEmpty(insideCodeReader.RecvData) && !string.IsNullOrEmpty(outsideCodeReader.RecvData))
                {
                    if (insideCodeReader.RecvData.Contains("ERROR") || outsideCodeReader.RecvData.Contains("ERROR"))
                    {
                        //读码失败
                        _plcDriver.WriteData(PLC1.内线扫码触发, 300);
                        _plcDriver.WriteData(PLC1.外线扫码触发, 300);

                        strErr             = "解码失败!";
                        taskInfo.iTaskStep = 501;
                        Program.formStart.formProductInfo.iScanNgCount++;
                        Program.formStart.ShowScanResult(false, (float)taskHiperTimer.Duration * 1000, insideCodeReader.RecvData, outsideCodeReader.RecvData, strErr);
                        break;
                    }
                    insideCodeReader.RecvData.Replace('\r', ' ');
                    insideCodeReader.RecvData.Replace('\n', ' ');
                    insideCodeReader.RecvData.Trim();
                    outsideCodeReader.RecvData.Replace('\r', ' ');
                    outsideCodeReader.RecvData.Replace('\n', ' ');
                    outsideCodeReader.RecvData.Trim();
                    taskInfo.iTaskStep = 31;
                }
                else if (taskHiperTimer.TimeUp((double)((double)iTimeout / 1000.0)))
                {
                    //读码超时
                    _plcDriver.WriteData(PLC1.内线扫码触发, 300);
                    _plcDriver.WriteData(PLC1.外线扫码触发, 300);

                    strErr             = "读码超时!";
                    taskInfo.iTaskStep = 501;
                    Program.formStart.formProductInfo.iScanNgCount++;
                    Program.formStart.ShowScanResult(false, (float)taskHiperTimer.Duration * 1000, insideCodeReader.RecvData, outsideCodeReader.RecvData, strErr);
                }
                break;

            case 31:
                //读码成功
                taskGroup.AddRunMessage("读码成功: " + "<" + insideCodeReader.RecvData + ">  <" + outsideCodeReader.RecvData + ">", OutputLevel.Trace);
                _plcDriver.WriteData(PLC1.内线二维码, insideCodeReader.RecvData);
                _plcDriver.WriteData(PLC1.外线二维码, outsideCodeReader.RecvData);

                Program.formStart.formProductInfo.iScanOkCount++;
                Program.formStart.ShowScanResult(true, (float)taskHiperTimer.Duration * 1000, insideCodeReader.RecvData, outsideCodeReader.RecvData, "");
                if (!Program.formStart.bMesSwitch)
                {
                    //MES屏蔽
                    _plcDriver.WriteData(PLC1.内线扫码触发, 200);
                    _plcDriver.WriteData(PLC1.外线扫码触发, 200);

                    taskInfo.iTaskStep = 601;
                    break;
                }

                taskGroup.AddRunMessage("开始进行电芯进站校验...", OutputLevel.Trace);

                taskInfo.iTaskStep = 41;
                break;

            case 41:
                //调用MES 进行电芯进站校验
                MESRes mesRes1 = MainModule.formMain.mes.CheckSfcStatus(insideCodeReader.RecvData);
                MESRes mesRes2 = MainModule.formMain.mes.CheckSfcStatus(outsideCodeReader.RecvData);
                if (!mesRes1.bSuccess || !mesRes2.bSuccess)
                {
                    //MES 调用失败
                    _plcDriver.WriteData(PLC1.内线扫码触发, 400);
                    _plcDriver.WriteData(PLC1.外线扫码触发, 400);

                    strErr             = "MES 调用失败,请检查网络与MES设置!";
                    taskInfo.iTaskStep = 501;
                    break;
                }
                if ([email protected] != 0 || [email protected] != 0)
                {
                    //电芯进站校验未通过
                    if ([email protected] != 0 && [email protected] != 0)
                    {
                        strErr = "内线与外线电芯进站校验均未通过!";
                    }
                    else if ([email protected] != 0)
                    {
                        strErr = "内线电芯进站校验未通过!";
                    }
                    else
                    {
                        strErr = "外线电芯进站校验未通过!";
                    }
                    _plcDriver.WriteData(PLC1.内线扫码触发, 400);
                    _plcDriver.WriteData(PLC1.外线扫码触发, 400);

                    taskInfo.iTaskStep = 501;
                    break;
                }

                //MES 调用成功,电芯进站校验通过
                _plcDriver.WriteData(PLC1.内线扫码触发, 200);
                _plcDriver.WriteData(PLC1.外线扫码触发, 200);

                taskGroup.AddRunMessage("电芯进站校验通过!", OutputLevel.Trace);
                taskInfo.iTaskStep = 51;
                taskHiperTimer.Start();
                break;

            case 51:
                if (!taskHiperTimer.TimeUp(0.5))
                {
                    break;
                }
                taskInfo.iTaskStep = 601;
                break;

                #region Error 501-600
            case 501:     //致命异常,需重新开始
                taskInfo.bTaskOnGoing = false;
                taskInfo.bTaskFinish  = false;
                taskInfo.bTaskAlarm   = true;
                taskInfo.iTaskStep    = 0;

                _plcDriver.plcData.dicScanItems[PLC1.内线扫码触发].strValue = "0";
                _plcDriver.plcData.dicScanItems[PLC1.外线扫码触发].strValue = "0";
                taskGroup.AddRunMessage(strErr, OutputLevel.Warn);
                MainModule.alarmManage.InsertAlarm(AppAlarmKeys.扫码异常, strErr);
                break;

            case 502:       //一般异常,解除后按下开始可以继续
                taskInfo.bTaskOnGoing = false;
                taskInfo.bTaskFinish  = false;
                taskInfo.bTaskAlarm   = true;
                taskInfo.strTaskMes   = "异常报警解除后,可以继续执行。";
                taskInfo.iTaskStep    = taskInfo.iTaskAlarmStep;

                _plcDriver.plcData.dicScanItems[PLC1.内线扫码触发].strValue = "0";
                _plcDriver.plcData.dicScanItems[PLC1.外线扫码触发].strValue = "0";
                taskGroup.AddRunMessage(strErr, OutputLevel.Warn);
                MainModule.alarmManage.InsertAlarm(AppAlarmKeys.扫码异常, strErr);
                break;

                #endregion
                #region Success 601 - 999
            case 601:
                taskInfo.bTaskOnGoing   = false;
                taskInfo.bTaskFinish    = true;
                taskInfo.bTaskAlarm     = false;
                taskInfo.iTaskStep      = 0;
                taskInfo.iTaskAlarmStep = 0;

                _plcDriver.plcData.dicScanItems[PLC1.内线扫码触发].strValue = "0";
                _plcDriver.plcData.dicScanItems[PLC1.外线扫码触发].strValue = "0";
                taskGroup.AddRunMessage("正常终了。", OutputLevel.Trace);
                break;

                #endregion
            default:
                taskInfo.iTaskStep  = 0;
                taskInfo.bTaskAlarm = true;
                break;
            }
        }
Exemplo n.º 4
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            #region Clr button pressed handle
            if (_bClrAllAlarm)
            {
                if (MainModule.alarmManage.IsAlarm && _bClrAllAlarm)
                {
                    MainModule.alarmManage.RemoveAllAlarm();
                }
                _bClrAllAlarm = false;
            }
            #endregion
            #region Set toolStripStatus
            if (null == _codereader1 && HardwareManage.dicHardwareDriver.ContainsKey(HardwareName.内线读码器))
            {
                _codereader1 = (KeyenceSR700)HardwareManage.dicHardwareDriver[HardwareName.内线读码器];
            }
            if (null == _codereader2 && HardwareManage.dicHardwareDriver.ContainsKey(HardwareName.外线读码器))
            {
                _codereader2 = (KeyenceSR700)HardwareManage.dicHardwareDriver[HardwareName.外线读码器];
            }
            if (null != _plc1 && null != _plc2)
            {
                MainModule.formMain.SetPLCStatus(1, _plc1.IsConnected());
                MainModule.formMain.SetPLCStatus(2, _plc2.IsConnected());

                //if (!_plc1.IsConnected())
                //    MainModule.alarmManage.InsertAlarm(AppAlarmKeys.与主控PLC连接断开, "与主控PLC连接断开,请检查PLC是否已上电以及网络连接是否正常。");
                //else
                //    MainModule.alarmManage.RemoveAlarm(AppAlarmKeys.与主控PLC连接断开);
                //if (!_plc2.IsConnected())
                //    MainModule.alarmManage.InsertAlarm(AppAlarmKeys.与清洗机PLC连接断开, "与清洗机PLC连接断开,请检查PLC是否已上电以及网络连接是否正常。");
                //else
                //    MainModule.alarmManage.RemoveAlarm(AppAlarmKeys.与清洗机PLC连接断开);
            }
            if (null != _codereader1 && null != _codereader2)
            {
                MainModule.formMain.SetCodeReaderStatus(1, _codereader2.IsConnected());
                MainModule.formMain.SetCodeReaderStatus(2, _codereader2.IsConnected());

                //if (!_codereader1.IsConnected())
                //    MainModule.alarmManage.InsertAlarm(AppAlarmKeys.与内线读码器连接断开, "与内线读码器连接断开。");
                //else
                //    MainModule.alarmManage.RemoveAlarm(AppAlarmKeys.与内线读码器连接断开);

                //if (!_codereader2.IsConnected())
                //    MainModule.alarmManage.InsertAlarm(AppAlarmKeys.与外线读码器连接断开, "与外线读码器连接断开。");
                //else
                //    MainModule.alarmManage.RemoveAlarm(AppAlarmKeys.与外线读码器连接断开);
            }
            #endregion
            #region Write PC status to PLC
            try
            {
                if (null != _plc1 && _plc1.IsConnected())
                {
                    int iPCAlarmSta = MainModule.alarmManage.IsAlarm ? 1 : 0;
                    if (!iPCAlarmSta.ToString().Equals(_plc1.plcData.dicScanItems[PLC1.位机状态].strValue))
                    {
                        _plc1.WriteData(PLC1.位机状态, iPCAlarmSta);
                    }
                }
            }
            catch (Exception)
            {
            }
            #endregion
        }