diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index dd7aa0e..6fd244e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -28,7 +28,7 @@ List getDeviceByChannel(); List getAllCounter(); - + int clearChannel(); } diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index dd7aa0e..6fd244e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -28,7 +28,7 @@ List getDeviceByChannel(); List getAllCounter(); - + int clearChannel(); } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index 6b8c687..7478161 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -82,7 +82,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -110,7 +110,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update: " + e.Message); iRetval = -1; } return iRetval; @@ -123,7 +123,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -159,7 +159,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect: " + e.Message); iRetval = -1; } @@ -174,7 +174,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -205,8 +205,7 @@ sQry = sQry + " STABILITY_100=@STABILITY_100,"; sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC where ID = " + detectionId; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "sQrys!Qrys!="+ sQry+ ";stability="+ stability+";DETECTION_ITEM_ID="+ detectionId); - + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@STABILITY", MySqlDbType.String, 10).Value = stability; cmd.Parameters.Add("@ACCURACY", MySqlDbType.String, 10).Value = accuracy; @@ -225,7 +224,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus: " + e.Message); iRetval = -1; } @@ -240,7 +239,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -263,7 +262,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo CHANNEL: " + e.Message); iRetval = -1; } @@ -277,7 +276,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -316,20 +315,20 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection: " + e.Message); iRetval = -1; } return iRetval; } public DetectionItem getById(long detectionItemId) { - DetectionItem detectionItem = new DetectionItem(); + DetectionItem detectionItem = null; try { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById : 数据库链接断开"); int iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -344,6 +343,7 @@ { while (aReader.Read()) { + detectionItem = new DetectionItem(); //姓名 if (!aReader.IsDBNull(0)) detectionItem.Id = Convert.ToInt32(aReader.GetString(0)); if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt64(aReader.GetString(1)); @@ -366,7 +366,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById: " + e.Message); return detectionItem; } return detectionItem; diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index dd7aa0e..6fd244e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -28,7 +28,7 @@ List getDeviceByChannel(); List getAllCounter(); - + int clearChannel(); } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index 6b8c687..7478161 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -82,7 +82,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -110,7 +110,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update: " + e.Message); iRetval = -1; } return iRetval; @@ -123,7 +123,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -159,7 +159,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect: " + e.Message); iRetval = -1; } @@ -174,7 +174,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -205,8 +205,7 @@ sQry = sQry + " STABILITY_100=@STABILITY_100,"; sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC where ID = " + detectionId; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "sQrys!Qrys!="+ sQry+ ";stability="+ stability+";DETECTION_ITEM_ID="+ detectionId); - + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@STABILITY", MySqlDbType.String, 10).Value = stability; cmd.Parameters.Add("@ACCURACY", MySqlDbType.String, 10).Value = accuracy; @@ -225,7 +224,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus: " + e.Message); iRetval = -1; } @@ -240,7 +239,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -263,7 +262,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo CHANNEL: " + e.Message); iRetval = -1; } @@ -277,7 +276,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -316,20 +315,20 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection: " + e.Message); iRetval = -1; } return iRetval; } public DetectionItem getById(long detectionItemId) { - DetectionItem detectionItem = new DetectionItem(); + DetectionItem detectionItem = null; try { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById : 数据库链接断开"); int iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -344,6 +343,7 @@ { while (aReader.Read()) { + detectionItem = new DetectionItem(); //姓名 if (!aReader.IsDBNull(0)) detectionItem.Id = Convert.ToInt32(aReader.GetString(0)); if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt64(aReader.GetString(1)); @@ -366,7 +366,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById: " + e.Message); return detectionItem; } return detectionItem; diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 2de0df9..2e91e63 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -584,5 +584,42 @@ return iRetval; } + public int clearChannel() + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_device SET CHANNEL=''"; + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + sQry = "UPDATE r_device SET STATUSID='1' WHERE STATUSID='2'"; + cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + + iRetval = 0; + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : " + ex.Message); + } + return iRetval; + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index dd7aa0e..6fd244e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -28,7 +28,7 @@ List getDeviceByChannel(); List getAllCounter(); - + int clearChannel(); } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index 6b8c687..7478161 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -82,7 +82,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -110,7 +110,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update: " + e.Message); iRetval = -1; } return iRetval; @@ -123,7 +123,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -159,7 +159,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect: " + e.Message); iRetval = -1; } @@ -174,7 +174,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -205,8 +205,7 @@ sQry = sQry + " STABILITY_100=@STABILITY_100,"; sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC where ID = " + detectionId; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "sQrys!Qrys!="+ sQry+ ";stability="+ stability+";DETECTION_ITEM_ID="+ detectionId); - + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@STABILITY", MySqlDbType.String, 10).Value = stability; cmd.Parameters.Add("@ACCURACY", MySqlDbType.String, 10).Value = accuracy; @@ -225,7 +224,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus: " + e.Message); iRetval = -1; } @@ -240,7 +239,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -263,7 +262,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo CHANNEL: " + e.Message); iRetval = -1; } @@ -277,7 +276,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -316,20 +315,20 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection: " + e.Message); iRetval = -1; } return iRetval; } public DetectionItem getById(long detectionItemId) { - DetectionItem detectionItem = new DetectionItem(); + DetectionItem detectionItem = null; try { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById : 数据库链接断开"); int iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -344,6 +343,7 @@ { while (aReader.Read()) { + detectionItem = new DetectionItem(); //姓名 if (!aReader.IsDBNull(0)) detectionItem.Id = Convert.ToInt32(aReader.GetString(0)); if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt64(aReader.GetString(1)); @@ -366,7 +366,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById: " + e.Message); return detectionItem; } return detectionItem; diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 2de0df9..2e91e63 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -584,5 +584,42 @@ return iRetval; } + public int clearChannel() + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_device SET CHANNEL=''"; + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + sQry = "UPDATE r_device SET STATUSID='1' WHERE STATUSID='2'"; + cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + + iRetval = 0; + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : " + ex.Message); + } + return iRetval; + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index c1d76b7..1455bc9 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -239,6 +239,12 @@ accuracy.cs + + Component + + + MyDataGridView.cs + True True diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index dd7aa0e..6fd244e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -28,7 +28,7 @@ List getDeviceByChannel(); List getAllCounter(); - + int clearChannel(); } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index 6b8c687..7478161 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -82,7 +82,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -110,7 +110,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update: " + e.Message); iRetval = -1; } return iRetval; @@ -123,7 +123,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -159,7 +159,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect: " + e.Message); iRetval = -1; } @@ -174,7 +174,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -205,8 +205,7 @@ sQry = sQry + " STABILITY_100=@STABILITY_100,"; sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC where ID = " + detectionId; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "sQrys!Qrys!="+ sQry+ ";stability="+ stability+";DETECTION_ITEM_ID="+ detectionId); - + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@STABILITY", MySqlDbType.String, 10).Value = stability; cmd.Parameters.Add("@ACCURACY", MySqlDbType.String, 10).Value = accuracy; @@ -225,7 +224,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus: " + e.Message); iRetval = -1; } @@ -240,7 +239,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -263,7 +262,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo CHANNEL: " + e.Message); iRetval = -1; } @@ -277,7 +276,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -316,20 +315,20 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection: " + e.Message); iRetval = -1; } return iRetval; } public DetectionItem getById(long detectionItemId) { - DetectionItem detectionItem = new DetectionItem(); + DetectionItem detectionItem = null; try { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById : 数据库链接断开"); int iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -344,6 +343,7 @@ { while (aReader.Read()) { + detectionItem = new DetectionItem(); //姓名 if (!aReader.IsDBNull(0)) detectionItem.Id = Convert.ToInt32(aReader.GetString(0)); if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt64(aReader.GetString(1)); @@ -366,7 +366,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById: " + e.Message); return detectionItem; } return detectionItem; diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 2de0df9..2e91e63 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -584,5 +584,42 @@ return iRetval; } + public int clearChannel() + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_device SET CHANNEL=''"; + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + sQry = "UPDATE r_device SET STATUSID='1' WHERE STATUSID='2'"; + cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + + iRetval = 0; + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : " + ex.Message); + } + return iRetval; + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index c1d76b7..1455bc9 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -239,6 +239,12 @@ accuracy.cs + + Component + + + MyDataGridView.cs + True True diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index a3daf40..4abd70a 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -362,6 +362,7 @@ detectionItemService.stopDetection(deviceId, device.DetectionItemId, startTime, endTime, true); } } + deviceService.clearChannel(); } else { diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index dd7aa0e..6fd244e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -28,7 +28,7 @@ List getDeviceByChannel(); List getAllCounter(); - + int clearChannel(); } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index 6b8c687..7478161 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -82,7 +82,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -110,7 +110,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update: " + e.Message); iRetval = -1; } return iRetval; @@ -123,7 +123,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -159,7 +159,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect: " + e.Message); iRetval = -1; } @@ -174,7 +174,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -205,8 +205,7 @@ sQry = sQry + " STABILITY_100=@STABILITY_100,"; sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC where ID = " + detectionId; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "sQrys!Qrys!="+ sQry+ ";stability="+ stability+";DETECTION_ITEM_ID="+ detectionId); - + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@STABILITY", MySqlDbType.String, 10).Value = stability; cmd.Parameters.Add("@ACCURACY", MySqlDbType.String, 10).Value = accuracy; @@ -225,7 +224,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus: " + e.Message); iRetval = -1; } @@ -240,7 +239,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -263,7 +262,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo CHANNEL: " + e.Message); iRetval = -1; } @@ -277,7 +276,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -316,20 +315,20 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection: " + e.Message); iRetval = -1; } return iRetval; } public DetectionItem getById(long detectionItemId) { - DetectionItem detectionItem = new DetectionItem(); + DetectionItem detectionItem = null; try { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById : 数据库链接断开"); int iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -344,6 +343,7 @@ { while (aReader.Read()) { + detectionItem = new DetectionItem(); //姓名 if (!aReader.IsDBNull(0)) detectionItem.Id = Convert.ToInt32(aReader.GetString(0)); if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt64(aReader.GetString(1)); @@ -366,7 +366,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById: " + e.Message); return detectionItem; } return detectionItem; diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 2de0df9..2e91e63 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -584,5 +584,42 @@ return iRetval; } + public int clearChannel() + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_device SET CHANNEL=''"; + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + sQry = "UPDATE r_device SET STATUSID='1' WHERE STATUSID='2'"; + cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + + iRetval = 0; + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : " + ex.Message); + } + return iRetval; + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index c1d76b7..1455bc9 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -239,6 +239,12 @@ accuracy.cs + + Component + + + MyDataGridView.cs + True True diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index a3daf40..4abd70a 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -362,6 +362,7 @@ detectionItemService.stopDetection(deviceId, device.DetectionItemId, startTime, endTime, true); } } + deviceService.clearChannel(); } else { diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index ad75cfd..bce03f9 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index dd7aa0e..6fd244e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -28,7 +28,7 @@ List getDeviceByChannel(); List getAllCounter(); - + int clearChannel(); } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index 6b8c687..7478161 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -82,7 +82,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -110,7 +110,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update: " + e.Message); iRetval = -1; } return iRetval; @@ -123,7 +123,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -159,7 +159,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect: " + e.Message); iRetval = -1; } @@ -174,7 +174,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -205,8 +205,7 @@ sQry = sQry + " STABILITY_100=@STABILITY_100,"; sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC where ID = " + detectionId; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "sQrys!Qrys!="+ sQry+ ";stability="+ stability+";DETECTION_ITEM_ID="+ detectionId); - + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@STABILITY", MySqlDbType.String, 10).Value = stability; cmd.Parameters.Add("@ACCURACY", MySqlDbType.String, 10).Value = accuracy; @@ -225,7 +224,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus: " + e.Message); iRetval = -1; } @@ -240,7 +239,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -263,7 +262,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo CHANNEL: " + e.Message); iRetval = -1; } @@ -277,7 +276,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -316,20 +315,20 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection: " + e.Message); iRetval = -1; } return iRetval; } public DetectionItem getById(long detectionItemId) { - DetectionItem detectionItem = new DetectionItem(); + DetectionItem detectionItem = null; try { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById : 数据库链接断开"); int iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -344,6 +343,7 @@ { while (aReader.Read()) { + detectionItem = new DetectionItem(); //姓名 if (!aReader.IsDBNull(0)) detectionItem.Id = Convert.ToInt32(aReader.GetString(0)); if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt64(aReader.GetString(1)); @@ -366,7 +366,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById: " + e.Message); return detectionItem; } return detectionItem; diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 2de0df9..2e91e63 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -584,5 +584,42 @@ return iRetval; } + public int clearChannel() + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_device SET CHANNEL=''"; + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + sQry = "UPDATE r_device SET STATUSID='1' WHERE STATUSID='2'"; + cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + + iRetval = 0; + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : " + ex.Message); + } + return iRetval; + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index c1d76b7..1455bc9 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -239,6 +239,12 @@ accuracy.cs + + Component + + + MyDataGridView.cs + True True diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index a3daf40..4abd70a 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -362,6 +362,7 @@ detectionItemService.stopDetection(deviceId, device.DetectionItemId, startTime, endTime, true); } } + deviceService.clearChannel(); } else { diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index ad75cfd..bce03f9 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index 09d1e4a..5fd129f 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -31,6 +31,9 @@ { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); @@ -73,7 +76,8 @@ this.pic_stability_1 = new System.Windows.Forms.PictureBox(); this.pic_accuracy_1 = new System.Windows.Forms.PictureBox(); this.pic_bootFeature_1 = new System.Windows.Forms.PictureBox(); - this.dataGridView_Channel = new System.Windows.Forms.DataGridView(); + this.dataGridView_Channel_old = new System.Windows.Forms.DataGridView(); + this.dataGridView_Channel = new Casic.Birmm.RbFreqStandMeasure.MyDataGridView(); this.panel_toTestDev.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.tableToBeTested)).BeginInit(); this.panelBase.SuspendLayout(); @@ -103,6 +107,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pic_stability_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_accuracy_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_bootFeature_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel_old)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel)).BeginInit(); this.SuspendLayout(); // @@ -299,6 +304,7 @@ this.panel_channelList.Controls.Add(this.panel2); this.panel_channelList.Controls.Add(this.panel1); this.panel_channelList.Controls.Add(this.dataGridView_Channel); + this.panel_channelList.Controls.Add(this.dataGridView_Channel_old); this.panel_channelList.Location = new System.Drawing.Point(11, 227); this.panel_channelList.Name = "panel_channelList"; this.panel_channelList.Size = new System.Drawing.Size(1004, 420); @@ -569,6 +575,56 @@ this.pic_bootFeature_1.TabIndex = 319; this.pic_bootFeature_1.TabStop = false; // + // dataGridView_Channel_old + // + this.dataGridView_Channel_old.AllowUserToAddRows = false; + this.dataGridView_Channel_old.AllowUserToDeleteRows = false; + this.dataGridView_Channel_old.AllowUserToResizeColumns = false; + this.dataGridView_Channel_old.AllowUserToResizeRows = false; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.dataGridView_Channel_old.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; + this.dataGridView_Channel_old.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView_Channel_old.BackgroundColor = System.Drawing.Color.White; + this.dataGridView_Channel_old.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.dataGridView_Channel_old.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SunkenHorizontal; + this.dataGridView_Channel_old.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable; + this.dataGridView_Channel_old.ColumnHeadersHeight = 30; + this.dataGridView_Channel_old.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Channel_old.DefaultCellStyle = dataGridViewCellStyle7; + this.dataGridView_Channel_old.GridColor = System.Drawing.Color.DarkGray; + this.dataGridView_Channel_old.Location = new System.Drawing.Point(11, 10); + this.dataGridView_Channel_old.Margin = new System.Windows.Forms.Padding(0); + this.dataGridView_Channel_old.MultiSelect = false; + this.dataGridView_Channel_old.Name = "dataGridView_Channel_old"; + this.dataGridView_Channel_old.RowHeadersVisible = false; + this.dataGridView_Channel_old.RowHeadersWidth = 30; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.dataGridView_Channel_old.RowsDefaultCellStyle = dataGridViewCellStyle8; + this.dataGridView_Channel_old.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.Transparent; + this.dataGridView_Channel_old.RowTemplate.Height = 74; + this.dataGridView_Channel_old.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.dataGridView_Channel_old.Size = new System.Drawing.Size(984, 400); + this.dataGridView_Channel_old.TabIndex = 0; + this.dataGridView_Channel_old.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick); + this.dataGridView_Channel_old.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint); + // // dataGridView_Channel // this.dataGridView_Channel.AllowUserToAddRows = false; @@ -577,7 +633,7 @@ this.dataGridView_Channel.AllowUserToResizeRows = false; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.Transparent; dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); @@ -606,7 +662,7 @@ this.dataGridView_Channel.RowHeadersWidth = 30; dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.Transparent; dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); @@ -615,9 +671,9 @@ this.dataGridView_Channel.RowTemplate.Height = 74; this.dataGridView_Channel.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; this.dataGridView_Channel.Size = new System.Drawing.Size(984, 400); - this.dataGridView_Channel.TabIndex = 0; - this.dataGridView_Channel.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick); - this.dataGridView_Channel.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint); + this.dataGridView_Channel.TabIndex = 342; + this.dataGridView_Channel.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick_1); + this.dataGridView_Channel.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint_1); // // HomeCtrlForm // @@ -661,6 +717,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pic_stability_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_accuracy_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_bootFeature_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel_old)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel)).EndInit(); this.ResumeLayout(false); @@ -679,7 +736,7 @@ private System.Windows.Forms.Button btnPre; private System.Windows.Forms.TextBox textBoxPage; private System.Windows.Forms.Button btnNext; - private System.Windows.Forms.DataGridView dataGridView_Channel; + private System.Windows.Forms.DataGridView dataGridView_Channel_old; private System.Windows.Forms.Label labelNodata; private System.Windows.Forms.PictureBox pic_accuracy_1; private System.Windows.Forms.PictureBox pic_ageRate_1; @@ -708,5 +765,6 @@ private System.Windows.Forms.Panel panel3; public System.Windows.Forms.Label label_receiverStatus; public System.Windows.Forms.Label label_clockStatus; + private MyDataGridView dataGridView_Channel; } } diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index dd7aa0e..6fd244e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -28,7 +28,7 @@ List getDeviceByChannel(); List getAllCounter(); - + int clearChannel(); } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index 6b8c687..7478161 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -82,7 +82,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -110,7 +110,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update: " + e.Message); iRetval = -1; } return iRetval; @@ -123,7 +123,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -159,7 +159,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect: " + e.Message); iRetval = -1; } @@ -174,7 +174,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -205,8 +205,7 @@ sQry = sQry + " STABILITY_100=@STABILITY_100,"; sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC where ID = " + detectionId; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "sQrys!Qrys!="+ sQry+ ";stability="+ stability+";DETECTION_ITEM_ID="+ detectionId); - + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@STABILITY", MySqlDbType.String, 10).Value = stability; cmd.Parameters.Add("@ACCURACY", MySqlDbType.String, 10).Value = accuracy; @@ -225,7 +224,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus: " + e.Message); iRetval = -1; } @@ -240,7 +239,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -263,7 +262,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo CHANNEL: " + e.Message); iRetval = -1; } @@ -277,7 +276,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -316,20 +315,20 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection: " + e.Message); iRetval = -1; } return iRetval; } public DetectionItem getById(long detectionItemId) { - DetectionItem detectionItem = new DetectionItem(); + DetectionItem detectionItem = null; try { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById : 数据库链接断开"); int iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -344,6 +343,7 @@ { while (aReader.Read()) { + detectionItem = new DetectionItem(); //姓名 if (!aReader.IsDBNull(0)) detectionItem.Id = Convert.ToInt32(aReader.GetString(0)); if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt64(aReader.GetString(1)); @@ -366,7 +366,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById: " + e.Message); return detectionItem; } return detectionItem; diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 2de0df9..2e91e63 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -584,5 +584,42 @@ return iRetval; } + public int clearChannel() + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_device SET CHANNEL=''"; + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + sQry = "UPDATE r_device SET STATUSID='1' WHERE STATUSID='2'"; + cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + + iRetval = 0; + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : " + ex.Message); + } + return iRetval; + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index c1d76b7..1455bc9 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -239,6 +239,12 @@ accuracy.cs + + Component + + + MyDataGridView.cs + True True diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index a3daf40..4abd70a 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -362,6 +362,7 @@ detectionItemService.stopDetection(deviceId, device.DetectionItemId, startTime, endTime, true); } } + deviceService.clearChannel(); } else { diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index ad75cfd..bce03f9 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index 09d1e4a..5fd129f 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -31,6 +31,9 @@ { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); @@ -73,7 +76,8 @@ this.pic_stability_1 = new System.Windows.Forms.PictureBox(); this.pic_accuracy_1 = new System.Windows.Forms.PictureBox(); this.pic_bootFeature_1 = new System.Windows.Forms.PictureBox(); - this.dataGridView_Channel = new System.Windows.Forms.DataGridView(); + this.dataGridView_Channel_old = new System.Windows.Forms.DataGridView(); + this.dataGridView_Channel = new Casic.Birmm.RbFreqStandMeasure.MyDataGridView(); this.panel_toTestDev.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.tableToBeTested)).BeginInit(); this.panelBase.SuspendLayout(); @@ -103,6 +107,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pic_stability_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_accuracy_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_bootFeature_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel_old)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel)).BeginInit(); this.SuspendLayout(); // @@ -299,6 +304,7 @@ this.panel_channelList.Controls.Add(this.panel2); this.panel_channelList.Controls.Add(this.panel1); this.panel_channelList.Controls.Add(this.dataGridView_Channel); + this.panel_channelList.Controls.Add(this.dataGridView_Channel_old); this.panel_channelList.Location = new System.Drawing.Point(11, 227); this.panel_channelList.Name = "panel_channelList"; this.panel_channelList.Size = new System.Drawing.Size(1004, 420); @@ -569,6 +575,56 @@ this.pic_bootFeature_1.TabIndex = 319; this.pic_bootFeature_1.TabStop = false; // + // dataGridView_Channel_old + // + this.dataGridView_Channel_old.AllowUserToAddRows = false; + this.dataGridView_Channel_old.AllowUserToDeleteRows = false; + this.dataGridView_Channel_old.AllowUserToResizeColumns = false; + this.dataGridView_Channel_old.AllowUserToResizeRows = false; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.dataGridView_Channel_old.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; + this.dataGridView_Channel_old.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView_Channel_old.BackgroundColor = System.Drawing.Color.White; + this.dataGridView_Channel_old.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.dataGridView_Channel_old.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SunkenHorizontal; + this.dataGridView_Channel_old.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable; + this.dataGridView_Channel_old.ColumnHeadersHeight = 30; + this.dataGridView_Channel_old.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Channel_old.DefaultCellStyle = dataGridViewCellStyle7; + this.dataGridView_Channel_old.GridColor = System.Drawing.Color.DarkGray; + this.dataGridView_Channel_old.Location = new System.Drawing.Point(11, 10); + this.dataGridView_Channel_old.Margin = new System.Windows.Forms.Padding(0); + this.dataGridView_Channel_old.MultiSelect = false; + this.dataGridView_Channel_old.Name = "dataGridView_Channel_old"; + this.dataGridView_Channel_old.RowHeadersVisible = false; + this.dataGridView_Channel_old.RowHeadersWidth = 30; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.dataGridView_Channel_old.RowsDefaultCellStyle = dataGridViewCellStyle8; + this.dataGridView_Channel_old.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.Transparent; + this.dataGridView_Channel_old.RowTemplate.Height = 74; + this.dataGridView_Channel_old.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.dataGridView_Channel_old.Size = new System.Drawing.Size(984, 400); + this.dataGridView_Channel_old.TabIndex = 0; + this.dataGridView_Channel_old.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick); + this.dataGridView_Channel_old.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint); + // // dataGridView_Channel // this.dataGridView_Channel.AllowUserToAddRows = false; @@ -577,7 +633,7 @@ this.dataGridView_Channel.AllowUserToResizeRows = false; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.Transparent; dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); @@ -606,7 +662,7 @@ this.dataGridView_Channel.RowHeadersWidth = 30; dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.Transparent; dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); @@ -615,9 +671,9 @@ this.dataGridView_Channel.RowTemplate.Height = 74; this.dataGridView_Channel.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; this.dataGridView_Channel.Size = new System.Drawing.Size(984, 400); - this.dataGridView_Channel.TabIndex = 0; - this.dataGridView_Channel.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick); - this.dataGridView_Channel.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint); + this.dataGridView_Channel.TabIndex = 342; + this.dataGridView_Channel.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick_1); + this.dataGridView_Channel.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint_1); // // HomeCtrlForm // @@ -661,6 +717,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pic_stability_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_accuracy_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_bootFeature_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel_old)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel)).EndInit(); this.ResumeLayout(false); @@ -679,7 +736,7 @@ private System.Windows.Forms.Button btnPre; private System.Windows.Forms.TextBox textBoxPage; private System.Windows.Forms.Button btnNext; - private System.Windows.Forms.DataGridView dataGridView_Channel; + private System.Windows.Forms.DataGridView dataGridView_Channel_old; private System.Windows.Forms.Label labelNodata; private System.Windows.Forms.PictureBox pic_accuracy_1; private System.Windows.Forms.PictureBox pic_ageRate_1; @@ -708,5 +765,6 @@ private System.Windows.Forms.Panel panel3; public System.Windows.Forms.Label label_receiverStatus; public System.Windows.Forms.Label label_clockStatus; + private MyDataGridView dataGridView_Channel; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index a33d35a..5a5771a 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -822,7 +822,57 @@ channelDlg.ShowDialog(); } - - + private void dataGridView_Channel_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e) + { + cellDoubleClick(e.RowIndex); + } + + private void dataGridView_Channel_RowPostPaint_1(object sender, DataGridViewRowPostPaintEventArgs e) + { + try + { + lock (obj) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "11111111"); + + dataGridView_Channel.ClearSelection(); + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "222222"); + int channelNo = e.RowIndex + 1; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "333333"); + if (channelFreeList.Contains(channelNo + "")) + { + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "44444"); + dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); + panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = false; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "5555555555"); + } + else + { + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "66666666666"); + dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(201, 203, 208); + panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = true; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "777777777"); + } + foreach (string no in channelFreeList.ToArray()) + { + dataGridView_Channel.Rows[Convert.ToInt32(no) - 1].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); + panel_channelList.Controls.Find("panel" + no, true)[0].Visible = false; + } + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "88888888"); + } + } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "dataGridView_Channel_RowPostPaint 错误:" + ex.Message); + + } + } } } diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index dd7aa0e..6fd244e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -28,7 +28,7 @@ List getDeviceByChannel(); List getAllCounter(); - + int clearChannel(); } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index 6b8c687..7478161 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -82,7 +82,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -110,7 +110,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update: " + e.Message); iRetval = -1; } return iRetval; @@ -123,7 +123,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -159,7 +159,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect: " + e.Message); iRetval = -1; } @@ -174,7 +174,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -205,8 +205,7 @@ sQry = sQry + " STABILITY_100=@STABILITY_100,"; sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC where ID = " + detectionId; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "sQrys!Qrys!="+ sQry+ ";stability="+ stability+";DETECTION_ITEM_ID="+ detectionId); - + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@STABILITY", MySqlDbType.String, 10).Value = stability; cmd.Parameters.Add("@ACCURACY", MySqlDbType.String, 10).Value = accuracy; @@ -225,7 +224,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus: " + e.Message); iRetval = -1; } @@ -240,7 +239,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -263,7 +262,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo CHANNEL: " + e.Message); iRetval = -1; } @@ -277,7 +276,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -316,20 +315,20 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection: " + e.Message); iRetval = -1; } return iRetval; } public DetectionItem getById(long detectionItemId) { - DetectionItem detectionItem = new DetectionItem(); + DetectionItem detectionItem = null; try { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById : 数据库链接断开"); int iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -344,6 +343,7 @@ { while (aReader.Read()) { + detectionItem = new DetectionItem(); //姓名 if (!aReader.IsDBNull(0)) detectionItem.Id = Convert.ToInt32(aReader.GetString(0)); if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt64(aReader.GetString(1)); @@ -366,7 +366,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById: " + e.Message); return detectionItem; } return detectionItem; diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 2de0df9..2e91e63 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -584,5 +584,42 @@ return iRetval; } + public int clearChannel() + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_device SET CHANNEL=''"; + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + sQry = "UPDATE r_device SET STATUSID='1' WHERE STATUSID='2'"; + cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + + iRetval = 0; + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : " + ex.Message); + } + return iRetval; + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index c1d76b7..1455bc9 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -239,6 +239,12 @@ accuracy.cs + + Component + + + MyDataGridView.cs + True True diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index a3daf40..4abd70a 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -362,6 +362,7 @@ detectionItemService.stopDetection(deviceId, device.DetectionItemId, startTime, endTime, true); } } + deviceService.clearChannel(); } else { diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index ad75cfd..bce03f9 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index 09d1e4a..5fd129f 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -31,6 +31,9 @@ { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); @@ -73,7 +76,8 @@ this.pic_stability_1 = new System.Windows.Forms.PictureBox(); this.pic_accuracy_1 = new System.Windows.Forms.PictureBox(); this.pic_bootFeature_1 = new System.Windows.Forms.PictureBox(); - this.dataGridView_Channel = new System.Windows.Forms.DataGridView(); + this.dataGridView_Channel_old = new System.Windows.Forms.DataGridView(); + this.dataGridView_Channel = new Casic.Birmm.RbFreqStandMeasure.MyDataGridView(); this.panel_toTestDev.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.tableToBeTested)).BeginInit(); this.panelBase.SuspendLayout(); @@ -103,6 +107,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pic_stability_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_accuracy_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_bootFeature_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel_old)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel)).BeginInit(); this.SuspendLayout(); // @@ -299,6 +304,7 @@ this.panel_channelList.Controls.Add(this.panel2); this.panel_channelList.Controls.Add(this.panel1); this.panel_channelList.Controls.Add(this.dataGridView_Channel); + this.panel_channelList.Controls.Add(this.dataGridView_Channel_old); this.panel_channelList.Location = new System.Drawing.Point(11, 227); this.panel_channelList.Name = "panel_channelList"; this.panel_channelList.Size = new System.Drawing.Size(1004, 420); @@ -569,6 +575,56 @@ this.pic_bootFeature_1.TabIndex = 319; this.pic_bootFeature_1.TabStop = false; // + // dataGridView_Channel_old + // + this.dataGridView_Channel_old.AllowUserToAddRows = false; + this.dataGridView_Channel_old.AllowUserToDeleteRows = false; + this.dataGridView_Channel_old.AllowUserToResizeColumns = false; + this.dataGridView_Channel_old.AllowUserToResizeRows = false; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.dataGridView_Channel_old.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; + this.dataGridView_Channel_old.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView_Channel_old.BackgroundColor = System.Drawing.Color.White; + this.dataGridView_Channel_old.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.dataGridView_Channel_old.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SunkenHorizontal; + this.dataGridView_Channel_old.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable; + this.dataGridView_Channel_old.ColumnHeadersHeight = 30; + this.dataGridView_Channel_old.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Channel_old.DefaultCellStyle = dataGridViewCellStyle7; + this.dataGridView_Channel_old.GridColor = System.Drawing.Color.DarkGray; + this.dataGridView_Channel_old.Location = new System.Drawing.Point(11, 10); + this.dataGridView_Channel_old.Margin = new System.Windows.Forms.Padding(0); + this.dataGridView_Channel_old.MultiSelect = false; + this.dataGridView_Channel_old.Name = "dataGridView_Channel_old"; + this.dataGridView_Channel_old.RowHeadersVisible = false; + this.dataGridView_Channel_old.RowHeadersWidth = 30; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.dataGridView_Channel_old.RowsDefaultCellStyle = dataGridViewCellStyle8; + this.dataGridView_Channel_old.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.Transparent; + this.dataGridView_Channel_old.RowTemplate.Height = 74; + this.dataGridView_Channel_old.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.dataGridView_Channel_old.Size = new System.Drawing.Size(984, 400); + this.dataGridView_Channel_old.TabIndex = 0; + this.dataGridView_Channel_old.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick); + this.dataGridView_Channel_old.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint); + // // dataGridView_Channel // this.dataGridView_Channel.AllowUserToAddRows = false; @@ -577,7 +633,7 @@ this.dataGridView_Channel.AllowUserToResizeRows = false; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.Transparent; dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); @@ -606,7 +662,7 @@ this.dataGridView_Channel.RowHeadersWidth = 30; dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.Transparent; dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); @@ -615,9 +671,9 @@ this.dataGridView_Channel.RowTemplate.Height = 74; this.dataGridView_Channel.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; this.dataGridView_Channel.Size = new System.Drawing.Size(984, 400); - this.dataGridView_Channel.TabIndex = 0; - this.dataGridView_Channel.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick); - this.dataGridView_Channel.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint); + this.dataGridView_Channel.TabIndex = 342; + this.dataGridView_Channel.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick_1); + this.dataGridView_Channel.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint_1); // // HomeCtrlForm // @@ -661,6 +717,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pic_stability_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_accuracy_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_bootFeature_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel_old)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel)).EndInit(); this.ResumeLayout(false); @@ -679,7 +736,7 @@ private System.Windows.Forms.Button btnPre; private System.Windows.Forms.TextBox textBoxPage; private System.Windows.Forms.Button btnNext; - private System.Windows.Forms.DataGridView dataGridView_Channel; + private System.Windows.Forms.DataGridView dataGridView_Channel_old; private System.Windows.Forms.Label labelNodata; private System.Windows.Forms.PictureBox pic_accuracy_1; private System.Windows.Forms.PictureBox pic_ageRate_1; @@ -708,5 +765,6 @@ private System.Windows.Forms.Panel panel3; public System.Windows.Forms.Label label_receiverStatus; public System.Windows.Forms.Label label_clockStatus; + private MyDataGridView dataGridView_Channel; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index a33d35a..5a5771a 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -822,7 +822,57 @@ channelDlg.ShowDialog(); } - - + private void dataGridView_Channel_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e) + { + cellDoubleClick(e.RowIndex); + } + + private void dataGridView_Channel_RowPostPaint_1(object sender, DataGridViewRowPostPaintEventArgs e) + { + try + { + lock (obj) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "11111111"); + + dataGridView_Channel.ClearSelection(); + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "222222"); + int channelNo = e.RowIndex + 1; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "333333"); + if (channelFreeList.Contains(channelNo + "")) + { + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "44444"); + dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); + panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = false; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "5555555555"); + } + else + { + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "66666666666"); + dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(201, 203, 208); + panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = true; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "777777777"); + } + foreach (string no in channelFreeList.ToArray()) + { + dataGridView_Channel.Rows[Convert.ToInt32(no) - 1].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); + panel_channelList.Controls.Find("panel" + no, true)[0].Visible = false; + } + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "88888888"); + } + } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "dataGridView_Channel_RowPostPaint 错误:" + ex.Message); + + } + } } } diff --git a/RbFreqStandMeasure/status/StatusCtrlForm.cs b/RbFreqStandMeasure/status/StatusCtrlForm.cs index 44a5302..8a7853d 100644 --- a/RbFreqStandMeasure/status/StatusCtrlForm.cs +++ b/RbFreqStandMeasure/status/StatusCtrlForm.cs @@ -137,8 +137,7 @@ { if ((i + 3) < arr.Length && !arr[i + 1].Equals("") && !arr[i + 2].Equals("") && !arr[i + 3].Equals("")) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, arr[i + 1] + ";" + arr[i + 2] + ";" + arr[i + 3]); - + int Elevation = Convert.ToInt32(arr[i + 1]); int azimuth = Convert.ToInt32(arr[i + 2]); double cosLen = Math.Cos(Elevation * Math.PI / 180) * (575 / 2); @@ -168,8 +167,7 @@ { if ((i + 3) < arr.Length && !arr[i + 1].Equals("") && !arr[i + 2].Equals("") && !arr[i + 3].Equals("")) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, arr[i + 1] + ";" + arr[i + 2] + ";" + arr[i + 3]); - + int Elevation = Convert.ToInt32(arr[i + 1]); int azimuth = Convert.ToInt32(arr[i + 2]); double cosLen = Math.Cos(Elevation * Math.PI / 180) * (575 / 2); @@ -258,7 +256,7 @@ if (!portSatellite.IsOpen) portSatellite.Open(); if (portSatellite.IsOpen) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "打开串口成功!" + portName); + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "打开卫星状态串口成功!" + portName); } else { @@ -379,7 +377,6 @@ } else if ((sss.Contains("GPGSV") || sss.Contains("BDGSV") || sss.Contains("GBGSV")) && sss.Contains("*")) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "GSV : " + sss); if (sss.Split(',').Length > 8) { if (sss.Contains("GPGSV")) @@ -400,9 +397,7 @@ totalBD = Convert.ToInt32(sss.Split(',')[3]); } } - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "gpList : " + gpList.Count + ",gp共有 :" + +gpMessCount); - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "bdList : " + bdList.Count + ",bd共有 : " + bdMessCount); - + if ((gpList.Count > 0 && gpList.Count == gpMessCount) && (bdList.Count > 0) && bdList.Count == bdMessCount) { if (!drawed) @@ -412,8 +407,7 @@ { lock (obj) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "更新更新更新更新更新画:::: : "); - + panelSite.Refresh(); } diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index dd7aa0e..6fd244e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -28,7 +28,7 @@ List getDeviceByChannel(); List getAllCounter(); - + int clearChannel(); } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index 6b8c687..7478161 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -82,7 +82,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -110,7 +110,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update: " + e.Message); iRetval = -1; } return iRetval; @@ -123,7 +123,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -159,7 +159,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect: " + e.Message); iRetval = -1; } @@ -174,7 +174,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -205,8 +205,7 @@ sQry = sQry + " STABILITY_100=@STABILITY_100,"; sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC where ID = " + detectionId; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "sQrys!Qrys!="+ sQry+ ";stability="+ stability+";DETECTION_ITEM_ID="+ detectionId); - + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@STABILITY", MySqlDbType.String, 10).Value = stability; cmd.Parameters.Add("@ACCURACY", MySqlDbType.String, 10).Value = accuracy; @@ -225,7 +224,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus: " + e.Message); iRetval = -1; } @@ -240,7 +239,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -263,7 +262,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo CHANNEL: " + e.Message); iRetval = -1; } @@ -277,7 +276,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -316,20 +315,20 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection: " + e.Message); iRetval = -1; } return iRetval; } public DetectionItem getById(long detectionItemId) { - DetectionItem detectionItem = new DetectionItem(); + DetectionItem detectionItem = null; try { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById : 数据库链接断开"); int iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -344,6 +343,7 @@ { while (aReader.Read()) { + detectionItem = new DetectionItem(); //姓名 if (!aReader.IsDBNull(0)) detectionItem.Id = Convert.ToInt32(aReader.GetString(0)); if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt64(aReader.GetString(1)); @@ -366,7 +366,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById: " + e.Message); return detectionItem; } return detectionItem; diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 2de0df9..2e91e63 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -584,5 +584,42 @@ return iRetval; } + public int clearChannel() + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_device SET CHANNEL=''"; + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + sQry = "UPDATE r_device SET STATUSID='1' WHERE STATUSID='2'"; + cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + + iRetval = 0; + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : " + ex.Message); + } + return iRetval; + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index c1d76b7..1455bc9 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -239,6 +239,12 @@ accuracy.cs + + Component + + + MyDataGridView.cs + True True diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index a3daf40..4abd70a 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -362,6 +362,7 @@ detectionItemService.stopDetection(deviceId, device.DetectionItemId, startTime, endTime, true); } } + deviceService.clearChannel(); } else { diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index ad75cfd..bce03f9 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index 09d1e4a..5fd129f 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -31,6 +31,9 @@ { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); @@ -73,7 +76,8 @@ this.pic_stability_1 = new System.Windows.Forms.PictureBox(); this.pic_accuracy_1 = new System.Windows.Forms.PictureBox(); this.pic_bootFeature_1 = new System.Windows.Forms.PictureBox(); - this.dataGridView_Channel = new System.Windows.Forms.DataGridView(); + this.dataGridView_Channel_old = new System.Windows.Forms.DataGridView(); + this.dataGridView_Channel = new Casic.Birmm.RbFreqStandMeasure.MyDataGridView(); this.panel_toTestDev.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.tableToBeTested)).BeginInit(); this.panelBase.SuspendLayout(); @@ -103,6 +107,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pic_stability_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_accuracy_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_bootFeature_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel_old)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel)).BeginInit(); this.SuspendLayout(); // @@ -299,6 +304,7 @@ this.panel_channelList.Controls.Add(this.panel2); this.panel_channelList.Controls.Add(this.panel1); this.panel_channelList.Controls.Add(this.dataGridView_Channel); + this.panel_channelList.Controls.Add(this.dataGridView_Channel_old); this.panel_channelList.Location = new System.Drawing.Point(11, 227); this.panel_channelList.Name = "panel_channelList"; this.panel_channelList.Size = new System.Drawing.Size(1004, 420); @@ -569,6 +575,56 @@ this.pic_bootFeature_1.TabIndex = 319; this.pic_bootFeature_1.TabStop = false; // + // dataGridView_Channel_old + // + this.dataGridView_Channel_old.AllowUserToAddRows = false; + this.dataGridView_Channel_old.AllowUserToDeleteRows = false; + this.dataGridView_Channel_old.AllowUserToResizeColumns = false; + this.dataGridView_Channel_old.AllowUserToResizeRows = false; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.dataGridView_Channel_old.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; + this.dataGridView_Channel_old.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView_Channel_old.BackgroundColor = System.Drawing.Color.White; + this.dataGridView_Channel_old.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.dataGridView_Channel_old.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SunkenHorizontal; + this.dataGridView_Channel_old.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable; + this.dataGridView_Channel_old.ColumnHeadersHeight = 30; + this.dataGridView_Channel_old.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Channel_old.DefaultCellStyle = dataGridViewCellStyle7; + this.dataGridView_Channel_old.GridColor = System.Drawing.Color.DarkGray; + this.dataGridView_Channel_old.Location = new System.Drawing.Point(11, 10); + this.dataGridView_Channel_old.Margin = new System.Windows.Forms.Padding(0); + this.dataGridView_Channel_old.MultiSelect = false; + this.dataGridView_Channel_old.Name = "dataGridView_Channel_old"; + this.dataGridView_Channel_old.RowHeadersVisible = false; + this.dataGridView_Channel_old.RowHeadersWidth = 30; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.dataGridView_Channel_old.RowsDefaultCellStyle = dataGridViewCellStyle8; + this.dataGridView_Channel_old.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.Transparent; + this.dataGridView_Channel_old.RowTemplate.Height = 74; + this.dataGridView_Channel_old.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.dataGridView_Channel_old.Size = new System.Drawing.Size(984, 400); + this.dataGridView_Channel_old.TabIndex = 0; + this.dataGridView_Channel_old.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick); + this.dataGridView_Channel_old.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint); + // // dataGridView_Channel // this.dataGridView_Channel.AllowUserToAddRows = false; @@ -577,7 +633,7 @@ this.dataGridView_Channel.AllowUserToResizeRows = false; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.Transparent; dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); @@ -606,7 +662,7 @@ this.dataGridView_Channel.RowHeadersWidth = 30; dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.Transparent; dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); @@ -615,9 +671,9 @@ this.dataGridView_Channel.RowTemplate.Height = 74; this.dataGridView_Channel.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; this.dataGridView_Channel.Size = new System.Drawing.Size(984, 400); - this.dataGridView_Channel.TabIndex = 0; - this.dataGridView_Channel.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick); - this.dataGridView_Channel.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint); + this.dataGridView_Channel.TabIndex = 342; + this.dataGridView_Channel.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick_1); + this.dataGridView_Channel.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint_1); // // HomeCtrlForm // @@ -661,6 +717,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pic_stability_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_accuracy_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_bootFeature_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel_old)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel)).EndInit(); this.ResumeLayout(false); @@ -679,7 +736,7 @@ private System.Windows.Forms.Button btnPre; private System.Windows.Forms.TextBox textBoxPage; private System.Windows.Forms.Button btnNext; - private System.Windows.Forms.DataGridView dataGridView_Channel; + private System.Windows.Forms.DataGridView dataGridView_Channel_old; private System.Windows.Forms.Label labelNodata; private System.Windows.Forms.PictureBox pic_accuracy_1; private System.Windows.Forms.PictureBox pic_ageRate_1; @@ -708,5 +765,6 @@ private System.Windows.Forms.Panel panel3; public System.Windows.Forms.Label label_receiverStatus; public System.Windows.Forms.Label label_clockStatus; + private MyDataGridView dataGridView_Channel; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index a33d35a..5a5771a 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -822,7 +822,57 @@ channelDlg.ShowDialog(); } - - + private void dataGridView_Channel_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e) + { + cellDoubleClick(e.RowIndex); + } + + private void dataGridView_Channel_RowPostPaint_1(object sender, DataGridViewRowPostPaintEventArgs e) + { + try + { + lock (obj) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "11111111"); + + dataGridView_Channel.ClearSelection(); + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "222222"); + int channelNo = e.RowIndex + 1; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "333333"); + if (channelFreeList.Contains(channelNo + "")) + { + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "44444"); + dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); + panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = false; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "5555555555"); + } + else + { + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "66666666666"); + dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(201, 203, 208); + panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = true; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "777777777"); + } + foreach (string no in channelFreeList.ToArray()) + { + dataGridView_Channel.Rows[Convert.ToInt32(no) - 1].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); + panel_channelList.Controls.Find("panel" + no, true)[0].Visible = false; + } + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "88888888"); + } + } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "dataGridView_Channel_RowPostPaint 错误:" + ex.Message); + + } + } } } diff --git a/RbFreqStandMeasure/status/StatusCtrlForm.cs b/RbFreqStandMeasure/status/StatusCtrlForm.cs index 44a5302..8a7853d 100644 --- a/RbFreqStandMeasure/status/StatusCtrlForm.cs +++ b/RbFreqStandMeasure/status/StatusCtrlForm.cs @@ -137,8 +137,7 @@ { if ((i + 3) < arr.Length && !arr[i + 1].Equals("") && !arr[i + 2].Equals("") && !arr[i + 3].Equals("")) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, arr[i + 1] + ";" + arr[i + 2] + ";" + arr[i + 3]); - + int Elevation = Convert.ToInt32(arr[i + 1]); int azimuth = Convert.ToInt32(arr[i + 2]); double cosLen = Math.Cos(Elevation * Math.PI / 180) * (575 / 2); @@ -168,8 +167,7 @@ { if ((i + 3) < arr.Length && !arr[i + 1].Equals("") && !arr[i + 2].Equals("") && !arr[i + 3].Equals("")) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, arr[i + 1] + ";" + arr[i + 2] + ";" + arr[i + 3]); - + int Elevation = Convert.ToInt32(arr[i + 1]); int azimuth = Convert.ToInt32(arr[i + 2]); double cosLen = Math.Cos(Elevation * Math.PI / 180) * (575 / 2); @@ -258,7 +256,7 @@ if (!portSatellite.IsOpen) portSatellite.Open(); if (portSatellite.IsOpen) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "打开串口成功!" + portName); + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "打开卫星状态串口成功!" + portName); } else { @@ -379,7 +377,6 @@ } else if ((sss.Contains("GPGSV") || sss.Contains("BDGSV") || sss.Contains("GBGSV")) && sss.Contains("*")) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "GSV : " + sss); if (sss.Split(',').Length > 8) { if (sss.Contains("GPGSV")) @@ -400,9 +397,7 @@ totalBD = Convert.ToInt32(sss.Split(',')[3]); } } - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "gpList : " + gpList.Count + ",gp共有 :" + +gpMessCount); - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "bdList : " + bdList.Count + ",bd共有 : " + bdMessCount); - + if ((gpList.Count > 0 && gpList.Count == gpMessCount) && (bdList.Count > 0) && bdList.Count == bdMessCount) { if (!drawed) @@ -412,8 +407,7 @@ { lock (obj) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "更新更新更新更新更新画:::: : "); - + panelSite.Refresh(); } diff --git a/RbFreqStandMeasure/tools/DetectionHelper.cs b/RbFreqStandMeasure/tools/DetectionHelper.cs index 0858c34..05f74fb 100644 --- a/RbFreqStandMeasure/tools/DetectionHelper.cs +++ b/RbFreqStandMeasure/tools/DetectionHelper.cs @@ -84,6 +84,8 @@ if (isUpdates) { isUpdate = true; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度 interval =" + interval + ";detectionItemId="+detectionItemId); + } portStability = port; devIdStability = deviceId; @@ -106,28 +108,26 @@ } private void exeStability1(Object State) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取稳定度1s"); try { lock (obj) { lock(resultStability1) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "isStarted:" + isStarted + ", detectionItemId =" + detectionItemId); - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + while (true) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度1s"); - - timerStability1.Dispose(); - return; - } - if (!isStarted) - { - while (true) - { - if (detectionItemId != -1) + if (detectionItemId != -1) + { + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item==null||(item!=null&&Convert.ToDateTime(item.EndTime) < DateTime.Now)) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度1s,devId="+ devIdStability+";detectionItemId="+ detectionItemId); + + timerStability1.Dispose(); + return; + } + if (!isStarted) + { isStarted = true; DetectionItem detectionItem0 = detectionItemService.searchById(detectionItemId); @@ -141,8 +141,8 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; } + break; } } @@ -157,6 +157,8 @@ { detectionService.add(devIdStability, fre, "1-1",detectionItemId); count1s++; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,1s稳定度,devId=" + devIdStability + ";detectionItemId=" + detectionItemId); + } } if (!isUpdate) @@ -166,10 +168,10 @@ result = FreMath.Stable(resultStability1) + ""; resultStability1.Clear(); - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "1s稳定度结果:" + result + ", devId =" + devIdStability); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "1s稳定度测量结果:" + result + ", devId =" + devIdStability + ";detectionItemId=" + detectionItemId); - // 更新检测结果 - detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "", "", result, "", "", ""); + // 更新检测结果 + detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "", "", result, "", "", ""); LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "detectionId :" + detectionItemId); DetectionItem detectionItem = detectionItemService.searchById(detectionItemId); @@ -195,9 +197,10 @@ } else { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度1s"); if (resultStability1.Count == 101) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度1s得到结果,detectionItemId="+ detectionItemId); + timerStability1.Dispose(); string result1 = FreMath.Stable(resultStability1) + ""; @@ -205,9 +208,9 @@ updateView(resultStability1); stability.label_result.Text = result1; - DetailDlg.detailDlg.resultStaStr1 = result1; - resultStability1.Clear(); - } + DetailDlg.detailDlg.resultStaStr1 = result1; + resultStability1.Clear(); + } } } } @@ -216,8 +219,6 @@ catch (Exception ex) { LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "稳定度检测错误:" + ex.Message); - - } } @@ -226,20 +227,20 @@ { lock (obj) { - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + while (true) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度10s"); - - timerStability10.Dispose(); - return; - } - if (!isStarted) - { - while (true) + if (detectionItemId != -1) { - if (detectionItemId != -1) + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度10s,devId=" + devIdStability + ";detectionItemId=" + detectionItemId); + + timerStability10.Dispose(); + return; + } + if (!isStarted) + { isStarted = true; DetectionItem detectionItem0 = detectionItemService.searchById(detectionItemId); if (detectionItem0.Stability1.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "-1", "", "", "", "", "-1", "", "", ""); @@ -251,8 +252,9 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; + } + break; } } @@ -268,17 +270,18 @@ { detectionService.add(devIdStability, fre, "1-10", detectionItemId); count10s++; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,10s稳定度,devId=" + devIdStability + ";detectionItemId=" + detectionItemId); + } - } - - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "稳定度10s fre=" + fre + ", devId =" + devIdStability); + } + if (!isUpdate) { if (resultStability10.Count == 101) { timerStability10.Dispose(); result = FreMath.Stable(resultStability10) + ""; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "10s稳定度检测结果:" + result +", devId =" + devIdStability); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "10s稳定度检测结果:" + result +", devId =" + devIdStability + ";detectionItemId=" + detectionItemId); detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "", "", "", result, "", ""); @@ -308,6 +311,8 @@ { if (resultStability10.Count == 101) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度10s得到结果,detectionItemId=" + detectionItemId); + timerStability10.Dispose(); @@ -327,20 +332,21 @@ { lock (obj) { - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + while (true) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度20s"); - - timerStability20.Dispose(); - return; - } - if (!isStarted) - { - while (true) + if (detectionItemId != -1) { - if (detectionItemId != -1) + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度20s, devId = " + devIdStability + "; detectionItemId = " + detectionItemId); + + timerStability20.Dispose(); + return; + } + if (!isStarted) + { + isStarted = true; DetectionItem detectionItem0 = detectionItemService.searchById(detectionItemId); if (detectionItem0.Stability1.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "-1", "", "", "", "", "-1", "", "", ""); @@ -352,8 +358,9 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; + } + break; } } @@ -367,11 +374,12 @@ { detectionService.add(devIdStability, fre, "1-20", detectionItemId); count20s++; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,20s稳定度,devId=" + devIdStability + ";detectionItemId=" + detectionItemId); + } } - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "稳定度20s fre=" + fre + ", devId =" + devIdStability); - + if (!isUpdate) { if (resultStability20.Count == 101) @@ -379,7 +387,7 @@ timerStability20.Dispose(); result = FreMath.Stable(resultStability20) + ""; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "20s稳定度检测结果:" + result + ", devId =" + devIdStability); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "20s稳定度检测结果:" + result + ", devId =" + devIdStability + ";detectionItemId=" + detectionItemId); detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "", "", "", "", result, ""); @@ -412,6 +420,8 @@ { if (resultStability20.Count == 101) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度20s得到结果,detectionItemId=" + detectionItemId); + timerStability20.Dispose(); @@ -433,18 +443,19 @@ { lock (obj) { - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) - { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度100s"); - - timerStability100.Dispose(); - return; - } if (!isStarted) { while (true) { + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度100s, devId = " + devIdStability + "; detectionItemId = " + detectionItemId); + + timerStability100.Dispose(); + return; + } + if (detectionItemId != -1) { isStarted = true; @@ -458,8 +469,9 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; + } + break; } } @@ -469,10 +481,14 @@ if (!fre.Equals("") && resultStability100.Count < 101) { resultStability100.Add(fre); - if (!isUpdate) detectionService.add(devIdStability, fre, "1-100", detectionItemId); - } - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "稳定度100s fre=" + fre + ", devId =" + devIdStability); + if (!isUpdate) + { + detectionService.add(devIdStability, fre, "1-100", detectionItemId); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,100s稳定度,devId=" + devIdStability + ";detectionItemId=" + detectionItemId); + } + } + if (!isUpdate) { @@ -481,7 +497,7 @@ timerStability100.Dispose(); result = FreMath.Stable(resultStability100) + ""; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "100s稳定度检测结果:" + result + ", devId =" + devIdStability); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "100s稳定度检测结果:" + result + ", devId =" + devIdStability + ";detectionItemId=" + detectionItemId); detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "", "", "", "", "", result); @@ -511,6 +527,8 @@ { if (resultStability100.Count == 101) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度100s得到结果,detectionItemId=" + detectionItemId); + timerStability100.Dispose(); string result1 = FreMath.Stable(resultStability100) + ""; @@ -545,8 +563,7 @@ TimeSpan secondSpan = new TimeSpan(Convert.ToDateTime(endTime).Ticks - DateTime.Now.Ticks); delay = (int)secondSpan.TotalMilliseconds - 20*1000; } - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "准确度 endtime:"+endTime + "; delay:"+delay); - + timerAccuracy = new System.Threading.Timer(exeAccuracy, null, delay + 200 ,5*60*1000); } private void exeAccuracy(Object State) @@ -555,20 +572,21 @@ { lock (obj) { - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + while (true) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,准确度"); - - timerAccuracy.Dispose(); - return; - } - if (!isStarted) - { - while (true) + if (detectionItemId != -1) { - if (detectionItemId != -1) + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,准确度, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); + + timerAccuracy.Dispose(); + return; + } + if (!isStarted) + { + isStarted = true; DetectionItem detectionItem0 = detectionItemService.searchById(detectionItemId); if (detectionItem0.Stability.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "-1", "", "", "", "", "-1", "", "", ""); @@ -581,13 +599,13 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; + } + break; } } - if (isUpdate) LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测准确度!!!!!!!开始"); string result = ""; double sum = 0.0; List resultList = new List(); @@ -600,8 +618,10 @@ if (!isUpdate) { detectionService.add(devIdAccuracy, fre, "2", detectionItemId); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,准确度, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); + } - if (resultList.Count == 3) + if (resultList.Count == 3) { sum = sum + Convert.ToDouble(fre); break; @@ -621,6 +641,8 @@ } if (!isUpdate) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "准确度检测结果result="+result+",detectionItemId=" + detectionItemId); + DetectionItem detectionItem = detectionItemService.searchById(detectionItemId); if (detectionItem != null) { @@ -634,7 +656,7 @@ } else { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "更新label_result:" + result); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测准确度得到结果,detectionItemId=" + detectionItemId); accuracy.label_result.Text = result; DetailDlg.detailDlg.resultAccStr = result; @@ -676,9 +698,9 @@ { LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "isStarted:"+ isStarted); DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,开机特性"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,开机特性, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); timerBootFeature.Dispose(); return; @@ -708,8 +730,7 @@ } } - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测开机特性"); - + string result = ""; double sum = 0.0; int count = 0; @@ -720,10 +741,13 @@ { count++; sum = sum + Convert.ToDouble(fre); + if (count == 3) break; } } detectionService.add(devIdBootFeature, sum / 3 + "", "3", detectionItemId); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,开机特性, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); + resultBootFeature.Add(sum / 3 + ""); if (resultBootFeature.Count == 8) @@ -737,6 +761,7 @@ if (Convert.ToDouble(fre) < Convert.ToDouble(min) || min.Equals("0.0")) min = fre; } result = (Convert.ToDouble(max) - Convert.ToDouble(min)) + ""; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开机特性检测结果result=" + result + ",detectionItemId=" + detectionItemId); detectionItemService.updateDetecStatus(detectionItemId, "", "", result, "", "", "", "", "", ""); @@ -780,20 +805,21 @@ { lock (obj) { - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + while (true) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,日老化率"); - - timerAgeRate.Dispose(); - return; - } - if (!isStarted) - { - while (true) + if (detectionItemId != -1) { - if (detectionItemId != -1) + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,日老化率, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); + + timerAgeRate.Dispose(); + return; + } + if (!isStarted) + { + isStarted = true; DetectionItem detectionItem0 = detectionItemService.searchById(detectionItemId); if (detectionItem0.Stability.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "-1", "", "", "", "", "-1", "", "", ""); @@ -806,8 +832,9 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; + } + break; } } @@ -823,10 +850,13 @@ { count++; sum = sum + Convert.ToDouble(fre); + if (count == 3) break; } } detectionService.add(devIdAgeRate, sum / 3+"", "4", detectionItemId); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,日老化率, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); + resultAgeRate.Add(sum / 3 + ""); if (resultAgeRate.Count == 15) @@ -835,7 +865,7 @@ double r = 0.0; double k = FreMath.DriftRate(resultAgeRate, out r); result = k + "," + r.ToString().Substring(0,5); - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "日老化率检测结果:" + result); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "日老化率检测结果result=" + result + ",detectionItemId=" + detectionItemId); detectionItemService.updateDetecStatus(detectionItemId, "", "", "", result, "", "", "", "", ""); @@ -969,16 +999,12 @@ } private void updateView(List result) - { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始更新界面 length:"+ result.Count); - + { isUpdate = false; //new Thread(() => //{ int index = 0; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "DetailDlg.dataGridView.Rows:" + DetailDlg.dataGridView.Rows); - - + foreach (DataGridViewRow row in DetailDlg.dataGridView.Rows) { if (index < result.Count) diff --git a/RbFreqStandMeasure/MyDataGridView.Designer.cs b/RbFreqStandMeasure/MyDataGridView.Designer.cs new file mode 100644 index 0000000..f69392d --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.Designer.cs @@ -0,0 +1,36 @@ +namespace Casic.Birmm.RbFreqStandMeasure +{ + partial class MyDataGridView + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/RbFreqStandMeasure/MyDataGridView.cs b/RbFreqStandMeasure/MyDataGridView.cs new file mode 100644 index 0000000..3f1fd6f --- /dev/null +++ b/RbFreqStandMeasure/MyDataGridView.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Casic.Birmm.RbFreqStandMeasure.Tools; +using System.Reflection; + +namespace Casic.Birmm.RbFreqStandMeasure +{ + public partial class MyDataGridView : DataGridView + { + public MyDataGridView() + { + InitializeComponent(); + } + protected override void OnPaint(PaintEventArgs e) + { + try + { + base.OnPaint(e); + } + catch(Exception ex) + { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "重绘通道列表出错:" + ex.Message); + + Invalidate(); + } + } + } +} diff --git a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs index dd7aa0e..6fd244e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DeviceService.cs @@ -28,7 +28,7 @@ List getDeviceByChannel(); List getAllCounter(); - + int clearChannel(); } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index 6b8c687..7478161 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -82,7 +82,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -110,7 +110,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "update: " + e.Message); iRetval = -1; } return iRetval; @@ -123,7 +123,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -159,7 +159,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "startDetect: " + e.Message); iRetval = -1; } @@ -174,7 +174,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -205,8 +205,7 @@ sQry = sQry + " STABILITY_100=@STABILITY_100,"; sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC where ID = " + detectionId; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "sQrys!Qrys!="+ sQry+ ";stability="+ stability+";DETECTION_ITEM_ID="+ detectionId); - + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@STABILITY", MySqlDbType.String, 10).Value = stability; cmd.Parameters.Add("@ACCURACY", MySqlDbType.String, 10).Value = accuracy; @@ -225,7 +224,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetecStatus: " + e.Message); iRetval = -1; } @@ -240,7 +239,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -263,7 +262,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateChannelNo CHANNEL: " + e.Message); iRetval = -1; } @@ -277,7 +276,7 @@ { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection : 数据库链接断开"); iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -316,20 +315,20 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "stopDetection: " + e.Message); iRetval = -1; } return iRetval; } public DetectionItem getById(long detectionItemId) { - DetectionItem detectionItem = new DetectionItem(); + DetectionItem detectionItem = null; try { if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById : 数据库链接断开"); int iRetval = DbConnectService.openDb(); if (iRetval != 0) { @@ -344,6 +343,7 @@ { while (aReader.Read()) { + detectionItem = new DetectionItem(); //姓名 if (!aReader.IsDBNull(0)) detectionItem.Id = Convert.ToInt32(aReader.GetString(0)); if (!aReader.IsDBNull(1)) detectionItem.DeviceId = Convert.ToInt64(aReader.GetString(1)); @@ -366,7 +366,7 @@ } catch (MySqlException e) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem: " + e.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getById: " + e.Message); return detectionItem; } return detectionItem; diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 2de0df9..2e91e63 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -584,5 +584,42 @@ return iRetval; } + public int clearChannel() + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_device SET CHANNEL=''"; + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + sQry = "UPDATE r_device SET STATUSID='1' WHERE STATUSID='2'"; + cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + + iRetval = 0; + } + catch (MySqlException ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "clearChannel : " + ex.Message); + } + return iRetval; + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index c1d76b7..1455bc9 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -239,6 +239,12 @@ accuracy.cs + + Component + + + MyDataGridView.cs + True True diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index a3daf40..4abd70a 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -362,6 +362,7 @@ detectionItemService.stopDetection(deviceId, device.DetectionItemId, startTime, endTime, true); } } + deviceService.clearChannel(); } else { diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index ad75cfd..bce03f9 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index 09d1e4a..5fd129f 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -31,6 +31,9 @@ { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); @@ -73,7 +76,8 @@ this.pic_stability_1 = new System.Windows.Forms.PictureBox(); this.pic_accuracy_1 = new System.Windows.Forms.PictureBox(); this.pic_bootFeature_1 = new System.Windows.Forms.PictureBox(); - this.dataGridView_Channel = new System.Windows.Forms.DataGridView(); + this.dataGridView_Channel_old = new System.Windows.Forms.DataGridView(); + this.dataGridView_Channel = new Casic.Birmm.RbFreqStandMeasure.MyDataGridView(); this.panel_toTestDev.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.tableToBeTested)).BeginInit(); this.panelBase.SuspendLayout(); @@ -103,6 +107,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pic_stability_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_accuracy_1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_bootFeature_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel_old)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel)).BeginInit(); this.SuspendLayout(); // @@ -299,6 +304,7 @@ this.panel_channelList.Controls.Add(this.panel2); this.panel_channelList.Controls.Add(this.panel1); this.panel_channelList.Controls.Add(this.dataGridView_Channel); + this.panel_channelList.Controls.Add(this.dataGridView_Channel_old); this.panel_channelList.Location = new System.Drawing.Point(11, 227); this.panel_channelList.Name = "panel_channelList"; this.panel_channelList.Size = new System.Drawing.Size(1004, 420); @@ -569,6 +575,56 @@ this.pic_bootFeature_1.TabIndex = 319; this.pic_bootFeature_1.TabStop = false; // + // dataGridView_Channel_old + // + this.dataGridView_Channel_old.AllowUserToAddRows = false; + this.dataGridView_Channel_old.AllowUserToDeleteRows = false; + this.dataGridView_Channel_old.AllowUserToResizeColumns = false; + this.dataGridView_Channel_old.AllowUserToResizeRows = false; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.dataGridView_Channel_old.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; + this.dataGridView_Channel_old.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.dataGridView_Channel_old.BackgroundColor = System.Drawing.Color.White; + this.dataGridView_Channel_old.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.dataGridView_Channel_old.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SunkenHorizontal; + this.dataGridView_Channel_old.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable; + this.dataGridView_Channel_old.ColumnHeadersHeight = 30; + this.dataGridView_Channel_old.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Channel_old.DefaultCellStyle = dataGridViewCellStyle7; + this.dataGridView_Channel_old.GridColor = System.Drawing.Color.DarkGray; + this.dataGridView_Channel_old.Location = new System.Drawing.Point(11, 10); + this.dataGridView_Channel_old.Margin = new System.Windows.Forms.Padding(0); + this.dataGridView_Channel_old.MultiSelect = false; + this.dataGridView_Channel_old.Name = "dataGridView_Channel_old"; + this.dataGridView_Channel_old.RowHeadersVisible = false; + this.dataGridView_Channel_old.RowHeadersWidth = 30; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); + dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.dataGridView_Channel_old.RowsDefaultCellStyle = dataGridViewCellStyle8; + this.dataGridView_Channel_old.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.Transparent; + this.dataGridView_Channel_old.RowTemplate.Height = 74; + this.dataGridView_Channel_old.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; + this.dataGridView_Channel_old.Size = new System.Drawing.Size(984, 400); + this.dataGridView_Channel_old.TabIndex = 0; + this.dataGridView_Channel_old.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick); + this.dataGridView_Channel_old.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint); + // // dataGridView_Channel // this.dataGridView_Channel.AllowUserToAddRows = false; @@ -577,7 +633,7 @@ this.dataGridView_Channel.AllowUserToResizeRows = false; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.Transparent; dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); @@ -606,7 +662,7 @@ this.dataGridView_Channel.RowHeadersWidth = 30; dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(203)))), ((int)(((byte)(208))))); - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.Transparent; dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); @@ -615,9 +671,9 @@ this.dataGridView_Channel.RowTemplate.Height = 74; this.dataGridView_Channel.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; this.dataGridView_Channel.Size = new System.Drawing.Size(984, 400); - this.dataGridView_Channel.TabIndex = 0; - this.dataGridView_Channel.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick); - this.dataGridView_Channel.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint); + this.dataGridView_Channel.TabIndex = 342; + this.dataGridView_Channel.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_Channel_CellDoubleClick_1); + this.dataGridView_Channel.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView_Channel_RowPostPaint_1); // // HomeCtrlForm // @@ -661,6 +717,7 @@ ((System.ComponentModel.ISupportInitialize)(this.pic_stability_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_accuracy_1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pic_bootFeature_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel_old)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Channel)).EndInit(); this.ResumeLayout(false); @@ -679,7 +736,7 @@ private System.Windows.Forms.Button btnPre; private System.Windows.Forms.TextBox textBoxPage; private System.Windows.Forms.Button btnNext; - private System.Windows.Forms.DataGridView dataGridView_Channel; + private System.Windows.Forms.DataGridView dataGridView_Channel_old; private System.Windows.Forms.Label labelNodata; private System.Windows.Forms.PictureBox pic_accuracy_1; private System.Windows.Forms.PictureBox pic_ageRate_1; @@ -708,5 +765,6 @@ private System.Windows.Forms.Panel panel3; public System.Windows.Forms.Label label_receiverStatus; public System.Windows.Forms.Label label_clockStatus; + private MyDataGridView dataGridView_Channel; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index a33d35a..5a5771a 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -822,7 +822,57 @@ channelDlg.ShowDialog(); } - - + private void dataGridView_Channel_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e) + { + cellDoubleClick(e.RowIndex); + } + + private void dataGridView_Channel_RowPostPaint_1(object sender, DataGridViewRowPostPaintEventArgs e) + { + try + { + lock (obj) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "11111111"); + + dataGridView_Channel.ClearSelection(); + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "222222"); + int channelNo = e.RowIndex + 1; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "333333"); + if (channelFreeList.Contains(channelNo + "")) + { + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "44444"); + dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); + panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = false; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "5555555555"); + } + else + { + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "66666666666"); + dataGridView_Channel.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.FromArgb(201, 203, 208); + panel_channelList.Controls.Find("panel" + channelNo, true)[0].Visible = true; + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "777777777"); + } + foreach (string no in channelFreeList.ToArray()) + { + dataGridView_Channel.Rows[Convert.ToInt32(no) - 1].DefaultCellStyle.BackColor = Color.FromArgb(232, 234, 238); + panel_channelList.Controls.Find("panel" + no, true)[0].Visible = false; + } + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "88888888"); + } + } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "dataGridView_Channel_RowPostPaint 错误:" + ex.Message); + + } + } } } diff --git a/RbFreqStandMeasure/status/StatusCtrlForm.cs b/RbFreqStandMeasure/status/StatusCtrlForm.cs index 44a5302..8a7853d 100644 --- a/RbFreqStandMeasure/status/StatusCtrlForm.cs +++ b/RbFreqStandMeasure/status/StatusCtrlForm.cs @@ -137,8 +137,7 @@ { if ((i + 3) < arr.Length && !arr[i + 1].Equals("") && !arr[i + 2].Equals("") && !arr[i + 3].Equals("")) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, arr[i + 1] + ";" + arr[i + 2] + ";" + arr[i + 3]); - + int Elevation = Convert.ToInt32(arr[i + 1]); int azimuth = Convert.ToInt32(arr[i + 2]); double cosLen = Math.Cos(Elevation * Math.PI / 180) * (575 / 2); @@ -168,8 +167,7 @@ { if ((i + 3) < arr.Length && !arr[i + 1].Equals("") && !arr[i + 2].Equals("") && !arr[i + 3].Equals("")) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, arr[i + 1] + ";" + arr[i + 2] + ";" + arr[i + 3]); - + int Elevation = Convert.ToInt32(arr[i + 1]); int azimuth = Convert.ToInt32(arr[i + 2]); double cosLen = Math.Cos(Elevation * Math.PI / 180) * (575 / 2); @@ -258,7 +256,7 @@ if (!portSatellite.IsOpen) portSatellite.Open(); if (portSatellite.IsOpen) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "打开串口成功!" + portName); + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "打开卫星状态串口成功!" + portName); } else { @@ -379,7 +377,6 @@ } else if ((sss.Contains("GPGSV") || sss.Contains("BDGSV") || sss.Contains("GBGSV")) && sss.Contains("*")) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "GSV : " + sss); if (sss.Split(',').Length > 8) { if (sss.Contains("GPGSV")) @@ -400,9 +397,7 @@ totalBD = Convert.ToInt32(sss.Split(',')[3]); } } - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "gpList : " + gpList.Count + ",gp共有 :" + +gpMessCount); - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "bdList : " + bdList.Count + ",bd共有 : " + bdMessCount); - + if ((gpList.Count > 0 && gpList.Count == gpMessCount) && (bdList.Count > 0) && bdList.Count == bdMessCount) { if (!drawed) @@ -412,8 +407,7 @@ { lock (obj) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "更新更新更新更新更新画:::: : "); - + panelSite.Refresh(); } diff --git a/RbFreqStandMeasure/tools/DetectionHelper.cs b/RbFreqStandMeasure/tools/DetectionHelper.cs index 0858c34..05f74fb 100644 --- a/RbFreqStandMeasure/tools/DetectionHelper.cs +++ b/RbFreqStandMeasure/tools/DetectionHelper.cs @@ -84,6 +84,8 @@ if (isUpdates) { isUpdate = true; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度 interval =" + interval + ";detectionItemId="+detectionItemId); + } portStability = port; devIdStability = deviceId; @@ -106,28 +108,26 @@ } private void exeStability1(Object State) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取稳定度1s"); try { lock (obj) { lock(resultStability1) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "isStarted:" + isStarted + ", detectionItemId =" + detectionItemId); - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + while (true) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度1s"); - - timerStability1.Dispose(); - return; - } - if (!isStarted) - { - while (true) - { - if (detectionItemId != -1) + if (detectionItemId != -1) + { + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item==null||(item!=null&&Convert.ToDateTime(item.EndTime) < DateTime.Now)) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度1s,devId="+ devIdStability+";detectionItemId="+ detectionItemId); + + timerStability1.Dispose(); + return; + } + if (!isStarted) + { isStarted = true; DetectionItem detectionItem0 = detectionItemService.searchById(detectionItemId); @@ -141,8 +141,8 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; } + break; } } @@ -157,6 +157,8 @@ { detectionService.add(devIdStability, fre, "1-1",detectionItemId); count1s++; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,1s稳定度,devId=" + devIdStability + ";detectionItemId=" + detectionItemId); + } } if (!isUpdate) @@ -166,10 +168,10 @@ result = FreMath.Stable(resultStability1) + ""; resultStability1.Clear(); - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "1s稳定度结果:" + result + ", devId =" + devIdStability); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "1s稳定度测量结果:" + result + ", devId =" + devIdStability + ";detectionItemId=" + detectionItemId); - // 更新检测结果 - detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "", "", result, "", "", ""); + // 更新检测结果 + detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "", "", result, "", "", ""); LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "detectionId :" + detectionItemId); DetectionItem detectionItem = detectionItemService.searchById(detectionItemId); @@ -195,9 +197,10 @@ } else { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度1s"); if (resultStability1.Count == 101) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度1s得到结果,detectionItemId="+ detectionItemId); + timerStability1.Dispose(); string result1 = FreMath.Stable(resultStability1) + ""; @@ -205,9 +208,9 @@ updateView(resultStability1); stability.label_result.Text = result1; - DetailDlg.detailDlg.resultStaStr1 = result1; - resultStability1.Clear(); - } + DetailDlg.detailDlg.resultStaStr1 = result1; + resultStability1.Clear(); + } } } } @@ -216,8 +219,6 @@ catch (Exception ex) { LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "稳定度检测错误:" + ex.Message); - - } } @@ -226,20 +227,20 @@ { lock (obj) { - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + while (true) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度10s"); - - timerStability10.Dispose(); - return; - } - if (!isStarted) - { - while (true) + if (detectionItemId != -1) { - if (detectionItemId != -1) + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度10s,devId=" + devIdStability + ";detectionItemId=" + detectionItemId); + + timerStability10.Dispose(); + return; + } + if (!isStarted) + { isStarted = true; DetectionItem detectionItem0 = detectionItemService.searchById(detectionItemId); if (detectionItem0.Stability1.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "-1", "", "", "", "", "-1", "", "", ""); @@ -251,8 +252,9 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; + } + break; } } @@ -268,17 +270,18 @@ { detectionService.add(devIdStability, fre, "1-10", detectionItemId); count10s++; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,10s稳定度,devId=" + devIdStability + ";detectionItemId=" + detectionItemId); + } - } - - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "稳定度10s fre=" + fre + ", devId =" + devIdStability); + } + if (!isUpdate) { if (resultStability10.Count == 101) { timerStability10.Dispose(); result = FreMath.Stable(resultStability10) + ""; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "10s稳定度检测结果:" + result +", devId =" + devIdStability); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "10s稳定度检测结果:" + result +", devId =" + devIdStability + ";detectionItemId=" + detectionItemId); detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "", "", "", result, "", ""); @@ -308,6 +311,8 @@ { if (resultStability10.Count == 101) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度10s得到结果,detectionItemId=" + detectionItemId); + timerStability10.Dispose(); @@ -327,20 +332,21 @@ { lock (obj) { - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + while (true) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度20s"); - - timerStability20.Dispose(); - return; - } - if (!isStarted) - { - while (true) + if (detectionItemId != -1) { - if (detectionItemId != -1) + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度20s, devId = " + devIdStability + "; detectionItemId = " + detectionItemId); + + timerStability20.Dispose(); + return; + } + if (!isStarted) + { + isStarted = true; DetectionItem detectionItem0 = detectionItemService.searchById(detectionItemId); if (detectionItem0.Stability1.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "-1", "", "", "", "", "-1", "", "", ""); @@ -352,8 +358,9 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; + } + break; } } @@ -367,11 +374,12 @@ { detectionService.add(devIdStability, fre, "1-20", detectionItemId); count20s++; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,20s稳定度,devId=" + devIdStability + ";detectionItemId=" + detectionItemId); + } } - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "稳定度20s fre=" + fre + ", devId =" + devIdStability); - + if (!isUpdate) { if (resultStability20.Count == 101) @@ -379,7 +387,7 @@ timerStability20.Dispose(); result = FreMath.Stable(resultStability20) + ""; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "20s稳定度检测结果:" + result + ", devId =" + devIdStability); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "20s稳定度检测结果:" + result + ", devId =" + devIdStability + ";detectionItemId=" + detectionItemId); detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "", "", "", "", result, ""); @@ -412,6 +420,8 @@ { if (resultStability20.Count == 101) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度20s得到结果,detectionItemId=" + detectionItemId); + timerStability20.Dispose(); @@ -433,18 +443,19 @@ { lock (obj) { - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) - { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度100s"); - - timerStability100.Dispose(); - return; - } if (!isStarted) { while (true) { + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,稳定度100s, devId = " + devIdStability + "; detectionItemId = " + detectionItemId); + + timerStability100.Dispose(); + return; + } + if (detectionItemId != -1) { isStarted = true; @@ -458,8 +469,9 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; + } + break; } } @@ -469,10 +481,14 @@ if (!fre.Equals("") && resultStability100.Count < 101) { resultStability100.Add(fre); - if (!isUpdate) detectionService.add(devIdStability, fre, "1-100", detectionItemId); - } - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "稳定度100s fre=" + fre + ", devId =" + devIdStability); + if (!isUpdate) + { + detectionService.add(devIdStability, fre, "1-100", detectionItemId); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,100s稳定度,devId=" + devIdStability + ";detectionItemId=" + detectionItemId); + } + } + if (!isUpdate) { @@ -481,7 +497,7 @@ timerStability100.Dispose(); result = FreMath.Stable(resultStability100) + ""; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "100s稳定度检测结果:" + result + ", devId =" + devIdStability); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "100s稳定度检测结果:" + result + ", devId =" + devIdStability + ";detectionItemId=" + detectionItemId); detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "", "", "", "", "", result); @@ -511,6 +527,8 @@ { if (resultStability100.Count == 101) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度100s得到结果,detectionItemId=" + detectionItemId); + timerStability100.Dispose(); string result1 = FreMath.Stable(resultStability100) + ""; @@ -545,8 +563,7 @@ TimeSpan secondSpan = new TimeSpan(Convert.ToDateTime(endTime).Ticks - DateTime.Now.Ticks); delay = (int)secondSpan.TotalMilliseconds - 20*1000; } - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "准确度 endtime:"+endTime + "; delay:"+delay); - + timerAccuracy = new System.Threading.Timer(exeAccuracy, null, delay + 200 ,5*60*1000); } private void exeAccuracy(Object State) @@ -555,20 +572,21 @@ { lock (obj) { - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + while (true) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,准确度"); - - timerAccuracy.Dispose(); - return; - } - if (!isStarted) - { - while (true) + if (detectionItemId != -1) { - if (detectionItemId != -1) + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,准确度, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); + + timerAccuracy.Dispose(); + return; + } + if (!isStarted) + { + isStarted = true; DetectionItem detectionItem0 = detectionItemService.searchById(detectionItemId); if (detectionItem0.Stability.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "-1", "", "", "", "", "-1", "", "", ""); @@ -581,13 +599,13 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; + } + break; } } - if (isUpdate) LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测准确度!!!!!!!开始"); string result = ""; double sum = 0.0; List resultList = new List(); @@ -600,8 +618,10 @@ if (!isUpdate) { detectionService.add(devIdAccuracy, fre, "2", detectionItemId); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,准确度, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); + } - if (resultList.Count == 3) + if (resultList.Count == 3) { sum = sum + Convert.ToDouble(fre); break; @@ -621,6 +641,8 @@ } if (!isUpdate) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "准确度检测结果result="+result+",detectionItemId=" + detectionItemId); + DetectionItem detectionItem = detectionItemService.searchById(detectionItemId); if (detectionItem != null) { @@ -634,7 +656,7 @@ } else { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "更新label_result:" + result); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测准确度得到结果,detectionItemId=" + detectionItemId); accuracy.label_result.Text = result; DetailDlg.detailDlg.resultAccStr = result; @@ -676,9 +698,9 @@ { LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "isStarted:"+ isStarted); DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,开机特性"); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,开机特性, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); timerBootFeature.Dispose(); return; @@ -708,8 +730,7 @@ } } - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测开机特性"); - + string result = ""; double sum = 0.0; int count = 0; @@ -720,10 +741,13 @@ { count++; sum = sum + Convert.ToDouble(fre); + if (count == 3) break; } } detectionService.add(devIdBootFeature, sum / 3 + "", "3", detectionItemId); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,开机特性, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); + resultBootFeature.Add(sum / 3 + ""); if (resultBootFeature.Count == 8) @@ -737,6 +761,7 @@ if (Convert.ToDouble(fre) < Convert.ToDouble(min) || min.Equals("0.0")) min = fre; } result = (Convert.ToDouble(max) - Convert.ToDouble(min)) + ""; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开机特性检测结果result=" + result + ",detectionItemId=" + detectionItemId); detectionItemService.updateDetecStatus(detectionItemId, "", "", result, "", "", "", "", "", ""); @@ -780,20 +805,21 @@ { lock (obj) { - DetectionItem item = detectionItemService.getById(detectionItemId); - if (Convert.ToDateTime(item.EndTime) < DateTime.Now) + while (true) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,日老化率"); - - timerAgeRate.Dispose(); - return; - } - if (!isStarted) - { - while (true) + if (detectionItemId != -1) { - if (detectionItemId != -1) + DetectionItem item = detectionItemService.getById(detectionItemId); + if (item == null || (item != null && Convert.ToDateTime(item.EndTime) < DateTime.Now)) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "已停止检测,日老化率, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); + + timerAgeRate.Dispose(); + return; + } + if (!isStarted) + { + isStarted = true; DetectionItem detectionItem0 = detectionItemService.searchById(detectionItemId); if (detectionItem0.Stability.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "-1", "", "", "", "", "-1", "", "", ""); @@ -806,8 +832,9 @@ if (detectionItem0.AgeRate.Equals("-2")) detectionItemService.updateDetecStatus(detectionItemId, "", "", "", "-1", "", "", "", "", ""); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - break; + } + break; } } @@ -823,10 +850,13 @@ { count++; sum = sum + Convert.ToDouble(fre); + if (count == 3) break; } } detectionService.add(devIdAgeRate, sum / 3+"", "4", detectionItemId); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取到频率值,日老化率, devId=" + devIdAccuracy + ";detectionItemId=" + detectionItemId); + resultAgeRate.Add(sum / 3 + ""); if (resultAgeRate.Count == 15) @@ -835,7 +865,7 @@ double r = 0.0; double k = FreMath.DriftRate(resultAgeRate, out r); result = k + "," + r.ToString().Substring(0,5); - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "日老化率检测结果:" + result); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "日老化率检测结果result=" + result + ",detectionItemId=" + detectionItemId); detectionItemService.updateDetecStatus(detectionItemId, "", "", "", result, "", "", "", "", ""); @@ -969,16 +999,12 @@ } private void updateView(List result) - { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始更新界面 length:"+ result.Count); - + { isUpdate = false; //new Thread(() => //{ int index = 0; - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "DetailDlg.dataGridView.Rows:" + DetailDlg.dataGridView.Rows); - - + foreach (DataGridViewRow row in DetailDlg.dataGridView.Rows) { if (index < result.Count) diff --git a/RbFreqStandMeasure/tools/FreshStatus.cs b/RbFreqStandMeasure/tools/FreshStatus.cs index 517657c..6fba4d9 100644 --- a/RbFreqStandMeasure/tools/FreshStatus.cs +++ b/RbFreqStandMeasure/tools/FreshStatus.cs @@ -156,7 +156,7 @@ if (!portSatellite.IsOpen) portSatellite.Open(); if (portSatellite.IsOpen) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "打开串口成功!" + portName); + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "打开卫星状态串口成功!" + portName); } else { @@ -189,8 +189,7 @@ totalGP = 0; totalBD = 0; } - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "清空清空清空 : " + dataArray.Length); - int index = -1; + int index = -1; bool drawed = false; bool gga = false; bool rmc = false; @@ -286,8 +285,7 @@ } else if ((sss.Contains("GPGSV") || sss.Contains("BDGSV") || sss.Contains("GBGSV")) && sss.Contains("*")) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "GSV : " + sss); - if (sss.Split(',').Length > 8) + if (sss.Split(',').Length > 8) { if (sss.Contains("GPGSV")) { @@ -307,9 +305,7 @@ totalBD = Convert.ToInt32(sss.Split(',')[3]); } } - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "gpList : " + gpList.Count + ",gp共有 :" + +gpMessCount); - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "bdList : " + bdList.Count+",bd共有 : " + bdMessCount); - + if ((gpList.Count>0 &&gpList.Count == gpMessCount) && (bdList.Count>0) && bdList.Count == bdMessCount) { if (!drawed) @@ -319,8 +315,7 @@ { lock (obj) { - LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "更新更新更新更新更新画:::: : "); - + StatusCtrlForm.statusCtrlForm.Refresh(); }