/// <summary> /// 停止辊台 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BTNstop_Click(object sender, EventArgs e) { try { if (CBdev.SelectedIndex == -1) { Notice.Show("请选择设备!", "提示", 3, MessageBoxIcon.Info); return; } string dev = CBdev.Text; ARF arf = new ARF(dev); if (arf.DeviceStatus() == ARF.DeviceError) { Notice.Show("指令发送失败:设备故障!", "错误", 3, MessageBoxIcon.Error); return; } byte[] order = ARF._StopRoller(arf.ARFNum()); if (!DataControl._mSocket.SendToClient(dev, order, out string result)) { Notice.Show("指令发送失败:" + result.ToString(), "错误", 3, MessageBoxIcon.Error); return; } Notice.Show("停止辊台 指令发送成功!", "成功", 3, MessageBoxIcon.Success); DataControl._mSocket.SwithRefresh(dev, true); } catch (Exception ex) { Notice.Show("指令发送失败:" + ex.ToString(), "错误", 3, MessageBoxIcon.Error); } }
/// <summary> /// 停止辊台 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BTNstop_Click(object sender, EventArgs e) { string dev = ""; byte[] order = null; try { if (CBdev.SelectedIndex == -1) { Notice.Show("请选择设备!", "提示", 3, MessageBoxIcon.Info); return; } dev = CBdev.Text; ARF arf = new ARF(dev); if (arf.DeviceStatus() == ARF.DeviceError) { Notice.Show("指令发送失败:设备故障!", "错误", 3, MessageBoxIcon.Error); return; } order = ARF._StopRoller(arf.ARFNum()); if (!DataControl._mSocket.SendToClient(dev, order, out string result)) { Notice.Show("指令发送失败:" + result.ToString(), "错误", 3, MessageBoxIcon.Error); // LOG DataControl._mTaskTools.RecordTaskErrLog("BTNstop_Click()", "摆渡车-停止辊台任务[ARF,指令]", dev, DataControl._mStools.BytetToString(order), result.ToString()); return; } Notice.Show("停止辊台 指令发送成功!", "成功", 3, MessageBoxIcon.Success); DataControl._mSocket.SwithRefresh(dev, true); } catch (Exception ex) { Notice.Show("指令发送失败:" + ex.Message, "错误", 3, MessageBoxIcon.Error); // LOG DataControl._mTaskTools.RecordTaskErrLog("BTNstop_Click()", "摆渡车-停止辊台任务[ARF,指令]", dev, DataControl._mStools.BytetToString(order), ex.Message); } }