/// <summary> /// 对3个按钮进行判断,判断哪一个按钮被按下 /// </summary> /// <param name="sender"></param> public void btn_MouseDown(object sender) { A0开机画面 parent = (A0开机画面)Parent.FindForm(); System.Windows.Forms.Button button = (System.Windows.Forms.Button)sender; var rsno = false; switch (button.Name) { case "btn_Recipe_Save": rsno = device.BaseProtocol.WriteReg("DB99.DBB38", 1); if (rsno == true) { btn_Recipe_Save.BackColor = Color.MediumSeaGreen; parent.showLog(device.typeName + device.index + "配方保存操作执行成功"); btn_Recipe_Save.Focus(); Btn_Recipe_Save_GotFocus1(); } else { MessageBox.Show("配方保存操作执行失败"); parent.showLog(device.typeName + device.index + "配方保存操作执行失败"); } break; case "btn_Recipe_Read": rsno = device.BaseProtocol.WriteReg("DB99.DBB38", 2); if (rsno == true) { btn_Recipe_Read.BackColor = Color.MediumSeaGreen; parent.showLog(device.typeName + device.index + "配方读取操作执行成功"); btn_Recipe_Read.Focus(); //当读取配方按钮得到焦点后 Btn_Recipe_Read_GotFocus(); } else { MessageBox.Show("配方读取操作执行失败"); parent.showLog(device.typeName + device.index + "配方读取操作执行失败"); } break; case "btn_Recipe_OK": rsno = device.BaseProtocol.WriteReg("DB99.DBB38", 4); if (rsno == true) { btn_Recipe_OK.BackColor = Color.MediumSeaGreen; parent.showLog(device.typeName + device.index + "配方确认操作执行成功"); } else { MessageBox.Show("配方确认操作执行失败"); parent.showLog(device.typeName + device.index + "配方确认操作执行失败"); } break; } //按下按钮后自动开始计时 TimerCloseRead.Enabled = true; }
//对3个按钮进行判断,判断哪一个按钮被按下 public void btn_MouseDown(object sender) { A0开机画面 parent = (A0开机画面)Parent.FindForm(); System.Windows.Forms.Button button = (System.Windows.Forms.Button)sender; int rsno = 0; switch (button.Name) { case "btn_Recipe_Save": rsno = CS7TCP.WriteBool(Z通讯设置.plcHandle, 0x84, device.address, 63, 0, 1); if (rsno == 0) { btn_Recipe_Save.BackColor = Color.LightGreen; parent.showLog(device.typeName + device.index + "配方保存操作执行成功"); //插入数据到数据库数据表进行记录 saveToDatabaseTable(); } else { parent.showLog(device.typeName + device.index + "配方保存操作执行失败"); MessageBox.Show("配方保存操作执行失败"); } break; case "btn_Recipe_Read": rsno = CS7TCP.WriteBool(Z通讯设置.plcHandle, 0x84, device.address, 63, 1, 1); if (rsno == 0) { btn_Recipe_Read.BackColor = Color.LightGreen; parent.showLog(device.typeName + device.index + "配方读取操作执行成功"); } else { parent.showLog(device.typeName + device.index + "配方读取操作执行失败"); MessageBox.Show("配方读取操作执行失败"); } break; case "btn_Recipe_OK": rsno = CS7TCP.WriteBool(Z通讯设置.plcHandle, 0x84, device.address, 63, 2, 1); if (rsno == 0) { btn_Recipe_OK.BackColor = Color.LightGreen; parent.showLog(device.typeName + device.index + "配方确认操作执行成功"); //插入数据到数据库数据表进行记录 saveToDatabaseTable(); } else { parent.showLog(device.typeName + device.index + "配方确认操作执行失败"); MessageBox.Show("配方确认操作执行失败"); } break; } //按下按钮后自动开始计时 TimerCloseRead.Enabled = true; }
/// <summary> /// 主界面参数修改按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { A0开机画面 parent = (A0开机画面)Parent.FindForm(); System.Windows.Forms.Button button = (System.Windows.Forms.Button)sender; switch (button.Name) { case "btnSave": btnSave.Focus(); //btnSave.GotFocus += BtnSave_GotFocus; BtnSave_GotFocus(); chbCheck.Enabled = false; chbAutoTestHeight.Enabled = false; chbAutomation.Enabled = false; chbTiaomachoice.Enabled = false; btnHeightBiaoDing.Enabled = false; txbInputHeight.Enabled = false; txbSpeedWrite.Enabled = false; txbProtectTime.Enabled = false; AutoHeightTest.Enabled = false; txbHeightValue.Enabled = false; btnSave.Enabled = false; btnEditor.Enabled = true; break; case "btnEditor": chbCheck.Enabled = true; chbAutoTestHeight.Enabled = true; chbAutomation.Enabled = true; chbTiaomachoice.Enabled = true; btnHeightBiaoDing.Enabled = true; txbInputHeight.Enabled = true; txbSpeedWrite.Enabled = true; txbProtectTime.Enabled = true; AutoHeightTest.Enabled = true; txbHeightValue.Enabled = true; btnEditor.Enabled = false; btnSave.Enabled = true; MessageBox.Show("编辑完参数后请点击保存按钮"); break; } }
//判定离开后开始执行写入指令 //配方参数输入,,,,,,对话框中参数输入 public void handleInputComplete(object sender) { System.Windows.Forms.TextBox _textbox = (System.Windows.Forms.TextBox)sender; switch (_textbox.Name) { //主输送线速度写入 case "txb_Control_Conveyor_Main": UInt32 Write_Conveyor_Main = 0; //定义读取变量 if (txb_Control_Conveyor_Main.Text.Trim() == "") { UInt32 ReadBack_Write_Conveyor_Main = 0; CS7TCP.ReadWord(Z通讯设置.plcHandle, 0x84, device.address, 0, ref ReadBack_Write_Conveyor_Main); txb_Control_Conveyor_Main.Text = Convert.ToString(Convert.ToDecimal(ReadBack_Write_Conveyor_Main) / 10); MessageBox.Show("参数区间在1-20之间,请输入适当的参数"); } else { Write_Conveyor_Main = Convert.ToUInt32(Convert.ToDecimal(txb_Control_Conveyor_Main.Text.ToString()) * 10); //转换成String格式然后显示在textbox里面 if (Convert.ToUInt32(Convert.ToDecimal(txb_Control_Conveyor_Main.Text) * 10) <= 200 && Convert.ToUInt32(Convert.ToDecimal(txb_Control_Conveyor_Main.Text) * 10) >= 0) { int resno = CS7TCP.WriteWord(Z通讯设置.plcHandle, 0x84, device.address, 0, Write_Conveyor_Main); //写入配方编号 if (resno == 0) { A0开机画面 parent = (A0开机画面)Parent.FindForm(); parent.showLog(" 输送线速度写入成功!"); } else { MessageBox.Show("输送线速度写入失败,请重新输入"); } } else { UInt32 ReadBack_Write_Conveyor_Main = 0; CS7TCP.ReadWord(Z通讯设置.plcHandle, 0x84, device.address, 0, ref ReadBack_Write_Conveyor_Main); txb_Control_Conveyor_Main.Text = Convert.ToString(Convert.ToDecimal(ReadBack_Write_Conveyor_Main) / 10); MessageBox.Show("参数区间在1-20之间,请输入适当的参数"); } } break; //第一组高度设定写入 case "txb_Control_Brush_Height": UInt32 Write_App1_Height = 0; //定义读取变量 if (txb_Control_Brush_Height.Text.Trim() == "") { UInt32 ReadBack_Write_App1_Height = 0; CS7TCP.ReadWord(Z通讯设置.plcHandle, 0x84, device.address, 2, ref ReadBack_Write_App1_Height); txb_Control_Brush_Height.Text = Convert.ToString(Convert.ToDecimal(ReadBack_Write_App1_Height) / 100); MessageBox.Show("参数区间在1-200之间,请输入适当的参数"); } else { Write_App1_Height = Convert.ToUInt32(Convert.ToDecimal(txb_Control_Brush_Height.Text.ToString()) * 100); //转换成String格式然后显示在textbox里面 if (Convert.ToUInt32(Convert.ToDecimal(txb_Control_Brush_Height.Text) * 100) <= 20000 && Convert.ToUInt32(Convert.ToDecimal(txb_Control_Brush_Height.Text) * 100) > 0) { int resno = CS7TCP.WriteWord(Z通讯设置.plcHandle, 0x84, device.address, 2, Write_App1_Height); //写入配方编号 if (resno == 0) { A0开机画面 parent = (A0开机画面)Parent.FindForm(); parent.showLog(" 第一组高度参数写入成功!"); } else { MessageBox.Show("第一组高度参数写入失败,请重新输入"); } } else { UInt32 ReadBack_Write_App1_Height = 0; CS7TCP.ReadWord(Z通讯设置.plcHandle, 0x84, device.address, 2, ref ReadBack_Write_App1_Height); txb_Control_Brush_Height.Text = Convert.ToString(Convert.ToDecimal(ReadBack_Write_App1_Height) / 100); MessageBox.Show("参数区间在1-200之间,请输入适当的参数"); } } break; //第一组高度误差补偿设定写入 case "txb_Control_Brush_buchang": UInt32 Write_App1_buchang = 0; //定义读取变量 if (txb_Control_Brush_buchang.Text.Trim() == "") { UInt32 ReadBack_Write_App1_buchang = 0; CS7TCP.ReadWord(Z通讯设置.plcHandle, 0x84, device.address, 4, ref ReadBack_Write_App1_buchang); txb_Control_Brush_buchang.Text = Convert.ToString(Convert.ToDecimal(ReadBack_Write_App1_buchang) / 100); MessageBox.Show("参数区间在1-20之间,请输入适当的参数"); } else { Write_App1_buchang = Convert.ToUInt32(Convert.ToDecimal(txb_Control_Brush_buchang.Text.ToString()) * 100); //转换成String格式然后显示在textbox里面 if (Convert.ToUInt32(Convert.ToDecimal(txb_Control_Brush_buchang.Text) * 100) <= 10000 && Convert.ToUInt32(Convert.ToDecimal(txb_Control_Brush_buchang.Text) * 100) >= 0) { int resno = CS7TCP.WriteWord(Z通讯设置.plcHandle, 0x84, device.address, 4, Write_App1_buchang); //写入配方编号 if (resno == 0) { A0开机画面 parent = (A0开机画面)Parent.FindForm(); parent.showLog(" 第一组高度误差补偿参数写入成功!"); } else { MessageBox.Show("第一组高度误差补偿写入失败,请重新输入"); } } else { UInt32 ReadBack_Write_App1_buchang = 0; CS7TCP.ReadWord(Z通讯设置.plcHandle, 0x84, device.address, 4, ref ReadBack_Write_App1_buchang); txb_Control_Brush_buchang.Text = Convert.ToString(Convert.ToDecimal(ReadBack_Write_App1_buchang) / 100); MessageBox.Show("参数区间在1-20之间,请输入适当的参数"); } } break; //配方编号写入 case "txb_Recipe_NO": UInt32 Write_Recipe_NO = 0; //定义读取变量 if (txb_Recipe_NO.Text.Trim() == "") { UInt32 ReadBack = 0; CS7TCP.ReadWord(Z通讯设置.plcHandle, 0x84, device.address, 52, ref ReadBack); txb_Recipe_NO.Text = Convert.ToString(ReadBack); MessageBox.Show("输入无效,配方区间在1-20之间,请输入适当的配方编号"); } else { Write_Recipe_NO = Convert.ToUInt32(txb_Recipe_NO.Text.ToString()); //转换成String格式然后显示在textbox里面 if (Convert.ToUInt32(txb_Recipe_NO.Text) <= 20 && Convert.ToUInt32(txb_Recipe_NO.Text) >= 0) { int resno = CS7TCP.WriteWord(Z通讯设置.plcHandle, 0x84, device.address, 52, Write_Recipe_NO); //写入配方编号 if (resno == 0) { A0开机画面 parent = (A0开机画面)Parent.FindForm(); parent.showLog(" 配方编号写入成功!"); } else { MessageBox.Show("配方编号写入失败,请重新输入"); } } else { UInt32 ReadBack = 0; CS7TCP.ReadWord(Z通讯设置.plcHandle, 0x84, device.address, 52, ref ReadBack); txb_Recipe_NO.Text = Convert.ToString(ReadBack); MessageBox.Show("输入无效,配方区间在1-20之间,请输入适当的配方编号"); } } break; } }
/// <summary> /// 使用测厚值或者一键设定测厚值;=0使用自动测厚值;=1使用设定值 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void chbCheck_CheckedChanged(object sender, EventArgs e) { A0开机画面 parent = (A0开机画面)Parent.FindForm(); System.Windows.Forms.CheckBox _name = (System.Windows.Forms.CheckBox)sender; switch (_name.Name) { case "chbCheck": if (chbCheck.Checked == true) { var resno0 = PublicValue.BaseProtocol.WriteReg("DB99.DBW410", 1); if (resno0 == true) { txbInputHeight.Visible = true; chbCheck.Checked = true; //chbCheck.Text = "测厚功能启用"; chbCheck.Text = "产品设定厚度(mm):"; MessageBox.Show("请设定一键厚度值"); } else { chbCheck.Checked = false; //MessageBox.Show("选择失败,请重新选择"); } } else { var resno1 = PublicValue.BaseProtocol.WriteReg("DB99.DBW410", 0); if (resno1 == true) { txbInputHeight.Visible = false; chbCheck.Checked = false; chbCheck.Text = "自动测厚功能选用"; //MessageBox.Show("已选择自动测厚功能"); } else { chbCheck.Checked = true; //MessageBox.Show("选择失败,请重新选择"); } } break; case "chbTiaomachoice": if (chbTiaomachoice.Checked == true) { var resno0 = PublicValue.BaseProtocol.WriteReg("DB99.DBW412", 1); if (resno0 == true) { //打开串口 parent.PortOpen(); //开机自动打开扫码枪的com5口 //parent.myComPort.Open(); chbTiaomachoice.Text = "扫码功能启用"; parent.btn_Recipe_Read.Visible = false; parent.btn_Recipe_OK.Visible = false; parent.showLog("启用条码扫描功能成功"); } else { chbTiaomachoice.Checked = false; //MessageBox.Show("选择失败,请重新选择"); } } else { var resno1 = PublicValue.BaseProtocol.WriteReg("DB99.DBW412", 0); if (resno1 == true) { chbTiaomachoice.Text = "扫码功能停用"; parent.myComPort.Close(); parent.btn_Recipe_Read.Visible = true; parent.btn_Recipe_OK.Visible = true; //关闭串口 parent.Portclosed(); parent.showLog("关闭条码扫描功能成功"); } else { chbTiaomachoice.Checked = true; //MessageBox.Show("选择失败,请重新选择"); } } break; case "chbAutoTestHeight": //自动测量厚度 if (chbAutoTestHeight.Checked == true) { Console.WriteLine(chbAutoTestHeight.Checked); var res5 = PublicValue.BaseProtocol.WriteReg("DB99.DBW396", 1); if (res5 == true) { chbAutoTestHeight.Checked = true; chbAutoTestHeight.Text = "测厚功能启用"; btnHeightBiaoDing.Visible = true; chbCheck.Visible = true; chbCheck.Checked = false; //if (chbCheck.Checked == true) //{ // txbInputHeight.Visible = true; //} //else //{ // txbInputHeight.Visible = false; //} parent.showLog("启用自动测厚度功能成功"); } } else { var res5 = PublicValue.BaseProtocol.WriteReg("DB99.DBW396", 0); if (res5 == true) { btnHeightBiaoDing.Visible = false; chbAutoTestHeight.Checked = false; chbAutoTestHeight.Text = "测厚功能停用"; chbCheck.Visible = false; txbInputHeight.Visible = false; parent.showLog("停用自动测厚度功能成功"); var resno1 = PublicValue.BaseProtocol.WriteReg("DB99.DBW410", 0); } } break; case "chbAutomation": //柔性功能 if (chbAutomation.Checked == true) { var res5 = PublicValue.BaseProtocol.WriteReg("DB99.DBW406", 0); if (res5 == true) { chbAutomation.Text = "柔性功能启用"; chbAutomation.Checked = true; parent.showLog("启用柔性功能成功"); } } else { var res5 = PublicValue.BaseProtocol.WriteReg("DB99.DBW406", 1); if (res5 == true) { chbAutomation.Text = "柔性功能停用"; chbAutomation.Checked = false; parent.showLog("关闭柔性功能成功"); } } break; } }
//对“运行”、“停止”、“复位”、“待机”按钮进行判断,判断哪一个按钮被按下 public void btn_MouseDown(object sender) { A0开机画面 parent = (A0开机画面)Parent.FindForm(); System.Windows.Forms.Button button = (System.Windows.Forms.Button)sender; switch (button.Name) { case "btn_Run": var rsno1 = PublicValue.BaseProtocol.WriteReg("DB99.DBB0", 1); //rsno = device.BaseProtocol.WriteReg("DB99.DBB63", 1); if (rsno1 == true) { btn_Run.BackColor = Color.MediumSeaGreen; btn_Run.Text = "启动"; parent.showLog("整线运行操作执行成功"); } else { parent.showLog("整线运行操作执行失败"); MessageBox.Show("整线启动操作失败"); } break; case "btn_Stop": var rsno2 = PublicValue.BaseProtocol.WriteReg("DB99.DBB0", 2); //var rsno2 = PublicValue.BaseProtocol.SetBit("DB999.DBX0.0"); if (rsno2 == true) { btn_Stop.BackColor = Color.MediumSeaGreen; btn_Stop.Text = "停止"; parent.showLog("整线停止操作执行成功"); } else { parent.showLog("整线停止操作执行失败"); MessageBox.Show("整线停止操作失败"); } break; case "btn_Reset": var rsno3 = PublicValue.BaseProtocol.WriteReg("DB99.DBB0", 4); if (rsno3 == true) { btn_Reset.BackColor = Color.MediumSeaGreen; btn_Reset.Text = "复位"; parent.showLog("整线复位操作执行成功"); } else { parent.showLog("整线复位操作执行失败"); MessageBox.Show("整线复位操作失败"); } break; case "btn_Ready": var rsno4 = PublicValue.BaseProtocol.WriteReg("DB99.DBB0", 8); if (rsno4 == true) { btn_Ready.BackColor = Color.MediumSeaGreen; btn_Ready.Text = "待机"; parent.showLog("整线待机操作执行成功"); } else { parent.showLog("整线待机操作执行失败"); MessageBox.Show("整线待机操作失败"); } break; } TimerReadClose.Enabled = true; }
/// <summary> /// 保存修改过的参数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSave_GotFocus() { A0开机画面 parent = (A0开机画面)Parent.FindForm(); //配方参数写入--整线速度一键写入DB99.DBW406 var res1 = PublicValue.BaseProtocol.WriteReg("DB99.DBW408", Convert.ToInt16(Convert.ToDecimal(txbSpeedWrite.Text.ToString()) * 100)); if (res1 == true) { parent.showLog("整线速度参数写入成功"); } else { MessageBox.Show("整线速度配方参数写入失败"); parent.showLog("整线速度参数写入失败"); } //配方参数写入--整线高度一键写入DB99.DBW404 var res2 = PublicValue.BaseProtocol.WriteReg("DB99.DBW404", Convert.ToInt16(Convert.ToDecimal(txbInputHeight.Text.ToString()) * 100)); if (res2 == true) { parent.showLog("整线高度参数写入成功"); } else { MessageBox.Show("整线高度配方参数写入失败"); parent.showLog("整线高度参数写入失败"); } //信号延时保护时间DB99.DBW400 var res3 = PublicValue.BaseProtocol.WriteReg("DB99.DBW400", Convert.ToInt16(Convert.ToDecimal(txbProtectTime.Text.ToString()) * 1000)); if (res3 == true) { parent.showLog("信号延时时间参数写入成功"); } else { MessageBox.Show("信号延时时间参数写入失败"); parent.showLog("信号延时时间参数写入失败"); } //未启用滚轮的高度DB99.DBW398 var res4 = PublicValue.BaseProtocol.WriteReg("DB99.DBW398", Convert.ToInt16(Convert.ToDecimal(AutoHeightTest.Text.ToString()) * 100)); if (res4 == true) { parent.showLog("未启用滚轮的高度参数写入成功"); } else { MessageBox.Show("未启用滚轮的高度参数写入失败"); parent.showLog("未启用滚轮的高度参数写入失败"); } //高度补偿显示DB99.DBW236 var res7 = PublicValue.BaseProtocol.WriteReg("DB99.DBW236", Convert.ToInt16(Convert.ToDecimal(txbHeightValue.Text.ToString()) * 100)); if (res7 == true) { parent.showLog("自动测厚补偿高度参数写入成功"); } else { MessageBox.Show("自动测厚补偿高度参数写入失败"); parent.showLog("自动测厚补偿高度参数写入失败"); } //相机颜色选择DB99.DBW306 }
/// <summary> /// 集中读取BYTE用于显示状态等信息,ReadBlockAsByte /// </summary> /// public void Monitor_ReadBack() { A0开机画面 parent = (A0开机画面)Parent.FindForm(); DryDevice drydevice = (DryDevice)device; //把运算值以字符串的格式写入到输送线速度监视的Label内 lab_Monitor_Conveyor_Speed.Text = Convert.ToString(Convert.ToDecimal(drydevice.shuSongDaiSpeed) / 100) + " Hz"; // LineSpeed = Convert.ToDecimal(drydevice.shuSongDaiSpeed) /100; //把运算值以字符串的格式写入到UV1功率监视的Label内 lab_Monitor_UV1.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV1Power) / 10) + " Kw"; //把运算值以字符串的格式写入到UV2功率监视的Label内 lab_Monitor_UV2.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV2Power) / 10) + " Kw"; //把运算值以字符串的格式写入到UV3功率监视的Label内 lab_Monitor_UV3.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV3Power) / 10) + " Kw"; //把运算值以字符串的格式写入到UV4功率监视的Label内 lab_Monitor_UV4.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV4Power) / 10) + " Kw"; //把运算值以字符串的格式写入到UV5功率监视的Label内 lab_Monitor_UV5.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV5Power) / 10) + " Kw"; //把运算值以字符串的格式写入到UV6功率监视的Label内 lab_Monitor_UV6.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV6Power) / 10) + " Kw"; //把运算值以字符串的格式写入到UV7功率监视的Label内 lab_Monitor_UV7.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV7Power) / 10) + " Kw"; //把运算值以字符串的格式写入到UV8功率监视的Label内 lab_Monitor_UV8.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV8Power) / 10) + " Kw"; //把运算值以字符串的格式写入到输送线运行时间的Label内 lab_Monitor_Conveyor_Hour.Text = Convert.ToString(Convert.ToDecimal(drydevice.shuSongDaiRunTime)) + " H"; //把运算值以字符串的格式写入到UV1运行时间的Label内 lab_Monitor_UV1Hour.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV1RunTime)) + " H"; //把运算值以字符串的格式写入到UV2运行时间的Label内 lab_Monitor_UV2Hour.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV2RunTime)) + " H"; //把运算值以字符串的格式写入到UV3运行时间的Label内 lab_Monitor_UV3Hour.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV3RunTime)) + " H"; //把运算值以字符串的格式写入到UV4运行时间的Label内 lab_Monitor_UV4Hour.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV4RunTime)) + " H"; //把运算值以字符串的格式写入到UV5运行时间的Label内 lab_Monitor_UV5Hour.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV5RunTime)) + " H"; //把运算值以字符串的格式写入到UV6运行时间的Label内 lab_Monitor_UV6Hour.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV6RunTime)) + " H"; //把运算值以字符串的格式写入到UV7运行时间的Label内 lab_Monitor_UV7Hour.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV7RunTime)) + " H"; //把运算值以字符串的格式写入到UV8运行时间的Label内 lab_Monitor_UV8Hour.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV8RunTime)) + " H"; //把运算值以字符串的格式写入到UV1剩余运行时间的Label内 lab_Monitor_UV1Hour1.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV1LeftTime)) + " H"; //把运算值以字符串的格式写入到UV2剩余运行时间的Label内 lab_Monitor_UV2Hour1.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV2LeftTime)) + " H"; //把运算值以字符串的格式写入到UV3剩余运行时间的Label内 lab_Monitor_UV3Hour1.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV3LeftTime)) + " H"; //把运算值以字符串的格式写入到UV4剩余运行时间的Label内 lab_Monitor_UV4Hour1.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV4LeftTime)) + " H"; //把运算值以字符串的格式写入到UV5剩余运行时间的Label内 lab_Monitor_UV5Hour1.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV5LeftTime)) + " H"; //把运算值以字符串的格式写入到UV6剩余运行时间的Label内 lab_Monitor_UV6Hour1.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV6LeftTime)) + " H"; //把运算值以字符串的格式写入到UV7剩余运行时间的Label内 lab_Monitor_UV7Hour1.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV7LeftTime)) + " H"; //把运算值以字符串的格式写入到UV8剩余运行时间的Label内 lab_Monitor_UV8Hour1.Text = Convert.ToString(Convert.ToDecimal(drydevice.UV8LeftTime)) + " H"; //判断寿命到期 string status = device.BaseProtocol.ConnectState.ToString(); if (status == "Connected") { if (drydevice.UV1LeftTime == 0 && device.childType == 1) { MessageBox.Show("1#UV灯管使用寿命到期,请更换配件!"); parent.showLog("1#UV灯管使用寿命到期,请更换配件!"); } if (drydevice.UV2LeftTime == 0 && device.childType == 1 && device.childType == 2) { MessageBox.Show("2#UV灯管使用寿命到期,请更换配件!"); parent.showLog("2#UV灯管使用寿命到期,请更换配件!"); } if (drydevice.UV3LeftTime == 0 && device.childType == 1 && device.childType == 2 && device.childType == 3) { MessageBox.Show("3#UV灯管使用寿命到期,请更换配件!"); parent.showLog("3#UV灯管使用寿命到期,请更换配件!"); } if (drydevice.UV4LeftTime == 0 && device.childType == 1 && device.childType == 2 && device.childType == 3 && device.childType == 4) { MessageBox.Show("4#UV灯管使用寿命到期,请更换配件!"); parent.showLog("4#UV灯管使用寿命到期,请更换配件!"); } } }