diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index da45f50..1bb08ca 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -213,7 +213,7 @@ long detectionItemId = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionItemId; this.HideMaskAction(); - + HomeCtrlForm.homeCtrlForm.refreshChannelList(); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } @@ -221,6 +221,8 @@ private void btnExitDev_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -272,20 +274,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } timePicker_endTime.Value = endTimeBySystem; @@ -320,5 +322,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index da45f50..1bb08ca 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -213,7 +213,7 @@ long detectionItemId = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionItemId; this.HideMaskAction(); - + HomeCtrlForm.homeCtrlForm.refreshChannelList(); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } @@ -221,6 +221,8 @@ private void btnExitDev_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -272,20 +274,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } timePicker_endTime.Value = endTimeBySystem; @@ -320,5 +322,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index cbb6cba..35c7a60 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -74,7 +74,7 @@ this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.checkBox_100s = new System.Windows.Forms.CheckBox(); + this.checkBox100s = new System.Windows.Forms.CheckBox(); this.checkBox20s = new System.Windows.Forms.CheckBox(); this.checkBox10s = new System.Windows.Forms.CheckBox(); this.checkBox1s = new System.Windows.Forms.CheckBox(); @@ -735,7 +735,7 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.checkBox_100s); + this.groupBox2.Controls.Add(this.checkBox100s); this.groupBox2.Controls.Add(this.checkBox20s); this.groupBox2.Controls.Add(this.checkBox10s); this.groupBox2.Controls.Add(this.checkBox1s); @@ -747,16 +747,17 @@ this.groupBox2.TabIndex = 40; this.groupBox2.TabStop = false; // - // checkBox_100s + // checkBox100s // - this.checkBox_100s.AutoSize = true; - this.checkBox_100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_100s.Location = new System.Drawing.Point(468, 19); - this.checkBox_100s.Name = "checkBox_100s"; - this.checkBox_100s.Size = new System.Drawing.Size(58, 24); - this.checkBox_100s.TabIndex = 361; - this.checkBox_100s.Text = "100s"; - this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox100s.AutoSize = true; + this.checkBox100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox100s.Location = new System.Drawing.Point(468, 19); + this.checkBox100s.Name = "checkBox100s"; + this.checkBox100s.Size = new System.Drawing.Size(58, 24); + this.checkBox100s.TabIndex = 361; + this.checkBox100s.Text = "100s"; + this.checkBox100s.UseVisualStyleBackColor = true; + this.checkBox100s.CheckedChanged += new System.EventHandler(this.checkBox100s_CheckedChanged); // // checkBox20s // @@ -768,6 +769,7 @@ this.checkBox20s.TabIndex = 360; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -779,6 +781,7 @@ this.checkBox10s.TabIndex = 359; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -790,6 +793,7 @@ this.checkBox1s.TabIndex = 358; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // @@ -930,7 +934,7 @@ private System.Windows.Forms.Label label14; public System.Windows.Forms.GroupBox groupBox1; public System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox checkBox_100s; + private System.Windows.Forms.CheckBox checkBox100s; private System.Windows.Forms.CheckBox checkBox20s; private System.Windows.Forms.CheckBox checkBox10s; private System.Windows.Forms.CheckBox checkBox1s; diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index da45f50..1bb08ca 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -213,7 +213,7 @@ long detectionItemId = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionItemId; this.HideMaskAction(); - + HomeCtrlForm.homeCtrlForm.refreshChannelList(); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } @@ -221,6 +221,8 @@ private void btnExitDev_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -272,20 +274,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } timePicker_endTime.Value = endTimeBySystem; @@ -320,5 +322,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index cbb6cba..35c7a60 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -74,7 +74,7 @@ this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.checkBox_100s = new System.Windows.Forms.CheckBox(); + this.checkBox100s = new System.Windows.Forms.CheckBox(); this.checkBox20s = new System.Windows.Forms.CheckBox(); this.checkBox10s = new System.Windows.Forms.CheckBox(); this.checkBox1s = new System.Windows.Forms.CheckBox(); @@ -735,7 +735,7 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.checkBox_100s); + this.groupBox2.Controls.Add(this.checkBox100s); this.groupBox2.Controls.Add(this.checkBox20s); this.groupBox2.Controls.Add(this.checkBox10s); this.groupBox2.Controls.Add(this.checkBox1s); @@ -747,16 +747,17 @@ this.groupBox2.TabIndex = 40; this.groupBox2.TabStop = false; // - // checkBox_100s + // checkBox100s // - this.checkBox_100s.AutoSize = true; - this.checkBox_100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_100s.Location = new System.Drawing.Point(468, 19); - this.checkBox_100s.Name = "checkBox_100s"; - this.checkBox_100s.Size = new System.Drawing.Size(58, 24); - this.checkBox_100s.TabIndex = 361; - this.checkBox_100s.Text = "100s"; - this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox100s.AutoSize = true; + this.checkBox100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox100s.Location = new System.Drawing.Point(468, 19); + this.checkBox100s.Name = "checkBox100s"; + this.checkBox100s.Size = new System.Drawing.Size(58, 24); + this.checkBox100s.TabIndex = 361; + this.checkBox100s.Text = "100s"; + this.checkBox100s.UseVisualStyleBackColor = true; + this.checkBox100s.CheckedChanged += new System.EventHandler(this.checkBox100s_CheckedChanged); // // checkBox20s // @@ -768,6 +769,7 @@ this.checkBox20s.TabIndex = 360; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -779,6 +781,7 @@ this.checkBox10s.TabIndex = 359; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -790,6 +793,7 @@ this.checkBox1s.TabIndex = 358; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // @@ -930,7 +934,7 @@ private System.Windows.Forms.Label label14; public System.Windows.Forms.GroupBox groupBox1; public System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox checkBox_100s; + private System.Windows.Forms.CheckBox checkBox100s; private System.Windows.Forms.CheckBox checkBox20s; private System.Windows.Forms.CheckBox checkBox10s; private System.Windows.Forms.CheckBox checkBox1s; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 8af1705..5d7de27 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -84,6 +84,8 @@ private void btnAddDevCancel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } // 添加并开始检测 @@ -115,7 +117,7 @@ } if (text_channelNo.Text.Trim() != "") { - if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox_100s.Checked) + if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox100s.Checked) { MessageBox.Show("请选择频率稳定度采样时间!"); return; @@ -142,7 +144,12 @@ string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; - string devTypeCode = cbBox_devType.SelectedValue.ToString(); + string devTypeCode = "1"; + foreach (Dict dict in (List)cbBox_devType.DataSource) + { + if (text_devType.Text.Equals(dict.Name)) devTypeCode = dict.Code; + } + //string devTypeCode = cbBox_devType.SelectedValue.ToString(); string channelNo = text_channelNo.Text.Trim(); string statusId = ""; @@ -263,7 +270,7 @@ if (checkBox1s.Checked) interval = "1,"; if (checkBox10s.Checked) interval = interval + "10,"; if (checkBox20s.Checked) interval = interval + "20,"; - if (checkBox_100s.Checked) interval = interval + "100"; + if (checkBox100s.Checked) interval = interval + "100"; stability = "-2"; @@ -273,7 +280,7 @@ if (checkBox1s.Checked) stability1 = "-1"; if (checkBox10s.Checked) stability10 = "-1"; if (checkBox20s.Checked) stability20 = "-1"; - if (checkBox_100s.Checked) stability100 = "-1"; + if (checkBox100s.Checked) stability100 = "-1"; detectionHelper.detecStability(deviceId, startTime, interval, port, true, false); } else @@ -281,7 +288,7 @@ if (checkBox1s.Checked) stability1 = "-2"; if (checkBox10s.Checked) stability10 = "-2"; if (checkBox20s.Checked) stability20 = "-2"; - if (checkBox_100s.Checked) stability100 = "-2"; + if (checkBox100s.Checked) stability100 = "-2"; detectionHelper.detecStability(deviceId, startTime, interval, port, false, false); } } @@ -334,6 +341,8 @@ //开始检测 long detectionId0 = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionId0; + + HomeCtrlForm.homeCtrlForm.refreshChannelList(); } if (labelTitle.Text.Equals("添加")) MessageBox.Show("添加成功!"); @@ -428,20 +437,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -482,5 +491,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index da45f50..1bb08ca 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -213,7 +213,7 @@ long detectionItemId = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionItemId; this.HideMaskAction(); - + HomeCtrlForm.homeCtrlForm.refreshChannelList(); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } @@ -221,6 +221,8 @@ private void btnExitDev_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -272,20 +274,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } timePicker_endTime.Value = endTimeBySystem; @@ -320,5 +322,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index cbb6cba..35c7a60 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -74,7 +74,7 @@ this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.checkBox_100s = new System.Windows.Forms.CheckBox(); + this.checkBox100s = new System.Windows.Forms.CheckBox(); this.checkBox20s = new System.Windows.Forms.CheckBox(); this.checkBox10s = new System.Windows.Forms.CheckBox(); this.checkBox1s = new System.Windows.Forms.CheckBox(); @@ -735,7 +735,7 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.checkBox_100s); + this.groupBox2.Controls.Add(this.checkBox100s); this.groupBox2.Controls.Add(this.checkBox20s); this.groupBox2.Controls.Add(this.checkBox10s); this.groupBox2.Controls.Add(this.checkBox1s); @@ -747,16 +747,17 @@ this.groupBox2.TabIndex = 40; this.groupBox2.TabStop = false; // - // checkBox_100s + // checkBox100s // - this.checkBox_100s.AutoSize = true; - this.checkBox_100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_100s.Location = new System.Drawing.Point(468, 19); - this.checkBox_100s.Name = "checkBox_100s"; - this.checkBox_100s.Size = new System.Drawing.Size(58, 24); - this.checkBox_100s.TabIndex = 361; - this.checkBox_100s.Text = "100s"; - this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox100s.AutoSize = true; + this.checkBox100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox100s.Location = new System.Drawing.Point(468, 19); + this.checkBox100s.Name = "checkBox100s"; + this.checkBox100s.Size = new System.Drawing.Size(58, 24); + this.checkBox100s.TabIndex = 361; + this.checkBox100s.Text = "100s"; + this.checkBox100s.UseVisualStyleBackColor = true; + this.checkBox100s.CheckedChanged += new System.EventHandler(this.checkBox100s_CheckedChanged); // // checkBox20s // @@ -768,6 +769,7 @@ this.checkBox20s.TabIndex = 360; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -779,6 +781,7 @@ this.checkBox10s.TabIndex = 359; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -790,6 +793,7 @@ this.checkBox1s.TabIndex = 358; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // @@ -930,7 +934,7 @@ private System.Windows.Forms.Label label14; public System.Windows.Forms.GroupBox groupBox1; public System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox checkBox_100s; + private System.Windows.Forms.CheckBox checkBox100s; private System.Windows.Forms.CheckBox checkBox20s; private System.Windows.Forms.CheckBox checkBox10s; private System.Windows.Forms.CheckBox checkBox1s; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 8af1705..5d7de27 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -84,6 +84,8 @@ private void btnAddDevCancel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } // 添加并开始检测 @@ -115,7 +117,7 @@ } if (text_channelNo.Text.Trim() != "") { - if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox_100s.Checked) + if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox100s.Checked) { MessageBox.Show("请选择频率稳定度采样时间!"); return; @@ -142,7 +144,12 @@ string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; - string devTypeCode = cbBox_devType.SelectedValue.ToString(); + string devTypeCode = "1"; + foreach (Dict dict in (List)cbBox_devType.DataSource) + { + if (text_devType.Text.Equals(dict.Name)) devTypeCode = dict.Code; + } + //string devTypeCode = cbBox_devType.SelectedValue.ToString(); string channelNo = text_channelNo.Text.Trim(); string statusId = ""; @@ -263,7 +270,7 @@ if (checkBox1s.Checked) interval = "1,"; if (checkBox10s.Checked) interval = interval + "10,"; if (checkBox20s.Checked) interval = interval + "20,"; - if (checkBox_100s.Checked) interval = interval + "100"; + if (checkBox100s.Checked) interval = interval + "100"; stability = "-2"; @@ -273,7 +280,7 @@ if (checkBox1s.Checked) stability1 = "-1"; if (checkBox10s.Checked) stability10 = "-1"; if (checkBox20s.Checked) stability20 = "-1"; - if (checkBox_100s.Checked) stability100 = "-1"; + if (checkBox100s.Checked) stability100 = "-1"; detectionHelper.detecStability(deviceId, startTime, interval, port, true, false); } else @@ -281,7 +288,7 @@ if (checkBox1s.Checked) stability1 = "-2"; if (checkBox10s.Checked) stability10 = "-2"; if (checkBox20s.Checked) stability20 = "-2"; - if (checkBox_100s.Checked) stability100 = "-2"; + if (checkBox100s.Checked) stability100 = "-2"; detectionHelper.detecStability(deviceId, startTime, interval, port, false, false); } } @@ -334,6 +341,8 @@ //开始检测 long detectionId0 = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionId0; + + HomeCtrlForm.homeCtrlForm.refreshChannelList(); } if (labelTitle.Text.Equals("添加")) MessageBox.Show("添加成功!"); @@ -428,20 +437,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -482,5 +491,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 66be073..82dd74d 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -670,10 +670,6 @@ private DevComponents.Editors.ComboItem channel4; private DevComponents.Editors.ComboItem channel5; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label label_customerComp; - private System.Windows.Forms.Label label_devCode; - private System.Windows.Forms.Label label_customerName; - private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; @@ -700,5 +696,9 @@ public System.Windows.Forms.DataGridView dataGridView_Data; public System.Windows.Forms.Label label_reDetecting; private RoundButton roundButton1; + public System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_customerComp; + public System.Windows.Forms.Label label_devCode; + public System.Windows.Forms.Label label_customerName; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index da45f50..1bb08ca 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -213,7 +213,7 @@ long detectionItemId = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionItemId; this.HideMaskAction(); - + HomeCtrlForm.homeCtrlForm.refreshChannelList(); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } @@ -221,6 +221,8 @@ private void btnExitDev_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -272,20 +274,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } timePicker_endTime.Value = endTimeBySystem; @@ -320,5 +322,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index cbb6cba..35c7a60 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -74,7 +74,7 @@ this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.checkBox_100s = new System.Windows.Forms.CheckBox(); + this.checkBox100s = new System.Windows.Forms.CheckBox(); this.checkBox20s = new System.Windows.Forms.CheckBox(); this.checkBox10s = new System.Windows.Forms.CheckBox(); this.checkBox1s = new System.Windows.Forms.CheckBox(); @@ -735,7 +735,7 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.checkBox_100s); + this.groupBox2.Controls.Add(this.checkBox100s); this.groupBox2.Controls.Add(this.checkBox20s); this.groupBox2.Controls.Add(this.checkBox10s); this.groupBox2.Controls.Add(this.checkBox1s); @@ -747,16 +747,17 @@ this.groupBox2.TabIndex = 40; this.groupBox2.TabStop = false; // - // checkBox_100s + // checkBox100s // - this.checkBox_100s.AutoSize = true; - this.checkBox_100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_100s.Location = new System.Drawing.Point(468, 19); - this.checkBox_100s.Name = "checkBox_100s"; - this.checkBox_100s.Size = new System.Drawing.Size(58, 24); - this.checkBox_100s.TabIndex = 361; - this.checkBox_100s.Text = "100s"; - this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox100s.AutoSize = true; + this.checkBox100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox100s.Location = new System.Drawing.Point(468, 19); + this.checkBox100s.Name = "checkBox100s"; + this.checkBox100s.Size = new System.Drawing.Size(58, 24); + this.checkBox100s.TabIndex = 361; + this.checkBox100s.Text = "100s"; + this.checkBox100s.UseVisualStyleBackColor = true; + this.checkBox100s.CheckedChanged += new System.EventHandler(this.checkBox100s_CheckedChanged); // // checkBox20s // @@ -768,6 +769,7 @@ this.checkBox20s.TabIndex = 360; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -779,6 +781,7 @@ this.checkBox10s.TabIndex = 359; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -790,6 +793,7 @@ this.checkBox1s.TabIndex = 358; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // @@ -930,7 +934,7 @@ private System.Windows.Forms.Label label14; public System.Windows.Forms.GroupBox groupBox1; public System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox checkBox_100s; + private System.Windows.Forms.CheckBox checkBox100s; private System.Windows.Forms.CheckBox checkBox20s; private System.Windows.Forms.CheckBox checkBox10s; private System.Windows.Forms.CheckBox checkBox1s; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 8af1705..5d7de27 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -84,6 +84,8 @@ private void btnAddDevCancel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } // 添加并开始检测 @@ -115,7 +117,7 @@ } if (text_channelNo.Text.Trim() != "") { - if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox_100s.Checked) + if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox100s.Checked) { MessageBox.Show("请选择频率稳定度采样时间!"); return; @@ -142,7 +144,12 @@ string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; - string devTypeCode = cbBox_devType.SelectedValue.ToString(); + string devTypeCode = "1"; + foreach (Dict dict in (List)cbBox_devType.DataSource) + { + if (text_devType.Text.Equals(dict.Name)) devTypeCode = dict.Code; + } + //string devTypeCode = cbBox_devType.SelectedValue.ToString(); string channelNo = text_channelNo.Text.Trim(); string statusId = ""; @@ -263,7 +270,7 @@ if (checkBox1s.Checked) interval = "1,"; if (checkBox10s.Checked) interval = interval + "10,"; if (checkBox20s.Checked) interval = interval + "20,"; - if (checkBox_100s.Checked) interval = interval + "100"; + if (checkBox100s.Checked) interval = interval + "100"; stability = "-2"; @@ -273,7 +280,7 @@ if (checkBox1s.Checked) stability1 = "-1"; if (checkBox10s.Checked) stability10 = "-1"; if (checkBox20s.Checked) stability20 = "-1"; - if (checkBox_100s.Checked) stability100 = "-1"; + if (checkBox100s.Checked) stability100 = "-1"; detectionHelper.detecStability(deviceId, startTime, interval, port, true, false); } else @@ -281,7 +288,7 @@ if (checkBox1s.Checked) stability1 = "-2"; if (checkBox10s.Checked) stability10 = "-2"; if (checkBox20s.Checked) stability20 = "-2"; - if (checkBox_100s.Checked) stability100 = "-2"; + if (checkBox100s.Checked) stability100 = "-2"; detectionHelper.detecStability(deviceId, startTime, interval, port, false, false); } } @@ -334,6 +341,8 @@ //开始检测 long detectionId0 = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionId0; + + HomeCtrlForm.homeCtrlForm.refreshChannelList(); } if (labelTitle.Text.Equals("添加")) MessageBox.Show("添加成功!"); @@ -428,20 +437,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -482,5 +491,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 66be073..82dd74d 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -670,10 +670,6 @@ private DevComponents.Editors.ComboItem channel4; private DevComponents.Editors.ComboItem channel5; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label label_customerComp; - private System.Windows.Forms.Label label_devCode; - private System.Windows.Forms.Label label_customerName; - private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; @@ -700,5 +696,9 @@ public System.Windows.Forms.DataGridView dataGridView_Data; public System.Windows.Forms.Label label_reDetecting; private RoundButton roundButton1; + public System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_customerComp; + public System.Windows.Forms.Label label_devCode; + public System.Windows.Forms.Label label_customerName; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index ce2e4ef..a670fe8 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -1,15 +1,11 @@ -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto; -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; using Casic.Birmm.RbFreqStandMeasure.Tools; -using DevComponents.DotNetBar.Controls; -using DevComponents.Editors; using System; using System.Collections.Generic; using System.Data; using System.Drawing; -using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -51,15 +47,15 @@ public static DataGridView dataGridView; public static Label label_redetecting; - + public static DetailDlg detailDlg; long deviceId = -1; string startTime = ""; string endTime = ""; - string resultAccStr = ""; - string resultStaStr10 = ""; - string resultStaStr20 = ""; - string resultStaStr100 = ""; - string resultStaStr1 = ""; + public string resultAccStr = ""; + public string resultStaStr10 = ""; + public string resultStaStr20 = ""; + public string resultStaStr100 = ""; + public string resultStaStr1 = ""; string resultBootStr = ""; string resultAgeStr = ""; @@ -72,7 +68,7 @@ public DetailDlg(long deviceId) { InitializeComponent(); - + detailDlg = this; this.deviceId = deviceId; LoadTimes(deviceId); @@ -87,19 +83,18 @@ resultStaStr1 = dataGridView_times.Rows[0].Cells[8].Value.ToString(); resultBootStr = dataGridView_times.Rows[0].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[0].Cells[6].Value.ToString(); - LoadData(deviceId, "1-1", startTime, endTime); - - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + if ((!resultStaStr1.Equals("-1")&& !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1")&& !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) ||( !resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if(!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if(!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + if (!resultBootStr.Equals("-1")&& !resultBootStr.Equals("-2")&& !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + if (!resultAgeStr.Equals("-1")&&!resultAgeStr.Equals("-2")&& !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); } if (dataGridView_Data.Rows.Count == 0) btn_reDetec.Enabled = false; @@ -114,6 +109,8 @@ return; } this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -173,8 +170,8 @@ tableOriginData.Columns.Add("序号", Type.GetType("System.String")); tableOriginData.Columns.Add("输出值", Type.GetType("System.String")); tableOriginData.Columns.Add("测量值", Type.GetType("System.String")); - tableOriginData.Columns.Add("灵敏度", Type.GetType("System.String")); - tableOriginData.Columns.Add("测量时间", Type.GetType("System.DateTime")); + tableOriginData.Columns.Add("灵敏度(Vpp)", Type.GetType("System.String")); + tableOriginData.Columns.Add("测量时间", Type.GetType("System.String")); // 获取当前页的数据 @@ -192,11 +189,11 @@ dataGridView_Data.DataSource = tableOriginData; // width=425px - dataGridView_Data.Columns[0].Width = 50; - dataGridView_Data.Columns[1].Width = 80; - dataGridView_Data.Columns[2].Width = 155; - dataGridView_Data.Columns[3].Width = 75; - dataGridView_Data.Columns[4].Width = 110; + dataGridView_Data.Columns[0].Width = 45; + dataGridView_Data.Columns[1].Width = 60; + dataGridView_Data.Columns[2].Width = 150; + dataGridView_Data.Columns[3].Width = 85; + dataGridView_Data.Columns[4].Width = 135; dataGridView_Data.Columns[0].ReadOnly = true; dataGridView_Data.Columns[1].ReadOnly = true; @@ -305,17 +302,18 @@ resultBootStr = dataGridView_times.Rows[rowIndex].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[rowIndex].Cells[6].Value.ToString(); - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + else if ((!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) || (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if (!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if (!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + else if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + else if (!resultAgeStr.Equals("-1") && !resultAgeStr.Equals("-2") && !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); + } } @@ -326,11 +324,12 @@ { case "tab_stability": { + tabControl1.SelectedIndex = 0; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = true; btn_reDetec.Enabled = true; - + radio_1s.Checked = true; LoadData(deviceId, "1-1", startTime, endTime); groupBox3.Text = "1s频率稳定度"; stability result = new stability(); @@ -345,6 +344,7 @@ } case "tab_accuracy": { + tabControl1.SelectedIndex = 1; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -363,13 +363,14 @@ } case "tab_bootFeature": { + tabControl1.SelectedIndex = 2; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; - bootFeature result = new bootFeature(); + bootFeature result = new bootFeature(tableOriginData); result.label_bootFeature.Text = ""; if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) result.label_bootFeature.Text = resultBootStr; result.Show(); @@ -378,6 +379,7 @@ } case "tab_ageRate": { + tabControl1.SelectedIndex = 3; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -400,6 +402,7 @@ } case "tab_counter": { + tabControl1.SelectedIndex = 4; btn_reDetec.Visible = false; dataGridView_times.Visible = false; panel_radios.Visible = false; @@ -436,7 +439,7 @@ else if (radio_20s.Checked) dlg.label1.Text = "频率稳定度 - 20s"; else if (radio_100s.Checked) dlg.label1.Text = "频率稳定度 - 100s"; } - dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); + //dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); dlg.HideMaskAction += () => { this.HideMask(); @@ -530,6 +533,12 @@ } } + public void updateChannelNoRedetec() + { + dataGridView_times.CurrentRow.Cells[7].Value = ReDetecDlg.channelNoReDetec; + detectionItemService.updateChannelNo(Convert.ToInt64(dataGridView_times.CurrentRow.Cells[12].Value), ReDetecDlg.channelNoReDetec); + } + private void roundButton1_Click_1(object sender, EventArgs e) { diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index da45f50..1bb08ca 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -213,7 +213,7 @@ long detectionItemId = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionItemId; this.HideMaskAction(); - + HomeCtrlForm.homeCtrlForm.refreshChannelList(); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } @@ -221,6 +221,8 @@ private void btnExitDev_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -272,20 +274,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } timePicker_endTime.Value = endTimeBySystem; @@ -320,5 +322,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index cbb6cba..35c7a60 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -74,7 +74,7 @@ this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.checkBox_100s = new System.Windows.Forms.CheckBox(); + this.checkBox100s = new System.Windows.Forms.CheckBox(); this.checkBox20s = new System.Windows.Forms.CheckBox(); this.checkBox10s = new System.Windows.Forms.CheckBox(); this.checkBox1s = new System.Windows.Forms.CheckBox(); @@ -735,7 +735,7 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.checkBox_100s); + this.groupBox2.Controls.Add(this.checkBox100s); this.groupBox2.Controls.Add(this.checkBox20s); this.groupBox2.Controls.Add(this.checkBox10s); this.groupBox2.Controls.Add(this.checkBox1s); @@ -747,16 +747,17 @@ this.groupBox2.TabIndex = 40; this.groupBox2.TabStop = false; // - // checkBox_100s + // checkBox100s // - this.checkBox_100s.AutoSize = true; - this.checkBox_100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_100s.Location = new System.Drawing.Point(468, 19); - this.checkBox_100s.Name = "checkBox_100s"; - this.checkBox_100s.Size = new System.Drawing.Size(58, 24); - this.checkBox_100s.TabIndex = 361; - this.checkBox_100s.Text = "100s"; - this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox100s.AutoSize = true; + this.checkBox100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox100s.Location = new System.Drawing.Point(468, 19); + this.checkBox100s.Name = "checkBox100s"; + this.checkBox100s.Size = new System.Drawing.Size(58, 24); + this.checkBox100s.TabIndex = 361; + this.checkBox100s.Text = "100s"; + this.checkBox100s.UseVisualStyleBackColor = true; + this.checkBox100s.CheckedChanged += new System.EventHandler(this.checkBox100s_CheckedChanged); // // checkBox20s // @@ -768,6 +769,7 @@ this.checkBox20s.TabIndex = 360; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -779,6 +781,7 @@ this.checkBox10s.TabIndex = 359; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -790,6 +793,7 @@ this.checkBox1s.TabIndex = 358; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // @@ -930,7 +934,7 @@ private System.Windows.Forms.Label label14; public System.Windows.Forms.GroupBox groupBox1; public System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox checkBox_100s; + private System.Windows.Forms.CheckBox checkBox100s; private System.Windows.Forms.CheckBox checkBox20s; private System.Windows.Forms.CheckBox checkBox10s; private System.Windows.Forms.CheckBox checkBox1s; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 8af1705..5d7de27 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -84,6 +84,8 @@ private void btnAddDevCancel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } // 添加并开始检测 @@ -115,7 +117,7 @@ } if (text_channelNo.Text.Trim() != "") { - if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox_100s.Checked) + if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox100s.Checked) { MessageBox.Show("请选择频率稳定度采样时间!"); return; @@ -142,7 +144,12 @@ string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; - string devTypeCode = cbBox_devType.SelectedValue.ToString(); + string devTypeCode = "1"; + foreach (Dict dict in (List)cbBox_devType.DataSource) + { + if (text_devType.Text.Equals(dict.Name)) devTypeCode = dict.Code; + } + //string devTypeCode = cbBox_devType.SelectedValue.ToString(); string channelNo = text_channelNo.Text.Trim(); string statusId = ""; @@ -263,7 +270,7 @@ if (checkBox1s.Checked) interval = "1,"; if (checkBox10s.Checked) interval = interval + "10,"; if (checkBox20s.Checked) interval = interval + "20,"; - if (checkBox_100s.Checked) interval = interval + "100"; + if (checkBox100s.Checked) interval = interval + "100"; stability = "-2"; @@ -273,7 +280,7 @@ if (checkBox1s.Checked) stability1 = "-1"; if (checkBox10s.Checked) stability10 = "-1"; if (checkBox20s.Checked) stability20 = "-1"; - if (checkBox_100s.Checked) stability100 = "-1"; + if (checkBox100s.Checked) stability100 = "-1"; detectionHelper.detecStability(deviceId, startTime, interval, port, true, false); } else @@ -281,7 +288,7 @@ if (checkBox1s.Checked) stability1 = "-2"; if (checkBox10s.Checked) stability10 = "-2"; if (checkBox20s.Checked) stability20 = "-2"; - if (checkBox_100s.Checked) stability100 = "-2"; + if (checkBox100s.Checked) stability100 = "-2"; detectionHelper.detecStability(deviceId, startTime, interval, port, false, false); } } @@ -334,6 +341,8 @@ //开始检测 long detectionId0 = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionId0; + + HomeCtrlForm.homeCtrlForm.refreshChannelList(); } if (labelTitle.Text.Equals("添加")) MessageBox.Show("添加成功!"); @@ -428,20 +437,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -482,5 +491,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 66be073..82dd74d 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -670,10 +670,6 @@ private DevComponents.Editors.ComboItem channel4; private DevComponents.Editors.ComboItem channel5; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label label_customerComp; - private System.Windows.Forms.Label label_devCode; - private System.Windows.Forms.Label label_customerName; - private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; @@ -700,5 +696,9 @@ public System.Windows.Forms.DataGridView dataGridView_Data; public System.Windows.Forms.Label label_reDetecting; private RoundButton roundButton1; + public System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_customerComp; + public System.Windows.Forms.Label label_devCode; + public System.Windows.Forms.Label label_customerName; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index ce2e4ef..a670fe8 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -1,15 +1,11 @@ -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto; -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; using Casic.Birmm.RbFreqStandMeasure.Tools; -using DevComponents.DotNetBar.Controls; -using DevComponents.Editors; using System; using System.Collections.Generic; using System.Data; using System.Drawing; -using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -51,15 +47,15 @@ public static DataGridView dataGridView; public static Label label_redetecting; - + public static DetailDlg detailDlg; long deviceId = -1; string startTime = ""; string endTime = ""; - string resultAccStr = ""; - string resultStaStr10 = ""; - string resultStaStr20 = ""; - string resultStaStr100 = ""; - string resultStaStr1 = ""; + public string resultAccStr = ""; + public string resultStaStr10 = ""; + public string resultStaStr20 = ""; + public string resultStaStr100 = ""; + public string resultStaStr1 = ""; string resultBootStr = ""; string resultAgeStr = ""; @@ -72,7 +68,7 @@ public DetailDlg(long deviceId) { InitializeComponent(); - + detailDlg = this; this.deviceId = deviceId; LoadTimes(deviceId); @@ -87,19 +83,18 @@ resultStaStr1 = dataGridView_times.Rows[0].Cells[8].Value.ToString(); resultBootStr = dataGridView_times.Rows[0].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[0].Cells[6].Value.ToString(); - LoadData(deviceId, "1-1", startTime, endTime); - - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + if ((!resultStaStr1.Equals("-1")&& !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1")&& !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) ||( !resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if(!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if(!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + if (!resultBootStr.Equals("-1")&& !resultBootStr.Equals("-2")&& !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + if (!resultAgeStr.Equals("-1")&&!resultAgeStr.Equals("-2")&& !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); } if (dataGridView_Data.Rows.Count == 0) btn_reDetec.Enabled = false; @@ -114,6 +109,8 @@ return; } this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -173,8 +170,8 @@ tableOriginData.Columns.Add("序号", Type.GetType("System.String")); tableOriginData.Columns.Add("输出值", Type.GetType("System.String")); tableOriginData.Columns.Add("测量值", Type.GetType("System.String")); - tableOriginData.Columns.Add("灵敏度", Type.GetType("System.String")); - tableOriginData.Columns.Add("测量时间", Type.GetType("System.DateTime")); + tableOriginData.Columns.Add("灵敏度(Vpp)", Type.GetType("System.String")); + tableOriginData.Columns.Add("测量时间", Type.GetType("System.String")); // 获取当前页的数据 @@ -192,11 +189,11 @@ dataGridView_Data.DataSource = tableOriginData; // width=425px - dataGridView_Data.Columns[0].Width = 50; - dataGridView_Data.Columns[1].Width = 80; - dataGridView_Data.Columns[2].Width = 155; - dataGridView_Data.Columns[3].Width = 75; - dataGridView_Data.Columns[4].Width = 110; + dataGridView_Data.Columns[0].Width = 45; + dataGridView_Data.Columns[1].Width = 60; + dataGridView_Data.Columns[2].Width = 150; + dataGridView_Data.Columns[3].Width = 85; + dataGridView_Data.Columns[4].Width = 135; dataGridView_Data.Columns[0].ReadOnly = true; dataGridView_Data.Columns[1].ReadOnly = true; @@ -305,17 +302,18 @@ resultBootStr = dataGridView_times.Rows[rowIndex].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[rowIndex].Cells[6].Value.ToString(); - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + else if ((!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) || (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if (!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if (!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + else if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + else if (!resultAgeStr.Equals("-1") && !resultAgeStr.Equals("-2") && !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); + } } @@ -326,11 +324,12 @@ { case "tab_stability": { + tabControl1.SelectedIndex = 0; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = true; btn_reDetec.Enabled = true; - + radio_1s.Checked = true; LoadData(deviceId, "1-1", startTime, endTime); groupBox3.Text = "1s频率稳定度"; stability result = new stability(); @@ -345,6 +344,7 @@ } case "tab_accuracy": { + tabControl1.SelectedIndex = 1; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -363,13 +363,14 @@ } case "tab_bootFeature": { + tabControl1.SelectedIndex = 2; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; - bootFeature result = new bootFeature(); + bootFeature result = new bootFeature(tableOriginData); result.label_bootFeature.Text = ""; if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) result.label_bootFeature.Text = resultBootStr; result.Show(); @@ -378,6 +379,7 @@ } case "tab_ageRate": { + tabControl1.SelectedIndex = 3; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -400,6 +402,7 @@ } case "tab_counter": { + tabControl1.SelectedIndex = 4; btn_reDetec.Visible = false; dataGridView_times.Visible = false; panel_radios.Visible = false; @@ -436,7 +439,7 @@ else if (radio_20s.Checked) dlg.label1.Text = "频率稳定度 - 20s"; else if (radio_100s.Checked) dlg.label1.Text = "频率稳定度 - 100s"; } - dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); + //dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); dlg.HideMaskAction += () => { this.HideMask(); @@ -530,6 +533,12 @@ } } + public void updateChannelNoRedetec() + { + dataGridView_times.CurrentRow.Cells[7].Value = ReDetecDlg.channelNoReDetec; + detectionItemService.updateChannelNo(Convert.ToInt64(dataGridView_times.CurrentRow.Cells[12].Value), ReDetecDlg.channelNoReDetec); + } + private void roundButton1_Click_1(object sender, EventArgs e) { diff --git a/RbFreqStandMeasure/info/ExportDlg.cs b/RbFreqStandMeasure/info/ExportDlg.cs index d7c6e02..53a903a 100644 --- a/RbFreqStandMeasure/info/ExportDlg.cs +++ b/RbFreqStandMeasure/info/ExportDlg.cs @@ -195,12 +195,7 @@ } private void btn_reDetec_Click(object sender, EventArgs e) - { - string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; - - StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); - strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); - strmWriterObj.WriteLine("序号,时间,相对频率偏差"); + { bool selected = false; foreach (DataGridViewRow row in dataGridView_times.Rows) { @@ -211,9 +206,14 @@ } if (!selected) { - MessageBox.Show("请选择要导出的数据!"); + MessageBox.Show("请选择要导出的检测记录!"); return; } + string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + + StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); + strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); + strmWriterObj.WriteLine("序号,时间,相对频率偏差"); foreach (DataGridViewRow row in dataGridView_times.Rows) { DataGridViewCheckBoxCell checkBox = (DataGridViewCheckBoxCell)row.Cells[0]; @@ -266,6 +266,18 @@ } } + + CounterDataService counterDataService = new CounterDataServiceImpl(); + List query = counterDataService.getHistory(deviceId, "", ""); + strmWriterObj.WriteLine("计数器范围及灵敏度"); + strmWriterObj.WriteLine("序号,输出值,测量值,灵敏度,时间"); + int index2 = 1; + foreach (CounterData counterData in query) + { + string strBufferLine = index2 + "," + counterData.OutValue + "," + counterData.Value + "," + counterData.Sensitivity + "," + counterData.LogTime; + strmWriterObj.WriteLine(strBufferLine); + index2++; + } strmWriterObj.Close(); MessageBox.Show("导出成功,存放位置:" + strFilePath); diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index da45f50..1bb08ca 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -213,7 +213,7 @@ long detectionItemId = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionItemId; this.HideMaskAction(); - + HomeCtrlForm.homeCtrlForm.refreshChannelList(); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } @@ -221,6 +221,8 @@ private void btnExitDev_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -272,20 +274,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } timePicker_endTime.Value = endTimeBySystem; @@ -320,5 +322,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index cbb6cba..35c7a60 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -74,7 +74,7 @@ this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.checkBox_100s = new System.Windows.Forms.CheckBox(); + this.checkBox100s = new System.Windows.Forms.CheckBox(); this.checkBox20s = new System.Windows.Forms.CheckBox(); this.checkBox10s = new System.Windows.Forms.CheckBox(); this.checkBox1s = new System.Windows.Forms.CheckBox(); @@ -735,7 +735,7 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.checkBox_100s); + this.groupBox2.Controls.Add(this.checkBox100s); this.groupBox2.Controls.Add(this.checkBox20s); this.groupBox2.Controls.Add(this.checkBox10s); this.groupBox2.Controls.Add(this.checkBox1s); @@ -747,16 +747,17 @@ this.groupBox2.TabIndex = 40; this.groupBox2.TabStop = false; // - // checkBox_100s + // checkBox100s // - this.checkBox_100s.AutoSize = true; - this.checkBox_100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_100s.Location = new System.Drawing.Point(468, 19); - this.checkBox_100s.Name = "checkBox_100s"; - this.checkBox_100s.Size = new System.Drawing.Size(58, 24); - this.checkBox_100s.TabIndex = 361; - this.checkBox_100s.Text = "100s"; - this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox100s.AutoSize = true; + this.checkBox100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox100s.Location = new System.Drawing.Point(468, 19); + this.checkBox100s.Name = "checkBox100s"; + this.checkBox100s.Size = new System.Drawing.Size(58, 24); + this.checkBox100s.TabIndex = 361; + this.checkBox100s.Text = "100s"; + this.checkBox100s.UseVisualStyleBackColor = true; + this.checkBox100s.CheckedChanged += new System.EventHandler(this.checkBox100s_CheckedChanged); // // checkBox20s // @@ -768,6 +769,7 @@ this.checkBox20s.TabIndex = 360; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -779,6 +781,7 @@ this.checkBox10s.TabIndex = 359; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -790,6 +793,7 @@ this.checkBox1s.TabIndex = 358; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // @@ -930,7 +934,7 @@ private System.Windows.Forms.Label label14; public System.Windows.Forms.GroupBox groupBox1; public System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox checkBox_100s; + private System.Windows.Forms.CheckBox checkBox100s; private System.Windows.Forms.CheckBox checkBox20s; private System.Windows.Forms.CheckBox checkBox10s; private System.Windows.Forms.CheckBox checkBox1s; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 8af1705..5d7de27 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -84,6 +84,8 @@ private void btnAddDevCancel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } // 添加并开始检测 @@ -115,7 +117,7 @@ } if (text_channelNo.Text.Trim() != "") { - if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox_100s.Checked) + if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox100s.Checked) { MessageBox.Show("请选择频率稳定度采样时间!"); return; @@ -142,7 +144,12 @@ string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; - string devTypeCode = cbBox_devType.SelectedValue.ToString(); + string devTypeCode = "1"; + foreach (Dict dict in (List)cbBox_devType.DataSource) + { + if (text_devType.Text.Equals(dict.Name)) devTypeCode = dict.Code; + } + //string devTypeCode = cbBox_devType.SelectedValue.ToString(); string channelNo = text_channelNo.Text.Trim(); string statusId = ""; @@ -263,7 +270,7 @@ if (checkBox1s.Checked) interval = "1,"; if (checkBox10s.Checked) interval = interval + "10,"; if (checkBox20s.Checked) interval = interval + "20,"; - if (checkBox_100s.Checked) interval = interval + "100"; + if (checkBox100s.Checked) interval = interval + "100"; stability = "-2"; @@ -273,7 +280,7 @@ if (checkBox1s.Checked) stability1 = "-1"; if (checkBox10s.Checked) stability10 = "-1"; if (checkBox20s.Checked) stability20 = "-1"; - if (checkBox_100s.Checked) stability100 = "-1"; + if (checkBox100s.Checked) stability100 = "-1"; detectionHelper.detecStability(deviceId, startTime, interval, port, true, false); } else @@ -281,7 +288,7 @@ if (checkBox1s.Checked) stability1 = "-2"; if (checkBox10s.Checked) stability10 = "-2"; if (checkBox20s.Checked) stability20 = "-2"; - if (checkBox_100s.Checked) stability100 = "-2"; + if (checkBox100s.Checked) stability100 = "-2"; detectionHelper.detecStability(deviceId, startTime, interval, port, false, false); } } @@ -334,6 +341,8 @@ //开始检测 long detectionId0 = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionId0; + + HomeCtrlForm.homeCtrlForm.refreshChannelList(); } if (labelTitle.Text.Equals("添加")) MessageBox.Show("添加成功!"); @@ -428,20 +437,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -482,5 +491,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 66be073..82dd74d 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -670,10 +670,6 @@ private DevComponents.Editors.ComboItem channel4; private DevComponents.Editors.ComboItem channel5; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label label_customerComp; - private System.Windows.Forms.Label label_devCode; - private System.Windows.Forms.Label label_customerName; - private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; @@ -700,5 +696,9 @@ public System.Windows.Forms.DataGridView dataGridView_Data; public System.Windows.Forms.Label label_reDetecting; private RoundButton roundButton1; + public System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_customerComp; + public System.Windows.Forms.Label label_devCode; + public System.Windows.Forms.Label label_customerName; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index ce2e4ef..a670fe8 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -1,15 +1,11 @@ -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto; -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; using Casic.Birmm.RbFreqStandMeasure.Tools; -using DevComponents.DotNetBar.Controls; -using DevComponents.Editors; using System; using System.Collections.Generic; using System.Data; using System.Drawing; -using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -51,15 +47,15 @@ public static DataGridView dataGridView; public static Label label_redetecting; - + public static DetailDlg detailDlg; long deviceId = -1; string startTime = ""; string endTime = ""; - string resultAccStr = ""; - string resultStaStr10 = ""; - string resultStaStr20 = ""; - string resultStaStr100 = ""; - string resultStaStr1 = ""; + public string resultAccStr = ""; + public string resultStaStr10 = ""; + public string resultStaStr20 = ""; + public string resultStaStr100 = ""; + public string resultStaStr1 = ""; string resultBootStr = ""; string resultAgeStr = ""; @@ -72,7 +68,7 @@ public DetailDlg(long deviceId) { InitializeComponent(); - + detailDlg = this; this.deviceId = deviceId; LoadTimes(deviceId); @@ -87,19 +83,18 @@ resultStaStr1 = dataGridView_times.Rows[0].Cells[8].Value.ToString(); resultBootStr = dataGridView_times.Rows[0].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[0].Cells[6].Value.ToString(); - LoadData(deviceId, "1-1", startTime, endTime); - - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + if ((!resultStaStr1.Equals("-1")&& !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1")&& !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) ||( !resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if(!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if(!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + if (!resultBootStr.Equals("-1")&& !resultBootStr.Equals("-2")&& !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + if (!resultAgeStr.Equals("-1")&&!resultAgeStr.Equals("-2")&& !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); } if (dataGridView_Data.Rows.Count == 0) btn_reDetec.Enabled = false; @@ -114,6 +109,8 @@ return; } this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -173,8 +170,8 @@ tableOriginData.Columns.Add("序号", Type.GetType("System.String")); tableOriginData.Columns.Add("输出值", Type.GetType("System.String")); tableOriginData.Columns.Add("测量值", Type.GetType("System.String")); - tableOriginData.Columns.Add("灵敏度", Type.GetType("System.String")); - tableOriginData.Columns.Add("测量时间", Type.GetType("System.DateTime")); + tableOriginData.Columns.Add("灵敏度(Vpp)", Type.GetType("System.String")); + tableOriginData.Columns.Add("测量时间", Type.GetType("System.String")); // 获取当前页的数据 @@ -192,11 +189,11 @@ dataGridView_Data.DataSource = tableOriginData; // width=425px - dataGridView_Data.Columns[0].Width = 50; - dataGridView_Data.Columns[1].Width = 80; - dataGridView_Data.Columns[2].Width = 155; - dataGridView_Data.Columns[3].Width = 75; - dataGridView_Data.Columns[4].Width = 110; + dataGridView_Data.Columns[0].Width = 45; + dataGridView_Data.Columns[1].Width = 60; + dataGridView_Data.Columns[2].Width = 150; + dataGridView_Data.Columns[3].Width = 85; + dataGridView_Data.Columns[4].Width = 135; dataGridView_Data.Columns[0].ReadOnly = true; dataGridView_Data.Columns[1].ReadOnly = true; @@ -305,17 +302,18 @@ resultBootStr = dataGridView_times.Rows[rowIndex].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[rowIndex].Cells[6].Value.ToString(); - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + else if ((!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) || (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if (!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if (!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + else if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + else if (!resultAgeStr.Equals("-1") && !resultAgeStr.Equals("-2") && !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); + } } @@ -326,11 +324,12 @@ { case "tab_stability": { + tabControl1.SelectedIndex = 0; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = true; btn_reDetec.Enabled = true; - + radio_1s.Checked = true; LoadData(deviceId, "1-1", startTime, endTime); groupBox3.Text = "1s频率稳定度"; stability result = new stability(); @@ -345,6 +344,7 @@ } case "tab_accuracy": { + tabControl1.SelectedIndex = 1; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -363,13 +363,14 @@ } case "tab_bootFeature": { + tabControl1.SelectedIndex = 2; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; - bootFeature result = new bootFeature(); + bootFeature result = new bootFeature(tableOriginData); result.label_bootFeature.Text = ""; if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) result.label_bootFeature.Text = resultBootStr; result.Show(); @@ -378,6 +379,7 @@ } case "tab_ageRate": { + tabControl1.SelectedIndex = 3; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -400,6 +402,7 @@ } case "tab_counter": { + tabControl1.SelectedIndex = 4; btn_reDetec.Visible = false; dataGridView_times.Visible = false; panel_radios.Visible = false; @@ -436,7 +439,7 @@ else if (radio_20s.Checked) dlg.label1.Text = "频率稳定度 - 20s"; else if (radio_100s.Checked) dlg.label1.Text = "频率稳定度 - 100s"; } - dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); + //dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); dlg.HideMaskAction += () => { this.HideMask(); @@ -530,6 +533,12 @@ } } + public void updateChannelNoRedetec() + { + dataGridView_times.CurrentRow.Cells[7].Value = ReDetecDlg.channelNoReDetec; + detectionItemService.updateChannelNo(Convert.ToInt64(dataGridView_times.CurrentRow.Cells[12].Value), ReDetecDlg.channelNoReDetec); + } + private void roundButton1_Click_1(object sender, EventArgs e) { diff --git a/RbFreqStandMeasure/info/ExportDlg.cs b/RbFreqStandMeasure/info/ExportDlg.cs index d7c6e02..53a903a 100644 --- a/RbFreqStandMeasure/info/ExportDlg.cs +++ b/RbFreqStandMeasure/info/ExportDlg.cs @@ -195,12 +195,7 @@ } private void btn_reDetec_Click(object sender, EventArgs e) - { - string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; - - StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); - strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); - strmWriterObj.WriteLine("序号,时间,相对频率偏差"); + { bool selected = false; foreach (DataGridViewRow row in dataGridView_times.Rows) { @@ -211,9 +206,14 @@ } if (!selected) { - MessageBox.Show("请选择要导出的数据!"); + MessageBox.Show("请选择要导出的检测记录!"); return; } + string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + + StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); + strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); + strmWriterObj.WriteLine("序号,时间,相对频率偏差"); foreach (DataGridViewRow row in dataGridView_times.Rows) { DataGridViewCheckBoxCell checkBox = (DataGridViewCheckBoxCell)row.Cells[0]; @@ -266,6 +266,18 @@ } } + + CounterDataService counterDataService = new CounterDataServiceImpl(); + List query = counterDataService.getHistory(deviceId, "", ""); + strmWriterObj.WriteLine("计数器范围及灵敏度"); + strmWriterObj.WriteLine("序号,输出值,测量值,灵敏度,时间"); + int index2 = 1; + foreach (CounterData counterData in query) + { + string strBufferLine = index2 + "," + counterData.OutValue + "," + counterData.Value + "," + counterData.Sensitivity + "," + counterData.LogTime; + strmWriterObj.WriteLine(strBufferLine); + index2++; + } strmWriterObj.Close(); MessageBox.Show("导出成功,存放位置:" + strFilePath); diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 55ae028..3b13488 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -475,10 +475,11 @@ long id = (long)dataGridView_DevList.Rows[rowIndex].Cells[9].Value; DetailDlg detailDlg = new DetailDlg(id); - detailDlg.Controls.Find("label_devModel", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[3].Value.ToString(); - detailDlg.Controls.Find("label_devCode", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[4].Value.ToString(); - detailDlg.Controls.Find("label_customerComp", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[5].Value.ToString(); - detailDlg.Controls.Find("label_customerName", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[6].Value.ToString(); + string model = dataGridView_DevList.Rows[rowIndex].Cells[3].Value.ToString(); + detailDlg.label_devModel.Text = model; + detailDlg.label_devCode.Text = dataGridView_DevList.Rows[rowIndex].Cells[4].Value.ToString(); + detailDlg.label_customerComp.Text = dataGridView_DevList.Rows[rowIndex].Cells[5].Value.ToString(); + detailDlg.label_customerName.Text = dataGridView_DevList.Rows[rowIndex].Cells[6].Value.ToString(); detailDlg.HideMaskAction += () => { @@ -529,7 +530,7 @@ editDlg.checkBox_stability.Checked = true; foreach (string n in detectionItem.Interval.Split(',')) { - if(!n.Equals(""))((RadioButton)editDlg.Controls.Find("radio_" + n + "s", true)[0]).Checked = true; + if(!n.Equals(""))((CheckBox)editDlg.Controls.Find("checkBox" + n + "s", true)[0]).Checked = true; } } if (!detectionItem.BootFeature.Equals("-3")) editDlg.checkBox_bootFeature.Checked = true; @@ -588,14 +589,18 @@ { try { + if (dataGridView_DevList.SelectedRows.Count == 0)//判断是否选中某行 + { + MessageBox.Show("无选中仪器!"); return; + } long devId = Convert.ToInt64(dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[9].Value); + string deviceName = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[2].Value.ToString(); + string deviceType = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[10].Value.ToString(); List queryList = detectionItemService.search(devId, false); if (null != queryList && queryList.Count > 0) { - string deviceName = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[2].Value.ToString(); - string deviceType = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[10].Value.ToString(); - + ExportDlg dlg = new ExportDlg(devId); dlg.label_devName.Text = deviceName; dlg.label_devType.Text = deviceType; @@ -611,7 +616,29 @@ } else { - MessageBox.Show("所选仪器无测试数据可导出!"); + CounterDataService counterDataService = new CounterDataServiceImpl(); + List query = counterDataService.getHistory(devId, "", ""); + if (null != query && query.Count > 0) + { + string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + + StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); + strmWriterObj.WriteLine(deviceName + " - " + deviceType + "-" + "计数器范围及灵敏度"); + strmWriterObj.WriteLine("序号,输出值,测量值,灵敏度,时间"); + int index = 1; + foreach (CounterData counterData in query) + { + string strBufferLine = index + "," + counterData.OutValue + "," + counterData.Value + "," + counterData.Sensitivity + "," + counterData.LogTime; + strmWriterObj.WriteLine(strBufferLine); + index++; + } + strmWriterObj.Close(); + MessageBox.Show("导出成功,存放位置:" + strFilePath); + } + else + { + MessageBox.Show("所选仪器无测试数据可导出!"); + } } } catch (Exception ex) diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index da45f50..1bb08ca 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -213,7 +213,7 @@ long detectionItemId = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionItemId; this.HideMaskAction(); - + HomeCtrlForm.homeCtrlForm.refreshChannelList(); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } @@ -221,6 +221,8 @@ private void btnExitDev_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -272,20 +274,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } timePicker_endTime.Value = endTimeBySystem; @@ -320,5 +322,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index cbb6cba..35c7a60 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -74,7 +74,7 @@ this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.checkBox_100s = new System.Windows.Forms.CheckBox(); + this.checkBox100s = new System.Windows.Forms.CheckBox(); this.checkBox20s = new System.Windows.Forms.CheckBox(); this.checkBox10s = new System.Windows.Forms.CheckBox(); this.checkBox1s = new System.Windows.Forms.CheckBox(); @@ -735,7 +735,7 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.checkBox_100s); + this.groupBox2.Controls.Add(this.checkBox100s); this.groupBox2.Controls.Add(this.checkBox20s); this.groupBox2.Controls.Add(this.checkBox10s); this.groupBox2.Controls.Add(this.checkBox1s); @@ -747,16 +747,17 @@ this.groupBox2.TabIndex = 40; this.groupBox2.TabStop = false; // - // checkBox_100s + // checkBox100s // - this.checkBox_100s.AutoSize = true; - this.checkBox_100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_100s.Location = new System.Drawing.Point(468, 19); - this.checkBox_100s.Name = "checkBox_100s"; - this.checkBox_100s.Size = new System.Drawing.Size(58, 24); - this.checkBox_100s.TabIndex = 361; - this.checkBox_100s.Text = "100s"; - this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox100s.AutoSize = true; + this.checkBox100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox100s.Location = new System.Drawing.Point(468, 19); + this.checkBox100s.Name = "checkBox100s"; + this.checkBox100s.Size = new System.Drawing.Size(58, 24); + this.checkBox100s.TabIndex = 361; + this.checkBox100s.Text = "100s"; + this.checkBox100s.UseVisualStyleBackColor = true; + this.checkBox100s.CheckedChanged += new System.EventHandler(this.checkBox100s_CheckedChanged); // // checkBox20s // @@ -768,6 +769,7 @@ this.checkBox20s.TabIndex = 360; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -779,6 +781,7 @@ this.checkBox10s.TabIndex = 359; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -790,6 +793,7 @@ this.checkBox1s.TabIndex = 358; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // @@ -930,7 +934,7 @@ private System.Windows.Forms.Label label14; public System.Windows.Forms.GroupBox groupBox1; public System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox checkBox_100s; + private System.Windows.Forms.CheckBox checkBox100s; private System.Windows.Forms.CheckBox checkBox20s; private System.Windows.Forms.CheckBox checkBox10s; private System.Windows.Forms.CheckBox checkBox1s; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 8af1705..5d7de27 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -84,6 +84,8 @@ private void btnAddDevCancel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } // 添加并开始检测 @@ -115,7 +117,7 @@ } if (text_channelNo.Text.Trim() != "") { - if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox_100s.Checked) + if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox100s.Checked) { MessageBox.Show("请选择频率稳定度采样时间!"); return; @@ -142,7 +144,12 @@ string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; - string devTypeCode = cbBox_devType.SelectedValue.ToString(); + string devTypeCode = "1"; + foreach (Dict dict in (List)cbBox_devType.DataSource) + { + if (text_devType.Text.Equals(dict.Name)) devTypeCode = dict.Code; + } + //string devTypeCode = cbBox_devType.SelectedValue.ToString(); string channelNo = text_channelNo.Text.Trim(); string statusId = ""; @@ -263,7 +270,7 @@ if (checkBox1s.Checked) interval = "1,"; if (checkBox10s.Checked) interval = interval + "10,"; if (checkBox20s.Checked) interval = interval + "20,"; - if (checkBox_100s.Checked) interval = interval + "100"; + if (checkBox100s.Checked) interval = interval + "100"; stability = "-2"; @@ -273,7 +280,7 @@ if (checkBox1s.Checked) stability1 = "-1"; if (checkBox10s.Checked) stability10 = "-1"; if (checkBox20s.Checked) stability20 = "-1"; - if (checkBox_100s.Checked) stability100 = "-1"; + if (checkBox100s.Checked) stability100 = "-1"; detectionHelper.detecStability(deviceId, startTime, interval, port, true, false); } else @@ -281,7 +288,7 @@ if (checkBox1s.Checked) stability1 = "-2"; if (checkBox10s.Checked) stability10 = "-2"; if (checkBox20s.Checked) stability20 = "-2"; - if (checkBox_100s.Checked) stability100 = "-2"; + if (checkBox100s.Checked) stability100 = "-2"; detectionHelper.detecStability(deviceId, startTime, interval, port, false, false); } } @@ -334,6 +341,8 @@ //开始检测 long detectionId0 = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionId0; + + HomeCtrlForm.homeCtrlForm.refreshChannelList(); } if (labelTitle.Text.Equals("添加")) MessageBox.Show("添加成功!"); @@ -428,20 +437,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -482,5 +491,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 66be073..82dd74d 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -670,10 +670,6 @@ private DevComponents.Editors.ComboItem channel4; private DevComponents.Editors.ComboItem channel5; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label label_customerComp; - private System.Windows.Forms.Label label_devCode; - private System.Windows.Forms.Label label_customerName; - private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; @@ -700,5 +696,9 @@ public System.Windows.Forms.DataGridView dataGridView_Data; public System.Windows.Forms.Label label_reDetecting; private RoundButton roundButton1; + public System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_customerComp; + public System.Windows.Forms.Label label_devCode; + public System.Windows.Forms.Label label_customerName; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index ce2e4ef..a670fe8 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -1,15 +1,11 @@ -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto; -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; using Casic.Birmm.RbFreqStandMeasure.Tools; -using DevComponents.DotNetBar.Controls; -using DevComponents.Editors; using System; using System.Collections.Generic; using System.Data; using System.Drawing; -using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -51,15 +47,15 @@ public static DataGridView dataGridView; public static Label label_redetecting; - + public static DetailDlg detailDlg; long deviceId = -1; string startTime = ""; string endTime = ""; - string resultAccStr = ""; - string resultStaStr10 = ""; - string resultStaStr20 = ""; - string resultStaStr100 = ""; - string resultStaStr1 = ""; + public string resultAccStr = ""; + public string resultStaStr10 = ""; + public string resultStaStr20 = ""; + public string resultStaStr100 = ""; + public string resultStaStr1 = ""; string resultBootStr = ""; string resultAgeStr = ""; @@ -72,7 +68,7 @@ public DetailDlg(long deviceId) { InitializeComponent(); - + detailDlg = this; this.deviceId = deviceId; LoadTimes(deviceId); @@ -87,19 +83,18 @@ resultStaStr1 = dataGridView_times.Rows[0].Cells[8].Value.ToString(); resultBootStr = dataGridView_times.Rows[0].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[0].Cells[6].Value.ToString(); - LoadData(deviceId, "1-1", startTime, endTime); - - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + if ((!resultStaStr1.Equals("-1")&& !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1")&& !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) ||( !resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if(!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if(!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + if (!resultBootStr.Equals("-1")&& !resultBootStr.Equals("-2")&& !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + if (!resultAgeStr.Equals("-1")&&!resultAgeStr.Equals("-2")&& !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); } if (dataGridView_Data.Rows.Count == 0) btn_reDetec.Enabled = false; @@ -114,6 +109,8 @@ return; } this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -173,8 +170,8 @@ tableOriginData.Columns.Add("序号", Type.GetType("System.String")); tableOriginData.Columns.Add("输出值", Type.GetType("System.String")); tableOriginData.Columns.Add("测量值", Type.GetType("System.String")); - tableOriginData.Columns.Add("灵敏度", Type.GetType("System.String")); - tableOriginData.Columns.Add("测量时间", Type.GetType("System.DateTime")); + tableOriginData.Columns.Add("灵敏度(Vpp)", Type.GetType("System.String")); + tableOriginData.Columns.Add("测量时间", Type.GetType("System.String")); // 获取当前页的数据 @@ -192,11 +189,11 @@ dataGridView_Data.DataSource = tableOriginData; // width=425px - dataGridView_Data.Columns[0].Width = 50; - dataGridView_Data.Columns[1].Width = 80; - dataGridView_Data.Columns[2].Width = 155; - dataGridView_Data.Columns[3].Width = 75; - dataGridView_Data.Columns[4].Width = 110; + dataGridView_Data.Columns[0].Width = 45; + dataGridView_Data.Columns[1].Width = 60; + dataGridView_Data.Columns[2].Width = 150; + dataGridView_Data.Columns[3].Width = 85; + dataGridView_Data.Columns[4].Width = 135; dataGridView_Data.Columns[0].ReadOnly = true; dataGridView_Data.Columns[1].ReadOnly = true; @@ -305,17 +302,18 @@ resultBootStr = dataGridView_times.Rows[rowIndex].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[rowIndex].Cells[6].Value.ToString(); - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + else if ((!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) || (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if (!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if (!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + else if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + else if (!resultAgeStr.Equals("-1") && !resultAgeStr.Equals("-2") && !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); + } } @@ -326,11 +324,12 @@ { case "tab_stability": { + tabControl1.SelectedIndex = 0; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = true; btn_reDetec.Enabled = true; - + radio_1s.Checked = true; LoadData(deviceId, "1-1", startTime, endTime); groupBox3.Text = "1s频率稳定度"; stability result = new stability(); @@ -345,6 +344,7 @@ } case "tab_accuracy": { + tabControl1.SelectedIndex = 1; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -363,13 +363,14 @@ } case "tab_bootFeature": { + tabControl1.SelectedIndex = 2; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; - bootFeature result = new bootFeature(); + bootFeature result = new bootFeature(tableOriginData); result.label_bootFeature.Text = ""; if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) result.label_bootFeature.Text = resultBootStr; result.Show(); @@ -378,6 +379,7 @@ } case "tab_ageRate": { + tabControl1.SelectedIndex = 3; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -400,6 +402,7 @@ } case "tab_counter": { + tabControl1.SelectedIndex = 4; btn_reDetec.Visible = false; dataGridView_times.Visible = false; panel_radios.Visible = false; @@ -436,7 +439,7 @@ else if (radio_20s.Checked) dlg.label1.Text = "频率稳定度 - 20s"; else if (radio_100s.Checked) dlg.label1.Text = "频率稳定度 - 100s"; } - dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); + //dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); dlg.HideMaskAction += () => { this.HideMask(); @@ -530,6 +533,12 @@ } } + public void updateChannelNoRedetec() + { + dataGridView_times.CurrentRow.Cells[7].Value = ReDetecDlg.channelNoReDetec; + detectionItemService.updateChannelNo(Convert.ToInt64(dataGridView_times.CurrentRow.Cells[12].Value), ReDetecDlg.channelNoReDetec); + } + private void roundButton1_Click_1(object sender, EventArgs e) { diff --git a/RbFreqStandMeasure/info/ExportDlg.cs b/RbFreqStandMeasure/info/ExportDlg.cs index d7c6e02..53a903a 100644 --- a/RbFreqStandMeasure/info/ExportDlg.cs +++ b/RbFreqStandMeasure/info/ExportDlg.cs @@ -195,12 +195,7 @@ } private void btn_reDetec_Click(object sender, EventArgs e) - { - string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; - - StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); - strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); - strmWriterObj.WriteLine("序号,时间,相对频率偏差"); + { bool selected = false; foreach (DataGridViewRow row in dataGridView_times.Rows) { @@ -211,9 +206,14 @@ } if (!selected) { - MessageBox.Show("请选择要导出的数据!"); + MessageBox.Show("请选择要导出的检测记录!"); return; } + string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + + StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); + strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); + strmWriterObj.WriteLine("序号,时间,相对频率偏差"); foreach (DataGridViewRow row in dataGridView_times.Rows) { DataGridViewCheckBoxCell checkBox = (DataGridViewCheckBoxCell)row.Cells[0]; @@ -266,6 +266,18 @@ } } + + CounterDataService counterDataService = new CounterDataServiceImpl(); + List query = counterDataService.getHistory(deviceId, "", ""); + strmWriterObj.WriteLine("计数器范围及灵敏度"); + strmWriterObj.WriteLine("序号,输出值,测量值,灵敏度,时间"); + int index2 = 1; + foreach (CounterData counterData in query) + { + string strBufferLine = index2 + "," + counterData.OutValue + "," + counterData.Value + "," + counterData.Sensitivity + "," + counterData.LogTime; + strmWriterObj.WriteLine(strBufferLine); + index2++; + } strmWriterObj.Close(); MessageBox.Show("导出成功,存放位置:" + strFilePath); diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 55ae028..3b13488 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -475,10 +475,11 @@ long id = (long)dataGridView_DevList.Rows[rowIndex].Cells[9].Value; DetailDlg detailDlg = new DetailDlg(id); - detailDlg.Controls.Find("label_devModel", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[3].Value.ToString(); - detailDlg.Controls.Find("label_devCode", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[4].Value.ToString(); - detailDlg.Controls.Find("label_customerComp", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[5].Value.ToString(); - detailDlg.Controls.Find("label_customerName", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[6].Value.ToString(); + string model = dataGridView_DevList.Rows[rowIndex].Cells[3].Value.ToString(); + detailDlg.label_devModel.Text = model; + detailDlg.label_devCode.Text = dataGridView_DevList.Rows[rowIndex].Cells[4].Value.ToString(); + detailDlg.label_customerComp.Text = dataGridView_DevList.Rows[rowIndex].Cells[5].Value.ToString(); + detailDlg.label_customerName.Text = dataGridView_DevList.Rows[rowIndex].Cells[6].Value.ToString(); detailDlg.HideMaskAction += () => { @@ -529,7 +530,7 @@ editDlg.checkBox_stability.Checked = true; foreach (string n in detectionItem.Interval.Split(',')) { - if(!n.Equals(""))((RadioButton)editDlg.Controls.Find("radio_" + n + "s", true)[0]).Checked = true; + if(!n.Equals(""))((CheckBox)editDlg.Controls.Find("checkBox" + n + "s", true)[0]).Checked = true; } } if (!detectionItem.BootFeature.Equals("-3")) editDlg.checkBox_bootFeature.Checked = true; @@ -588,14 +589,18 @@ { try { + if (dataGridView_DevList.SelectedRows.Count == 0)//判断是否选中某行 + { + MessageBox.Show("无选中仪器!"); return; + } long devId = Convert.ToInt64(dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[9].Value); + string deviceName = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[2].Value.ToString(); + string deviceType = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[10].Value.ToString(); List queryList = detectionItemService.search(devId, false); if (null != queryList && queryList.Count > 0) { - string deviceName = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[2].Value.ToString(); - string deviceType = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[10].Value.ToString(); - + ExportDlg dlg = new ExportDlg(devId); dlg.label_devName.Text = deviceName; dlg.label_devType.Text = deviceType; @@ -611,7 +616,29 @@ } else { - MessageBox.Show("所选仪器无测试数据可导出!"); + CounterDataService counterDataService = new CounterDataServiceImpl(); + List query = counterDataService.getHistory(devId, "", ""); + if (null != query && query.Count > 0) + { + string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + + StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); + strmWriterObj.WriteLine(deviceName + " - " + deviceType + "-" + "计数器范围及灵敏度"); + strmWriterObj.WriteLine("序号,输出值,测量值,灵敏度,时间"); + int index = 1; + foreach (CounterData counterData in query) + { + string strBufferLine = index + "," + counterData.OutValue + "," + counterData.Value + "," + counterData.Sensitivity + "," + counterData.LogTime; + strmWriterObj.WriteLine(strBufferLine); + index++; + } + strmWriterObj.Close(); + MessageBox.Show("导出成功,存放位置:" + strFilePath); + } + else + { + MessageBox.Show("所选仪器无测试数据可导出!"); + } } } catch (Exception ex) diff --git a/RbFreqStandMeasure/info/ReDetecDlg.cs b/RbFreqStandMeasure/info/ReDetecDlg.cs index 0225309..0af7776 100644 --- a/RbFreqStandMeasure/info/ReDetecDlg.cs +++ b/RbFreqStandMeasure/info/ReDetecDlg.cs @@ -36,6 +36,7 @@ public string detectType = ""; public long deviceId=-1; public long detectionItemId = -1; + public static string channelNoReDetec = ""; public Action HideMaskAction { @@ -96,11 +97,11 @@ string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); - string channelNo = text_channelNo.Text; + channelNoReDetec = text_channelNo.Text; // 打开串口 - SerialPort port = RbFreqStdMeas.portList[Convert.ToInt32(channelNo) - 1]; + SerialPort port = RbFreqStdMeas.portList[Convert.ToInt32(channelNoReDetec) - 1]; if (port.IsOpen) port.Close(); port.PortName = portName; port.BaudRate = band; @@ -115,20 +116,20 @@ port.Open(); if (!port.IsOpen) { - MessageBox.Show("无法打开通道"+channelNo+",检测失败!"); + MessageBox.Show("无法打开通道"+ channelNoReDetec + ",检测失败!"); return; } } catch (Exception exc) { - MessageBox.Show("无法打开通道" + channelNo + ",检测失败!"); + MessageBox.Show("无法打开通道" + channelNoReDetec + ",检测失败!"); return; } DetectionHelper detectionHelper = new DetectionHelper(); if (DetectionHelper.detectionHelper.getFrequencyData(port).Equals("")) { - MessageBox.Show("请连接仪器到通道[" + channelNo + "]!"); + MessageBox.Show("请连接仪器到通道[" + channelNoReDetec + "]!"); return; } diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index da45f50..1bb08ca 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -213,7 +213,7 @@ long detectionItemId = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionItemId; this.HideMaskAction(); - + HomeCtrlForm.homeCtrlForm.refreshChannelList(); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } @@ -221,6 +221,8 @@ private void btnExitDev_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -272,20 +274,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } timePicker_endTime.Value = endTimeBySystem; @@ -320,5 +322,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index cbb6cba..35c7a60 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -74,7 +74,7 @@ this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.checkBox_100s = new System.Windows.Forms.CheckBox(); + this.checkBox100s = new System.Windows.Forms.CheckBox(); this.checkBox20s = new System.Windows.Forms.CheckBox(); this.checkBox10s = new System.Windows.Forms.CheckBox(); this.checkBox1s = new System.Windows.Forms.CheckBox(); @@ -735,7 +735,7 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.checkBox_100s); + this.groupBox2.Controls.Add(this.checkBox100s); this.groupBox2.Controls.Add(this.checkBox20s); this.groupBox2.Controls.Add(this.checkBox10s); this.groupBox2.Controls.Add(this.checkBox1s); @@ -747,16 +747,17 @@ this.groupBox2.TabIndex = 40; this.groupBox2.TabStop = false; // - // checkBox_100s + // checkBox100s // - this.checkBox_100s.AutoSize = true; - this.checkBox_100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_100s.Location = new System.Drawing.Point(468, 19); - this.checkBox_100s.Name = "checkBox_100s"; - this.checkBox_100s.Size = new System.Drawing.Size(58, 24); - this.checkBox_100s.TabIndex = 361; - this.checkBox_100s.Text = "100s"; - this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox100s.AutoSize = true; + this.checkBox100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox100s.Location = new System.Drawing.Point(468, 19); + this.checkBox100s.Name = "checkBox100s"; + this.checkBox100s.Size = new System.Drawing.Size(58, 24); + this.checkBox100s.TabIndex = 361; + this.checkBox100s.Text = "100s"; + this.checkBox100s.UseVisualStyleBackColor = true; + this.checkBox100s.CheckedChanged += new System.EventHandler(this.checkBox100s_CheckedChanged); // // checkBox20s // @@ -768,6 +769,7 @@ this.checkBox20s.TabIndex = 360; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -779,6 +781,7 @@ this.checkBox10s.TabIndex = 359; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -790,6 +793,7 @@ this.checkBox1s.TabIndex = 358; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // @@ -930,7 +934,7 @@ private System.Windows.Forms.Label label14; public System.Windows.Forms.GroupBox groupBox1; public System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox checkBox_100s; + private System.Windows.Forms.CheckBox checkBox100s; private System.Windows.Forms.CheckBox checkBox20s; private System.Windows.Forms.CheckBox checkBox10s; private System.Windows.Forms.CheckBox checkBox1s; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 8af1705..5d7de27 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -84,6 +84,8 @@ private void btnAddDevCancel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } // 添加并开始检测 @@ -115,7 +117,7 @@ } if (text_channelNo.Text.Trim() != "") { - if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox_100s.Checked) + if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox100s.Checked) { MessageBox.Show("请选择频率稳定度采样时间!"); return; @@ -142,7 +144,12 @@ string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; - string devTypeCode = cbBox_devType.SelectedValue.ToString(); + string devTypeCode = "1"; + foreach (Dict dict in (List)cbBox_devType.DataSource) + { + if (text_devType.Text.Equals(dict.Name)) devTypeCode = dict.Code; + } + //string devTypeCode = cbBox_devType.SelectedValue.ToString(); string channelNo = text_channelNo.Text.Trim(); string statusId = ""; @@ -263,7 +270,7 @@ if (checkBox1s.Checked) interval = "1,"; if (checkBox10s.Checked) interval = interval + "10,"; if (checkBox20s.Checked) interval = interval + "20,"; - if (checkBox_100s.Checked) interval = interval + "100"; + if (checkBox100s.Checked) interval = interval + "100"; stability = "-2"; @@ -273,7 +280,7 @@ if (checkBox1s.Checked) stability1 = "-1"; if (checkBox10s.Checked) stability10 = "-1"; if (checkBox20s.Checked) stability20 = "-1"; - if (checkBox_100s.Checked) stability100 = "-1"; + if (checkBox100s.Checked) stability100 = "-1"; detectionHelper.detecStability(deviceId, startTime, interval, port, true, false); } else @@ -281,7 +288,7 @@ if (checkBox1s.Checked) stability1 = "-2"; if (checkBox10s.Checked) stability10 = "-2"; if (checkBox20s.Checked) stability20 = "-2"; - if (checkBox_100s.Checked) stability100 = "-2"; + if (checkBox100s.Checked) stability100 = "-2"; detectionHelper.detecStability(deviceId, startTime, interval, port, false, false); } } @@ -334,6 +341,8 @@ //开始检测 long detectionId0 = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionId0; + + HomeCtrlForm.homeCtrlForm.refreshChannelList(); } if (labelTitle.Text.Equals("添加")) MessageBox.Show("添加成功!"); @@ -428,20 +437,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -482,5 +491,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 66be073..82dd74d 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -670,10 +670,6 @@ private DevComponents.Editors.ComboItem channel4; private DevComponents.Editors.ComboItem channel5; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label label_customerComp; - private System.Windows.Forms.Label label_devCode; - private System.Windows.Forms.Label label_customerName; - private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; @@ -700,5 +696,9 @@ public System.Windows.Forms.DataGridView dataGridView_Data; public System.Windows.Forms.Label label_reDetecting; private RoundButton roundButton1; + public System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_customerComp; + public System.Windows.Forms.Label label_devCode; + public System.Windows.Forms.Label label_customerName; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index ce2e4ef..a670fe8 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -1,15 +1,11 @@ -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto; -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; using Casic.Birmm.RbFreqStandMeasure.Tools; -using DevComponents.DotNetBar.Controls; -using DevComponents.Editors; using System; using System.Collections.Generic; using System.Data; using System.Drawing; -using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -51,15 +47,15 @@ public static DataGridView dataGridView; public static Label label_redetecting; - + public static DetailDlg detailDlg; long deviceId = -1; string startTime = ""; string endTime = ""; - string resultAccStr = ""; - string resultStaStr10 = ""; - string resultStaStr20 = ""; - string resultStaStr100 = ""; - string resultStaStr1 = ""; + public string resultAccStr = ""; + public string resultStaStr10 = ""; + public string resultStaStr20 = ""; + public string resultStaStr100 = ""; + public string resultStaStr1 = ""; string resultBootStr = ""; string resultAgeStr = ""; @@ -72,7 +68,7 @@ public DetailDlg(long deviceId) { InitializeComponent(); - + detailDlg = this; this.deviceId = deviceId; LoadTimes(deviceId); @@ -87,19 +83,18 @@ resultStaStr1 = dataGridView_times.Rows[0].Cells[8].Value.ToString(); resultBootStr = dataGridView_times.Rows[0].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[0].Cells[6].Value.ToString(); - LoadData(deviceId, "1-1", startTime, endTime); - - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + if ((!resultStaStr1.Equals("-1")&& !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1")&& !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) ||( !resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if(!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if(!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + if (!resultBootStr.Equals("-1")&& !resultBootStr.Equals("-2")&& !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + if (!resultAgeStr.Equals("-1")&&!resultAgeStr.Equals("-2")&& !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); } if (dataGridView_Data.Rows.Count == 0) btn_reDetec.Enabled = false; @@ -114,6 +109,8 @@ return; } this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -173,8 +170,8 @@ tableOriginData.Columns.Add("序号", Type.GetType("System.String")); tableOriginData.Columns.Add("输出值", Type.GetType("System.String")); tableOriginData.Columns.Add("测量值", Type.GetType("System.String")); - tableOriginData.Columns.Add("灵敏度", Type.GetType("System.String")); - tableOriginData.Columns.Add("测量时间", Type.GetType("System.DateTime")); + tableOriginData.Columns.Add("灵敏度(Vpp)", Type.GetType("System.String")); + tableOriginData.Columns.Add("测量时间", Type.GetType("System.String")); // 获取当前页的数据 @@ -192,11 +189,11 @@ dataGridView_Data.DataSource = tableOriginData; // width=425px - dataGridView_Data.Columns[0].Width = 50; - dataGridView_Data.Columns[1].Width = 80; - dataGridView_Data.Columns[2].Width = 155; - dataGridView_Data.Columns[3].Width = 75; - dataGridView_Data.Columns[4].Width = 110; + dataGridView_Data.Columns[0].Width = 45; + dataGridView_Data.Columns[1].Width = 60; + dataGridView_Data.Columns[2].Width = 150; + dataGridView_Data.Columns[3].Width = 85; + dataGridView_Data.Columns[4].Width = 135; dataGridView_Data.Columns[0].ReadOnly = true; dataGridView_Data.Columns[1].ReadOnly = true; @@ -305,17 +302,18 @@ resultBootStr = dataGridView_times.Rows[rowIndex].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[rowIndex].Cells[6].Value.ToString(); - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + else if ((!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) || (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if (!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if (!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + else if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + else if (!resultAgeStr.Equals("-1") && !resultAgeStr.Equals("-2") && !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); + } } @@ -326,11 +324,12 @@ { case "tab_stability": { + tabControl1.SelectedIndex = 0; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = true; btn_reDetec.Enabled = true; - + radio_1s.Checked = true; LoadData(deviceId, "1-1", startTime, endTime); groupBox3.Text = "1s频率稳定度"; stability result = new stability(); @@ -345,6 +344,7 @@ } case "tab_accuracy": { + tabControl1.SelectedIndex = 1; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -363,13 +363,14 @@ } case "tab_bootFeature": { + tabControl1.SelectedIndex = 2; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; - bootFeature result = new bootFeature(); + bootFeature result = new bootFeature(tableOriginData); result.label_bootFeature.Text = ""; if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) result.label_bootFeature.Text = resultBootStr; result.Show(); @@ -378,6 +379,7 @@ } case "tab_ageRate": { + tabControl1.SelectedIndex = 3; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -400,6 +402,7 @@ } case "tab_counter": { + tabControl1.SelectedIndex = 4; btn_reDetec.Visible = false; dataGridView_times.Visible = false; panel_radios.Visible = false; @@ -436,7 +439,7 @@ else if (radio_20s.Checked) dlg.label1.Text = "频率稳定度 - 20s"; else if (radio_100s.Checked) dlg.label1.Text = "频率稳定度 - 100s"; } - dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); + //dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); dlg.HideMaskAction += () => { this.HideMask(); @@ -530,6 +533,12 @@ } } + public void updateChannelNoRedetec() + { + dataGridView_times.CurrentRow.Cells[7].Value = ReDetecDlg.channelNoReDetec; + detectionItemService.updateChannelNo(Convert.ToInt64(dataGridView_times.CurrentRow.Cells[12].Value), ReDetecDlg.channelNoReDetec); + } + private void roundButton1_Click_1(object sender, EventArgs e) { diff --git a/RbFreqStandMeasure/info/ExportDlg.cs b/RbFreqStandMeasure/info/ExportDlg.cs index d7c6e02..53a903a 100644 --- a/RbFreqStandMeasure/info/ExportDlg.cs +++ b/RbFreqStandMeasure/info/ExportDlg.cs @@ -195,12 +195,7 @@ } private void btn_reDetec_Click(object sender, EventArgs e) - { - string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; - - StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); - strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); - strmWriterObj.WriteLine("序号,时间,相对频率偏差"); + { bool selected = false; foreach (DataGridViewRow row in dataGridView_times.Rows) { @@ -211,9 +206,14 @@ } if (!selected) { - MessageBox.Show("请选择要导出的数据!"); + MessageBox.Show("请选择要导出的检测记录!"); return; } + string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + + StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); + strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); + strmWriterObj.WriteLine("序号,时间,相对频率偏差"); foreach (DataGridViewRow row in dataGridView_times.Rows) { DataGridViewCheckBoxCell checkBox = (DataGridViewCheckBoxCell)row.Cells[0]; @@ -266,6 +266,18 @@ } } + + CounterDataService counterDataService = new CounterDataServiceImpl(); + List query = counterDataService.getHistory(deviceId, "", ""); + strmWriterObj.WriteLine("计数器范围及灵敏度"); + strmWriterObj.WriteLine("序号,输出值,测量值,灵敏度,时间"); + int index2 = 1; + foreach (CounterData counterData in query) + { + string strBufferLine = index2 + "," + counterData.OutValue + "," + counterData.Value + "," + counterData.Sensitivity + "," + counterData.LogTime; + strmWriterObj.WriteLine(strBufferLine); + index2++; + } strmWriterObj.Close(); MessageBox.Show("导出成功,存放位置:" + strFilePath); diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 55ae028..3b13488 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -475,10 +475,11 @@ long id = (long)dataGridView_DevList.Rows[rowIndex].Cells[9].Value; DetailDlg detailDlg = new DetailDlg(id); - detailDlg.Controls.Find("label_devModel", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[3].Value.ToString(); - detailDlg.Controls.Find("label_devCode", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[4].Value.ToString(); - detailDlg.Controls.Find("label_customerComp", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[5].Value.ToString(); - detailDlg.Controls.Find("label_customerName", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[6].Value.ToString(); + string model = dataGridView_DevList.Rows[rowIndex].Cells[3].Value.ToString(); + detailDlg.label_devModel.Text = model; + detailDlg.label_devCode.Text = dataGridView_DevList.Rows[rowIndex].Cells[4].Value.ToString(); + detailDlg.label_customerComp.Text = dataGridView_DevList.Rows[rowIndex].Cells[5].Value.ToString(); + detailDlg.label_customerName.Text = dataGridView_DevList.Rows[rowIndex].Cells[6].Value.ToString(); detailDlg.HideMaskAction += () => { @@ -529,7 +530,7 @@ editDlg.checkBox_stability.Checked = true; foreach (string n in detectionItem.Interval.Split(',')) { - if(!n.Equals(""))((RadioButton)editDlg.Controls.Find("radio_" + n + "s", true)[0]).Checked = true; + if(!n.Equals(""))((CheckBox)editDlg.Controls.Find("checkBox" + n + "s", true)[0]).Checked = true; } } if (!detectionItem.BootFeature.Equals("-3")) editDlg.checkBox_bootFeature.Checked = true; @@ -588,14 +589,18 @@ { try { + if (dataGridView_DevList.SelectedRows.Count == 0)//判断是否选中某行 + { + MessageBox.Show("无选中仪器!"); return; + } long devId = Convert.ToInt64(dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[9].Value); + string deviceName = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[2].Value.ToString(); + string deviceType = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[10].Value.ToString(); List queryList = detectionItemService.search(devId, false); if (null != queryList && queryList.Count > 0) { - string deviceName = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[2].Value.ToString(); - string deviceType = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[10].Value.ToString(); - + ExportDlg dlg = new ExportDlg(devId); dlg.label_devName.Text = deviceName; dlg.label_devType.Text = deviceType; @@ -611,7 +616,29 @@ } else { - MessageBox.Show("所选仪器无测试数据可导出!"); + CounterDataService counterDataService = new CounterDataServiceImpl(); + List query = counterDataService.getHistory(devId, "", ""); + if (null != query && query.Count > 0) + { + string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + + StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); + strmWriterObj.WriteLine(deviceName + " - " + deviceType + "-" + "计数器范围及灵敏度"); + strmWriterObj.WriteLine("序号,输出值,测量值,灵敏度,时间"); + int index = 1; + foreach (CounterData counterData in query) + { + string strBufferLine = index + "," + counterData.OutValue + "," + counterData.Value + "," + counterData.Sensitivity + "," + counterData.LogTime; + strmWriterObj.WriteLine(strBufferLine); + index++; + } + strmWriterObj.Close(); + MessageBox.Show("导出成功,存放位置:" + strFilePath); + } + else + { + MessageBox.Show("所选仪器无测试数据可导出!"); + } } } catch (Exception ex) diff --git a/RbFreqStandMeasure/info/ReDetecDlg.cs b/RbFreqStandMeasure/info/ReDetecDlg.cs index 0225309..0af7776 100644 --- a/RbFreqStandMeasure/info/ReDetecDlg.cs +++ b/RbFreqStandMeasure/info/ReDetecDlg.cs @@ -36,6 +36,7 @@ public string detectType = ""; public long deviceId=-1; public long detectionItemId = -1; + public static string channelNoReDetec = ""; public Action HideMaskAction { @@ -96,11 +97,11 @@ string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); - string channelNo = text_channelNo.Text; + channelNoReDetec = text_channelNo.Text; // 打开串口 - SerialPort port = RbFreqStdMeas.portList[Convert.ToInt32(channelNo) - 1]; + SerialPort port = RbFreqStdMeas.portList[Convert.ToInt32(channelNoReDetec) - 1]; if (port.IsOpen) port.Close(); port.PortName = portName; port.BaudRate = band; @@ -115,20 +116,20 @@ port.Open(); if (!port.IsOpen) { - MessageBox.Show("无法打开通道"+channelNo+",检测失败!"); + MessageBox.Show("无法打开通道"+ channelNoReDetec + ",检测失败!"); return; } } catch (Exception exc) { - MessageBox.Show("无法打开通道" + channelNo + ",检测失败!"); + MessageBox.Show("无法打开通道" + channelNoReDetec + ",检测失败!"); return; } DetectionHelper detectionHelper = new DetectionHelper(); if (DetectionHelper.detectionHelper.getFrequencyData(port).Equals("")) { - MessageBox.Show("请连接仪器到通道[" + channelNo + "]!"); + MessageBox.Show("请连接仪器到通道[" + channelNoReDetec + "]!"); return; } diff --git a/RbFreqStandMeasure/info/accuracy.designer.cs b/RbFreqStandMeasure/info/accuracy.designer.cs index e33e95d..1e9da53 100644 --- a/RbFreqStandMeasure/info/accuracy.designer.cs +++ b/RbFreqStandMeasure/info/accuracy.designer.cs @@ -30,7 +30,7 @@ { this.label_accuracy = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_stand = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // @@ -58,18 +58,18 @@ this.label4.Text = "测量结果A:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_devModel + // label_stand // - this.label_devModel.BackColor = System.Drawing.Color.Transparent; - this.label_devModel.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; - this.label_devModel.Location = new System.Drawing.Point(183, 62); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(83, 27); - this.label_devModel.TabIndex = 98; - this.label_devModel.Text = "10MHz"; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_stand.BackColor = System.Drawing.Color.Transparent; + this.label_stand.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_stand.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_stand.Location = new System.Drawing.Point(183, 62); + this.label_stand.Margin = new System.Windows.Forms.Padding(0); + this.label_stand.Name = "label_stand"; + this.label_stand.Size = new System.Drawing.Size(83, 27); + this.label_stand.TabIndex = 98; + this.label_stand.Text = "10MHz"; + this.label_stand.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label9 // @@ -89,7 +89,7 @@ this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label_accuracy); this.Controls.Add(this.label4); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_stand); this.Controls.Add(this.label9); this.Name = "accuracy"; this.Size = new System.Drawing.Size(405, 229); @@ -99,7 +99,7 @@ #endregion private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label_devModel; + private System.Windows.Forms.Label label_stand; private System.Windows.Forms.Label label9; public System.Windows.Forms.Label label_accuracy; } diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index da45f50..1bb08ca 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -213,7 +213,7 @@ long detectionItemId = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionItemId; this.HideMaskAction(); - + HomeCtrlForm.homeCtrlForm.refreshChannelList(); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } @@ -221,6 +221,8 @@ private void btnExitDev_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -272,20 +274,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } timePicker_endTime.Value = endTimeBySystem; @@ -320,5 +322,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index cbb6cba..35c7a60 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -74,7 +74,7 @@ this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.checkBox_100s = new System.Windows.Forms.CheckBox(); + this.checkBox100s = new System.Windows.Forms.CheckBox(); this.checkBox20s = new System.Windows.Forms.CheckBox(); this.checkBox10s = new System.Windows.Forms.CheckBox(); this.checkBox1s = new System.Windows.Forms.CheckBox(); @@ -735,7 +735,7 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.checkBox_100s); + this.groupBox2.Controls.Add(this.checkBox100s); this.groupBox2.Controls.Add(this.checkBox20s); this.groupBox2.Controls.Add(this.checkBox10s); this.groupBox2.Controls.Add(this.checkBox1s); @@ -747,16 +747,17 @@ this.groupBox2.TabIndex = 40; this.groupBox2.TabStop = false; // - // checkBox_100s + // checkBox100s // - this.checkBox_100s.AutoSize = true; - this.checkBox_100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_100s.Location = new System.Drawing.Point(468, 19); - this.checkBox_100s.Name = "checkBox_100s"; - this.checkBox_100s.Size = new System.Drawing.Size(58, 24); - this.checkBox_100s.TabIndex = 361; - this.checkBox_100s.Text = "100s"; - this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox100s.AutoSize = true; + this.checkBox100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox100s.Location = new System.Drawing.Point(468, 19); + this.checkBox100s.Name = "checkBox100s"; + this.checkBox100s.Size = new System.Drawing.Size(58, 24); + this.checkBox100s.TabIndex = 361; + this.checkBox100s.Text = "100s"; + this.checkBox100s.UseVisualStyleBackColor = true; + this.checkBox100s.CheckedChanged += new System.EventHandler(this.checkBox100s_CheckedChanged); // // checkBox20s // @@ -768,6 +769,7 @@ this.checkBox20s.TabIndex = 360; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -779,6 +781,7 @@ this.checkBox10s.TabIndex = 359; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -790,6 +793,7 @@ this.checkBox1s.TabIndex = 358; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // @@ -930,7 +934,7 @@ private System.Windows.Forms.Label label14; public System.Windows.Forms.GroupBox groupBox1; public System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox checkBox_100s; + private System.Windows.Forms.CheckBox checkBox100s; private System.Windows.Forms.CheckBox checkBox20s; private System.Windows.Forms.CheckBox checkBox10s; private System.Windows.Forms.CheckBox checkBox1s; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 8af1705..5d7de27 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -84,6 +84,8 @@ private void btnAddDevCancel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } // 添加并开始检测 @@ -115,7 +117,7 @@ } if (text_channelNo.Text.Trim() != "") { - if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox_100s.Checked) + if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox100s.Checked) { MessageBox.Show("请选择频率稳定度采样时间!"); return; @@ -142,7 +144,12 @@ string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; - string devTypeCode = cbBox_devType.SelectedValue.ToString(); + string devTypeCode = "1"; + foreach (Dict dict in (List)cbBox_devType.DataSource) + { + if (text_devType.Text.Equals(dict.Name)) devTypeCode = dict.Code; + } + //string devTypeCode = cbBox_devType.SelectedValue.ToString(); string channelNo = text_channelNo.Text.Trim(); string statusId = ""; @@ -263,7 +270,7 @@ if (checkBox1s.Checked) interval = "1,"; if (checkBox10s.Checked) interval = interval + "10,"; if (checkBox20s.Checked) interval = interval + "20,"; - if (checkBox_100s.Checked) interval = interval + "100"; + if (checkBox100s.Checked) interval = interval + "100"; stability = "-2"; @@ -273,7 +280,7 @@ if (checkBox1s.Checked) stability1 = "-1"; if (checkBox10s.Checked) stability10 = "-1"; if (checkBox20s.Checked) stability20 = "-1"; - if (checkBox_100s.Checked) stability100 = "-1"; + if (checkBox100s.Checked) stability100 = "-1"; detectionHelper.detecStability(deviceId, startTime, interval, port, true, false); } else @@ -281,7 +288,7 @@ if (checkBox1s.Checked) stability1 = "-2"; if (checkBox10s.Checked) stability10 = "-2"; if (checkBox20s.Checked) stability20 = "-2"; - if (checkBox_100s.Checked) stability100 = "-2"; + if (checkBox100s.Checked) stability100 = "-2"; detectionHelper.detecStability(deviceId, startTime, interval, port, false, false); } } @@ -334,6 +341,8 @@ //开始检测 long detectionId0 = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionId0; + + HomeCtrlForm.homeCtrlForm.refreshChannelList(); } if (labelTitle.Text.Equals("添加")) MessageBox.Show("添加成功!"); @@ -428,20 +437,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -482,5 +491,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 66be073..82dd74d 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -670,10 +670,6 @@ private DevComponents.Editors.ComboItem channel4; private DevComponents.Editors.ComboItem channel5; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label label_customerComp; - private System.Windows.Forms.Label label_devCode; - private System.Windows.Forms.Label label_customerName; - private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; @@ -700,5 +696,9 @@ public System.Windows.Forms.DataGridView dataGridView_Data; public System.Windows.Forms.Label label_reDetecting; private RoundButton roundButton1; + public System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_customerComp; + public System.Windows.Forms.Label label_devCode; + public System.Windows.Forms.Label label_customerName; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index ce2e4ef..a670fe8 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -1,15 +1,11 @@ -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto; -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; using Casic.Birmm.RbFreqStandMeasure.Tools; -using DevComponents.DotNetBar.Controls; -using DevComponents.Editors; using System; using System.Collections.Generic; using System.Data; using System.Drawing; -using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -51,15 +47,15 @@ public static DataGridView dataGridView; public static Label label_redetecting; - + public static DetailDlg detailDlg; long deviceId = -1; string startTime = ""; string endTime = ""; - string resultAccStr = ""; - string resultStaStr10 = ""; - string resultStaStr20 = ""; - string resultStaStr100 = ""; - string resultStaStr1 = ""; + public string resultAccStr = ""; + public string resultStaStr10 = ""; + public string resultStaStr20 = ""; + public string resultStaStr100 = ""; + public string resultStaStr1 = ""; string resultBootStr = ""; string resultAgeStr = ""; @@ -72,7 +68,7 @@ public DetailDlg(long deviceId) { InitializeComponent(); - + detailDlg = this; this.deviceId = deviceId; LoadTimes(deviceId); @@ -87,19 +83,18 @@ resultStaStr1 = dataGridView_times.Rows[0].Cells[8].Value.ToString(); resultBootStr = dataGridView_times.Rows[0].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[0].Cells[6].Value.ToString(); - LoadData(deviceId, "1-1", startTime, endTime); - - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + if ((!resultStaStr1.Equals("-1")&& !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1")&& !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) ||( !resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if(!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if(!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + if (!resultBootStr.Equals("-1")&& !resultBootStr.Equals("-2")&& !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + if (!resultAgeStr.Equals("-1")&&!resultAgeStr.Equals("-2")&& !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); } if (dataGridView_Data.Rows.Count == 0) btn_reDetec.Enabled = false; @@ -114,6 +109,8 @@ return; } this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -173,8 +170,8 @@ tableOriginData.Columns.Add("序号", Type.GetType("System.String")); tableOriginData.Columns.Add("输出值", Type.GetType("System.String")); tableOriginData.Columns.Add("测量值", Type.GetType("System.String")); - tableOriginData.Columns.Add("灵敏度", Type.GetType("System.String")); - tableOriginData.Columns.Add("测量时间", Type.GetType("System.DateTime")); + tableOriginData.Columns.Add("灵敏度(Vpp)", Type.GetType("System.String")); + tableOriginData.Columns.Add("测量时间", Type.GetType("System.String")); // 获取当前页的数据 @@ -192,11 +189,11 @@ dataGridView_Data.DataSource = tableOriginData; // width=425px - dataGridView_Data.Columns[0].Width = 50; - dataGridView_Data.Columns[1].Width = 80; - dataGridView_Data.Columns[2].Width = 155; - dataGridView_Data.Columns[3].Width = 75; - dataGridView_Data.Columns[4].Width = 110; + dataGridView_Data.Columns[0].Width = 45; + dataGridView_Data.Columns[1].Width = 60; + dataGridView_Data.Columns[2].Width = 150; + dataGridView_Data.Columns[3].Width = 85; + dataGridView_Data.Columns[4].Width = 135; dataGridView_Data.Columns[0].ReadOnly = true; dataGridView_Data.Columns[1].ReadOnly = true; @@ -305,17 +302,18 @@ resultBootStr = dataGridView_times.Rows[rowIndex].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[rowIndex].Cells[6].Value.ToString(); - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + else if ((!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) || (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if (!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if (!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + else if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + else if (!resultAgeStr.Equals("-1") && !resultAgeStr.Equals("-2") && !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); + } } @@ -326,11 +324,12 @@ { case "tab_stability": { + tabControl1.SelectedIndex = 0; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = true; btn_reDetec.Enabled = true; - + radio_1s.Checked = true; LoadData(deviceId, "1-1", startTime, endTime); groupBox3.Text = "1s频率稳定度"; stability result = new stability(); @@ -345,6 +344,7 @@ } case "tab_accuracy": { + tabControl1.SelectedIndex = 1; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -363,13 +363,14 @@ } case "tab_bootFeature": { + tabControl1.SelectedIndex = 2; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; - bootFeature result = new bootFeature(); + bootFeature result = new bootFeature(tableOriginData); result.label_bootFeature.Text = ""; if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) result.label_bootFeature.Text = resultBootStr; result.Show(); @@ -378,6 +379,7 @@ } case "tab_ageRate": { + tabControl1.SelectedIndex = 3; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -400,6 +402,7 @@ } case "tab_counter": { + tabControl1.SelectedIndex = 4; btn_reDetec.Visible = false; dataGridView_times.Visible = false; panel_radios.Visible = false; @@ -436,7 +439,7 @@ else if (radio_20s.Checked) dlg.label1.Text = "频率稳定度 - 20s"; else if (radio_100s.Checked) dlg.label1.Text = "频率稳定度 - 100s"; } - dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); + //dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); dlg.HideMaskAction += () => { this.HideMask(); @@ -530,6 +533,12 @@ } } + public void updateChannelNoRedetec() + { + dataGridView_times.CurrentRow.Cells[7].Value = ReDetecDlg.channelNoReDetec; + detectionItemService.updateChannelNo(Convert.ToInt64(dataGridView_times.CurrentRow.Cells[12].Value), ReDetecDlg.channelNoReDetec); + } + private void roundButton1_Click_1(object sender, EventArgs e) { diff --git a/RbFreqStandMeasure/info/ExportDlg.cs b/RbFreqStandMeasure/info/ExportDlg.cs index d7c6e02..53a903a 100644 --- a/RbFreqStandMeasure/info/ExportDlg.cs +++ b/RbFreqStandMeasure/info/ExportDlg.cs @@ -195,12 +195,7 @@ } private void btn_reDetec_Click(object sender, EventArgs e) - { - string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; - - StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); - strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); - strmWriterObj.WriteLine("序号,时间,相对频率偏差"); + { bool selected = false; foreach (DataGridViewRow row in dataGridView_times.Rows) { @@ -211,9 +206,14 @@ } if (!selected) { - MessageBox.Show("请选择要导出的数据!"); + MessageBox.Show("请选择要导出的检测记录!"); return; } + string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + + StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); + strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); + strmWriterObj.WriteLine("序号,时间,相对频率偏差"); foreach (DataGridViewRow row in dataGridView_times.Rows) { DataGridViewCheckBoxCell checkBox = (DataGridViewCheckBoxCell)row.Cells[0]; @@ -266,6 +266,18 @@ } } + + CounterDataService counterDataService = new CounterDataServiceImpl(); + List query = counterDataService.getHistory(deviceId, "", ""); + strmWriterObj.WriteLine("计数器范围及灵敏度"); + strmWriterObj.WriteLine("序号,输出值,测量值,灵敏度,时间"); + int index2 = 1; + foreach (CounterData counterData in query) + { + string strBufferLine = index2 + "," + counterData.OutValue + "," + counterData.Value + "," + counterData.Sensitivity + "," + counterData.LogTime; + strmWriterObj.WriteLine(strBufferLine); + index2++; + } strmWriterObj.Close(); MessageBox.Show("导出成功,存放位置:" + strFilePath); diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 55ae028..3b13488 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -475,10 +475,11 @@ long id = (long)dataGridView_DevList.Rows[rowIndex].Cells[9].Value; DetailDlg detailDlg = new DetailDlg(id); - detailDlg.Controls.Find("label_devModel", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[3].Value.ToString(); - detailDlg.Controls.Find("label_devCode", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[4].Value.ToString(); - detailDlg.Controls.Find("label_customerComp", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[5].Value.ToString(); - detailDlg.Controls.Find("label_customerName", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[6].Value.ToString(); + string model = dataGridView_DevList.Rows[rowIndex].Cells[3].Value.ToString(); + detailDlg.label_devModel.Text = model; + detailDlg.label_devCode.Text = dataGridView_DevList.Rows[rowIndex].Cells[4].Value.ToString(); + detailDlg.label_customerComp.Text = dataGridView_DevList.Rows[rowIndex].Cells[5].Value.ToString(); + detailDlg.label_customerName.Text = dataGridView_DevList.Rows[rowIndex].Cells[6].Value.ToString(); detailDlg.HideMaskAction += () => { @@ -529,7 +530,7 @@ editDlg.checkBox_stability.Checked = true; foreach (string n in detectionItem.Interval.Split(',')) { - if(!n.Equals(""))((RadioButton)editDlg.Controls.Find("radio_" + n + "s", true)[0]).Checked = true; + if(!n.Equals(""))((CheckBox)editDlg.Controls.Find("checkBox" + n + "s", true)[0]).Checked = true; } } if (!detectionItem.BootFeature.Equals("-3")) editDlg.checkBox_bootFeature.Checked = true; @@ -588,14 +589,18 @@ { try { + if (dataGridView_DevList.SelectedRows.Count == 0)//判断是否选中某行 + { + MessageBox.Show("无选中仪器!"); return; + } long devId = Convert.ToInt64(dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[9].Value); + string deviceName = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[2].Value.ToString(); + string deviceType = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[10].Value.ToString(); List queryList = detectionItemService.search(devId, false); if (null != queryList && queryList.Count > 0) { - string deviceName = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[2].Value.ToString(); - string deviceType = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[10].Value.ToString(); - + ExportDlg dlg = new ExportDlg(devId); dlg.label_devName.Text = deviceName; dlg.label_devType.Text = deviceType; @@ -611,7 +616,29 @@ } else { - MessageBox.Show("所选仪器无测试数据可导出!"); + CounterDataService counterDataService = new CounterDataServiceImpl(); + List query = counterDataService.getHistory(devId, "", ""); + if (null != query && query.Count > 0) + { + string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + + StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); + strmWriterObj.WriteLine(deviceName + " - " + deviceType + "-" + "计数器范围及灵敏度"); + strmWriterObj.WriteLine("序号,输出值,测量值,灵敏度,时间"); + int index = 1; + foreach (CounterData counterData in query) + { + string strBufferLine = index + "," + counterData.OutValue + "," + counterData.Value + "," + counterData.Sensitivity + "," + counterData.LogTime; + strmWriterObj.WriteLine(strBufferLine); + index++; + } + strmWriterObj.Close(); + MessageBox.Show("导出成功,存放位置:" + strFilePath); + } + else + { + MessageBox.Show("所选仪器无测试数据可导出!"); + } } } catch (Exception ex) diff --git a/RbFreqStandMeasure/info/ReDetecDlg.cs b/RbFreqStandMeasure/info/ReDetecDlg.cs index 0225309..0af7776 100644 --- a/RbFreqStandMeasure/info/ReDetecDlg.cs +++ b/RbFreqStandMeasure/info/ReDetecDlg.cs @@ -36,6 +36,7 @@ public string detectType = ""; public long deviceId=-1; public long detectionItemId = -1; + public static string channelNoReDetec = ""; public Action HideMaskAction { @@ -96,11 +97,11 @@ string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); - string channelNo = text_channelNo.Text; + channelNoReDetec = text_channelNo.Text; // 打开串口 - SerialPort port = RbFreqStdMeas.portList[Convert.ToInt32(channelNo) - 1]; + SerialPort port = RbFreqStdMeas.portList[Convert.ToInt32(channelNoReDetec) - 1]; if (port.IsOpen) port.Close(); port.PortName = portName; port.BaudRate = band; @@ -115,20 +116,20 @@ port.Open(); if (!port.IsOpen) { - MessageBox.Show("无法打开通道"+channelNo+",检测失败!"); + MessageBox.Show("无法打开通道"+ channelNoReDetec + ",检测失败!"); return; } } catch (Exception exc) { - MessageBox.Show("无法打开通道" + channelNo + ",检测失败!"); + MessageBox.Show("无法打开通道" + channelNoReDetec + ",检测失败!"); return; } DetectionHelper detectionHelper = new DetectionHelper(); if (DetectionHelper.detectionHelper.getFrequencyData(port).Equals("")) { - MessageBox.Show("请连接仪器到通道[" + channelNo + "]!"); + MessageBox.Show("请连接仪器到通道[" + channelNoReDetec + "]!"); return; } diff --git a/RbFreqStandMeasure/info/accuracy.designer.cs b/RbFreqStandMeasure/info/accuracy.designer.cs index e33e95d..1e9da53 100644 --- a/RbFreqStandMeasure/info/accuracy.designer.cs +++ b/RbFreqStandMeasure/info/accuracy.designer.cs @@ -30,7 +30,7 @@ { this.label_accuracy = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_stand = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // @@ -58,18 +58,18 @@ this.label4.Text = "测量结果A:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_devModel + // label_stand // - this.label_devModel.BackColor = System.Drawing.Color.Transparent; - this.label_devModel.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; - this.label_devModel.Location = new System.Drawing.Point(183, 62); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(83, 27); - this.label_devModel.TabIndex = 98; - this.label_devModel.Text = "10MHz"; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_stand.BackColor = System.Drawing.Color.Transparent; + this.label_stand.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_stand.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_stand.Location = new System.Drawing.Point(183, 62); + this.label_stand.Margin = new System.Windows.Forms.Padding(0); + this.label_stand.Name = "label_stand"; + this.label_stand.Size = new System.Drawing.Size(83, 27); + this.label_stand.TabIndex = 98; + this.label_stand.Text = "10MHz"; + this.label_stand.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label9 // @@ -89,7 +89,7 @@ this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label_accuracy); this.Controls.Add(this.label4); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_stand); this.Controls.Add(this.label9); this.Name = "accuracy"; this.Size = new System.Drawing.Size(405, 229); @@ -99,7 +99,7 @@ #endregion private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label_devModel; + private System.Windows.Forms.Label label_stand; private System.Windows.Forms.Label label9; public System.Windows.Forms.Label label_accuracy; } diff --git a/RbFreqStandMeasure/info/bootFeature.cs b/RbFreqStandMeasure/info/bootFeature.cs index 2cec888..a75db54 100644 --- a/RbFreqStandMeasure/info/bootFeature.cs +++ b/RbFreqStandMeasure/info/bootFeature.cs @@ -4,18 +4,27 @@ using System.Windows.Forms; using System.Drawing.Drawing2D; using Casic.Birmm.RbFreqStandMeasure.Properties; +using System.Windows.Forms.DataVisualization.Charting; +using System.Data; namespace Casic.Birmm.RbFreqStandMeasure { public partial class bootFeature : UserControl { - public bootFeature() + public bootFeature(DataTable originData) { InitializeComponent(); - //设置背景颜色为透明 - this.BackColor = Color.Transparent; + + chart1.Series["Series1"].XValueMember = "时间"; + chart1.Series["Series1"].YValueMembers = "相对频率偏差"; + + //chart1.Series["Series1"].MarkerStyle = MarkerStyle.Circle; //线条上的数据点标志类型 + //chart1.Series["Series1"].MarkerSize = 3; //标志大小 + Series Series1 = new Series(); + chart1.Series.Add(Series1);//加入你的chart1 + chart1.DataSource = originData; } diff --git a/RbFreqStandMeasure/Properties/Resources.Designer.cs b/RbFreqStandMeasure/Properties/Resources.Designer.cs index a663f6c..2639730 100644 --- a/RbFreqStandMeasure/Properties/Resources.Designer.cs +++ b/RbFreqStandMeasure/Properties/Resources.Designer.cs @@ -263,16 +263,6 @@ /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// - internal static System.Drawing.Bitmap dot_red { - get { - object obj = ResourceManager.GetObject("dot_red", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// 查找 System.Drawing.Bitmap 类型的本地化资源。 - /// internal static System.Drawing.Bitmap icon_counter { get { object obj = ResourceManager.GetObject("icon_counter", resourceCulture); diff --git a/RbFreqStandMeasure/Properties/Resources.resx b/RbFreqStandMeasure/Properties/Resources.resx index a357bf1..b843d2d 100644 --- a/RbFreqStandMeasure/Properties/Resources.resx +++ b/RbFreqStandMeasure/Properties/Resources.resx @@ -220,24 +220,12 @@ ..\res\icons\CHN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\path.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\calender.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\dot-gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\dot-orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\line.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -247,4 +235,13 @@ ..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\dot_gray.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\dot_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs index 1c72462..3fe0773 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/DetectionItemService.cs @@ -18,6 +18,7 @@ int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData); DetectionItem searchById(long detectionId); + int updateChannelNo(long detectionItemId, string channelNo); int updateDetecStatus(long detectionId, string stability, string accuracy, string bootFeature, string ageRate, string counterDetec, string stability1, string stability10, string stability20, string stability100); } } diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index d3f6132..5c4cda2 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -182,6 +182,43 @@ return iRetval; } + public int updateChannelNo(long detectionItemId, string channelNo) + { + int iRetval = -1; + + try + { + if (DbConnectService.mySqlConnect.State == ConnectionState.Closed) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem : 数据库链接断开"); + iRetval = DbConnectService.openDb(); + if (iRetval != 0) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重连失败!"); + return iRetval; + } + } + + string sQry = "UPDATE r_detection_item SET CHANNEL=@CHANNEL where ID = "+ detectionItemId; + + + + MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); + cmd.Parameters.Add("@CHANNEL", MySqlDbType.String, 10).Value = channelNo; + + cmd.ExecuteNonQuery(); + + cmd.Dispose(); + iRetval = 0; + } + catch (MySqlException e) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateDetectionItem CHANNEL: " + e.Message); + iRetval = -1; + } + + return iRetval; + } public int stopDetection(long deviceId, string startTime, string endTime, bool isDeleteData) { @@ -248,7 +285,7 @@ { sQry = sQry + " and ('" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' between START_TIME AND END_TIME)"; } - sQry = sQry +"order by END_TIME desc"; + sQry = sQry +" order by END_TIME desc"; MySqlCommand aCommand = new MySqlCommand(sQry, DbConnectService.mySqlConnect); using (MySqlDataReader aReader = aCommand.ExecuteReader()) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs index 66e9d26..c536399 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionServiceImpl.cs @@ -71,10 +71,11 @@ } string sQry = "UPDATE r_detection SET FREQUENCY=@FREQUENCY WHERE ID = " + detectionId; - + + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency sQry:"+ sQry); MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); - cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 30).Value = fre; + cmd.Parameters.Add("@FREQUENCY", MySqlDbType.String, 50).Value = fre; cmd.ExecuteNonQuery(); cmd.Dispose(); diff --git a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs index 647ce40..059c95c 100644 --- a/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs +++ b/RbFreqStandMeasure/R_DevService/Service/Impl/SensitivityServiceImpl.cs @@ -37,7 +37,7 @@ if (currentVolTage == null) { sensitivityContentParam.VolTage = "灵敏度超限"; - sensitivityContentParam.CheckTime = new DateTime(); + sensitivityContentParam.CheckTime = DateTime.Now; break; } //设置当前灵敏度 diff --git a/RbFreqStandMeasure/RbFreqStandMeasure.csproj b/RbFreqStandMeasure/RbFreqStandMeasure.csproj index 746f63e..c1d76b7 100644 --- a/RbFreqStandMeasure/RbFreqStandMeasure.csproj +++ b/RbFreqStandMeasure/RbFreqStandMeasure.csproj @@ -582,18 +582,11 @@ - - - - - - - @@ -613,6 +606,10 @@ + + + + \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index fdd6255..12c816e 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -511,13 +511,13 @@ } private void switchMainPanel(int index) - { + { + if (index != 3 && CounterCtrlForm.isDetecting) + { + MessageBox.Show("正在检测计数器,无法离开当前界面!"); + return; + } panelMain.Controls.Clear(); - //if (index != 3 && CounterCtrlForm.isDetecting) - //{ - // MessageBox.Show("正在检测计数器,无法离开当前界面!"); - // return; - //} switch (index) { case 0: // 首页 diff --git a/RbFreqStandMeasure/Resources/dot-green.png b/RbFreqStandMeasure/Resources/dot-green.png index 3663a1d..6cb5784 100644 --- a/RbFreqStandMeasure/Resources/dot-green.png +++ b/RbFreqStandMeasure/Resources/dot-green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_gray.png b/RbFreqStandMeasure/Resources/dot_gray.png index 6342fb2..0695226 100644 --- a/RbFreqStandMeasure/Resources/dot_gray.png +++ b/RbFreqStandMeasure/Resources/dot_gray.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_green.png b/RbFreqStandMeasure/Resources/dot_green.png new file mode 100644 index 0000000..38ac3be --- /dev/null +++ b/RbFreqStandMeasure/Resources/dot_green.png Binary files differ diff --git a/RbFreqStandMeasure/Resources/dot_orange.png b/RbFreqStandMeasure/Resources/dot_orange.png index 04305b6..2dee181 100644 --- a/RbFreqStandMeasure/Resources/dot_orange.png +++ b/RbFreqStandMeasure/Resources/dot_orange.png Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 0662749..3f61c45 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 10d1e6f..9f570f7 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -186,7 +186,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "灵敏度(Vpp)", - Location = new Point(485, 0), + Location = new Point(480, 0), Size = new Size(95, 50) }; dataGridView_CounterResult.Controls.Add(colSensitivity); @@ -353,7 +353,7 @@ private void dataGridView_CounterResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6) + if (e.ColumnIndex == 4|| e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7) { dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = false;//将当前单元格设为可读 dataGridView_CounterResult.CurrentCell = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex];//获取当前单元格 @@ -680,76 +680,127 @@ { int id = Convert.ToInt32(dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value); string value = dataGridView_CounterResult.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); - if (e.ColumnIndex == 4) + + try { - if (String.IsNullOrEmpty(value)) + if (e.ColumnIndex == 4) { - MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + if (String.IsNullOrEmpty(value)) + { + MessageBox.Show("输出" + textBox_detecModel.Text.Substring(0, 2) + "不能为空,操作失败!"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + return; + } else { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; + if (textBox_detecModel.Text.Equals("频率测量")) + { + if (!checkFreq(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } + else + { + if (!checkCyc(value) || freAndCycle(value) == null) + { + MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); + if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); + else + { + dataGridView_CounterResult.CurrentCell.Value = valueOld; + valueOld = ""; + } + isAdd = false; + + return; + } + } } - isAdd = false; - return; - } - else - { + + string freq = ""; + string cycle = ""; if (textBox_detecModel.Text.Equals("频率测量")) { - if (!checkFreq(value) || freAndCycle(value) == null) - { - MessageBox.Show("请输入正确的带单位的频率值(Hz\\kHz\\MHz\\GHz)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - - return; - } + freq = value; + cycle = freAndCycle(freq); } else { - if (!checkCyc(value)|| freAndCycle(value)==null) + cycle = value; + freq = freAndCycle(cycle); + } + long initId = counterDetecInitService.addOrUpdate(freq, cycle); + dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; + } + + else if (e.ColumnIndex == 5) + { + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.E]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) { - MessageBox.Show("请输入正确的带单位的周期值(s\\ms\\us\\ns)"); - if (isAdd) table_counterDetecInit.Rows.RemoveAt(table_counterDetecInit.Rows.Count - 1); - else - { - dataGridView_CounterResult.CurrentCell.Value = valueOld; - valueOld = ""; - } - isAdd = false; - + MessageBox.Show("请输入格式正确的测量值!"); return; } } } - - string freq = ""; - string cycle = ""; - if (textBox_detecModel.Text.Equals("频率测量")) + else if (e.ColumnIndex == 6) { - freq = value; - cycle = freAndCycle(freq); + if (!String.IsNullOrEmpty(value)) + { + string pattern = @"^[0-9.]+$"; + Regex regex = new Regex(pattern); + if (!regex.IsMatch(value)) + { + MessageBox.Show("请输入格式正确的灵敏度!"); + return; + } + } } - else + else if (e.ColumnIndex == 7) { - cycle = value; - freq = freAndCycle(cycle); + if (!String.IsNullOrEmpty(value)) + { + try + { + DateTime.Parse(value); //不是字符串时会出现异常 + } + catch + { + dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = ""; + MessageBox.Show("请输入格式正确的时间!"); + return; + } + } } - long initId = counterDetecInitService.addOrUpdate(freq, cycle); - dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } + catch (Exception ex) { } + finally + { + string valueTime = dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value.ToString(); - if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4 && String.IsNullOrEmpty(valueTime)) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - updateDatabase(); - + updateDatabase(); + } } private bool checkFreq(string val) { @@ -799,7 +850,10 @@ string type = textBox_detecModel.Text.Equals("频率测量") ? "1" : "2"; foreach (DataGridViewRow row in dataGridView_CounterResult.Rows) { - counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + if (!String.IsNullOrEmpty(row.Cells[5].Value.ToString()) || !String.IsNullOrEmpty(row.Cells[6].Value.ToString())) + { + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), row.Cells[5].Value.ToString(), row.Cells[6].Value.ToString(), row.Cells[7].Value.ToString(), type); + } } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs index b5b28dd..fcefb48 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.Designer.cs @@ -177,9 +177,9 @@ this.label_pageInfo.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label_pageInfo.Location = new System.Drawing.Point(510, 184); this.label_pageInfo.Name = "label_pageInfo"; - this.label_pageInfo.Size = new System.Drawing.Size(144, 17); + this.label_pageInfo.Size = new System.Drawing.Size(137, 17); this.label_pageInfo.TabIndex = 312; - this.label_pageInfo.Text = "共10条,每页4条,共2页"; + this.label_pageInfo.Text = "共0条,每页0条,共0页"; // // tableToBeTested // diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 024ac67..5d75f74 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -484,8 +484,26 @@ dataGridView_Channel.Controls.Add(colAgingRate); colAgingRate.BringToFront(); - } + } + public void refreshChannelList() + { + channelFreeList.Clear(); + channelFreeList.Add("1"); + channelFreeList.Add("2"); + channelFreeList.Add("3"); + channelFreeList.Add("4"); + channelFreeList.Add("5"); + + listChannelStatus = deviceService.getDeviceByChannel(); + if (listChannelStatus != null && listChannelStatus.Count > 0) + { + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + } + } + } public void LoadChannelStatus() { channelsTable = new DataTable(); diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 62ab441..c8a9d0e 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -88,6 +88,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(674, 32); this.panel1.TabIndex = 10; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // btnExitChannel @@ -666,6 +667,7 @@ this.checkBox_100s.TabIndex = 353; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -677,6 +679,7 @@ this.checkBox20s.TabIndex = 352; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -688,6 +691,7 @@ this.checkBox10s.TabIndex = 351; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -699,6 +703,7 @@ this.checkBox1s.TabIndex = 350; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label12 // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index 03f9d90..6aaa532 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -74,6 +74,8 @@ private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } private void SetDevChannelDlg_Shown(object sender, EventArgs e) @@ -306,20 +308,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -355,5 +357,30 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs index 05081ac..473850d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.Designer.cs @@ -646,6 +646,7 @@ this.checkBox_100s.TabIndex = 357; this.checkBox_100s.Text = "100s"; this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox_100s.CheckedChanged += new System.EventHandler(this.checkBox_100s_CheckedChanged); // // checkBox20s // @@ -657,6 +658,7 @@ this.checkBox20s.TabIndex = 356; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -668,6 +670,7 @@ this.checkBox10s.TabIndex = 355; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -679,6 +682,7 @@ this.checkBox1s.TabIndex = 354; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index da45f50..1bb08ca 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -213,7 +213,7 @@ long detectionItemId = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionItemId; this.HideMaskAction(); - + HomeCtrlForm.homeCtrlForm.refreshChannelList(); HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } @@ -221,6 +221,8 @@ private void btnExitDev_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -272,20 +274,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = timePicker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = timePicker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox_100s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = timePicker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } timePicker_endTime.Value = endTimeBySystem; @@ -320,5 +322,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox_100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index cbb6cba..35c7a60 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -74,7 +74,7 @@ this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.checkBox_100s = new System.Windows.Forms.CheckBox(); + this.checkBox100s = new System.Windows.Forms.CheckBox(); this.checkBox20s = new System.Windows.Forms.CheckBox(); this.checkBox10s = new System.Windows.Forms.CheckBox(); this.checkBox1s = new System.Windows.Forms.CheckBox(); @@ -735,7 +735,7 @@ // // groupBox2 // - this.groupBox2.Controls.Add(this.checkBox_100s); + this.groupBox2.Controls.Add(this.checkBox100s); this.groupBox2.Controls.Add(this.checkBox20s); this.groupBox2.Controls.Add(this.checkBox10s); this.groupBox2.Controls.Add(this.checkBox1s); @@ -747,16 +747,17 @@ this.groupBox2.TabIndex = 40; this.groupBox2.TabStop = false; // - // checkBox_100s + // checkBox100s // - this.checkBox_100s.AutoSize = true; - this.checkBox_100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_100s.Location = new System.Drawing.Point(468, 19); - this.checkBox_100s.Name = "checkBox_100s"; - this.checkBox_100s.Size = new System.Drawing.Size(58, 24); - this.checkBox_100s.TabIndex = 361; - this.checkBox_100s.Text = "100s"; - this.checkBox_100s.UseVisualStyleBackColor = true; + this.checkBox100s.AutoSize = true; + this.checkBox100s.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox100s.Location = new System.Drawing.Point(468, 19); + this.checkBox100s.Name = "checkBox100s"; + this.checkBox100s.Size = new System.Drawing.Size(58, 24); + this.checkBox100s.TabIndex = 361; + this.checkBox100s.Text = "100s"; + this.checkBox100s.UseVisualStyleBackColor = true; + this.checkBox100s.CheckedChanged += new System.EventHandler(this.checkBox100s_CheckedChanged); // // checkBox20s // @@ -768,6 +769,7 @@ this.checkBox20s.TabIndex = 360; this.checkBox20s.Text = "20s"; this.checkBox20s.UseVisualStyleBackColor = true; + this.checkBox20s.CheckedChanged += new System.EventHandler(this.checkBox20s_CheckedChanged); // // checkBox10s // @@ -779,6 +781,7 @@ this.checkBox10s.TabIndex = 359; this.checkBox10s.Text = "10s"; this.checkBox10s.UseVisualStyleBackColor = true; + this.checkBox10s.CheckedChanged += new System.EventHandler(this.checkBox10s_CheckedChanged); // // checkBox1s // @@ -790,6 +793,7 @@ this.checkBox1s.TabIndex = 358; this.checkBox1s.Text = "1s"; this.checkBox1s.UseVisualStyleBackColor = true; + this.checkBox1s.CheckedChanged += new System.EventHandler(this.checkBox1s_CheckedChanged); // // label6 // @@ -930,7 +934,7 @@ private System.Windows.Forms.Label label14; public System.Windows.Forms.GroupBox groupBox1; public System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.CheckBox checkBox_100s; + private System.Windows.Forms.CheckBox checkBox100s; private System.Windows.Forms.CheckBox checkBox20s; private System.Windows.Forms.CheckBox checkBox10s; private System.Windows.Forms.CheckBox checkBox1s; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 8af1705..5d7de27 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -84,6 +84,8 @@ private void btnAddDevCancel_Click(object sender, EventArgs e) { this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } // 添加并开始检测 @@ -115,7 +117,7 @@ } if (text_channelNo.Text.Trim() != "") { - if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox_100s.Checked) + if (checkBox_stability.Checked && !checkBox1s.Checked && !checkBox10s.Checked && !checkBox20s.Checked && !checkBox100s.Checked) { MessageBox.Show("请选择频率稳定度采样时间!"); return; @@ -142,7 +144,12 @@ string devModel = ((TextBoxX)this.Controls.Find("inputDevModel", true)[0]).Text; string devCustomComp = ((TextBoxX)this.Controls.Find("inputCustComp", true)[0]).Text; string devCustomName = ((TextBoxX)this.Controls.Find("inputCustName", true)[0]).Text; - string devTypeCode = cbBox_devType.SelectedValue.ToString(); + string devTypeCode = "1"; + foreach (Dict dict in (List)cbBox_devType.DataSource) + { + if (text_devType.Text.Equals(dict.Name)) devTypeCode = dict.Code; + } + //string devTypeCode = cbBox_devType.SelectedValue.ToString(); string channelNo = text_channelNo.Text.Trim(); string statusId = ""; @@ -263,7 +270,7 @@ if (checkBox1s.Checked) interval = "1,"; if (checkBox10s.Checked) interval = interval + "10,"; if (checkBox20s.Checked) interval = interval + "20,"; - if (checkBox_100s.Checked) interval = interval + "100"; + if (checkBox100s.Checked) interval = interval + "100"; stability = "-2"; @@ -273,7 +280,7 @@ if (checkBox1s.Checked) stability1 = "-1"; if (checkBox10s.Checked) stability10 = "-1"; if (checkBox20s.Checked) stability20 = "-1"; - if (checkBox_100s.Checked) stability100 = "-1"; + if (checkBox100s.Checked) stability100 = "-1"; detectionHelper.detecStability(deviceId, startTime, interval, port, true, false); } else @@ -281,7 +288,7 @@ if (checkBox1s.Checked) stability1 = "-2"; if (checkBox10s.Checked) stability10 = "-2"; if (checkBox20s.Checked) stability20 = "-2"; - if (checkBox_100s.Checked) stability100 = "-2"; + if (checkBox100s.Checked) stability100 = "-2"; detectionHelper.detecStability(deviceId, startTime, interval, port, false, false); } } @@ -334,6 +341,8 @@ //开始检测 long detectionId0 = detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text, stability1, stability10, stability20, stability100); detectionHelper.detectionItemId = detectionId0; + + HomeCtrlForm.homeCtrlForm.refreshChannelList(); } if (labelTitle.Text.Equals("添加")) MessageBox.Show("添加成功!"); @@ -428,20 +437,20 @@ private void getEndTime() { - if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(5); + if (checkBox_ageRate.Checked) endTimeBySystem = picker_startTime.Value.AddDays(7).AddSeconds(30); else { - if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7); + if (checkBox_bootFeature.Checked) endTimeBySystem = picker_startTime.Value.AddHours(7).AddSeconds(30); else { if (checkBox_stability.Checked) { - if (checkBox_100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(5); - else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(5); - else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(5); - else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(5); + if (checkBox100s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 100).AddSeconds(40); + else if (checkBox20s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 20).AddSeconds(40); + else if (checkBox10s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101 * 10).AddSeconds(40); + else if (checkBox1s.Checked) endTimeBySystem = picker_startTime.Value.AddSeconds(101).AddSeconds(40); } - else endTimeBySystem = DateTime.Now.AddMinutes(5).AddSeconds(5); + else endTimeBySystem = DateTime.Now.AddMinutes(1).AddSeconds(30); } } @@ -482,5 +491,25 @@ { } + + private void checkBox1s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox10s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox20s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } + + private void checkBox100s_CheckedChanged(object sender, EventArgs e) + { + getEndTime(); + } } } diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 66be073..82dd74d 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -670,10 +670,6 @@ private DevComponents.Editors.ComboItem channel4; private DevComponents.Editors.ComboItem channel5; private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Label label_customerComp; - private System.Windows.Forms.Label label_devCode; - private System.Windows.Forms.Label label_customerName; - private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label9; @@ -700,5 +696,9 @@ public System.Windows.Forms.DataGridView dataGridView_Data; public System.Windows.Forms.Label label_reDetecting; private RoundButton roundButton1; + public System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_customerComp; + public System.Windows.Forms.Label label_devCode; + public System.Windows.Forms.Label label_customerName; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index ce2e4ef..a670fe8 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -1,15 +1,11 @@ -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Dto; -using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; +using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Model; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service; using Casic.Birmm.RbFreqStandMeasure.R_DataBase.Service.Impl; using Casic.Birmm.RbFreqStandMeasure.Tools; -using DevComponents.DotNetBar.Controls; -using DevComponents.Editors; using System; using System.Collections.Generic; using System.Data; using System.Drawing; -using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -51,15 +47,15 @@ public static DataGridView dataGridView; public static Label label_redetecting; - + public static DetailDlg detailDlg; long deviceId = -1; string startTime = ""; string endTime = ""; - string resultAccStr = ""; - string resultStaStr10 = ""; - string resultStaStr20 = ""; - string resultStaStr100 = ""; - string resultStaStr1 = ""; + public string resultAccStr = ""; + public string resultStaStr10 = ""; + public string resultStaStr20 = ""; + public string resultStaStr100 = ""; + public string resultStaStr1 = ""; string resultBootStr = ""; string resultAgeStr = ""; @@ -72,7 +68,7 @@ public DetailDlg(long deviceId) { InitializeComponent(); - + detailDlg = this; this.deviceId = deviceId; LoadTimes(deviceId); @@ -87,19 +83,18 @@ resultStaStr1 = dataGridView_times.Rows[0].Cells[8].Value.ToString(); resultBootStr = dataGridView_times.Rows[0].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[0].Cells[6].Value.ToString(); - LoadData(deviceId, "1-1", startTime, endTime); - - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + if ((!resultStaStr1.Equals("-1")&& !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1")&& !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) ||( !resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if(!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if(!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + if (!resultBootStr.Equals("-1")&& !resultBootStr.Equals("-2")&& !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + if (!resultAgeStr.Equals("-1")&&!resultAgeStr.Equals("-2")&& !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); } if (dataGridView_Data.Rows.Count == 0) btn_reDetec.Enabled = false; @@ -114,6 +109,8 @@ return; } this.HideMaskAction(); + RbFreqStdMeas.rbFreqStdMeas.TopMost = true; + RbFreqStdMeas.rbFreqStdMeas.TopMost = false; } @@ -173,8 +170,8 @@ tableOriginData.Columns.Add("序号", Type.GetType("System.String")); tableOriginData.Columns.Add("输出值", Type.GetType("System.String")); tableOriginData.Columns.Add("测量值", Type.GetType("System.String")); - tableOriginData.Columns.Add("灵敏度", Type.GetType("System.String")); - tableOriginData.Columns.Add("测量时间", Type.GetType("System.DateTime")); + tableOriginData.Columns.Add("灵敏度(Vpp)", Type.GetType("System.String")); + tableOriginData.Columns.Add("测量时间", Type.GetType("System.String")); // 获取当前页的数据 @@ -192,11 +189,11 @@ dataGridView_Data.DataSource = tableOriginData; // width=425px - dataGridView_Data.Columns[0].Width = 50; - dataGridView_Data.Columns[1].Width = 80; - dataGridView_Data.Columns[2].Width = 155; - dataGridView_Data.Columns[3].Width = 75; - dataGridView_Data.Columns[4].Width = 110; + dataGridView_Data.Columns[0].Width = 45; + dataGridView_Data.Columns[1].Width = 60; + dataGridView_Data.Columns[2].Width = 150; + dataGridView_Data.Columns[3].Width = 85; + dataGridView_Data.Columns[4].Width = 135; dataGridView_Data.Columns[0].ReadOnly = true; dataGridView_Data.Columns[1].ReadOnly = true; @@ -305,17 +302,18 @@ resultBootStr = dataGridView_times.Rows[rowIndex].Cells[5].Value.ToString(); resultAgeStr = dataGridView_times.Rows[rowIndex].Cells[6].Value.ToString(); - if (!resultAccStr.Equals("")) tabPageEvent("tab_accuracy"); - if (!resultStaStr1.Equals("") || !resultStaStr10.Equals("") || !resultStaStr100.Equals("")) + if (!resultAccStr.Equals("-1") && !resultAccStr.Equals("-2") && !resultAccStr.Equals("-3")) tabPageEvent("tab_accuracy"); + else if ((!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) || (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) || (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3"))) { tabPageEvent("tab_stability"); - if (!resultStaStr1.Equals("")) radio_1s.Checked = true; - else if (!resultStaStr10.Equals("")) radio_10s.Checked = true; - else if (!resultStaStr20.Equals("")) radio_20s.Checked = true; - else if (!resultStaStr100.Equals("")) radio_100s.Checked = true; + if (!resultStaStr1.Equals("-1") && !resultStaStr1.Equals("-2") && !resultStaStr1.Equals("-3")) radio_1s.Checked = true; + else if (!resultStaStr10.Equals("-1") && !resultStaStr10.Equals("-2") && !resultStaStr10.Equals("-3")) radio_10s.Checked = true; + else if (!resultStaStr20.Equals("-1") && !resultStaStr20.Equals("-2") && !resultStaStr20.Equals("-3")) radio_20s.Checked = true; + else if (!resultStaStr100.Equals("-1") && !resultStaStr100.Equals("-2") && !resultStaStr100.Equals("-3")) radio_100s.Checked = true; } - if (!resultBootStr.Equals("")) tabPageEvent("tab_bootFeature"); - if (!resultAgeStr.Equals("")) tabPageEvent("tab_ageRate"); + else if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) tabPageEvent("tab_bootFeature"); + else if (!resultAgeStr.Equals("-1") && !resultAgeStr.Equals("-2") && !resultAgeStr.Equals("-3")) tabPageEvent("tab_ageRate"); + } } @@ -326,11 +324,12 @@ { case "tab_stability": { + tabControl1.SelectedIndex = 0; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = true; btn_reDetec.Enabled = true; - + radio_1s.Checked = true; LoadData(deviceId, "1-1", startTime, endTime); groupBox3.Text = "1s频率稳定度"; stability result = new stability(); @@ -345,6 +344,7 @@ } case "tab_accuracy": { + tabControl1.SelectedIndex = 1; btn_reDetec.Visible = true; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -363,13 +363,14 @@ } case "tab_bootFeature": { + tabControl1.SelectedIndex = 2; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; - bootFeature result = new bootFeature(); + bootFeature result = new bootFeature(tableOriginData); result.label_bootFeature.Text = ""; if (!resultBootStr.Equals("-1") && !resultBootStr.Equals("-2") && !resultBootStr.Equals("-3")) result.label_bootFeature.Text = resultBootStr; result.Show(); @@ -378,6 +379,7 @@ } case "tab_ageRate": { + tabControl1.SelectedIndex = 3; btn_reDetec.Visible = false; dataGridView_times.Visible = true; panel_radios.Visible = false; @@ -400,6 +402,7 @@ } case "tab_counter": { + tabControl1.SelectedIndex = 4; btn_reDetec.Visible = false; dataGridView_times.Visible = false; panel_radios.Visible = false; @@ -436,7 +439,7 @@ else if (radio_20s.Checked) dlg.label1.Text = "频率稳定度 - 20s"; else if (radio_100s.Checked) dlg.label1.Text = "频率稳定度 - 100s"; } - dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); + //dlg.text_channelNo.Text = dataGridView_times.CurrentRow.Cells[7].Value.ToString(); dlg.HideMaskAction += () => { this.HideMask(); @@ -530,6 +533,12 @@ } } + public void updateChannelNoRedetec() + { + dataGridView_times.CurrentRow.Cells[7].Value = ReDetecDlg.channelNoReDetec; + detectionItemService.updateChannelNo(Convert.ToInt64(dataGridView_times.CurrentRow.Cells[12].Value), ReDetecDlg.channelNoReDetec); + } + private void roundButton1_Click_1(object sender, EventArgs e) { diff --git a/RbFreqStandMeasure/info/ExportDlg.cs b/RbFreqStandMeasure/info/ExportDlg.cs index d7c6e02..53a903a 100644 --- a/RbFreqStandMeasure/info/ExportDlg.cs +++ b/RbFreqStandMeasure/info/ExportDlg.cs @@ -195,12 +195,7 @@ } private void btn_reDetec_Click(object sender, EventArgs e) - { - string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; - - StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); - strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); - strmWriterObj.WriteLine("序号,时间,相对频率偏差"); + { bool selected = false; foreach (DataGridViewRow row in dataGridView_times.Rows) { @@ -211,9 +206,14 @@ } if (!selected) { - MessageBox.Show("请选择要导出的数据!"); + MessageBox.Show("请选择要导出的检测记录!"); return; } + string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + + StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); + strmWriterObj.WriteLine(label_devName.Text + " - " + label_devType.Text + "-" + "测试数据及结果"); + strmWriterObj.WriteLine("序号,时间,相对频率偏差"); foreach (DataGridViewRow row in dataGridView_times.Rows) { DataGridViewCheckBoxCell checkBox = (DataGridViewCheckBoxCell)row.Cells[0]; @@ -266,6 +266,18 @@ } } + + CounterDataService counterDataService = new CounterDataServiceImpl(); + List query = counterDataService.getHistory(deviceId, "", ""); + strmWriterObj.WriteLine("计数器范围及灵敏度"); + strmWriterObj.WriteLine("序号,输出值,测量值,灵敏度,时间"); + int index2 = 1; + foreach (CounterData counterData in query) + { + string strBufferLine = index2 + "," + counterData.OutValue + "," + counterData.Value + "," + counterData.Sensitivity + "," + counterData.LogTime; + strmWriterObj.WriteLine(strBufferLine); + index2++; + } strmWriterObj.Close(); MessageBox.Show("导出成功,存放位置:" + strFilePath); diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 55ae028..3b13488 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -475,10 +475,11 @@ long id = (long)dataGridView_DevList.Rows[rowIndex].Cells[9].Value; DetailDlg detailDlg = new DetailDlg(id); - detailDlg.Controls.Find("label_devModel", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[3].Value.ToString(); - detailDlg.Controls.Find("label_devCode", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[4].Value.ToString(); - detailDlg.Controls.Find("label_customerComp", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[5].Value.ToString(); - detailDlg.Controls.Find("label_customerName", true)[0].Text = dataGridView_DevList.Rows[rowIndex].Cells[6].Value.ToString(); + string model = dataGridView_DevList.Rows[rowIndex].Cells[3].Value.ToString(); + detailDlg.label_devModel.Text = model; + detailDlg.label_devCode.Text = dataGridView_DevList.Rows[rowIndex].Cells[4].Value.ToString(); + detailDlg.label_customerComp.Text = dataGridView_DevList.Rows[rowIndex].Cells[5].Value.ToString(); + detailDlg.label_customerName.Text = dataGridView_DevList.Rows[rowIndex].Cells[6].Value.ToString(); detailDlg.HideMaskAction += () => { @@ -529,7 +530,7 @@ editDlg.checkBox_stability.Checked = true; foreach (string n in detectionItem.Interval.Split(',')) { - if(!n.Equals(""))((RadioButton)editDlg.Controls.Find("radio_" + n + "s", true)[0]).Checked = true; + if(!n.Equals(""))((CheckBox)editDlg.Controls.Find("checkBox" + n + "s", true)[0]).Checked = true; } } if (!detectionItem.BootFeature.Equals("-3")) editDlg.checkBox_bootFeature.Checked = true; @@ -588,14 +589,18 @@ { try { + if (dataGridView_DevList.SelectedRows.Count == 0)//判断是否选中某行 + { + MessageBox.Show("无选中仪器!"); return; + } long devId = Convert.ToInt64(dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[9].Value); + string deviceName = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[2].Value.ToString(); + string deviceType = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[10].Value.ToString(); List queryList = detectionItemService.search(devId, false); if (null != queryList && queryList.Count > 0) { - string deviceName = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[2].Value.ToString(); - string deviceType = dataGridView_DevList.Rows[dataGridView_DevList.CurrentRow.Index].Cells[10].Value.ToString(); - + ExportDlg dlg = new ExportDlg(devId); dlg.label_devName.Text = deviceName; dlg.label_devType.Text = deviceType; @@ -611,7 +616,29 @@ } else { - MessageBox.Show("所选仪器无测试数据可导出!"); + CounterDataService counterDataService = new CounterDataServiceImpl(); + List query = counterDataService.getHistory(devId, "", ""); + if (null != query && query.Count > 0) + { + string strFilePath = ConfigHelper.GetAppConfig("exportPath") + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv"; + + StreamWriter strmWriterObj = new StreamWriter(strFilePath, false, System.Text.Encoding.UTF8); + strmWriterObj.WriteLine(deviceName + " - " + deviceType + "-" + "计数器范围及灵敏度"); + strmWriterObj.WriteLine("序号,输出值,测量值,灵敏度,时间"); + int index = 1; + foreach (CounterData counterData in query) + { + string strBufferLine = index + "," + counterData.OutValue + "," + counterData.Value + "," + counterData.Sensitivity + "," + counterData.LogTime; + strmWriterObj.WriteLine(strBufferLine); + index++; + } + strmWriterObj.Close(); + MessageBox.Show("导出成功,存放位置:" + strFilePath); + } + else + { + MessageBox.Show("所选仪器无测试数据可导出!"); + } } } catch (Exception ex) diff --git a/RbFreqStandMeasure/info/ReDetecDlg.cs b/RbFreqStandMeasure/info/ReDetecDlg.cs index 0225309..0af7776 100644 --- a/RbFreqStandMeasure/info/ReDetecDlg.cs +++ b/RbFreqStandMeasure/info/ReDetecDlg.cs @@ -36,6 +36,7 @@ public string detectType = ""; public long deviceId=-1; public long detectionItemId = -1; + public static string channelNoReDetec = ""; public Action HideMaskAction { @@ -96,11 +97,11 @@ string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); - string channelNo = text_channelNo.Text; + channelNoReDetec = text_channelNo.Text; // 打开串口 - SerialPort port = RbFreqStdMeas.portList[Convert.ToInt32(channelNo) - 1]; + SerialPort port = RbFreqStdMeas.portList[Convert.ToInt32(channelNoReDetec) - 1]; if (port.IsOpen) port.Close(); port.PortName = portName; port.BaudRate = band; @@ -115,20 +116,20 @@ port.Open(); if (!port.IsOpen) { - MessageBox.Show("无法打开通道"+channelNo+",检测失败!"); + MessageBox.Show("无法打开通道"+ channelNoReDetec + ",检测失败!"); return; } } catch (Exception exc) { - MessageBox.Show("无法打开通道" + channelNo + ",检测失败!"); + MessageBox.Show("无法打开通道" + channelNoReDetec + ",检测失败!"); return; } DetectionHelper detectionHelper = new DetectionHelper(); if (DetectionHelper.detectionHelper.getFrequencyData(port).Equals("")) { - MessageBox.Show("请连接仪器到通道[" + channelNo + "]!"); + MessageBox.Show("请连接仪器到通道[" + channelNoReDetec + "]!"); return; } diff --git a/RbFreqStandMeasure/info/accuracy.designer.cs b/RbFreqStandMeasure/info/accuracy.designer.cs index e33e95d..1e9da53 100644 --- a/RbFreqStandMeasure/info/accuracy.designer.cs +++ b/RbFreqStandMeasure/info/accuracy.designer.cs @@ -30,7 +30,7 @@ { this.label_accuracy = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_stand = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // @@ -58,18 +58,18 @@ this.label4.Text = "测量结果A:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_devModel + // label_stand // - this.label_devModel.BackColor = System.Drawing.Color.Transparent; - this.label_devModel.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; - this.label_devModel.Location = new System.Drawing.Point(183, 62); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(83, 27); - this.label_devModel.TabIndex = 98; - this.label_devModel.Text = "10MHz"; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_stand.BackColor = System.Drawing.Color.Transparent; + this.label_stand.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_stand.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_stand.Location = new System.Drawing.Point(183, 62); + this.label_stand.Margin = new System.Windows.Forms.Padding(0); + this.label_stand.Name = "label_stand"; + this.label_stand.Size = new System.Drawing.Size(83, 27); + this.label_stand.TabIndex = 98; + this.label_stand.Text = "10MHz"; + this.label_stand.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label9 // @@ -89,7 +89,7 @@ this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label_accuracy); this.Controls.Add(this.label4); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_stand); this.Controls.Add(this.label9); this.Name = "accuracy"; this.Size = new System.Drawing.Size(405, 229); @@ -99,7 +99,7 @@ #endregion private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label_devModel; + private System.Windows.Forms.Label label_stand; private System.Windows.Forms.Label label9; public System.Windows.Forms.Label label_accuracy; } diff --git a/RbFreqStandMeasure/info/bootFeature.cs b/RbFreqStandMeasure/info/bootFeature.cs index 2cec888..a75db54 100644 --- a/RbFreqStandMeasure/info/bootFeature.cs +++ b/RbFreqStandMeasure/info/bootFeature.cs @@ -4,18 +4,27 @@ using System.Windows.Forms; using System.Drawing.Drawing2D; using Casic.Birmm.RbFreqStandMeasure.Properties; +using System.Windows.Forms.DataVisualization.Charting; +using System.Data; namespace Casic.Birmm.RbFreqStandMeasure { public partial class bootFeature : UserControl { - public bootFeature() + public bootFeature(DataTable originData) { InitializeComponent(); - //设置背景颜色为透明 - this.BackColor = Color.Transparent; + + chart1.Series["Series1"].XValueMember = "时间"; + chart1.Series["Series1"].YValueMembers = "相对频率偏差"; + + //chart1.Series["Series1"].MarkerStyle = MarkerStyle.Circle; //线条上的数据点标志类型 + //chart1.Series["Series1"].MarkerSize = 3; //标志大小 + Series Series1 = new Series(); + chart1.Series.Add(Series1);//加入你的chart1 + chart1.DataSource = originData; } diff --git a/RbFreqStandMeasure/tools/DetectionHelper.cs b/RbFreqStandMeasure/tools/DetectionHelper.cs index e732f79..3f14f44 100644 --- a/RbFreqStandMeasure/tools/DetectionHelper.cs +++ b/RbFreqStandMeasure/tools/DetectionHelper.cs @@ -12,6 +12,7 @@ using System.Linq; using System.Reflection; using System.Text; +using System.Text.RegularExpressions; using System.Threading; using System.Windows.Forms; @@ -56,6 +57,9 @@ private DetectionService detectionService = new DetectionServiceImpl(); private DetectionItemService detectionItemService = new DetectionItemServiceImpl(); private DeviceService deviceService = new DeviceServiceImpl(); + private int count1s = 0; + private int count10s = 0; + private int count20s = 0; //1-STABILITY,2-ACCURACY,3-BOOT_FEATURE,4-AGE_RATE @@ -73,6 +77,9 @@ resultStability10 = new List(); resultStability20 = new List(); resultStability100 = new List(); + count1s = 0; + count10s = 0; + count20s = 0; if (isUpdates) { isUpdate = true; @@ -83,7 +90,7 @@ if (Convert.ToDateTime(startTime) > DateTime.Now) { TimeSpan secondSpan = new TimeSpan(Convert.ToDateTime(startTime).Ticks - DateTime.Now.Ticks); - delay = secondSpan.Milliseconds; + delay = (int)secondSpan.TotalMilliseconds; } string[] arr = interval.Split(','); @@ -110,15 +117,17 @@ if (!fre.Equals("") && resultStability1.Count<101) { resultStability1.Add(fre); - if (!isUpdate) detectionService.add(devIdStability, fre, "1-1"); + if (resultStability1.Count == 101) timerStability1.Dispose(); + if (!isUpdate && count1s < 101) + { + detectionService.add(devIdStability, fre, "1-1"); + count1s++; + } } if (!isUpdate) { if (resultStability1.Count == 101) - { - timerStability1.Dispose(); - - + { result = FreMath.Stable(resultStability1) + ""; resultStability1.Clear(); @@ -151,6 +160,7 @@ } else { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "重新检测稳定度1s"); if (resultStability1.Count == 101) { timerStability1.Dispose(); @@ -160,8 +170,8 @@ updateView(resultStability1); stability.label_result.Text = result1; - - resultStability1.Clear(); + DetailDlg.detailDlg.resultStaStr1 = result1; + resultStability1.Clear(); } } } @@ -187,7 +197,12 @@ if (!fre.Equals("") && resultStability10.Count < 101) { resultStability10.Add(fre); - if (!isUpdate) detectionService.add(devIdStability, fre, "1-10"); + if (resultStability10.Count == 101) timerStability10.Dispose(); + if (!isUpdate && count10s < 101) + { + detectionService.add(devIdStability, fre, "1-10"); + count10s++; + } } LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "稳定度10s fre=" + fre + ", devId =" + devIdStability); @@ -235,6 +250,7 @@ updateView(resultStability10); stability.label_result.Text = result1; + DetailDlg.detailDlg.resultStaStr10 = result1; } } } @@ -251,7 +267,11 @@ if (!fre.Equals("") && resultStability20.Count < 101) { resultStability20.Add(fre); - if (!isUpdate) detectionService.add(devIdStability, fre, "1-20"); + if (!isUpdate && count20s < 101) + { + detectionService.add(devIdStability, fre, "1-20"); + count20s++; + } } LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "稳定度20s fre=" + fre + ", devId =" + devIdStability); @@ -304,6 +324,7 @@ updateView(resultStability20); stability.label_result.Text = result1; + DetailDlg.detailDlg.resultStaStr20 = result1; resultStability20.Clear(); } @@ -371,6 +392,7 @@ updateView(resultStability100); stability.label_result.Text = result1; + DetailDlg.detailDlg.resultStaStr100 = result1; resultStability100.Clear(); } } @@ -379,8 +401,6 @@ #endregion - - #region 准确度 public void detecAccuracy(long deviceId, SerialPort port, string endTime, bool isStartNow, bool isUpdates) { @@ -396,8 +416,10 @@ if (Convert.ToDateTime(endTime)>=DateTime.Now) { TimeSpan secondSpan = new TimeSpan(Convert.ToDateTime(endTime).Ticks - DateTime.Now.Ticks); - delay = secondSpan.Milliseconds; + 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) @@ -411,11 +433,11 @@ double sum = 0.0; List resultList = new List(); - for (int i = 0; i < 50; i++) + for (int i = 0; i < 500; i++) { - string fre = getFrequencyData(portAccuracy); - resultList.Add(fre); + string fre = getFrequencyData(portAccuracy); if (fre.Equals("")) continue; + resultList.Add(fre); if (!isUpdate) { detectionService.add(devIdAccuracy, fre, "2"); @@ -425,8 +447,6 @@ sum = sum + Convert.ToDouble(fre); break; } - - Thread.Sleep(500); } result = Math.Abs(sum / 3) + ""; @@ -442,7 +462,15 @@ } if (!isUpdate) { - deviceService.updateStatus(devIdAccuracy, "3", ""); + DetectionItem detectionItem = detectionItemService.searchById(detectionItemId); + if (detectionItem != null) + { + if (!detectionItem.Stability.Equals("-1") && !detectionItem.Accuracy.Equals("-1") && !detectionItem.AgeRate.Equals("-1") && !detectionItem.BootFeature.Equals("-1")) + { + deviceService.updateStatus(devIdAccuracy, "3", ""); + portAccuracy.Close(); + } + } HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); } else @@ -450,9 +478,9 @@ LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "更新label_result:" + result); accuracy.label_result.Text = result; + DetailDlg.detailDlg.resultAccStr = result; updateView(resultList); - } - portAccuracy.Close(); + } } @@ -478,7 +506,7 @@ if (!isStartNow && Convert.ToDateTime(startTime) >= DateTime.Now) { TimeSpan secondSpan = new TimeSpan(Convert.ToDateTime(startTime).Ticks - DateTime.Now.Ticks); - delay = secondSpan.Milliseconds; + delay = (int)secondSpan.TotalMilliseconds; } timerBootFeature = new System.Threading.Timer(exeBootFeature, null, delay + 100, 60*60*1000); } @@ -549,7 +577,7 @@ if (!isStartNow && Convert.ToDateTime(startTime) > DateTime.Now) { TimeSpan secondSpan = new TimeSpan(Convert.ToDateTime(startTime).Ticks - DateTime.Now.Ticks); - delay = secondSpan.Milliseconds; + delay = (int)secondSpan.TotalMilliseconds; } timerAgeRate = new System.Threading.Timer(exeAgeRate, null, delay + 100, 12* 60* 60 * 1000); } @@ -622,7 +650,7 @@ if (ConfigHelper.GetAppConfig("deviceType").ToString().Equals("1")) { int count = 0; - while (count < 5000) + while (count < 600) { Thread.Sleep(100); int readLen = port.BytesToRead; @@ -631,18 +659,25 @@ byte[] buffer = new byte[readLen]; port.Read(buffer, 0, readLen);// 接收数据到buffer里面 string data = Encoding.ASCII.GetString(buffer); - string[] dataArray = data.Split(' '); - if (data.StartsWith("$") && dataArray.Length == 2 && data.LastIndexOf('$') == 0) + + if (data.StartsWith("$")) { - if (received.Contains("-")) + string[] dataArray = data.Split('$')[1].Split(' '); + if (dataArray.Length < 2) continue; + string s1 = dataArray[0].Replace("$", ""); + string s2 = "0." + dataArray[1].Replace(".", "").Replace("-", "").TrimEnd('0'); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, port.PortName + "s1=" + s1 + ";s2="+s2); + + if (dataArray[1].Contains("-")) { - received = (Convert.ToDouble(dataArray[0].Replace("$", "")) - Convert.ToDouble("0." + data.Split(' ')[1].Replace(".", "").Replace("-", "").TrimEnd('0'))) + ""; + received = (Convert.ToDouble(s1) - Convert.ToDouble(s2)) + ""; } - else received = dataArray[0].Replace("$", "") + "." + data.Split(' ')[1].Replace(".", "").TrimEnd('0'); - + else received = (Convert.ToDouble(s1) + Convert.ToDouble(s2)) + ""; + received = ((Convert.ToDouble(received) - 10000000) / 10000000) + ""; + break; + - break; } } count++; @@ -652,7 +687,7 @@ { int count = 0; - while (count < 5000) + while (count < 600) { Thread.Sleep(100); int readLen = port.BytesToRead; @@ -696,7 +731,7 @@ } catch (Exception ex) { - LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "错误:" + ex.Message); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "getFrequencyData错误:" + ex.Message); return ""; } finally @@ -709,9 +744,11 @@ private void updateView(List result) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始更新界面 length:"+ result.Count); + isUpdate = false; - new Thread(() => - { + //new Thread(() => + //{ int index = 0; LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "DetailDlg.dataGridView.Rows:" + DetailDlg.dataGridView.Rows); @@ -721,13 +758,16 @@ if (index < result.Count) { row.Cells[2].Value = result[index].ToString(); - detectionService.updateFrequency(Convert.ToInt64(row.Cells[3].Value), result[index].ToString()); + int re = detectionService.updateFrequency(Convert.ToInt64(row.Cells[3].Value), result[index].ToString()); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "updateFrequency re=" + re + ";id="+ row.Cells[3].Value + "; fre=" + result[index].ToString()); + } index++; } + DetailDlg.detailDlg.updateChannelNoRedetec(); DetailDlg.label_redetecting.Visible = false; - }).Start(); + //}).Start(); }