private void SendControlCmd(string cmd1, string cmd2)
        {
            Thread controlThread2 = new Thread((ThreadStart) delegate
            {
                try
                {
                    string pwd     = "88 88 88 88 88 88 88 88";
                    byte[] cmdbyte = SerialPortCmdCombine.SetBaseCommand("FF", pwd, "81", cmd1);
                    CommonLogHelper.GetInstance("LogInfo").Info(
                        $@"发送控制命令1:{string.Join(" ", cmdbyte.Select(x => x.ToString("X2")).ToArray())}");
                    //isfirsControlcmd = true;
                    _serialPort.SendCommand(cmdbyte);
                    //while (!isContinueKeyUp)
                    //{
                    //    //SpinWait.SpinUntil(() => isContinueKeyUp);
                    //}
                    Thread.Sleep(1200);
                    //Thread.SpinWait(1200);
                    //isfirsControlcmd = false;
                    //isContinueKeyUp = false;
                    byte[] cmdbyte2 = SerialPortCmdCombine.SetBaseCommand("FF", pwd, "81", cmd2);
                    CommonLogHelper.GetInstance("LogInfo").Info(
                        $@"发送控制命令2:{string.Join(" ", cmdbyte2.Select(x => x.ToString("X2")).ToArray())}");
                    _serialPort.SendCommand(cmdbyte2);
                    _tmrControl.Start();
                    MessageBox.Show(@"发送控制指令成功,等待8秒后更新界面", @"提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //返回状态更新界面
                }
                catch (Exception ex)
                {
                    CommonLogHelper.GetInstance("LogError").Error(@"发送控制命令过程出错", ex);
                    MessageBox.Show(@"发送控制命令过程出错," + ex.Message, @"错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            })
            {
                IsBackground = true
            };

            controlThread2.Start();
        }
        private void 实时采集ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DateTime dt   = DateTime.Now;
            DateTime obdt = dt.AddSeconds(-dt.Second).AddMilliseconds(-dt.Millisecond);

            #region 台站级别发送指令

            if (Para.StationGrade.Contains("台站"))
            {
                Thread collectThread = new Thread((ThreadStart) delegate
                {
                    try
                    {
                        SerialPortOperate tempSerialPortOperate = _serialPort;
                        //_tempSerialPortOperate.ReturnCollectorRecData += ManualRecDataProcessing;
                        byte[] cmd = SerialPortCmdCombine.SetBaseCommand("FF", "03");
                        CommonLogHelper.GetInstance("LogInfo")
                        .Info($@"实时采集:发送采集命令:{string.Join(" ", cmd.Select(x => x.ToString("X2")).ToArray())}");
                        tempSerialPortOperate.SendCommand(cmd);
                    }
                    catch (Exception ex)
                    {
                        CommonLogHelper.GetInstance("LogInfo").Info(@"实时采集:发送串口命令获取数据过程出错");
                        CommonLogHelper.GetInstance("LogError").Error(@"实时采集:发送串口命令获取数据过程出错", ex);
                        _synchContext.Post(a =>
                                           MessageBox.Show(this, @"实时采集:发送串口命令获取数据过程出错," + ex.Message, @"错误", MessageBoxButtons.OK, MessageBoxIcon.Error)
                                           , null);
                    }
                })
                {
                    IsBackground = true
                };
                collectThread.Start();
            }

            #endregion 台站级别发送指令

            #region 省级级别操作数据库

            try
            {
                if (Para.StationGrade.Contains("省级"))
                {
                    Thread collectProThread = new Thread((ThreadStart) delegate
                    {
                        tSSLSystemStatus.Text = @"获取最新数据";
                        RadarDataClassesDataContext radarDataContext = new RadarDataClassesDataContext(_conn);
                        DataAdapter dataadp = new DataAdapter(StationId, obdt);
                        dataadp.DataResolve(radarDataContext);
                        _synchContext.Post(a =>
                        {
                            try
                            {
                                if (dataadp.AlarmStatusData != null)
                                {
                                    radarStatusUI.SetAlarmStatus(dataadp.AlarmStatusData);
                                }
                                if (dataadp.ControlStatusData != null)
                                {
                                    radarControlUI.SetControlStatus(dataadp.ControlStatusData);
                                }
                                if (dataadp.RadarPowerData != null)
                                {
                                    powerIndicationUI.SetPowerDataValue(dataadp.RadarPowerData);
                                }
                                if (dataadp.AlarmStatusData != null || dataadp.ControlStatusData != null ||
                                    dataadp.RadarPowerData != null)
                                {
                                    tSSLDataUpdateTime.Text = $"数据更新时间:{obdt.ToString("yyyy-MM-dd HH:mm")}";
                                }
                                else
                                {
                                    MessageBox.Show(@"无当前实时数据");
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(@"数据显示到界面上出错" + ex);
                            }
                        }, null);
                        CommonLogHelper.GetInstance("LogInfo").Info(@"获取数据库数据成功");

                        try
                        {
                            RadarFailureAlarm(dataadp.AlarmStatusData);
                        }
                        catch (Exception ex)
                        {
                            CommonLogHelper.GetInstance("LogError").Error(@"雷达故障报警过程出错", ex);
                        }
                    })
                    {
                        IsBackground = true
                    };
                    collectProThread.Start();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, @"提取数据库数据处理过程出错" + ex, @"错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            #endregion 省级级别操作数据库
        }