private void btn_collection_Click(object sender, EventArgs e) { var name = cbb_type.Text; if (string.IsNullOrWhiteSpace(cbb_type.Text)) { MessageBox.Show("警告", "请选择传感器!", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); return; } double res = 0; bool IsSuccess = false; ListViewItem lvi = new ListViewItem(); if (name == "风速传感器 米/秒") { res = _tcpConnection.GetFSXS(ref IsSuccess); } if (name == "差压传感器 高 帕") { res = _tcpConnection.GetCYXS(ref IsSuccess); } if (name == "温度传感器 ℃") { res = _tcpConnection.GetWDXS(ref IsSuccess); } if (name == "大气压力传感器 KPa") { res = _tcpConnection.GetDQYLXS(ref IsSuccess); } if (name == "位移传感器1 mm") { res = _tcpConnection.GetDisplace1(ref IsSuccess); } if (name == "位移传感器2 mm") { res = _tcpConnection.GetDisplace2(ref IsSuccess); } if (name == "位移传感器3 mm") { res = _tcpConnection.GetDisplace3(ref IsSuccess); } lvi.Text = res.ToString(); lvi.SubItems.Add(DateTime.Now.ToString("HH:mm:ss")); this.lv_cjz.Items.Add(lvi); }
private void DataInit() { //隐藏打开按钮 // tsb_open.Visible = false; if (tcpClient.IsTCPLink) { #region 获取面板显示 var IsSeccess = false; var temperature = _temperature = tcpClient.GetWDXS(ref IsSeccess); if (!IsSeccess) { return; } var temppressure = _temppressure = tcpClient.GetDQYLXS(ref IsSeccess); if (!IsSeccess) { return; } var windSpeed = tcpClient.GetFSXS(ref IsSeccess).ToString(); if (!IsSeccess) { return; } var diffPress = tcpClient.GetCYXS(ref IsSeccess).ToString(); if (!IsSeccess) { return; } lbl_wdcgq.Text = temperature.ToString(); lbl_dqylcgq.Text = temppressure.ToString(); lbl_fscgq.Text = windSpeed.ToString(); lbl_cycgq.Text = diffPress.ToString(); #endregion #region 获取正负压阀状态 GetPRVs(); #endregion } }
private void tim_Top10_Tick(object sender, EventArgs e) { index++; if (index < 6) { return; } gv_list.Enabled = true; var cyvalue = _tcpClient.GetCYXS(ref IsSeccess); if (!IsSeccess) { //todo // MessageBox.Show("获取差压异常--气密前十!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (index >= 11) { //标记计时结束 if (kpa_Level == PublicEnum.Kpa_Level.liter100) { if (cyvalue > 0) { Z_S_100Stop = false; } else { F_S_100Stop = false; } } else if (kpa_Level == PublicEnum.Kpa_Level.liter150) { if (cyvalue > 0) { Z_S_150Stop = false; } else { F_S_150Stop = false; } } else if (kpa_Level == PublicEnum.Kpa_Level.drop100) { if (cyvalue > 0) { Z_J_100Stop = false; } else { F_J_100Stop = false; } } this.tim_Top10.Enabled = false; index = 0; gv_list.Enabled = false; return; } //获取风速 var fsvalue = _tcpClient.GetFSXS(ref IsSeccess); if (!IsSeccess) { //MessageBox.Show("获取风速异常!", "警告!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (rdb_fjstl.Checked) { if (kpa_Level == PublicEnum.Kpa_Level.liter100) { if (cyvalue > 0) { pressure.AddZYFJ(fsvalue, PublicEnum.Kpa_Level.liter100); } else { pressure.AddFYFJ(fsvalue, PublicEnum.Kpa_Level.liter100); } } else if (kpa_Level == PublicEnum.Kpa_Level.liter150) { if (cyvalue > 0) { pressure.AddZYFJ(fsvalue, PublicEnum.Kpa_Level.liter150); } else { pressure.AddFYFJ(fsvalue, PublicEnum.Kpa_Level.liter150); } } else if (kpa_Level == PublicEnum.Kpa_Level.drop100) { if (cyvalue > 0) { pressure.AddZYFJ(fsvalue, PublicEnum.Kpa_Level.drop100); } else { pressure.AddFYFJ(fsvalue, PublicEnum.Kpa_Level.drop100); } } } else if (rdb_zdstl.Checked) { if (kpa_Level == PublicEnum.Kpa_Level.liter100) { if (cyvalue > 0) { pressure.AddZYZD(fsvalue, PublicEnum.Kpa_Level.liter100); } else { pressure.AddFYZD(fsvalue, PublicEnum.Kpa_Level.liter100); } } else if (kpa_Level == PublicEnum.Kpa_Level.liter150) { if (cyvalue > 0) { pressure.AddZYZD(fsvalue, PublicEnum.Kpa_Level.liter150); } else { pressure.AddFYZD(fsvalue, PublicEnum.Kpa_Level.liter150); } } else if (kpa_Level == PublicEnum.Kpa_Level.drop100) { if (cyvalue > 0) { pressure.AddZYZD(fsvalue, PublicEnum.Kpa_Level.drop100); } else { pressure.AddFYZD(fsvalue, PublicEnum.Kpa_Level.drop100); } } } }
private void DataInit() { //隐藏打开按钮 tsb_open.Visible = false; if (tcpClient.IsTCPLink) { #region 获取面板显示 var IsSeccess = false; //设置高压标零 var pressureZero = tcpClient.SendGYBD(true); var temperature = _temperature = tcpClient.GetWDXS(ref IsSeccess); if (!IsSeccess) { return; } var temppressure = _temppressure = tcpClient.GetDQYLXS(ref IsSeccess); if (!IsSeccess) { return; } var windSpeed = tcpClient.GetFSXS(ref IsSeccess).ToString(); if (!IsSeccess) { return; } var diffPress = tcpClient.GetCYXS(ref IsSeccess).ToString(); if (!IsSeccess) { return; } lbl_wdcgq.Text = temperature.ToString(); lbl_dqylcgq.Text = temppressure.ToString(); lbl_fscgq.Text = windSpeed.ToString(); lbl_cycgq.Text = diffPress.ToString(); //抗风压 var displace1 = tcpClient.GetDisplace1(ref IsSeccess).ToString(); if (!IsSeccess) { return; } var displace2 = tcpClient.GetDisplace2(ref IsSeccess).ToString(); if (!IsSeccess) { return; } var displace3 = tcpClient.GetDisplace3(ref IsSeccess).ToString(); if (!IsSeccess) { return; } lbl_Displace1.Text = displace1.ToString(); lbl_Displace2.Text = displace2.ToString(); lbl_Displace3.Text = displace3.ToString(); #endregion #region 获取正负压阀状态 GetPRVs(); #endregion } }