private void yure_Exe() { if (panel_js.BackColor != Color.LightCoral) { Msg(label_tishi, panel_tishi, "正在检查举升器...", false); setPanelColor(panel_js, Color.LightCoral); Thread.Sleep(1000); if (igbt != null) { igbt.Lifter_Down(); Thread.Sleep(1000); Msg(label_tishi, panel_tishi, "举升器下降请点右侧【确定】键", false); setPanelVisible(button_qd, true); while (!sure_value) { ; } Msg(label_tishi, panel_tishi, "举升器下降正常", false); setPanelVisible(button_qd, false); sure_value = false; igbt.Lifter_Up(); Thread.Sleep(1000); Msg(label_tishi, panel_tishi, "举升器上升请点右侧【确定】键", false); setPanelVisible(button_qd, true); while (!sure_value) { ; } setPanelVisible(button_qd, false); sure_value = false; Msg(label_tishi, panel_tishi, "举升器上升正常,将自动下降", false); igbt.Lifter_Down(); Thread.Sleep(1000); jsIsUp = false; } else { Msg(label_jstime, panel_jstime, "非预热项", false); } } if (panel_fxy.BackColor != Color.LightCoral) { Msg(label_tishi, panel_tishi, "正在检查废气仪...", false); setPanelColor(panel_fxy, Color.LightCoral); Thread.Sleep(1000); switch (UseFqy) { case "fla_502": if (fla_502 != null) { if (fla_502.Get_Struct() == "仪器通讯失败") { Msg(label_tishi, panel_tishi, "废气仪通讯失败,预热终止", false); setPanelColor(panel_fxy, Color.Red); return; } else { Msg(label_tishi, panel_tishi, "废气仪已开启,开始计时", false); fqy_starttime = DateTime.Now; fqystart = true; } } else { Msg(label_fqytime, panel_fqytime, "非预热项", false); } break; case "cdf5000": if (configdata.cd_fqy) { if (fla_502 != null) { if (fla_502.Get_Struct() == "仪器通讯失败") { Msg(label_tishi, panel_tishi, "废气仪通讯失败,预热终止", false); setPanelColor(panel_fxy, Color.Red); return; } else { Msg(label_tishi, panel_tishi, "废气仪已开启,开始计时", false); fqy_starttime = DateTime.Now; fqystart = true; } } else { Msg(label_fqytime, panel_fqytime, "非预热项", false); } } else { Msg(label_fqytime, panel_fqytime, "非预热项", false); } break; case "mqw_50a": case "mqw_50b": if (fla_502 != null) { if (fla_502.Get_Struct() == "仪器通讯失败") { Msg(label_tishi, panel_tishi, "废气仪通讯失败,预热终止", false); setPanelColor(panel_fxy, Color.Red); return; } else { Msg(label_tishi, panel_tishi, "废气仪已开启,开始计时", false); fqy_starttime = DateTime.Now; fqystart = true; } } else { Msg(label_fqytime, panel_fqytime, "非预热项", false); } break; case "fla_501": if (fla_501 != null) { Msg(label_tishi, panel_tishi, "废气仪已开启,开始计时", false); fqy_starttime = DateTime.Now; fqystart = true; } else { Msg(label_fqytime, panel_fqytime, "非预热项", false); } break; default: Msg(label_fqytime, panel_fqytime, "非预热项", false); break; } Thread.Sleep(1000); } if (panel_ydj.BackColor != Color.LightCoral) { Msg(label_tishi, panel_tishi, "正在检查烟度计...", false); setPanelColor(panel_ydj, Color.LightCoral); Thread.Sleep(1000); if (configdata.Ydjifpz) { if (configdata.Ydjxh.ToLower() == "cdf5000") { if (fla_502 != null) { Msg(label_tishi, panel_tishi, "烟度计已开启,开始计时", false); ydj_starttime = DateTime.Now; ydjstart = true; } else { Msg(label_tishi, panel_tishi, "烟度计通讯失败,预热终止", false); setPanelColor(panel_ydj, Color.Red); return; } } else if (flb_100 != null) { if (flb_100.Get_Mode() == "通讯故障") { Msg(label_tishi, panel_tishi, "烟度计通讯失败,预热终止", false); setPanelColor(panel_ydj, Color.Red); return; } else { Msg(label_tishi, panel_tishi, "烟度计已开启,开始计时", false); ydj_starttime = DateTime.Now; ydjstart = true; } } else { Msg(label_tishi, panel_tishi, "烟度计通讯失败,预热终止", false); setPanelColor(panel_ydj, Color.Red); return; } } else { Msg(label_ydjtime, panel_ydjtime, "非预热项", false); } Thread.Sleep(1000); } if (panel_llj.BackColor != Color.LightCoral) { Msg(label_tishi, panel_tishi, "正在检查流量计...", false); setPanelColor(panel_llj, Color.LightCoral); Thread.Sleep(1000); if (flv_1000 != null) { Msg(label_tishi, panel_tishi, "流量计已开启,开始计时", false); llj_starttime = DateTime.Now; lljstart = true; } else { Msg(label_lljtime, panel_lljtime, "非预热项", false); } Thread.Sleep(1000); } if (panel_cgj.BackColor != Color.LightCoral) { Msg(label_tishi, panel_tishi, "正在检查测功机...", false); setPanelColor(panel_cgj, Color.LightCoral); Thread.Sleep(3000); if (igbt != null) { Msg(label_tishi, panel_tishi, "电机即将开启,请注意安全", false); if (configdata.BpqMethod == "串口") { bpq.setMotorFre(40 * configdata.BpqXs); Thread.Sleep(20); bpq.turnOnMotor(); igbt.TurnOnRelay((byte)configdata.BpqDy); } else { //igbt.TurnOffRelay((byte)configdata.BpqDy); igbt.Motor_Open(); Thread.Sleep(500); igbt.Motor_Open(); } while (igbt.Speed < 39) { Thread.Sleep(1000); } cgj_starttime = DateTime.Now; cgjstart = true; } else { Msg(label_cgjtime, panel_cgjtime, "非预热项", false); } Thread.Sleep(1000); } Msg(label_tishi, panel_tishi, "正在预热", false); }
public void initEquipment() { bool Init_flag = true; string init_message = ""; //这里只初始化了废气分析仪其他设备要继续初始化 try { if (equipconfig.Ydjifpz == true) { if (equipconfig.Ydjxh != "CDF5000") { try { flb_100 = new Exhaust.FLB_100(equipconfig.Ydjxh); flb_100.isNhSelfUse = equipconfig.isYdjNhSelfUse; if (flb_100.Init_Comm(equipconfig.Ydjck, "9600,N,8,1") == false) { flb_100 = null; Init_flag = false; init_message += "烟度计串口打开失败."; Msg(label_msg, panel_msg, init_message, false); } else if (equipconfig.Ydjxh != "nht_1") { string ydjzt = flb_100.Get_Mode(); if (ydjzt.Contains("故障")) { ydjzt = flb_100.Get_Mode(); if (ydjzt.Contains("故障")) { init_message += "烟度计通讯异常"; Msg(label_msg, panel_msg, init_message, false); return; } else if (ydjzt.Contains("预热")) { init_message += "烟度计正在预热"; Msg(label_msg, panel_msg, init_message, false); return; } } else if (ydjzt.Contains("预热")) { init_message += "烟度计正在预热"; Msg(label_msg, panel_msg, init_message, false); return; } flb_100.Set_Measure(); Thread.Sleep(1000); timer1.Start(); } else { flb_100.Set_Measure(); Thread.Sleep(1000); timer1.Start(); } } catch (Exception er) { flb_100 = null; Init_flag = false; MessageBox.Show(er.ToString(), "出错啦"); } } else if (fla_502 == null) { try { fla_502 = new Exhaust.Fla502("cdf5000"); fla_502.isNhSelfUse = equipconfig.isFqyNhSelfUse; if (fla_502.Init_Comm(equipconfig.Fqyck, equipconfig.Fqyckpzz) == false) { fla_502 = null; Init_flag = false; init_message = "废气仪串口打开失败."; return; } fla_502.Set_Measure(); Thread.Sleep(1000); timer1.Start(); } catch (Exception er) { MessageBox.Show(er.ToString(), "出错啦"); fla_502 = null; Init_flag = false; } } } } catch (Exception) { } }