diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 77ac28c..fcb7086 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -29,11 +29,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -62,7 +62,7 @@ this.tab_accuracy = new System.Windows.Forms.TabPage(); this.tab_bootFeature = new System.Windows.Forms.TabPage(); this.tab_ageRate = new System.Windows.Forms.TabPage(); - this.tab_count = new System.Windows.Forms.TabPage(); + this.tab_counter = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridView_Data = new System.Windows.Forms.DataGridView(); this.panel1.SuspendLayout(); @@ -161,11 +161,11 @@ // this.label_customerComp.BackColor = System.Drawing.Color.Transparent; this.label_customerComp.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerComp.ForeColor = System.Drawing.Color.Gray; - this.label_customerComp.Location = new System.Drawing.Point(310, 64); + this.label_customerComp.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerComp.Location = new System.Drawing.Point(305, 64); this.label_customerComp.Margin = new System.Windows.Forms.Padding(0); this.label_customerComp.Name = "label_customerComp"; - this.label_customerComp.Size = new System.Drawing.Size(120, 27); + this.label_customerComp.Size = new System.Drawing.Size(112, 27); this.label_customerComp.TabIndex = 80; this.label_customerComp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -173,11 +173,11 @@ // this.label_devCode.BackColor = System.Drawing.Color.Transparent; this.label_devCode.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devCode.ForeColor = System.Drawing.Color.Gray; - this.label_devCode.Location = new System.Drawing.Point(310, 30); + this.label_devCode.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_devCode.Location = new System.Drawing.Point(305, 30); this.label_devCode.Margin = new System.Windows.Forms.Padding(0); this.label_devCode.Name = "label_devCode"; - this.label_devCode.Size = new System.Drawing.Size(120, 27); + this.label_devCode.Size = new System.Drawing.Size(115, 27); this.label_devCode.TabIndex = 79; this.label_devCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -185,11 +185,11 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.Color.Gray; + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; this.label_customerName.Location = new System.Drawing.Point(98, 62); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); + this.label_customerName.Size = new System.Drawing.Size(127, 27); this.label_customerName.TabIndex = 76; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -197,11 +197,11 @@ // 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.Color.Gray; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(98, 30); 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.Size = new System.Drawing.Size(127, 27); this.label_devModel.TabIndex = 75; this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -223,7 +223,7 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label1.Location = new System.Drawing.Point(225, 64); + this.label1.Location = new System.Drawing.Point(221, 64); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(85, 27); @@ -249,7 +249,7 @@ this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label8.Location = new System.Drawing.Point(229, 30); + this.label8.Location = new System.Drawing.Point(224, 30); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(81, 27); @@ -316,14 +316,14 @@ this.dataGridView_times.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_times.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_times.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dataGridView_times.ColumnHeadersHeight = 28; this.dataGridView_times.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_times.GridColor = System.Drawing.Color.White; @@ -331,13 +331,13 @@ this.dataGridView_times.Name = "dataGridView_times"; this.dataGridView_times.RowHeadersVisible = false; this.dataGridView_times.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle12; this.dataGridView_times.RowTemplate.Height = 23; this.dataGridView_times.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView_times.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -366,7 +366,7 @@ this.tabControl1.Controls.Add(this.tab_accuracy); this.tabControl1.Controls.Add(this.tab_bootFeature); this.tabControl1.Controls.Add(this.tab_ageRate); - this.tabControl1.Controls.Add(this.tab_count); + this.tabControl1.Controls.Add(this.tab_counter); this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabControl1.HotTrack = true; this.tabControl1.Location = new System.Drawing.Point(0, 460); @@ -419,15 +419,15 @@ this.tab_ageRate.Text = "日老化率"; this.tab_ageRate.UseVisualStyleBackColor = true; // - // tab_count + // tab_counter // - this.tab_count.Location = new System.Drawing.Point(4, 4); - this.tab_count.Name = "tab_count"; - this.tab_count.Padding = new System.Windows.Forms.Padding(3); - this.tab_count.Size = new System.Drawing.Size(433, 19); - this.tab_count.TabIndex = 4; - this.tab_count.Text = "计数器范围及灵敏度"; - this.tab_count.UseVisualStyleBackColor = true; + this.tab_counter.Location = new System.Drawing.Point(4, 4); + this.tab_counter.Name = "tab_counter"; + this.tab_counter.Padding = new System.Windows.Forms.Padding(3); + this.tab_counter.Size = new System.Drawing.Size(433, 19); + this.tab_counter.TabIndex = 4; + this.tab_counter.Text = "计数器范围及灵敏度"; + this.tab_counter.UseVisualStyleBackColor = true; // // groupBox1 // @@ -449,27 +449,27 @@ this.dataGridView_Data.AllowUserToDeleteRows = false; this.dataGridView_Data.AllowUserToResizeColumns = false; this.dataGridView_Data.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridView_Data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView_Data.BackgroundColor = System.Drawing.Color.White; this.dataGridView_Data.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_Data.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_Data.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dataGridView_Data.ColumnHeadersHeight = 28; this.dataGridView_Data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_Data.GridColor = System.Drawing.Color.White; @@ -479,15 +479,15 @@ this.dataGridView_Data.ReadOnly = true; this.dataGridView_Data.RowHeadersVisible = false; this.dataGridView_Data.RowHeadersWidth = 30; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.NullValue = "-"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.NullValue = "-"; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView_Data.RowTemplate.Height = 26; this.dataGridView_Data.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_Data.Size = new System.Drawing.Size(431, 447); @@ -551,7 +551,7 @@ private System.Windows.Forms.TabPage tab_accuracy; private System.Windows.Forms.TabPage tab_bootFeature; private System.Windows.Forms.TabPage tab_ageRate; - private System.Windows.Forms.TabPage tab_count; + private System.Windows.Forms.TabPage tab_counter; private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 77ac28c..fcb7086 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -29,11 +29,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -62,7 +62,7 @@ this.tab_accuracy = new System.Windows.Forms.TabPage(); this.tab_bootFeature = new System.Windows.Forms.TabPage(); this.tab_ageRate = new System.Windows.Forms.TabPage(); - this.tab_count = new System.Windows.Forms.TabPage(); + this.tab_counter = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridView_Data = new System.Windows.Forms.DataGridView(); this.panel1.SuspendLayout(); @@ -161,11 +161,11 @@ // this.label_customerComp.BackColor = System.Drawing.Color.Transparent; this.label_customerComp.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerComp.ForeColor = System.Drawing.Color.Gray; - this.label_customerComp.Location = new System.Drawing.Point(310, 64); + this.label_customerComp.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerComp.Location = new System.Drawing.Point(305, 64); this.label_customerComp.Margin = new System.Windows.Forms.Padding(0); this.label_customerComp.Name = "label_customerComp"; - this.label_customerComp.Size = new System.Drawing.Size(120, 27); + this.label_customerComp.Size = new System.Drawing.Size(112, 27); this.label_customerComp.TabIndex = 80; this.label_customerComp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -173,11 +173,11 @@ // this.label_devCode.BackColor = System.Drawing.Color.Transparent; this.label_devCode.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devCode.ForeColor = System.Drawing.Color.Gray; - this.label_devCode.Location = new System.Drawing.Point(310, 30); + this.label_devCode.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_devCode.Location = new System.Drawing.Point(305, 30); this.label_devCode.Margin = new System.Windows.Forms.Padding(0); this.label_devCode.Name = "label_devCode"; - this.label_devCode.Size = new System.Drawing.Size(120, 27); + this.label_devCode.Size = new System.Drawing.Size(115, 27); this.label_devCode.TabIndex = 79; this.label_devCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -185,11 +185,11 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.Color.Gray; + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; this.label_customerName.Location = new System.Drawing.Point(98, 62); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); + this.label_customerName.Size = new System.Drawing.Size(127, 27); this.label_customerName.TabIndex = 76; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -197,11 +197,11 @@ // 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.Color.Gray; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(98, 30); 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.Size = new System.Drawing.Size(127, 27); this.label_devModel.TabIndex = 75; this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -223,7 +223,7 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label1.Location = new System.Drawing.Point(225, 64); + this.label1.Location = new System.Drawing.Point(221, 64); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(85, 27); @@ -249,7 +249,7 @@ this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label8.Location = new System.Drawing.Point(229, 30); + this.label8.Location = new System.Drawing.Point(224, 30); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(81, 27); @@ -316,14 +316,14 @@ this.dataGridView_times.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_times.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_times.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dataGridView_times.ColumnHeadersHeight = 28; this.dataGridView_times.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_times.GridColor = System.Drawing.Color.White; @@ -331,13 +331,13 @@ this.dataGridView_times.Name = "dataGridView_times"; this.dataGridView_times.RowHeadersVisible = false; this.dataGridView_times.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle12; this.dataGridView_times.RowTemplate.Height = 23; this.dataGridView_times.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView_times.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -366,7 +366,7 @@ this.tabControl1.Controls.Add(this.tab_accuracy); this.tabControl1.Controls.Add(this.tab_bootFeature); this.tabControl1.Controls.Add(this.tab_ageRate); - this.tabControl1.Controls.Add(this.tab_count); + this.tabControl1.Controls.Add(this.tab_counter); this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabControl1.HotTrack = true; this.tabControl1.Location = new System.Drawing.Point(0, 460); @@ -419,15 +419,15 @@ this.tab_ageRate.Text = "日老化率"; this.tab_ageRate.UseVisualStyleBackColor = true; // - // tab_count + // tab_counter // - this.tab_count.Location = new System.Drawing.Point(4, 4); - this.tab_count.Name = "tab_count"; - this.tab_count.Padding = new System.Windows.Forms.Padding(3); - this.tab_count.Size = new System.Drawing.Size(433, 19); - this.tab_count.TabIndex = 4; - this.tab_count.Text = "计数器范围及灵敏度"; - this.tab_count.UseVisualStyleBackColor = true; + this.tab_counter.Location = new System.Drawing.Point(4, 4); + this.tab_counter.Name = "tab_counter"; + this.tab_counter.Padding = new System.Windows.Forms.Padding(3); + this.tab_counter.Size = new System.Drawing.Size(433, 19); + this.tab_counter.TabIndex = 4; + this.tab_counter.Text = "计数器范围及灵敏度"; + this.tab_counter.UseVisualStyleBackColor = true; // // groupBox1 // @@ -449,27 +449,27 @@ this.dataGridView_Data.AllowUserToDeleteRows = false; this.dataGridView_Data.AllowUserToResizeColumns = false; this.dataGridView_Data.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridView_Data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView_Data.BackgroundColor = System.Drawing.Color.White; this.dataGridView_Data.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_Data.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_Data.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dataGridView_Data.ColumnHeadersHeight = 28; this.dataGridView_Data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_Data.GridColor = System.Drawing.Color.White; @@ -479,15 +479,15 @@ this.dataGridView_Data.ReadOnly = true; this.dataGridView_Data.RowHeadersVisible = false; this.dataGridView_Data.RowHeadersWidth = 30; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.NullValue = "-"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.NullValue = "-"; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView_Data.RowTemplate.Height = 26; this.dataGridView_Data.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_Data.Size = new System.Drawing.Size(431, 447); @@ -551,7 +551,7 @@ private System.Windows.Forms.TabPage tab_accuracy; private System.Windows.Forms.TabPage tab_bootFeature; private System.Windows.Forms.TabPage tab_ageRate; - private System.Windows.Forms.TabPage tab_count; + private System.Windows.Forms.TabPage tab_counter; private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index 179389d..caabb86 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -47,9 +47,12 @@ DataTable tableTimes = new DataTable(); DetectionService detectionService = new DetectionServiceImpl(); DetectionItemService detectionItemService = new DetectionItemServiceImpl(); + CounterDataService counterDataService = new CounterDataServiceImpl(); + long deviceId = -1; string startTime = ""; string endTime = ""; + string resultStr = ""; public Action HideMaskAction { @@ -68,10 +71,9 @@ { startTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[0].Cells[3].Value.ToString(); LoadData(deviceId, "1", startTime, endTime); - stability result = new stability(); - result.Show(); - panel_result.Controls.Add(result); + tabPageEvent("tab_stability"); } } @@ -128,6 +130,56 @@ } } + private void LoadData_Counter(long deviceId) + { + tableOriginData = new DataTable(); + + // 设置表格的列 + 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")); + + + // 获取当前页的数据 + List queryList = counterDataService.getList(deviceId, "", "", ""); + if (null != queryList && queryList.Count > 0) + { + int index = 1; + foreach (CounterData counterData in queryList) + { + tableOriginData.Rows.Add(index, counterData.OutValue, counterData.Value, counterData.Sensitivity,counterData.LogTime); + index++; + } + + label_noData.Visible = false; + dataGridView_Data.DataSource = tableOriginData; + + // width=425px + dataGridView_Data.Columns[0].Width = 50; + dataGridView_Data.Columns[1].Width = 100; + dataGridView_Data.Columns[2].Width = 100; + dataGridView_Data.Columns[3].Width = 100; + dataGridView_Data.Columns[4].Width = 120; + + dataGridView_Data.Columns[0].ReadOnly = true; + dataGridView_Data.Columns[1].ReadOnly = true; + dataGridView_Data.Columns[2].ReadOnly = true; + + dataGridView_Data.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; + } + else + { + dataGridView_Data.DataSource = null; + label_noData.Visible = true; + } + } + + + // 检测记录列表 private void LoadTimes(long deviceId) { @@ -140,6 +192,7 @@ tableTimes.Columns.Add("序号", Type.GetType("System.String")); tableTimes.Columns.Add("开始时间", Type.GetType("System.String")); tableTimes.Columns.Add("结束时间", Type.GetType("System.String")); + tableTimes.Columns.Add("result", Type.GetType("System.String")); // 获取当前页的数据 List queryList = detectionItemService.search(deviceId, false); @@ -154,13 +207,15 @@ } label_noTimes.Visible = false; - dataGridView_times.DataSource = tableTimes; + + // width=407px dataGridView_times.Columns[0].Width = 47; dataGridView_times.Columns[1].Width = 180; dataGridView_times.Columns[2].Width = 180; + dataGridView_times.Columns[3].Visible = false; dataGridView_times.Columns[0].ReadOnly = true; @@ -191,6 +246,8 @@ int rowIndex = e.RowIndex; startTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[rowIndex].Cells[3].Value.ToString(); + tabPageEvent(tabControl1.SelectedTab.Name); } @@ -204,6 +261,7 @@ LoadData(deviceId, "1", startTime, endTime); groupBox3.Text = "频率稳定度"; stability result = new stability(); + result.label_stability.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -213,6 +271,7 @@ LoadData(deviceId, "2", startTime, endTime); groupBox3.Text = "频率准确度"; accuracy result = new accuracy(); + result.label_accuracy.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -222,6 +281,7 @@ LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; bootFeature result = new bootFeature(); + result.label_bootFeature.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -231,10 +291,23 @@ LoadData(deviceId, "4", startTime, endTime); groupBox3.Text = "日老化率"; ageRate result = new ageRate(tableOriginData); + if (resultStr.Split(',').Length > 1) + { + result.label_k.Text = resultStr.Split(',')[0]; + result.label_r.Text = resultStr.Split(',')[1]; + } result.Show(); panel_result.Controls.Add(result); break; } + case "tab_counter": + { + LoadData_Counter(deviceId); + groupBox3.Text = "计数器范围及灵敏度"; + //ageRate result = new ageRate(tableOriginData); + //result.Show(); + break; + } default: break; } diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 77ac28c..fcb7086 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -29,11 +29,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -62,7 +62,7 @@ this.tab_accuracy = new System.Windows.Forms.TabPage(); this.tab_bootFeature = new System.Windows.Forms.TabPage(); this.tab_ageRate = new System.Windows.Forms.TabPage(); - this.tab_count = new System.Windows.Forms.TabPage(); + this.tab_counter = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridView_Data = new System.Windows.Forms.DataGridView(); this.panel1.SuspendLayout(); @@ -161,11 +161,11 @@ // this.label_customerComp.BackColor = System.Drawing.Color.Transparent; this.label_customerComp.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerComp.ForeColor = System.Drawing.Color.Gray; - this.label_customerComp.Location = new System.Drawing.Point(310, 64); + this.label_customerComp.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerComp.Location = new System.Drawing.Point(305, 64); this.label_customerComp.Margin = new System.Windows.Forms.Padding(0); this.label_customerComp.Name = "label_customerComp"; - this.label_customerComp.Size = new System.Drawing.Size(120, 27); + this.label_customerComp.Size = new System.Drawing.Size(112, 27); this.label_customerComp.TabIndex = 80; this.label_customerComp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -173,11 +173,11 @@ // this.label_devCode.BackColor = System.Drawing.Color.Transparent; this.label_devCode.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devCode.ForeColor = System.Drawing.Color.Gray; - this.label_devCode.Location = new System.Drawing.Point(310, 30); + this.label_devCode.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_devCode.Location = new System.Drawing.Point(305, 30); this.label_devCode.Margin = new System.Windows.Forms.Padding(0); this.label_devCode.Name = "label_devCode"; - this.label_devCode.Size = new System.Drawing.Size(120, 27); + this.label_devCode.Size = new System.Drawing.Size(115, 27); this.label_devCode.TabIndex = 79; this.label_devCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -185,11 +185,11 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.Color.Gray; + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; this.label_customerName.Location = new System.Drawing.Point(98, 62); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); + this.label_customerName.Size = new System.Drawing.Size(127, 27); this.label_customerName.TabIndex = 76; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -197,11 +197,11 @@ // 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.Color.Gray; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(98, 30); 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.Size = new System.Drawing.Size(127, 27); this.label_devModel.TabIndex = 75; this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -223,7 +223,7 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label1.Location = new System.Drawing.Point(225, 64); + this.label1.Location = new System.Drawing.Point(221, 64); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(85, 27); @@ -249,7 +249,7 @@ this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label8.Location = new System.Drawing.Point(229, 30); + this.label8.Location = new System.Drawing.Point(224, 30); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(81, 27); @@ -316,14 +316,14 @@ this.dataGridView_times.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_times.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_times.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dataGridView_times.ColumnHeadersHeight = 28; this.dataGridView_times.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_times.GridColor = System.Drawing.Color.White; @@ -331,13 +331,13 @@ this.dataGridView_times.Name = "dataGridView_times"; this.dataGridView_times.RowHeadersVisible = false; this.dataGridView_times.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle12; this.dataGridView_times.RowTemplate.Height = 23; this.dataGridView_times.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView_times.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -366,7 +366,7 @@ this.tabControl1.Controls.Add(this.tab_accuracy); this.tabControl1.Controls.Add(this.tab_bootFeature); this.tabControl1.Controls.Add(this.tab_ageRate); - this.tabControl1.Controls.Add(this.tab_count); + this.tabControl1.Controls.Add(this.tab_counter); this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabControl1.HotTrack = true; this.tabControl1.Location = new System.Drawing.Point(0, 460); @@ -419,15 +419,15 @@ this.tab_ageRate.Text = "日老化率"; this.tab_ageRate.UseVisualStyleBackColor = true; // - // tab_count + // tab_counter // - this.tab_count.Location = new System.Drawing.Point(4, 4); - this.tab_count.Name = "tab_count"; - this.tab_count.Padding = new System.Windows.Forms.Padding(3); - this.tab_count.Size = new System.Drawing.Size(433, 19); - this.tab_count.TabIndex = 4; - this.tab_count.Text = "计数器范围及灵敏度"; - this.tab_count.UseVisualStyleBackColor = true; + this.tab_counter.Location = new System.Drawing.Point(4, 4); + this.tab_counter.Name = "tab_counter"; + this.tab_counter.Padding = new System.Windows.Forms.Padding(3); + this.tab_counter.Size = new System.Drawing.Size(433, 19); + this.tab_counter.TabIndex = 4; + this.tab_counter.Text = "计数器范围及灵敏度"; + this.tab_counter.UseVisualStyleBackColor = true; // // groupBox1 // @@ -449,27 +449,27 @@ this.dataGridView_Data.AllowUserToDeleteRows = false; this.dataGridView_Data.AllowUserToResizeColumns = false; this.dataGridView_Data.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridView_Data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView_Data.BackgroundColor = System.Drawing.Color.White; this.dataGridView_Data.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_Data.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_Data.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dataGridView_Data.ColumnHeadersHeight = 28; this.dataGridView_Data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_Data.GridColor = System.Drawing.Color.White; @@ -479,15 +479,15 @@ this.dataGridView_Data.ReadOnly = true; this.dataGridView_Data.RowHeadersVisible = false; this.dataGridView_Data.RowHeadersWidth = 30; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.NullValue = "-"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.NullValue = "-"; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView_Data.RowTemplate.Height = 26; this.dataGridView_Data.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_Data.Size = new System.Drawing.Size(431, 447); @@ -551,7 +551,7 @@ private System.Windows.Forms.TabPage tab_accuracy; private System.Windows.Forms.TabPage tab_bootFeature; private System.Windows.Forms.TabPage tab_ageRate; - private System.Windows.Forms.TabPage tab_count; + private System.Windows.Forms.TabPage tab_counter; private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index 179389d..caabb86 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -47,9 +47,12 @@ DataTable tableTimes = new DataTable(); DetectionService detectionService = new DetectionServiceImpl(); DetectionItemService detectionItemService = new DetectionItemServiceImpl(); + CounterDataService counterDataService = new CounterDataServiceImpl(); + long deviceId = -1; string startTime = ""; string endTime = ""; + string resultStr = ""; public Action HideMaskAction { @@ -68,10 +71,9 @@ { startTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[0].Cells[3].Value.ToString(); LoadData(deviceId, "1", startTime, endTime); - stability result = new stability(); - result.Show(); - panel_result.Controls.Add(result); + tabPageEvent("tab_stability"); } } @@ -128,6 +130,56 @@ } } + private void LoadData_Counter(long deviceId) + { + tableOriginData = new DataTable(); + + // 设置表格的列 + 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")); + + + // 获取当前页的数据 + List queryList = counterDataService.getList(deviceId, "", "", ""); + if (null != queryList && queryList.Count > 0) + { + int index = 1; + foreach (CounterData counterData in queryList) + { + tableOriginData.Rows.Add(index, counterData.OutValue, counterData.Value, counterData.Sensitivity,counterData.LogTime); + index++; + } + + label_noData.Visible = false; + dataGridView_Data.DataSource = tableOriginData; + + // width=425px + dataGridView_Data.Columns[0].Width = 50; + dataGridView_Data.Columns[1].Width = 100; + dataGridView_Data.Columns[2].Width = 100; + dataGridView_Data.Columns[3].Width = 100; + dataGridView_Data.Columns[4].Width = 120; + + dataGridView_Data.Columns[0].ReadOnly = true; + dataGridView_Data.Columns[1].ReadOnly = true; + dataGridView_Data.Columns[2].ReadOnly = true; + + dataGridView_Data.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; + } + else + { + dataGridView_Data.DataSource = null; + label_noData.Visible = true; + } + } + + + // 检测记录列表 private void LoadTimes(long deviceId) { @@ -140,6 +192,7 @@ tableTimes.Columns.Add("序号", Type.GetType("System.String")); tableTimes.Columns.Add("开始时间", Type.GetType("System.String")); tableTimes.Columns.Add("结束时间", Type.GetType("System.String")); + tableTimes.Columns.Add("result", Type.GetType("System.String")); // 获取当前页的数据 List queryList = detectionItemService.search(deviceId, false); @@ -154,13 +207,15 @@ } label_noTimes.Visible = false; - dataGridView_times.DataSource = tableTimes; + + // width=407px dataGridView_times.Columns[0].Width = 47; dataGridView_times.Columns[1].Width = 180; dataGridView_times.Columns[2].Width = 180; + dataGridView_times.Columns[3].Visible = false; dataGridView_times.Columns[0].ReadOnly = true; @@ -191,6 +246,8 @@ int rowIndex = e.RowIndex; startTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[rowIndex].Cells[3].Value.ToString(); + tabPageEvent(tabControl1.SelectedTab.Name); } @@ -204,6 +261,7 @@ LoadData(deviceId, "1", startTime, endTime); groupBox3.Text = "频率稳定度"; stability result = new stability(); + result.label_stability.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -213,6 +271,7 @@ LoadData(deviceId, "2", startTime, endTime); groupBox3.Text = "频率准确度"; accuracy result = new accuracy(); + result.label_accuracy.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -222,6 +281,7 @@ LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; bootFeature result = new bootFeature(); + result.label_bootFeature.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -231,10 +291,23 @@ LoadData(deviceId, "4", startTime, endTime); groupBox3.Text = "日老化率"; ageRate result = new ageRate(tableOriginData); + if (resultStr.Split(',').Length > 1) + { + result.label_k.Text = resultStr.Split(',')[0]; + result.label_r.Text = resultStr.Split(',')[1]; + } result.Show(); panel_result.Controls.Add(result); break; } + case "tab_counter": + { + LoadData_Counter(deviceId); + groupBox3.Text = "计数器范围及灵敏度"; + //ageRate result = new ageRate(tableOriginData); + //result.Show(); + break; + } default: break; } diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 7c1cfbc..2b0ab6e 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -362,10 +362,10 @@ addDevDlg.StartPosition = FormStartPosition.CenterParent; // 指定窗口弹出在父窗口的中间位置 // 设置默认值 - DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("startTime", true)[0]; + DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("picker_startTime", true)[0]; startTimeInput.Value = DateTime.Now; - DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("endTime", true)[0]; + DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("picker_endTime", true)[0]; endTimeInput.Value = DateTime.Now.AddDays(1); addDevDlg.ShowDialog(); @@ -491,6 +491,7 @@ string devCode = (string)dataGridView_DevList.Rows[rowIndex].Cells[4].Value; AddDevDlg editDlg = new AddDevDlg(); + editDlg.deviceId = Convert.ToInt64(dataGridView_DevList.Rows[rowIndex].Cells[9].Value); editDlg.Controls.Find("labelTitle", true)[0].Text = "修改"; editDlg.Controls.Find("inputDevName", true)[0].Text = devName; editDlg.Controls.Find("inputDevModel", true)[0].Text = devModel; @@ -502,6 +503,7 @@ editDlg.btnSave.Text = "保存"; if (((string)dataGridView_DevList.Rows[rowIndex].Cells[7].Value).Equals("检测中")) { + editDlg.isInDetection = true; DetectionItemService detectionItemService = new DetectionItemServiceImpl(); DetectionItem detectionItem = (detectionItemService.search(id, true))[0]; editDlg.groupBox1.Enabled = false; diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 77ac28c..fcb7086 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -29,11 +29,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -62,7 +62,7 @@ this.tab_accuracy = new System.Windows.Forms.TabPage(); this.tab_bootFeature = new System.Windows.Forms.TabPage(); this.tab_ageRate = new System.Windows.Forms.TabPage(); - this.tab_count = new System.Windows.Forms.TabPage(); + this.tab_counter = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridView_Data = new System.Windows.Forms.DataGridView(); this.panel1.SuspendLayout(); @@ -161,11 +161,11 @@ // this.label_customerComp.BackColor = System.Drawing.Color.Transparent; this.label_customerComp.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerComp.ForeColor = System.Drawing.Color.Gray; - this.label_customerComp.Location = new System.Drawing.Point(310, 64); + this.label_customerComp.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerComp.Location = new System.Drawing.Point(305, 64); this.label_customerComp.Margin = new System.Windows.Forms.Padding(0); this.label_customerComp.Name = "label_customerComp"; - this.label_customerComp.Size = new System.Drawing.Size(120, 27); + this.label_customerComp.Size = new System.Drawing.Size(112, 27); this.label_customerComp.TabIndex = 80; this.label_customerComp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -173,11 +173,11 @@ // this.label_devCode.BackColor = System.Drawing.Color.Transparent; this.label_devCode.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devCode.ForeColor = System.Drawing.Color.Gray; - this.label_devCode.Location = new System.Drawing.Point(310, 30); + this.label_devCode.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_devCode.Location = new System.Drawing.Point(305, 30); this.label_devCode.Margin = new System.Windows.Forms.Padding(0); this.label_devCode.Name = "label_devCode"; - this.label_devCode.Size = new System.Drawing.Size(120, 27); + this.label_devCode.Size = new System.Drawing.Size(115, 27); this.label_devCode.TabIndex = 79; this.label_devCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -185,11 +185,11 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.Color.Gray; + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; this.label_customerName.Location = new System.Drawing.Point(98, 62); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); + this.label_customerName.Size = new System.Drawing.Size(127, 27); this.label_customerName.TabIndex = 76; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -197,11 +197,11 @@ // 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.Color.Gray; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(98, 30); 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.Size = new System.Drawing.Size(127, 27); this.label_devModel.TabIndex = 75; this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -223,7 +223,7 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label1.Location = new System.Drawing.Point(225, 64); + this.label1.Location = new System.Drawing.Point(221, 64); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(85, 27); @@ -249,7 +249,7 @@ this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label8.Location = new System.Drawing.Point(229, 30); + this.label8.Location = new System.Drawing.Point(224, 30); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(81, 27); @@ -316,14 +316,14 @@ this.dataGridView_times.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_times.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_times.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dataGridView_times.ColumnHeadersHeight = 28; this.dataGridView_times.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_times.GridColor = System.Drawing.Color.White; @@ -331,13 +331,13 @@ this.dataGridView_times.Name = "dataGridView_times"; this.dataGridView_times.RowHeadersVisible = false; this.dataGridView_times.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle12; this.dataGridView_times.RowTemplate.Height = 23; this.dataGridView_times.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView_times.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -366,7 +366,7 @@ this.tabControl1.Controls.Add(this.tab_accuracy); this.tabControl1.Controls.Add(this.tab_bootFeature); this.tabControl1.Controls.Add(this.tab_ageRate); - this.tabControl1.Controls.Add(this.tab_count); + this.tabControl1.Controls.Add(this.tab_counter); this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabControl1.HotTrack = true; this.tabControl1.Location = new System.Drawing.Point(0, 460); @@ -419,15 +419,15 @@ this.tab_ageRate.Text = "日老化率"; this.tab_ageRate.UseVisualStyleBackColor = true; // - // tab_count + // tab_counter // - this.tab_count.Location = new System.Drawing.Point(4, 4); - this.tab_count.Name = "tab_count"; - this.tab_count.Padding = new System.Windows.Forms.Padding(3); - this.tab_count.Size = new System.Drawing.Size(433, 19); - this.tab_count.TabIndex = 4; - this.tab_count.Text = "计数器范围及灵敏度"; - this.tab_count.UseVisualStyleBackColor = true; + this.tab_counter.Location = new System.Drawing.Point(4, 4); + this.tab_counter.Name = "tab_counter"; + this.tab_counter.Padding = new System.Windows.Forms.Padding(3); + this.tab_counter.Size = new System.Drawing.Size(433, 19); + this.tab_counter.TabIndex = 4; + this.tab_counter.Text = "计数器范围及灵敏度"; + this.tab_counter.UseVisualStyleBackColor = true; // // groupBox1 // @@ -449,27 +449,27 @@ this.dataGridView_Data.AllowUserToDeleteRows = false; this.dataGridView_Data.AllowUserToResizeColumns = false; this.dataGridView_Data.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridView_Data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView_Data.BackgroundColor = System.Drawing.Color.White; this.dataGridView_Data.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_Data.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_Data.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dataGridView_Data.ColumnHeadersHeight = 28; this.dataGridView_Data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_Data.GridColor = System.Drawing.Color.White; @@ -479,15 +479,15 @@ this.dataGridView_Data.ReadOnly = true; this.dataGridView_Data.RowHeadersVisible = false; this.dataGridView_Data.RowHeadersWidth = 30; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.NullValue = "-"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.NullValue = "-"; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView_Data.RowTemplate.Height = 26; this.dataGridView_Data.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_Data.Size = new System.Drawing.Size(431, 447); @@ -551,7 +551,7 @@ private System.Windows.Forms.TabPage tab_accuracy; private System.Windows.Forms.TabPage tab_bootFeature; private System.Windows.Forms.TabPage tab_ageRate; - private System.Windows.Forms.TabPage tab_count; + private System.Windows.Forms.TabPage tab_counter; private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index 179389d..caabb86 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -47,9 +47,12 @@ DataTable tableTimes = new DataTable(); DetectionService detectionService = new DetectionServiceImpl(); DetectionItemService detectionItemService = new DetectionItemServiceImpl(); + CounterDataService counterDataService = new CounterDataServiceImpl(); + long deviceId = -1; string startTime = ""; string endTime = ""; + string resultStr = ""; public Action HideMaskAction { @@ -68,10 +71,9 @@ { startTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[0].Cells[3].Value.ToString(); LoadData(deviceId, "1", startTime, endTime); - stability result = new stability(); - result.Show(); - panel_result.Controls.Add(result); + tabPageEvent("tab_stability"); } } @@ -128,6 +130,56 @@ } } + private void LoadData_Counter(long deviceId) + { + tableOriginData = new DataTable(); + + // 设置表格的列 + 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")); + + + // 获取当前页的数据 + List queryList = counterDataService.getList(deviceId, "", "", ""); + if (null != queryList && queryList.Count > 0) + { + int index = 1; + foreach (CounterData counterData in queryList) + { + tableOriginData.Rows.Add(index, counterData.OutValue, counterData.Value, counterData.Sensitivity,counterData.LogTime); + index++; + } + + label_noData.Visible = false; + dataGridView_Data.DataSource = tableOriginData; + + // width=425px + dataGridView_Data.Columns[0].Width = 50; + dataGridView_Data.Columns[1].Width = 100; + dataGridView_Data.Columns[2].Width = 100; + dataGridView_Data.Columns[3].Width = 100; + dataGridView_Data.Columns[4].Width = 120; + + dataGridView_Data.Columns[0].ReadOnly = true; + dataGridView_Data.Columns[1].ReadOnly = true; + dataGridView_Data.Columns[2].ReadOnly = true; + + dataGridView_Data.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; + } + else + { + dataGridView_Data.DataSource = null; + label_noData.Visible = true; + } + } + + + // 检测记录列表 private void LoadTimes(long deviceId) { @@ -140,6 +192,7 @@ tableTimes.Columns.Add("序号", Type.GetType("System.String")); tableTimes.Columns.Add("开始时间", Type.GetType("System.String")); tableTimes.Columns.Add("结束时间", Type.GetType("System.String")); + tableTimes.Columns.Add("result", Type.GetType("System.String")); // 获取当前页的数据 List queryList = detectionItemService.search(deviceId, false); @@ -154,13 +207,15 @@ } label_noTimes.Visible = false; - dataGridView_times.DataSource = tableTimes; + + // width=407px dataGridView_times.Columns[0].Width = 47; dataGridView_times.Columns[1].Width = 180; dataGridView_times.Columns[2].Width = 180; + dataGridView_times.Columns[3].Visible = false; dataGridView_times.Columns[0].ReadOnly = true; @@ -191,6 +246,8 @@ int rowIndex = e.RowIndex; startTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[rowIndex].Cells[3].Value.ToString(); + tabPageEvent(tabControl1.SelectedTab.Name); } @@ -204,6 +261,7 @@ LoadData(deviceId, "1", startTime, endTime); groupBox3.Text = "频率稳定度"; stability result = new stability(); + result.label_stability.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -213,6 +271,7 @@ LoadData(deviceId, "2", startTime, endTime); groupBox3.Text = "频率准确度"; accuracy result = new accuracy(); + result.label_accuracy.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -222,6 +281,7 @@ LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; bootFeature result = new bootFeature(); + result.label_bootFeature.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -231,10 +291,23 @@ LoadData(deviceId, "4", startTime, endTime); groupBox3.Text = "日老化率"; ageRate result = new ageRate(tableOriginData); + if (resultStr.Split(',').Length > 1) + { + result.label_k.Text = resultStr.Split(',')[0]; + result.label_r.Text = resultStr.Split(',')[1]; + } result.Show(); panel_result.Controls.Add(result); break; } + case "tab_counter": + { + LoadData_Counter(deviceId); + groupBox3.Text = "计数器范围及灵敏度"; + //ageRate result = new ageRate(tableOriginData); + //result.Show(); + break; + } default: break; } diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 7c1cfbc..2b0ab6e 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -362,10 +362,10 @@ addDevDlg.StartPosition = FormStartPosition.CenterParent; // 指定窗口弹出在父窗口的中间位置 // 设置默认值 - DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("startTime", true)[0]; + DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("picker_startTime", true)[0]; startTimeInput.Value = DateTime.Now; - DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("endTime", true)[0]; + DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("picker_endTime", true)[0]; endTimeInput.Value = DateTime.Now.AddDays(1); addDevDlg.ShowDialog(); @@ -491,6 +491,7 @@ string devCode = (string)dataGridView_DevList.Rows[rowIndex].Cells[4].Value; AddDevDlg editDlg = new AddDevDlg(); + editDlg.deviceId = Convert.ToInt64(dataGridView_DevList.Rows[rowIndex].Cells[9].Value); editDlg.Controls.Find("labelTitle", true)[0].Text = "修改"; editDlg.Controls.Find("inputDevName", true)[0].Text = devName; editDlg.Controls.Find("inputDevModel", true)[0].Text = devModel; @@ -502,6 +503,7 @@ editDlg.btnSave.Text = "保存"; if (((string)dataGridView_DevList.Rows[rowIndex].Cells[7].Value).Equals("检测中")) { + editDlg.isInDetection = true; DetectionItemService detectionItemService = new DetectionItemServiceImpl(); DetectionItem detectionItem = (detectionItemService.search(id, true))[0]; editDlg.groupBox1.Enabled = false; diff --git a/RbFreqStandMeasure/info/accuracy.designer.cs b/RbFreqStandMeasure/info/accuracy.designer.cs index f60767b..9fe1e3a 100644 --- a/RbFreqStandMeasure/info/accuracy.designer.cs +++ b/RbFreqStandMeasure/info/accuracy.designer.cs @@ -28,23 +28,23 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); + this.label_accuracy = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label_devModel = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // label1 + // label_accuracy // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(206, 110); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 100; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_accuracy.BackColor = System.Drawing.Color.Transparent; + this.label_accuracy.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_accuracy.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_accuracy.Location = new System.Drawing.Point(206, 110); + this.label_accuracy.Margin = new System.Windows.Forms.Padding(0); + this.label_accuracy.Name = "label_accuracy"; + this.label_accuracy.Size = new System.Drawing.Size(83, 27); + this.label_accuracy.TabIndex = 100; + this.label_accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // @@ -62,12 +62,13 @@ // 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.ControlDark; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(206, 61); 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; // // label9 @@ -86,7 +87,7 @@ // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label1); + this.Controls.Add(this.label_accuracy); this.Controls.Add(this.label4); this.Controls.Add(this.label_devModel); this.Controls.Add(this.label9); @@ -97,10 +98,9 @@ } #endregion - - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label9; + public System.Windows.Forms.Label label_accuracy; } } diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 77ac28c..fcb7086 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -29,11 +29,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -62,7 +62,7 @@ this.tab_accuracy = new System.Windows.Forms.TabPage(); this.tab_bootFeature = new System.Windows.Forms.TabPage(); this.tab_ageRate = new System.Windows.Forms.TabPage(); - this.tab_count = new System.Windows.Forms.TabPage(); + this.tab_counter = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridView_Data = new System.Windows.Forms.DataGridView(); this.panel1.SuspendLayout(); @@ -161,11 +161,11 @@ // this.label_customerComp.BackColor = System.Drawing.Color.Transparent; this.label_customerComp.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerComp.ForeColor = System.Drawing.Color.Gray; - this.label_customerComp.Location = new System.Drawing.Point(310, 64); + this.label_customerComp.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerComp.Location = new System.Drawing.Point(305, 64); this.label_customerComp.Margin = new System.Windows.Forms.Padding(0); this.label_customerComp.Name = "label_customerComp"; - this.label_customerComp.Size = new System.Drawing.Size(120, 27); + this.label_customerComp.Size = new System.Drawing.Size(112, 27); this.label_customerComp.TabIndex = 80; this.label_customerComp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -173,11 +173,11 @@ // this.label_devCode.BackColor = System.Drawing.Color.Transparent; this.label_devCode.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devCode.ForeColor = System.Drawing.Color.Gray; - this.label_devCode.Location = new System.Drawing.Point(310, 30); + this.label_devCode.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_devCode.Location = new System.Drawing.Point(305, 30); this.label_devCode.Margin = new System.Windows.Forms.Padding(0); this.label_devCode.Name = "label_devCode"; - this.label_devCode.Size = new System.Drawing.Size(120, 27); + this.label_devCode.Size = new System.Drawing.Size(115, 27); this.label_devCode.TabIndex = 79; this.label_devCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -185,11 +185,11 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.Color.Gray; + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; this.label_customerName.Location = new System.Drawing.Point(98, 62); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); + this.label_customerName.Size = new System.Drawing.Size(127, 27); this.label_customerName.TabIndex = 76; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -197,11 +197,11 @@ // 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.Color.Gray; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(98, 30); 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.Size = new System.Drawing.Size(127, 27); this.label_devModel.TabIndex = 75; this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -223,7 +223,7 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label1.Location = new System.Drawing.Point(225, 64); + this.label1.Location = new System.Drawing.Point(221, 64); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(85, 27); @@ -249,7 +249,7 @@ this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label8.Location = new System.Drawing.Point(229, 30); + this.label8.Location = new System.Drawing.Point(224, 30); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(81, 27); @@ -316,14 +316,14 @@ this.dataGridView_times.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_times.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_times.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dataGridView_times.ColumnHeadersHeight = 28; this.dataGridView_times.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_times.GridColor = System.Drawing.Color.White; @@ -331,13 +331,13 @@ this.dataGridView_times.Name = "dataGridView_times"; this.dataGridView_times.RowHeadersVisible = false; this.dataGridView_times.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle12; this.dataGridView_times.RowTemplate.Height = 23; this.dataGridView_times.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView_times.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -366,7 +366,7 @@ this.tabControl1.Controls.Add(this.tab_accuracy); this.tabControl1.Controls.Add(this.tab_bootFeature); this.tabControl1.Controls.Add(this.tab_ageRate); - this.tabControl1.Controls.Add(this.tab_count); + this.tabControl1.Controls.Add(this.tab_counter); this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabControl1.HotTrack = true; this.tabControl1.Location = new System.Drawing.Point(0, 460); @@ -419,15 +419,15 @@ this.tab_ageRate.Text = "日老化率"; this.tab_ageRate.UseVisualStyleBackColor = true; // - // tab_count + // tab_counter // - this.tab_count.Location = new System.Drawing.Point(4, 4); - this.tab_count.Name = "tab_count"; - this.tab_count.Padding = new System.Windows.Forms.Padding(3); - this.tab_count.Size = new System.Drawing.Size(433, 19); - this.tab_count.TabIndex = 4; - this.tab_count.Text = "计数器范围及灵敏度"; - this.tab_count.UseVisualStyleBackColor = true; + this.tab_counter.Location = new System.Drawing.Point(4, 4); + this.tab_counter.Name = "tab_counter"; + this.tab_counter.Padding = new System.Windows.Forms.Padding(3); + this.tab_counter.Size = new System.Drawing.Size(433, 19); + this.tab_counter.TabIndex = 4; + this.tab_counter.Text = "计数器范围及灵敏度"; + this.tab_counter.UseVisualStyleBackColor = true; // // groupBox1 // @@ -449,27 +449,27 @@ this.dataGridView_Data.AllowUserToDeleteRows = false; this.dataGridView_Data.AllowUserToResizeColumns = false; this.dataGridView_Data.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridView_Data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView_Data.BackgroundColor = System.Drawing.Color.White; this.dataGridView_Data.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_Data.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_Data.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dataGridView_Data.ColumnHeadersHeight = 28; this.dataGridView_Data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_Data.GridColor = System.Drawing.Color.White; @@ -479,15 +479,15 @@ this.dataGridView_Data.ReadOnly = true; this.dataGridView_Data.RowHeadersVisible = false; this.dataGridView_Data.RowHeadersWidth = 30; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.NullValue = "-"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.NullValue = "-"; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView_Data.RowTemplate.Height = 26; this.dataGridView_Data.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_Data.Size = new System.Drawing.Size(431, 447); @@ -551,7 +551,7 @@ private System.Windows.Forms.TabPage tab_accuracy; private System.Windows.Forms.TabPage tab_bootFeature; private System.Windows.Forms.TabPage tab_ageRate; - private System.Windows.Forms.TabPage tab_count; + private System.Windows.Forms.TabPage tab_counter; private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index 179389d..caabb86 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -47,9 +47,12 @@ DataTable tableTimes = new DataTable(); DetectionService detectionService = new DetectionServiceImpl(); DetectionItemService detectionItemService = new DetectionItemServiceImpl(); + CounterDataService counterDataService = new CounterDataServiceImpl(); + long deviceId = -1; string startTime = ""; string endTime = ""; + string resultStr = ""; public Action HideMaskAction { @@ -68,10 +71,9 @@ { startTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[0].Cells[3].Value.ToString(); LoadData(deviceId, "1", startTime, endTime); - stability result = new stability(); - result.Show(); - panel_result.Controls.Add(result); + tabPageEvent("tab_stability"); } } @@ -128,6 +130,56 @@ } } + private void LoadData_Counter(long deviceId) + { + tableOriginData = new DataTable(); + + // 设置表格的列 + 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")); + + + // 获取当前页的数据 + List queryList = counterDataService.getList(deviceId, "", "", ""); + if (null != queryList && queryList.Count > 0) + { + int index = 1; + foreach (CounterData counterData in queryList) + { + tableOriginData.Rows.Add(index, counterData.OutValue, counterData.Value, counterData.Sensitivity,counterData.LogTime); + index++; + } + + label_noData.Visible = false; + dataGridView_Data.DataSource = tableOriginData; + + // width=425px + dataGridView_Data.Columns[0].Width = 50; + dataGridView_Data.Columns[1].Width = 100; + dataGridView_Data.Columns[2].Width = 100; + dataGridView_Data.Columns[3].Width = 100; + dataGridView_Data.Columns[4].Width = 120; + + dataGridView_Data.Columns[0].ReadOnly = true; + dataGridView_Data.Columns[1].ReadOnly = true; + dataGridView_Data.Columns[2].ReadOnly = true; + + dataGridView_Data.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; + } + else + { + dataGridView_Data.DataSource = null; + label_noData.Visible = true; + } + } + + + // 检测记录列表 private void LoadTimes(long deviceId) { @@ -140,6 +192,7 @@ tableTimes.Columns.Add("序号", Type.GetType("System.String")); tableTimes.Columns.Add("开始时间", Type.GetType("System.String")); tableTimes.Columns.Add("结束时间", Type.GetType("System.String")); + tableTimes.Columns.Add("result", Type.GetType("System.String")); // 获取当前页的数据 List queryList = detectionItemService.search(deviceId, false); @@ -154,13 +207,15 @@ } label_noTimes.Visible = false; - dataGridView_times.DataSource = tableTimes; + + // width=407px dataGridView_times.Columns[0].Width = 47; dataGridView_times.Columns[1].Width = 180; dataGridView_times.Columns[2].Width = 180; + dataGridView_times.Columns[3].Visible = false; dataGridView_times.Columns[0].ReadOnly = true; @@ -191,6 +246,8 @@ int rowIndex = e.RowIndex; startTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[rowIndex].Cells[3].Value.ToString(); + tabPageEvent(tabControl1.SelectedTab.Name); } @@ -204,6 +261,7 @@ LoadData(deviceId, "1", startTime, endTime); groupBox3.Text = "频率稳定度"; stability result = new stability(); + result.label_stability.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -213,6 +271,7 @@ LoadData(deviceId, "2", startTime, endTime); groupBox3.Text = "频率准确度"; accuracy result = new accuracy(); + result.label_accuracy.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -222,6 +281,7 @@ LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; bootFeature result = new bootFeature(); + result.label_bootFeature.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -231,10 +291,23 @@ LoadData(deviceId, "4", startTime, endTime); groupBox3.Text = "日老化率"; ageRate result = new ageRate(tableOriginData); + if (resultStr.Split(',').Length > 1) + { + result.label_k.Text = resultStr.Split(',')[0]; + result.label_r.Text = resultStr.Split(',')[1]; + } result.Show(); panel_result.Controls.Add(result); break; } + case "tab_counter": + { + LoadData_Counter(deviceId); + groupBox3.Text = "计数器范围及灵敏度"; + //ageRate result = new ageRate(tableOriginData); + //result.Show(); + break; + } default: break; } diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 7c1cfbc..2b0ab6e 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -362,10 +362,10 @@ addDevDlg.StartPosition = FormStartPosition.CenterParent; // 指定窗口弹出在父窗口的中间位置 // 设置默认值 - DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("startTime", true)[0]; + DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("picker_startTime", true)[0]; startTimeInput.Value = DateTime.Now; - DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("endTime", true)[0]; + DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("picker_endTime", true)[0]; endTimeInput.Value = DateTime.Now.AddDays(1); addDevDlg.ShowDialog(); @@ -491,6 +491,7 @@ string devCode = (string)dataGridView_DevList.Rows[rowIndex].Cells[4].Value; AddDevDlg editDlg = new AddDevDlg(); + editDlg.deviceId = Convert.ToInt64(dataGridView_DevList.Rows[rowIndex].Cells[9].Value); editDlg.Controls.Find("labelTitle", true)[0].Text = "修改"; editDlg.Controls.Find("inputDevName", true)[0].Text = devName; editDlg.Controls.Find("inputDevModel", true)[0].Text = devModel; @@ -502,6 +503,7 @@ editDlg.btnSave.Text = "保存"; if (((string)dataGridView_DevList.Rows[rowIndex].Cells[7].Value).Equals("检测中")) { + editDlg.isInDetection = true; DetectionItemService detectionItemService = new DetectionItemServiceImpl(); DetectionItem detectionItem = (detectionItemService.search(id, true))[0]; editDlg.groupBox1.Enabled = false; diff --git a/RbFreqStandMeasure/info/accuracy.designer.cs b/RbFreqStandMeasure/info/accuracy.designer.cs index f60767b..9fe1e3a 100644 --- a/RbFreqStandMeasure/info/accuracy.designer.cs +++ b/RbFreqStandMeasure/info/accuracy.designer.cs @@ -28,23 +28,23 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); + this.label_accuracy = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label_devModel = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // label1 + // label_accuracy // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(206, 110); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 100; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_accuracy.BackColor = System.Drawing.Color.Transparent; + this.label_accuracy.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_accuracy.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_accuracy.Location = new System.Drawing.Point(206, 110); + this.label_accuracy.Margin = new System.Windows.Forms.Padding(0); + this.label_accuracy.Name = "label_accuracy"; + this.label_accuracy.Size = new System.Drawing.Size(83, 27); + this.label_accuracy.TabIndex = 100; + this.label_accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // @@ -62,12 +62,13 @@ // 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.ControlDark; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(206, 61); 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; // // label9 @@ -86,7 +87,7 @@ // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label1); + this.Controls.Add(this.label_accuracy); this.Controls.Add(this.label4); this.Controls.Add(this.label_devModel); this.Controls.Add(this.label9); @@ -97,10 +98,9 @@ } #endregion - - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label9; + public System.Windows.Forms.Label label_accuracy; } } diff --git a/RbFreqStandMeasure/info/ageRate.designer.cs b/RbFreqStandMeasure/info/ageRate.designer.cs index 5780827..e310441 100644 --- a/RbFreqStandMeasure/info/ageRate.designer.cs +++ b/RbFreqStandMeasure/info/ageRate.designer.cs @@ -28,81 +28,77 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_r = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); + this.label_k = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); this.SuspendLayout(); // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 67); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 42); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(402, 176); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 201); this.chart1.TabIndex = 117; this.chart1.Text = "chart1"; // - // label1 + // label_r // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(318, 35); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 116; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_r.BackColor = System.Drawing.Color.Transparent; + this.label_r.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_r.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_r.Location = new System.Drawing.Point(318, 12); + this.label_r.Margin = new System.Windows.Forms.Padding(0); + this.label_r.Name = "label_r"; + this.label_r.Size = new System.Drawing.Size(83, 27); + this.label_r.TabIndex = 116; + this.label_r.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(199, 35); + this.label4.Location = new System.Drawing.Point(213, 12); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(119, 27); + this.label4.Size = new System.Drawing.Size(105, 27); this.label4.TabIndex = 115; this.label4.Text = "相关系数(%):"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_k // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(100, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(57, 27); - this.label_customerName.TabIndex = 114; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_k.BackColor = System.Drawing.Color.Transparent; + this.label_k.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_k.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_k.Location = new System.Drawing.Point(100, 12); + this.label_k.Margin = new System.Windows.Forms.Padding(0); + this.label_k.Name = "label_k"; + this.label_k.Size = new System.Drawing.Size(101, 27); + this.label_k.TabIndex = 114; + this.label_k.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(13, 35); + this.label2.Location = new System.Drawing.Point(13, 12); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -110,67 +106,15 @@ this.label2.Text = "测量结果:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label3 - // - this.label3.BackColor = System.Drawing.Color.Transparent; - this.label3.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label3.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label3.Location = new System.Drawing.Point(318, 8); - this.label3.Margin = new System.Windows.Forms.Padding(0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(83, 27); - this.label3.TabIndex = 119; - this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label5 - // - this.label5.BackColor = System.Drawing.Color.Transparent; - this.label5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label5.Location = new System.Drawing.Point(231, 8); - this.label5.Margin = new System.Windows.Forms.Padding(0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(87, 27); - this.label5.TabIndex = 118; - this.label5.Text = "标准偏差:"; - this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label9 - // - this.label9.BackColor = System.Drawing.Color.Transparent; - this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(17, 8); - this.label9.Margin = new System.Windows.Forms.Padding(0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(83, 27); - this.label9.TabIndex = 111; - this.label9.Text = "预热天数:"; - this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label_devModel - // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(100, 8); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 113; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // ageRate // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label3); - this.Controls.Add(this.label5); this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_r); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_k); this.Controls.Add(this.label2); - this.Controls.Add(this.label9); this.Name = "ageRate"; this.Size = new System.Drawing.Size(405, 246); ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); @@ -181,13 +125,9 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label_customerName; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_r; + public System.Windows.Forms.Label label_k; } } diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 77ac28c..fcb7086 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -29,11 +29,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -62,7 +62,7 @@ this.tab_accuracy = new System.Windows.Forms.TabPage(); this.tab_bootFeature = new System.Windows.Forms.TabPage(); this.tab_ageRate = new System.Windows.Forms.TabPage(); - this.tab_count = new System.Windows.Forms.TabPage(); + this.tab_counter = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridView_Data = new System.Windows.Forms.DataGridView(); this.panel1.SuspendLayout(); @@ -161,11 +161,11 @@ // this.label_customerComp.BackColor = System.Drawing.Color.Transparent; this.label_customerComp.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerComp.ForeColor = System.Drawing.Color.Gray; - this.label_customerComp.Location = new System.Drawing.Point(310, 64); + this.label_customerComp.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerComp.Location = new System.Drawing.Point(305, 64); this.label_customerComp.Margin = new System.Windows.Forms.Padding(0); this.label_customerComp.Name = "label_customerComp"; - this.label_customerComp.Size = new System.Drawing.Size(120, 27); + this.label_customerComp.Size = new System.Drawing.Size(112, 27); this.label_customerComp.TabIndex = 80; this.label_customerComp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -173,11 +173,11 @@ // this.label_devCode.BackColor = System.Drawing.Color.Transparent; this.label_devCode.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devCode.ForeColor = System.Drawing.Color.Gray; - this.label_devCode.Location = new System.Drawing.Point(310, 30); + this.label_devCode.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_devCode.Location = new System.Drawing.Point(305, 30); this.label_devCode.Margin = new System.Windows.Forms.Padding(0); this.label_devCode.Name = "label_devCode"; - this.label_devCode.Size = new System.Drawing.Size(120, 27); + this.label_devCode.Size = new System.Drawing.Size(115, 27); this.label_devCode.TabIndex = 79; this.label_devCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -185,11 +185,11 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.Color.Gray; + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; this.label_customerName.Location = new System.Drawing.Point(98, 62); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); + this.label_customerName.Size = new System.Drawing.Size(127, 27); this.label_customerName.TabIndex = 76; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -197,11 +197,11 @@ // 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.Color.Gray; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(98, 30); 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.Size = new System.Drawing.Size(127, 27); this.label_devModel.TabIndex = 75; this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -223,7 +223,7 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label1.Location = new System.Drawing.Point(225, 64); + this.label1.Location = new System.Drawing.Point(221, 64); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(85, 27); @@ -249,7 +249,7 @@ this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label8.Location = new System.Drawing.Point(229, 30); + this.label8.Location = new System.Drawing.Point(224, 30); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(81, 27); @@ -316,14 +316,14 @@ this.dataGridView_times.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_times.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_times.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dataGridView_times.ColumnHeadersHeight = 28; this.dataGridView_times.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_times.GridColor = System.Drawing.Color.White; @@ -331,13 +331,13 @@ this.dataGridView_times.Name = "dataGridView_times"; this.dataGridView_times.RowHeadersVisible = false; this.dataGridView_times.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle12; this.dataGridView_times.RowTemplate.Height = 23; this.dataGridView_times.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView_times.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -366,7 +366,7 @@ this.tabControl1.Controls.Add(this.tab_accuracy); this.tabControl1.Controls.Add(this.tab_bootFeature); this.tabControl1.Controls.Add(this.tab_ageRate); - this.tabControl1.Controls.Add(this.tab_count); + this.tabControl1.Controls.Add(this.tab_counter); this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabControl1.HotTrack = true; this.tabControl1.Location = new System.Drawing.Point(0, 460); @@ -419,15 +419,15 @@ this.tab_ageRate.Text = "日老化率"; this.tab_ageRate.UseVisualStyleBackColor = true; // - // tab_count + // tab_counter // - this.tab_count.Location = new System.Drawing.Point(4, 4); - this.tab_count.Name = "tab_count"; - this.tab_count.Padding = new System.Windows.Forms.Padding(3); - this.tab_count.Size = new System.Drawing.Size(433, 19); - this.tab_count.TabIndex = 4; - this.tab_count.Text = "计数器范围及灵敏度"; - this.tab_count.UseVisualStyleBackColor = true; + this.tab_counter.Location = new System.Drawing.Point(4, 4); + this.tab_counter.Name = "tab_counter"; + this.tab_counter.Padding = new System.Windows.Forms.Padding(3); + this.tab_counter.Size = new System.Drawing.Size(433, 19); + this.tab_counter.TabIndex = 4; + this.tab_counter.Text = "计数器范围及灵敏度"; + this.tab_counter.UseVisualStyleBackColor = true; // // groupBox1 // @@ -449,27 +449,27 @@ this.dataGridView_Data.AllowUserToDeleteRows = false; this.dataGridView_Data.AllowUserToResizeColumns = false; this.dataGridView_Data.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridView_Data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView_Data.BackgroundColor = System.Drawing.Color.White; this.dataGridView_Data.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_Data.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_Data.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dataGridView_Data.ColumnHeadersHeight = 28; this.dataGridView_Data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_Data.GridColor = System.Drawing.Color.White; @@ -479,15 +479,15 @@ this.dataGridView_Data.ReadOnly = true; this.dataGridView_Data.RowHeadersVisible = false; this.dataGridView_Data.RowHeadersWidth = 30; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.NullValue = "-"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.NullValue = "-"; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView_Data.RowTemplate.Height = 26; this.dataGridView_Data.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_Data.Size = new System.Drawing.Size(431, 447); @@ -551,7 +551,7 @@ private System.Windows.Forms.TabPage tab_accuracy; private System.Windows.Forms.TabPage tab_bootFeature; private System.Windows.Forms.TabPage tab_ageRate; - private System.Windows.Forms.TabPage tab_count; + private System.Windows.Forms.TabPage tab_counter; private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index 179389d..caabb86 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -47,9 +47,12 @@ DataTable tableTimes = new DataTable(); DetectionService detectionService = new DetectionServiceImpl(); DetectionItemService detectionItemService = new DetectionItemServiceImpl(); + CounterDataService counterDataService = new CounterDataServiceImpl(); + long deviceId = -1; string startTime = ""; string endTime = ""; + string resultStr = ""; public Action HideMaskAction { @@ -68,10 +71,9 @@ { startTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[0].Cells[3].Value.ToString(); LoadData(deviceId, "1", startTime, endTime); - stability result = new stability(); - result.Show(); - panel_result.Controls.Add(result); + tabPageEvent("tab_stability"); } } @@ -128,6 +130,56 @@ } } + private void LoadData_Counter(long deviceId) + { + tableOriginData = new DataTable(); + + // 设置表格的列 + 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")); + + + // 获取当前页的数据 + List queryList = counterDataService.getList(deviceId, "", "", ""); + if (null != queryList && queryList.Count > 0) + { + int index = 1; + foreach (CounterData counterData in queryList) + { + tableOriginData.Rows.Add(index, counterData.OutValue, counterData.Value, counterData.Sensitivity,counterData.LogTime); + index++; + } + + label_noData.Visible = false; + dataGridView_Data.DataSource = tableOriginData; + + // width=425px + dataGridView_Data.Columns[0].Width = 50; + dataGridView_Data.Columns[1].Width = 100; + dataGridView_Data.Columns[2].Width = 100; + dataGridView_Data.Columns[3].Width = 100; + dataGridView_Data.Columns[4].Width = 120; + + dataGridView_Data.Columns[0].ReadOnly = true; + dataGridView_Data.Columns[1].ReadOnly = true; + dataGridView_Data.Columns[2].ReadOnly = true; + + dataGridView_Data.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; + } + else + { + dataGridView_Data.DataSource = null; + label_noData.Visible = true; + } + } + + + // 检测记录列表 private void LoadTimes(long deviceId) { @@ -140,6 +192,7 @@ tableTimes.Columns.Add("序号", Type.GetType("System.String")); tableTimes.Columns.Add("开始时间", Type.GetType("System.String")); tableTimes.Columns.Add("结束时间", Type.GetType("System.String")); + tableTimes.Columns.Add("result", Type.GetType("System.String")); // 获取当前页的数据 List queryList = detectionItemService.search(deviceId, false); @@ -154,13 +207,15 @@ } label_noTimes.Visible = false; - dataGridView_times.DataSource = tableTimes; + + // width=407px dataGridView_times.Columns[0].Width = 47; dataGridView_times.Columns[1].Width = 180; dataGridView_times.Columns[2].Width = 180; + dataGridView_times.Columns[3].Visible = false; dataGridView_times.Columns[0].ReadOnly = true; @@ -191,6 +246,8 @@ int rowIndex = e.RowIndex; startTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[rowIndex].Cells[3].Value.ToString(); + tabPageEvent(tabControl1.SelectedTab.Name); } @@ -204,6 +261,7 @@ LoadData(deviceId, "1", startTime, endTime); groupBox3.Text = "频率稳定度"; stability result = new stability(); + result.label_stability.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -213,6 +271,7 @@ LoadData(deviceId, "2", startTime, endTime); groupBox3.Text = "频率准确度"; accuracy result = new accuracy(); + result.label_accuracy.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -222,6 +281,7 @@ LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; bootFeature result = new bootFeature(); + result.label_bootFeature.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -231,10 +291,23 @@ LoadData(deviceId, "4", startTime, endTime); groupBox3.Text = "日老化率"; ageRate result = new ageRate(tableOriginData); + if (resultStr.Split(',').Length > 1) + { + result.label_k.Text = resultStr.Split(',')[0]; + result.label_r.Text = resultStr.Split(',')[1]; + } result.Show(); panel_result.Controls.Add(result); break; } + case "tab_counter": + { + LoadData_Counter(deviceId); + groupBox3.Text = "计数器范围及灵敏度"; + //ageRate result = new ageRate(tableOriginData); + //result.Show(); + break; + } default: break; } diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 7c1cfbc..2b0ab6e 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -362,10 +362,10 @@ addDevDlg.StartPosition = FormStartPosition.CenterParent; // 指定窗口弹出在父窗口的中间位置 // 设置默认值 - DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("startTime", true)[0]; + DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("picker_startTime", true)[0]; startTimeInput.Value = DateTime.Now; - DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("endTime", true)[0]; + DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("picker_endTime", true)[0]; endTimeInput.Value = DateTime.Now.AddDays(1); addDevDlg.ShowDialog(); @@ -491,6 +491,7 @@ string devCode = (string)dataGridView_DevList.Rows[rowIndex].Cells[4].Value; AddDevDlg editDlg = new AddDevDlg(); + editDlg.deviceId = Convert.ToInt64(dataGridView_DevList.Rows[rowIndex].Cells[9].Value); editDlg.Controls.Find("labelTitle", true)[0].Text = "修改"; editDlg.Controls.Find("inputDevName", true)[0].Text = devName; editDlg.Controls.Find("inputDevModel", true)[0].Text = devModel; @@ -502,6 +503,7 @@ editDlg.btnSave.Text = "保存"; if (((string)dataGridView_DevList.Rows[rowIndex].Cells[7].Value).Equals("检测中")) { + editDlg.isInDetection = true; DetectionItemService detectionItemService = new DetectionItemServiceImpl(); DetectionItem detectionItem = (detectionItemService.search(id, true))[0]; editDlg.groupBox1.Enabled = false; diff --git a/RbFreqStandMeasure/info/accuracy.designer.cs b/RbFreqStandMeasure/info/accuracy.designer.cs index f60767b..9fe1e3a 100644 --- a/RbFreqStandMeasure/info/accuracy.designer.cs +++ b/RbFreqStandMeasure/info/accuracy.designer.cs @@ -28,23 +28,23 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); + this.label_accuracy = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label_devModel = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // label1 + // label_accuracy // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(206, 110); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 100; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_accuracy.BackColor = System.Drawing.Color.Transparent; + this.label_accuracy.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_accuracy.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_accuracy.Location = new System.Drawing.Point(206, 110); + this.label_accuracy.Margin = new System.Windows.Forms.Padding(0); + this.label_accuracy.Name = "label_accuracy"; + this.label_accuracy.Size = new System.Drawing.Size(83, 27); + this.label_accuracy.TabIndex = 100; + this.label_accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // @@ -62,12 +62,13 @@ // 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.ControlDark; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(206, 61); 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; // // label9 @@ -86,7 +87,7 @@ // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label1); + this.Controls.Add(this.label_accuracy); this.Controls.Add(this.label4); this.Controls.Add(this.label_devModel); this.Controls.Add(this.label9); @@ -97,10 +98,9 @@ } #endregion - - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label9; + public System.Windows.Forms.Label label_accuracy; } } diff --git a/RbFreqStandMeasure/info/ageRate.designer.cs b/RbFreqStandMeasure/info/ageRate.designer.cs index 5780827..e310441 100644 --- a/RbFreqStandMeasure/info/ageRate.designer.cs +++ b/RbFreqStandMeasure/info/ageRate.designer.cs @@ -28,81 +28,77 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_r = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); + this.label_k = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); this.SuspendLayout(); // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 67); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 42); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(402, 176); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 201); this.chart1.TabIndex = 117; this.chart1.Text = "chart1"; // - // label1 + // label_r // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(318, 35); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 116; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_r.BackColor = System.Drawing.Color.Transparent; + this.label_r.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_r.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_r.Location = new System.Drawing.Point(318, 12); + this.label_r.Margin = new System.Windows.Forms.Padding(0); + this.label_r.Name = "label_r"; + this.label_r.Size = new System.Drawing.Size(83, 27); + this.label_r.TabIndex = 116; + this.label_r.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(199, 35); + this.label4.Location = new System.Drawing.Point(213, 12); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(119, 27); + this.label4.Size = new System.Drawing.Size(105, 27); this.label4.TabIndex = 115; this.label4.Text = "相关系数(%):"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_k // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(100, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(57, 27); - this.label_customerName.TabIndex = 114; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_k.BackColor = System.Drawing.Color.Transparent; + this.label_k.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_k.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_k.Location = new System.Drawing.Point(100, 12); + this.label_k.Margin = new System.Windows.Forms.Padding(0); + this.label_k.Name = "label_k"; + this.label_k.Size = new System.Drawing.Size(101, 27); + this.label_k.TabIndex = 114; + this.label_k.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(13, 35); + this.label2.Location = new System.Drawing.Point(13, 12); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -110,67 +106,15 @@ this.label2.Text = "测量结果:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label3 - // - this.label3.BackColor = System.Drawing.Color.Transparent; - this.label3.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label3.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label3.Location = new System.Drawing.Point(318, 8); - this.label3.Margin = new System.Windows.Forms.Padding(0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(83, 27); - this.label3.TabIndex = 119; - this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label5 - // - this.label5.BackColor = System.Drawing.Color.Transparent; - this.label5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label5.Location = new System.Drawing.Point(231, 8); - this.label5.Margin = new System.Windows.Forms.Padding(0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(87, 27); - this.label5.TabIndex = 118; - this.label5.Text = "标准偏差:"; - this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label9 - // - this.label9.BackColor = System.Drawing.Color.Transparent; - this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(17, 8); - this.label9.Margin = new System.Windows.Forms.Padding(0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(83, 27); - this.label9.TabIndex = 111; - this.label9.Text = "预热天数:"; - this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label_devModel - // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(100, 8); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 113; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // ageRate // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label3); - this.Controls.Add(this.label5); this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_r); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_k); this.Controls.Add(this.label2); - this.Controls.Add(this.label9); this.Name = "ageRate"; this.Size = new System.Drawing.Size(405, 246); ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); @@ -181,13 +125,9 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label_customerName; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_r; + public System.Windows.Forms.Label label_k; } } diff --git a/RbFreqStandMeasure/info/bootFeature.designer.cs b/RbFreqStandMeasure/info/bootFeature.designer.cs index 8993819..b0d3d73 100644 --- a/RbFreqStandMeasure/info/bootFeature.designer.cs +++ b/RbFreqStandMeasure/info/bootFeature.designer.cs @@ -28,13 +28,13 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_max = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_bootFeature = new System.Windows.Forms.Label(); + this.label_min = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); @@ -42,78 +42,78 @@ // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 65); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 39); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(399, 178); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + series2.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 204); this.chart1.TabIndex = 110; this.chart1.Text = "chart1"; // - // label1 + // label_max // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(294, 6); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 107; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_max.BackColor = System.Drawing.Color.Transparent; + this.label_max.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_max.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_max.Location = new System.Drawing.Point(214, 9); + this.label_max.Margin = new System.Windows.Forms.Padding(0); + this.label_max.Name = "label_max"; + this.label_max.Size = new System.Drawing.Size(66, 27); + this.label_max.TabIndex = 107; + this.label_max.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(207, 6); + this.label4.Location = new System.Drawing.Point(137, 9); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(87, 27); + this.label4.Size = new System.Drawing.Size(83, 27); this.label4.TabIndex = 106; this.label4.Text = "y(t)-Max:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_bootFeature // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(106, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); - this.label_customerName.TabIndex = 103; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_bootFeature.BackColor = System.Drawing.Color.Transparent; + this.label_bootFeature.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_bootFeature.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_bootFeature.Location = new System.Drawing.Point(350, 9); + this.label_bootFeature.Margin = new System.Windows.Forms.Padding(0); + this.label_bootFeature.Name = "label_bootFeature"; + this.label_bootFeature.Size = new System.Drawing.Size(55, 27); + this.label_bootFeature.TabIndex = 103; + this.label_bootFeature.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label_devModel + // label_min // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(106, 6); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 102; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_min.BackColor = System.Drawing.Color.Transparent; + this.label_min.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_min.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_min.Location = new System.Drawing.Point(74, 9); + this.label_min.Margin = new System.Windows.Forms.Padding(0); + this.label_min.Name = "label_min"; + this.label_min.Size = new System.Drawing.Size(67, 27); + this.label_min.TabIndex = 102; + this.label_min.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(19, 35); + this.label2.Location = new System.Drawing.Point(268, 9); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -125,10 +125,10 @@ // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(22, 6); + this.label9.Location = new System.Drawing.Point(-2, 9); this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(84, 27); + this.label9.Size = new System.Drawing.Size(83, 27); this.label9.TabIndex = 100; this.label9.Text = "y(t)-Min:"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -138,10 +138,10 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_max); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_bootFeature); + this.Controls.Add(this.label_min); this.Controls.Add(this.label2); this.Controls.Add(this.label9); this.Name = "bootFeature"; @@ -154,11 +154,11 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - 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 label9; + public System.Windows.Forms.Label label_max; + public System.Windows.Forms.Label label_bootFeature; + public System.Windows.Forms.Label label_min; } } diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 77ac28c..fcb7086 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -29,11 +29,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -62,7 +62,7 @@ this.tab_accuracy = new System.Windows.Forms.TabPage(); this.tab_bootFeature = new System.Windows.Forms.TabPage(); this.tab_ageRate = new System.Windows.Forms.TabPage(); - this.tab_count = new System.Windows.Forms.TabPage(); + this.tab_counter = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridView_Data = new System.Windows.Forms.DataGridView(); this.panel1.SuspendLayout(); @@ -161,11 +161,11 @@ // this.label_customerComp.BackColor = System.Drawing.Color.Transparent; this.label_customerComp.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerComp.ForeColor = System.Drawing.Color.Gray; - this.label_customerComp.Location = new System.Drawing.Point(310, 64); + this.label_customerComp.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerComp.Location = new System.Drawing.Point(305, 64); this.label_customerComp.Margin = new System.Windows.Forms.Padding(0); this.label_customerComp.Name = "label_customerComp"; - this.label_customerComp.Size = new System.Drawing.Size(120, 27); + this.label_customerComp.Size = new System.Drawing.Size(112, 27); this.label_customerComp.TabIndex = 80; this.label_customerComp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -173,11 +173,11 @@ // this.label_devCode.BackColor = System.Drawing.Color.Transparent; this.label_devCode.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devCode.ForeColor = System.Drawing.Color.Gray; - this.label_devCode.Location = new System.Drawing.Point(310, 30); + this.label_devCode.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_devCode.Location = new System.Drawing.Point(305, 30); this.label_devCode.Margin = new System.Windows.Forms.Padding(0); this.label_devCode.Name = "label_devCode"; - this.label_devCode.Size = new System.Drawing.Size(120, 27); + this.label_devCode.Size = new System.Drawing.Size(115, 27); this.label_devCode.TabIndex = 79; this.label_devCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -185,11 +185,11 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.Color.Gray; + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; this.label_customerName.Location = new System.Drawing.Point(98, 62); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); + this.label_customerName.Size = new System.Drawing.Size(127, 27); this.label_customerName.TabIndex = 76; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -197,11 +197,11 @@ // 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.Color.Gray; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(98, 30); 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.Size = new System.Drawing.Size(127, 27); this.label_devModel.TabIndex = 75; this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -223,7 +223,7 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label1.Location = new System.Drawing.Point(225, 64); + this.label1.Location = new System.Drawing.Point(221, 64); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(85, 27); @@ -249,7 +249,7 @@ this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label8.Location = new System.Drawing.Point(229, 30); + this.label8.Location = new System.Drawing.Point(224, 30); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(81, 27); @@ -316,14 +316,14 @@ this.dataGridView_times.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_times.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_times.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dataGridView_times.ColumnHeadersHeight = 28; this.dataGridView_times.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_times.GridColor = System.Drawing.Color.White; @@ -331,13 +331,13 @@ this.dataGridView_times.Name = "dataGridView_times"; this.dataGridView_times.RowHeadersVisible = false; this.dataGridView_times.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle12; this.dataGridView_times.RowTemplate.Height = 23; this.dataGridView_times.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView_times.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -366,7 +366,7 @@ this.tabControl1.Controls.Add(this.tab_accuracy); this.tabControl1.Controls.Add(this.tab_bootFeature); this.tabControl1.Controls.Add(this.tab_ageRate); - this.tabControl1.Controls.Add(this.tab_count); + this.tabControl1.Controls.Add(this.tab_counter); this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabControl1.HotTrack = true; this.tabControl1.Location = new System.Drawing.Point(0, 460); @@ -419,15 +419,15 @@ this.tab_ageRate.Text = "日老化率"; this.tab_ageRate.UseVisualStyleBackColor = true; // - // tab_count + // tab_counter // - this.tab_count.Location = new System.Drawing.Point(4, 4); - this.tab_count.Name = "tab_count"; - this.tab_count.Padding = new System.Windows.Forms.Padding(3); - this.tab_count.Size = new System.Drawing.Size(433, 19); - this.tab_count.TabIndex = 4; - this.tab_count.Text = "计数器范围及灵敏度"; - this.tab_count.UseVisualStyleBackColor = true; + this.tab_counter.Location = new System.Drawing.Point(4, 4); + this.tab_counter.Name = "tab_counter"; + this.tab_counter.Padding = new System.Windows.Forms.Padding(3); + this.tab_counter.Size = new System.Drawing.Size(433, 19); + this.tab_counter.TabIndex = 4; + this.tab_counter.Text = "计数器范围及灵敏度"; + this.tab_counter.UseVisualStyleBackColor = true; // // groupBox1 // @@ -449,27 +449,27 @@ this.dataGridView_Data.AllowUserToDeleteRows = false; this.dataGridView_Data.AllowUserToResizeColumns = false; this.dataGridView_Data.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridView_Data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView_Data.BackgroundColor = System.Drawing.Color.White; this.dataGridView_Data.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_Data.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_Data.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dataGridView_Data.ColumnHeadersHeight = 28; this.dataGridView_Data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_Data.GridColor = System.Drawing.Color.White; @@ -479,15 +479,15 @@ this.dataGridView_Data.ReadOnly = true; this.dataGridView_Data.RowHeadersVisible = false; this.dataGridView_Data.RowHeadersWidth = 30; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.NullValue = "-"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.NullValue = "-"; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView_Data.RowTemplate.Height = 26; this.dataGridView_Data.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_Data.Size = new System.Drawing.Size(431, 447); @@ -551,7 +551,7 @@ private System.Windows.Forms.TabPage tab_accuracy; private System.Windows.Forms.TabPage tab_bootFeature; private System.Windows.Forms.TabPage tab_ageRate; - private System.Windows.Forms.TabPage tab_count; + private System.Windows.Forms.TabPage tab_counter; private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index 179389d..caabb86 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -47,9 +47,12 @@ DataTable tableTimes = new DataTable(); DetectionService detectionService = new DetectionServiceImpl(); DetectionItemService detectionItemService = new DetectionItemServiceImpl(); + CounterDataService counterDataService = new CounterDataServiceImpl(); + long deviceId = -1; string startTime = ""; string endTime = ""; + string resultStr = ""; public Action HideMaskAction { @@ -68,10 +71,9 @@ { startTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[0].Cells[3].Value.ToString(); LoadData(deviceId, "1", startTime, endTime); - stability result = new stability(); - result.Show(); - panel_result.Controls.Add(result); + tabPageEvent("tab_stability"); } } @@ -128,6 +130,56 @@ } } + private void LoadData_Counter(long deviceId) + { + tableOriginData = new DataTable(); + + // 设置表格的列 + 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")); + + + // 获取当前页的数据 + List queryList = counterDataService.getList(deviceId, "", "", ""); + if (null != queryList && queryList.Count > 0) + { + int index = 1; + foreach (CounterData counterData in queryList) + { + tableOriginData.Rows.Add(index, counterData.OutValue, counterData.Value, counterData.Sensitivity,counterData.LogTime); + index++; + } + + label_noData.Visible = false; + dataGridView_Data.DataSource = tableOriginData; + + // width=425px + dataGridView_Data.Columns[0].Width = 50; + dataGridView_Data.Columns[1].Width = 100; + dataGridView_Data.Columns[2].Width = 100; + dataGridView_Data.Columns[3].Width = 100; + dataGridView_Data.Columns[4].Width = 120; + + dataGridView_Data.Columns[0].ReadOnly = true; + dataGridView_Data.Columns[1].ReadOnly = true; + dataGridView_Data.Columns[2].ReadOnly = true; + + dataGridView_Data.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; + } + else + { + dataGridView_Data.DataSource = null; + label_noData.Visible = true; + } + } + + + // 检测记录列表 private void LoadTimes(long deviceId) { @@ -140,6 +192,7 @@ tableTimes.Columns.Add("序号", Type.GetType("System.String")); tableTimes.Columns.Add("开始时间", Type.GetType("System.String")); tableTimes.Columns.Add("结束时间", Type.GetType("System.String")); + tableTimes.Columns.Add("result", Type.GetType("System.String")); // 获取当前页的数据 List queryList = detectionItemService.search(deviceId, false); @@ -154,13 +207,15 @@ } label_noTimes.Visible = false; - dataGridView_times.DataSource = tableTimes; + + // width=407px dataGridView_times.Columns[0].Width = 47; dataGridView_times.Columns[1].Width = 180; dataGridView_times.Columns[2].Width = 180; + dataGridView_times.Columns[3].Visible = false; dataGridView_times.Columns[0].ReadOnly = true; @@ -191,6 +246,8 @@ int rowIndex = e.RowIndex; startTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[rowIndex].Cells[3].Value.ToString(); + tabPageEvent(tabControl1.SelectedTab.Name); } @@ -204,6 +261,7 @@ LoadData(deviceId, "1", startTime, endTime); groupBox3.Text = "频率稳定度"; stability result = new stability(); + result.label_stability.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -213,6 +271,7 @@ LoadData(deviceId, "2", startTime, endTime); groupBox3.Text = "频率准确度"; accuracy result = new accuracy(); + result.label_accuracy.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -222,6 +281,7 @@ LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; bootFeature result = new bootFeature(); + result.label_bootFeature.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -231,10 +291,23 @@ LoadData(deviceId, "4", startTime, endTime); groupBox3.Text = "日老化率"; ageRate result = new ageRate(tableOriginData); + if (resultStr.Split(',').Length > 1) + { + result.label_k.Text = resultStr.Split(',')[0]; + result.label_r.Text = resultStr.Split(',')[1]; + } result.Show(); panel_result.Controls.Add(result); break; } + case "tab_counter": + { + LoadData_Counter(deviceId); + groupBox3.Text = "计数器范围及灵敏度"; + //ageRate result = new ageRate(tableOriginData); + //result.Show(); + break; + } default: break; } diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 7c1cfbc..2b0ab6e 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -362,10 +362,10 @@ addDevDlg.StartPosition = FormStartPosition.CenterParent; // 指定窗口弹出在父窗口的中间位置 // 设置默认值 - DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("startTime", true)[0]; + DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("picker_startTime", true)[0]; startTimeInput.Value = DateTime.Now; - DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("endTime", true)[0]; + DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("picker_endTime", true)[0]; endTimeInput.Value = DateTime.Now.AddDays(1); addDevDlg.ShowDialog(); @@ -491,6 +491,7 @@ string devCode = (string)dataGridView_DevList.Rows[rowIndex].Cells[4].Value; AddDevDlg editDlg = new AddDevDlg(); + editDlg.deviceId = Convert.ToInt64(dataGridView_DevList.Rows[rowIndex].Cells[9].Value); editDlg.Controls.Find("labelTitle", true)[0].Text = "修改"; editDlg.Controls.Find("inputDevName", true)[0].Text = devName; editDlg.Controls.Find("inputDevModel", true)[0].Text = devModel; @@ -502,6 +503,7 @@ editDlg.btnSave.Text = "保存"; if (((string)dataGridView_DevList.Rows[rowIndex].Cells[7].Value).Equals("检测中")) { + editDlg.isInDetection = true; DetectionItemService detectionItemService = new DetectionItemServiceImpl(); DetectionItem detectionItem = (detectionItemService.search(id, true))[0]; editDlg.groupBox1.Enabled = false; diff --git a/RbFreqStandMeasure/info/accuracy.designer.cs b/RbFreqStandMeasure/info/accuracy.designer.cs index f60767b..9fe1e3a 100644 --- a/RbFreqStandMeasure/info/accuracy.designer.cs +++ b/RbFreqStandMeasure/info/accuracy.designer.cs @@ -28,23 +28,23 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); + this.label_accuracy = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label_devModel = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // label1 + // label_accuracy // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(206, 110); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 100; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_accuracy.BackColor = System.Drawing.Color.Transparent; + this.label_accuracy.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_accuracy.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_accuracy.Location = new System.Drawing.Point(206, 110); + this.label_accuracy.Margin = new System.Windows.Forms.Padding(0); + this.label_accuracy.Name = "label_accuracy"; + this.label_accuracy.Size = new System.Drawing.Size(83, 27); + this.label_accuracy.TabIndex = 100; + this.label_accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // @@ -62,12 +62,13 @@ // 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.ControlDark; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(206, 61); 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; // // label9 @@ -86,7 +87,7 @@ // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label1); + this.Controls.Add(this.label_accuracy); this.Controls.Add(this.label4); this.Controls.Add(this.label_devModel); this.Controls.Add(this.label9); @@ -97,10 +98,9 @@ } #endregion - - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label9; + public System.Windows.Forms.Label label_accuracy; } } diff --git a/RbFreqStandMeasure/info/ageRate.designer.cs b/RbFreqStandMeasure/info/ageRate.designer.cs index 5780827..e310441 100644 --- a/RbFreqStandMeasure/info/ageRate.designer.cs +++ b/RbFreqStandMeasure/info/ageRate.designer.cs @@ -28,81 +28,77 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_r = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); + this.label_k = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); this.SuspendLayout(); // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 67); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 42); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(402, 176); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 201); this.chart1.TabIndex = 117; this.chart1.Text = "chart1"; // - // label1 + // label_r // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(318, 35); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 116; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_r.BackColor = System.Drawing.Color.Transparent; + this.label_r.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_r.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_r.Location = new System.Drawing.Point(318, 12); + this.label_r.Margin = new System.Windows.Forms.Padding(0); + this.label_r.Name = "label_r"; + this.label_r.Size = new System.Drawing.Size(83, 27); + this.label_r.TabIndex = 116; + this.label_r.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(199, 35); + this.label4.Location = new System.Drawing.Point(213, 12); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(119, 27); + this.label4.Size = new System.Drawing.Size(105, 27); this.label4.TabIndex = 115; this.label4.Text = "相关系数(%):"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_k // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(100, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(57, 27); - this.label_customerName.TabIndex = 114; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_k.BackColor = System.Drawing.Color.Transparent; + this.label_k.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_k.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_k.Location = new System.Drawing.Point(100, 12); + this.label_k.Margin = new System.Windows.Forms.Padding(0); + this.label_k.Name = "label_k"; + this.label_k.Size = new System.Drawing.Size(101, 27); + this.label_k.TabIndex = 114; + this.label_k.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(13, 35); + this.label2.Location = new System.Drawing.Point(13, 12); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -110,67 +106,15 @@ this.label2.Text = "测量结果:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label3 - // - this.label3.BackColor = System.Drawing.Color.Transparent; - this.label3.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label3.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label3.Location = new System.Drawing.Point(318, 8); - this.label3.Margin = new System.Windows.Forms.Padding(0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(83, 27); - this.label3.TabIndex = 119; - this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label5 - // - this.label5.BackColor = System.Drawing.Color.Transparent; - this.label5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label5.Location = new System.Drawing.Point(231, 8); - this.label5.Margin = new System.Windows.Forms.Padding(0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(87, 27); - this.label5.TabIndex = 118; - this.label5.Text = "标准偏差:"; - this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label9 - // - this.label9.BackColor = System.Drawing.Color.Transparent; - this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(17, 8); - this.label9.Margin = new System.Windows.Forms.Padding(0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(83, 27); - this.label9.TabIndex = 111; - this.label9.Text = "预热天数:"; - this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label_devModel - // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(100, 8); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 113; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // ageRate // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label3); - this.Controls.Add(this.label5); this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_r); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_k); this.Controls.Add(this.label2); - this.Controls.Add(this.label9); this.Name = "ageRate"; this.Size = new System.Drawing.Size(405, 246); ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); @@ -181,13 +125,9 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label_customerName; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_r; + public System.Windows.Forms.Label label_k; } } diff --git a/RbFreqStandMeasure/info/bootFeature.designer.cs b/RbFreqStandMeasure/info/bootFeature.designer.cs index 8993819..b0d3d73 100644 --- a/RbFreqStandMeasure/info/bootFeature.designer.cs +++ b/RbFreqStandMeasure/info/bootFeature.designer.cs @@ -28,13 +28,13 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_max = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_bootFeature = new System.Windows.Forms.Label(); + this.label_min = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); @@ -42,78 +42,78 @@ // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 65); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 39); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(399, 178); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + series2.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 204); this.chart1.TabIndex = 110; this.chart1.Text = "chart1"; // - // label1 + // label_max // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(294, 6); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 107; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_max.BackColor = System.Drawing.Color.Transparent; + this.label_max.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_max.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_max.Location = new System.Drawing.Point(214, 9); + this.label_max.Margin = new System.Windows.Forms.Padding(0); + this.label_max.Name = "label_max"; + this.label_max.Size = new System.Drawing.Size(66, 27); + this.label_max.TabIndex = 107; + this.label_max.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(207, 6); + this.label4.Location = new System.Drawing.Point(137, 9); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(87, 27); + this.label4.Size = new System.Drawing.Size(83, 27); this.label4.TabIndex = 106; this.label4.Text = "y(t)-Max:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_bootFeature // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(106, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); - this.label_customerName.TabIndex = 103; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_bootFeature.BackColor = System.Drawing.Color.Transparent; + this.label_bootFeature.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_bootFeature.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_bootFeature.Location = new System.Drawing.Point(350, 9); + this.label_bootFeature.Margin = new System.Windows.Forms.Padding(0); + this.label_bootFeature.Name = "label_bootFeature"; + this.label_bootFeature.Size = new System.Drawing.Size(55, 27); + this.label_bootFeature.TabIndex = 103; + this.label_bootFeature.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label_devModel + // label_min // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(106, 6); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 102; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_min.BackColor = System.Drawing.Color.Transparent; + this.label_min.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_min.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_min.Location = new System.Drawing.Point(74, 9); + this.label_min.Margin = new System.Windows.Forms.Padding(0); + this.label_min.Name = "label_min"; + this.label_min.Size = new System.Drawing.Size(67, 27); + this.label_min.TabIndex = 102; + this.label_min.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(19, 35); + this.label2.Location = new System.Drawing.Point(268, 9); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -125,10 +125,10 @@ // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(22, 6); + this.label9.Location = new System.Drawing.Point(-2, 9); this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(84, 27); + this.label9.Size = new System.Drawing.Size(83, 27); this.label9.TabIndex = 100; this.label9.Text = "y(t)-Min:"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -138,10 +138,10 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_max); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_bootFeature); + this.Controls.Add(this.label_min); this.Controls.Add(this.label2); this.Controls.Add(this.label9); this.Name = "bootFeature"; @@ -154,11 +154,11 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - 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 label9; + public System.Windows.Forms.Label label_max; + public System.Windows.Forms.Label label_bootFeature; + public System.Windows.Forms.Label label_min; } } diff --git a/RbFreqStandMeasure/info/stability.designer.cs b/RbFreqStandMeasure/info/stability.designer.cs index 791a330..9ad5415 100644 --- a/RbFreqStandMeasure/info/stability.designer.cs +++ b/RbFreqStandMeasure/info/stability.designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { this.label_customerName = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_stability = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); @@ -38,31 +38,32 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(197, 91); + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerName.Location = new System.Drawing.Point(195, 110); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; this.label_customerName.Size = new System.Drawing.Size(83, 27); this.label_customerName.TabIndex = 82; + this.label_customerName.Text = "101"; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label_devModel + // label_stability // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(197, 38); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 81; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_stability.BackColor = System.Drawing.Color.Transparent; + this.label_stability.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_stability.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_stability.Location = new System.Drawing.Point(195, 57); + this.label_stability.Margin = new System.Windows.Forms.Padding(0); + this.label_stability.Name = "label_stability"; + this.label_stability.Size = new System.Drawing.Size(67, 27); + this.label_stability.TabIndex = 81; + this.label_stability.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(110, 91); + this.label2.Location = new System.Drawing.Point(109, 110); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -74,7 +75,7 @@ // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(114, 38); + this.label9.Location = new System.Drawing.Point(112, 57); this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(83, 27); @@ -87,7 +88,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_stability); this.Controls.Add(this.label2); this.Controls.Add(this.label9); this.Name = "stability"; @@ -98,8 +99,8 @@ #endregion 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 label9; + public System.Windows.Forms.Label label_stability; } } diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 77ac28c..fcb7086 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -29,11 +29,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -62,7 +62,7 @@ this.tab_accuracy = new System.Windows.Forms.TabPage(); this.tab_bootFeature = new System.Windows.Forms.TabPage(); this.tab_ageRate = new System.Windows.Forms.TabPage(); - this.tab_count = new System.Windows.Forms.TabPage(); + this.tab_counter = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridView_Data = new System.Windows.Forms.DataGridView(); this.panel1.SuspendLayout(); @@ -161,11 +161,11 @@ // this.label_customerComp.BackColor = System.Drawing.Color.Transparent; this.label_customerComp.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerComp.ForeColor = System.Drawing.Color.Gray; - this.label_customerComp.Location = new System.Drawing.Point(310, 64); + this.label_customerComp.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerComp.Location = new System.Drawing.Point(305, 64); this.label_customerComp.Margin = new System.Windows.Forms.Padding(0); this.label_customerComp.Name = "label_customerComp"; - this.label_customerComp.Size = new System.Drawing.Size(120, 27); + this.label_customerComp.Size = new System.Drawing.Size(112, 27); this.label_customerComp.TabIndex = 80; this.label_customerComp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -173,11 +173,11 @@ // this.label_devCode.BackColor = System.Drawing.Color.Transparent; this.label_devCode.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devCode.ForeColor = System.Drawing.Color.Gray; - this.label_devCode.Location = new System.Drawing.Point(310, 30); + this.label_devCode.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_devCode.Location = new System.Drawing.Point(305, 30); this.label_devCode.Margin = new System.Windows.Forms.Padding(0); this.label_devCode.Name = "label_devCode"; - this.label_devCode.Size = new System.Drawing.Size(120, 27); + this.label_devCode.Size = new System.Drawing.Size(115, 27); this.label_devCode.TabIndex = 79; this.label_devCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -185,11 +185,11 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.Color.Gray; + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; this.label_customerName.Location = new System.Drawing.Point(98, 62); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); + this.label_customerName.Size = new System.Drawing.Size(127, 27); this.label_customerName.TabIndex = 76; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -197,11 +197,11 @@ // 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.Color.Gray; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(98, 30); 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.Size = new System.Drawing.Size(127, 27); this.label_devModel.TabIndex = 75; this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -223,7 +223,7 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label1.Location = new System.Drawing.Point(225, 64); + this.label1.Location = new System.Drawing.Point(221, 64); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(85, 27); @@ -249,7 +249,7 @@ this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label8.Location = new System.Drawing.Point(229, 30); + this.label8.Location = new System.Drawing.Point(224, 30); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(81, 27); @@ -316,14 +316,14 @@ this.dataGridView_times.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_times.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_times.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dataGridView_times.ColumnHeadersHeight = 28; this.dataGridView_times.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_times.GridColor = System.Drawing.Color.White; @@ -331,13 +331,13 @@ this.dataGridView_times.Name = "dataGridView_times"; this.dataGridView_times.RowHeadersVisible = false; this.dataGridView_times.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle12; this.dataGridView_times.RowTemplate.Height = 23; this.dataGridView_times.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView_times.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -366,7 +366,7 @@ this.tabControl1.Controls.Add(this.tab_accuracy); this.tabControl1.Controls.Add(this.tab_bootFeature); this.tabControl1.Controls.Add(this.tab_ageRate); - this.tabControl1.Controls.Add(this.tab_count); + this.tabControl1.Controls.Add(this.tab_counter); this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabControl1.HotTrack = true; this.tabControl1.Location = new System.Drawing.Point(0, 460); @@ -419,15 +419,15 @@ this.tab_ageRate.Text = "日老化率"; this.tab_ageRate.UseVisualStyleBackColor = true; // - // tab_count + // tab_counter // - this.tab_count.Location = new System.Drawing.Point(4, 4); - this.tab_count.Name = "tab_count"; - this.tab_count.Padding = new System.Windows.Forms.Padding(3); - this.tab_count.Size = new System.Drawing.Size(433, 19); - this.tab_count.TabIndex = 4; - this.tab_count.Text = "计数器范围及灵敏度"; - this.tab_count.UseVisualStyleBackColor = true; + this.tab_counter.Location = new System.Drawing.Point(4, 4); + this.tab_counter.Name = "tab_counter"; + this.tab_counter.Padding = new System.Windows.Forms.Padding(3); + this.tab_counter.Size = new System.Drawing.Size(433, 19); + this.tab_counter.TabIndex = 4; + this.tab_counter.Text = "计数器范围及灵敏度"; + this.tab_counter.UseVisualStyleBackColor = true; // // groupBox1 // @@ -449,27 +449,27 @@ this.dataGridView_Data.AllowUserToDeleteRows = false; this.dataGridView_Data.AllowUserToResizeColumns = false; this.dataGridView_Data.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridView_Data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView_Data.BackgroundColor = System.Drawing.Color.White; this.dataGridView_Data.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_Data.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_Data.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dataGridView_Data.ColumnHeadersHeight = 28; this.dataGridView_Data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_Data.GridColor = System.Drawing.Color.White; @@ -479,15 +479,15 @@ this.dataGridView_Data.ReadOnly = true; this.dataGridView_Data.RowHeadersVisible = false; this.dataGridView_Data.RowHeadersWidth = 30; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.NullValue = "-"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.NullValue = "-"; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView_Data.RowTemplate.Height = 26; this.dataGridView_Data.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_Data.Size = new System.Drawing.Size(431, 447); @@ -551,7 +551,7 @@ private System.Windows.Forms.TabPage tab_accuracy; private System.Windows.Forms.TabPage tab_bootFeature; private System.Windows.Forms.TabPage tab_ageRate; - private System.Windows.Forms.TabPage tab_count; + private System.Windows.Forms.TabPage tab_counter; private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index 179389d..caabb86 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -47,9 +47,12 @@ DataTable tableTimes = new DataTable(); DetectionService detectionService = new DetectionServiceImpl(); DetectionItemService detectionItemService = new DetectionItemServiceImpl(); + CounterDataService counterDataService = new CounterDataServiceImpl(); + long deviceId = -1; string startTime = ""; string endTime = ""; + string resultStr = ""; public Action HideMaskAction { @@ -68,10 +71,9 @@ { startTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[0].Cells[3].Value.ToString(); LoadData(deviceId, "1", startTime, endTime); - stability result = new stability(); - result.Show(); - panel_result.Controls.Add(result); + tabPageEvent("tab_stability"); } } @@ -128,6 +130,56 @@ } } + private void LoadData_Counter(long deviceId) + { + tableOriginData = new DataTable(); + + // 设置表格的列 + 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")); + + + // 获取当前页的数据 + List queryList = counterDataService.getList(deviceId, "", "", ""); + if (null != queryList && queryList.Count > 0) + { + int index = 1; + foreach (CounterData counterData in queryList) + { + tableOriginData.Rows.Add(index, counterData.OutValue, counterData.Value, counterData.Sensitivity,counterData.LogTime); + index++; + } + + label_noData.Visible = false; + dataGridView_Data.DataSource = tableOriginData; + + // width=425px + dataGridView_Data.Columns[0].Width = 50; + dataGridView_Data.Columns[1].Width = 100; + dataGridView_Data.Columns[2].Width = 100; + dataGridView_Data.Columns[3].Width = 100; + dataGridView_Data.Columns[4].Width = 120; + + dataGridView_Data.Columns[0].ReadOnly = true; + dataGridView_Data.Columns[1].ReadOnly = true; + dataGridView_Data.Columns[2].ReadOnly = true; + + dataGridView_Data.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; + } + else + { + dataGridView_Data.DataSource = null; + label_noData.Visible = true; + } + } + + + // 检测记录列表 private void LoadTimes(long deviceId) { @@ -140,6 +192,7 @@ tableTimes.Columns.Add("序号", Type.GetType("System.String")); tableTimes.Columns.Add("开始时间", Type.GetType("System.String")); tableTimes.Columns.Add("结束时间", Type.GetType("System.String")); + tableTimes.Columns.Add("result", Type.GetType("System.String")); // 获取当前页的数据 List queryList = detectionItemService.search(deviceId, false); @@ -154,13 +207,15 @@ } label_noTimes.Visible = false; - dataGridView_times.DataSource = tableTimes; + + // width=407px dataGridView_times.Columns[0].Width = 47; dataGridView_times.Columns[1].Width = 180; dataGridView_times.Columns[2].Width = 180; + dataGridView_times.Columns[3].Visible = false; dataGridView_times.Columns[0].ReadOnly = true; @@ -191,6 +246,8 @@ int rowIndex = e.RowIndex; startTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[rowIndex].Cells[3].Value.ToString(); + tabPageEvent(tabControl1.SelectedTab.Name); } @@ -204,6 +261,7 @@ LoadData(deviceId, "1", startTime, endTime); groupBox3.Text = "频率稳定度"; stability result = new stability(); + result.label_stability.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -213,6 +271,7 @@ LoadData(deviceId, "2", startTime, endTime); groupBox3.Text = "频率准确度"; accuracy result = new accuracy(); + result.label_accuracy.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -222,6 +281,7 @@ LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; bootFeature result = new bootFeature(); + result.label_bootFeature.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -231,10 +291,23 @@ LoadData(deviceId, "4", startTime, endTime); groupBox3.Text = "日老化率"; ageRate result = new ageRate(tableOriginData); + if (resultStr.Split(',').Length > 1) + { + result.label_k.Text = resultStr.Split(',')[0]; + result.label_r.Text = resultStr.Split(',')[1]; + } result.Show(); panel_result.Controls.Add(result); break; } + case "tab_counter": + { + LoadData_Counter(deviceId); + groupBox3.Text = "计数器范围及灵敏度"; + //ageRate result = new ageRate(tableOriginData); + //result.Show(); + break; + } default: break; } diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 7c1cfbc..2b0ab6e 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -362,10 +362,10 @@ addDevDlg.StartPosition = FormStartPosition.CenterParent; // 指定窗口弹出在父窗口的中间位置 // 设置默认值 - DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("startTime", true)[0]; + DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("picker_startTime", true)[0]; startTimeInput.Value = DateTime.Now; - DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("endTime", true)[0]; + DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("picker_endTime", true)[0]; endTimeInput.Value = DateTime.Now.AddDays(1); addDevDlg.ShowDialog(); @@ -491,6 +491,7 @@ string devCode = (string)dataGridView_DevList.Rows[rowIndex].Cells[4].Value; AddDevDlg editDlg = new AddDevDlg(); + editDlg.deviceId = Convert.ToInt64(dataGridView_DevList.Rows[rowIndex].Cells[9].Value); editDlg.Controls.Find("labelTitle", true)[0].Text = "修改"; editDlg.Controls.Find("inputDevName", true)[0].Text = devName; editDlg.Controls.Find("inputDevModel", true)[0].Text = devModel; @@ -502,6 +503,7 @@ editDlg.btnSave.Text = "保存"; if (((string)dataGridView_DevList.Rows[rowIndex].Cells[7].Value).Equals("检测中")) { + editDlg.isInDetection = true; DetectionItemService detectionItemService = new DetectionItemServiceImpl(); DetectionItem detectionItem = (detectionItemService.search(id, true))[0]; editDlg.groupBox1.Enabled = false; diff --git a/RbFreqStandMeasure/info/accuracy.designer.cs b/RbFreqStandMeasure/info/accuracy.designer.cs index f60767b..9fe1e3a 100644 --- a/RbFreqStandMeasure/info/accuracy.designer.cs +++ b/RbFreqStandMeasure/info/accuracy.designer.cs @@ -28,23 +28,23 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); + this.label_accuracy = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label_devModel = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // label1 + // label_accuracy // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(206, 110); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 100; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_accuracy.BackColor = System.Drawing.Color.Transparent; + this.label_accuracy.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_accuracy.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_accuracy.Location = new System.Drawing.Point(206, 110); + this.label_accuracy.Margin = new System.Windows.Forms.Padding(0); + this.label_accuracy.Name = "label_accuracy"; + this.label_accuracy.Size = new System.Drawing.Size(83, 27); + this.label_accuracy.TabIndex = 100; + this.label_accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // @@ -62,12 +62,13 @@ // 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.ControlDark; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(206, 61); 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; // // label9 @@ -86,7 +87,7 @@ // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label1); + this.Controls.Add(this.label_accuracy); this.Controls.Add(this.label4); this.Controls.Add(this.label_devModel); this.Controls.Add(this.label9); @@ -97,10 +98,9 @@ } #endregion - - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label9; + public System.Windows.Forms.Label label_accuracy; } } diff --git a/RbFreqStandMeasure/info/ageRate.designer.cs b/RbFreqStandMeasure/info/ageRate.designer.cs index 5780827..e310441 100644 --- a/RbFreqStandMeasure/info/ageRate.designer.cs +++ b/RbFreqStandMeasure/info/ageRate.designer.cs @@ -28,81 +28,77 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_r = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); + this.label_k = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); this.SuspendLayout(); // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 67); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 42); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(402, 176); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 201); this.chart1.TabIndex = 117; this.chart1.Text = "chart1"; // - // label1 + // label_r // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(318, 35); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 116; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_r.BackColor = System.Drawing.Color.Transparent; + this.label_r.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_r.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_r.Location = new System.Drawing.Point(318, 12); + this.label_r.Margin = new System.Windows.Forms.Padding(0); + this.label_r.Name = "label_r"; + this.label_r.Size = new System.Drawing.Size(83, 27); + this.label_r.TabIndex = 116; + this.label_r.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(199, 35); + this.label4.Location = new System.Drawing.Point(213, 12); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(119, 27); + this.label4.Size = new System.Drawing.Size(105, 27); this.label4.TabIndex = 115; this.label4.Text = "相关系数(%):"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_k // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(100, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(57, 27); - this.label_customerName.TabIndex = 114; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_k.BackColor = System.Drawing.Color.Transparent; + this.label_k.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_k.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_k.Location = new System.Drawing.Point(100, 12); + this.label_k.Margin = new System.Windows.Forms.Padding(0); + this.label_k.Name = "label_k"; + this.label_k.Size = new System.Drawing.Size(101, 27); + this.label_k.TabIndex = 114; + this.label_k.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(13, 35); + this.label2.Location = new System.Drawing.Point(13, 12); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -110,67 +106,15 @@ this.label2.Text = "测量结果:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label3 - // - this.label3.BackColor = System.Drawing.Color.Transparent; - this.label3.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label3.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label3.Location = new System.Drawing.Point(318, 8); - this.label3.Margin = new System.Windows.Forms.Padding(0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(83, 27); - this.label3.TabIndex = 119; - this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label5 - // - this.label5.BackColor = System.Drawing.Color.Transparent; - this.label5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label5.Location = new System.Drawing.Point(231, 8); - this.label5.Margin = new System.Windows.Forms.Padding(0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(87, 27); - this.label5.TabIndex = 118; - this.label5.Text = "标准偏差:"; - this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label9 - // - this.label9.BackColor = System.Drawing.Color.Transparent; - this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(17, 8); - this.label9.Margin = new System.Windows.Forms.Padding(0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(83, 27); - this.label9.TabIndex = 111; - this.label9.Text = "预热天数:"; - this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label_devModel - // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(100, 8); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 113; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // ageRate // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label3); - this.Controls.Add(this.label5); this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_r); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_k); this.Controls.Add(this.label2); - this.Controls.Add(this.label9); this.Name = "ageRate"; this.Size = new System.Drawing.Size(405, 246); ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); @@ -181,13 +125,9 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label_customerName; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_r; + public System.Windows.Forms.Label label_k; } } diff --git a/RbFreqStandMeasure/info/bootFeature.designer.cs b/RbFreqStandMeasure/info/bootFeature.designer.cs index 8993819..b0d3d73 100644 --- a/RbFreqStandMeasure/info/bootFeature.designer.cs +++ b/RbFreqStandMeasure/info/bootFeature.designer.cs @@ -28,13 +28,13 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_max = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_bootFeature = new System.Windows.Forms.Label(); + this.label_min = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); @@ -42,78 +42,78 @@ // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 65); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 39); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(399, 178); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + series2.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 204); this.chart1.TabIndex = 110; this.chart1.Text = "chart1"; // - // label1 + // label_max // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(294, 6); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 107; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_max.BackColor = System.Drawing.Color.Transparent; + this.label_max.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_max.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_max.Location = new System.Drawing.Point(214, 9); + this.label_max.Margin = new System.Windows.Forms.Padding(0); + this.label_max.Name = "label_max"; + this.label_max.Size = new System.Drawing.Size(66, 27); + this.label_max.TabIndex = 107; + this.label_max.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(207, 6); + this.label4.Location = new System.Drawing.Point(137, 9); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(87, 27); + this.label4.Size = new System.Drawing.Size(83, 27); this.label4.TabIndex = 106; this.label4.Text = "y(t)-Max:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_bootFeature // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(106, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); - this.label_customerName.TabIndex = 103; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_bootFeature.BackColor = System.Drawing.Color.Transparent; + this.label_bootFeature.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_bootFeature.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_bootFeature.Location = new System.Drawing.Point(350, 9); + this.label_bootFeature.Margin = new System.Windows.Forms.Padding(0); + this.label_bootFeature.Name = "label_bootFeature"; + this.label_bootFeature.Size = new System.Drawing.Size(55, 27); + this.label_bootFeature.TabIndex = 103; + this.label_bootFeature.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label_devModel + // label_min // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(106, 6); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 102; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_min.BackColor = System.Drawing.Color.Transparent; + this.label_min.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_min.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_min.Location = new System.Drawing.Point(74, 9); + this.label_min.Margin = new System.Windows.Forms.Padding(0); + this.label_min.Name = "label_min"; + this.label_min.Size = new System.Drawing.Size(67, 27); + this.label_min.TabIndex = 102; + this.label_min.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(19, 35); + this.label2.Location = new System.Drawing.Point(268, 9); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -125,10 +125,10 @@ // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(22, 6); + this.label9.Location = new System.Drawing.Point(-2, 9); this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(84, 27); + this.label9.Size = new System.Drawing.Size(83, 27); this.label9.TabIndex = 100; this.label9.Text = "y(t)-Min:"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -138,10 +138,10 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_max); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_bootFeature); + this.Controls.Add(this.label_min); this.Controls.Add(this.label2); this.Controls.Add(this.label9); this.Name = "bootFeature"; @@ -154,11 +154,11 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - 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 label9; + public System.Windows.Forms.Label label_max; + public System.Windows.Forms.Label label_bootFeature; + public System.Windows.Forms.Label label_min; } } diff --git a/RbFreqStandMeasure/info/stability.designer.cs b/RbFreqStandMeasure/info/stability.designer.cs index 791a330..9ad5415 100644 --- a/RbFreqStandMeasure/info/stability.designer.cs +++ b/RbFreqStandMeasure/info/stability.designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { this.label_customerName = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_stability = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); @@ -38,31 +38,32 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(197, 91); + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerName.Location = new System.Drawing.Point(195, 110); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; this.label_customerName.Size = new System.Drawing.Size(83, 27); this.label_customerName.TabIndex = 82; + this.label_customerName.Text = "101"; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label_devModel + // label_stability // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(197, 38); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 81; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_stability.BackColor = System.Drawing.Color.Transparent; + this.label_stability.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_stability.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_stability.Location = new System.Drawing.Point(195, 57); + this.label_stability.Margin = new System.Windows.Forms.Padding(0); + this.label_stability.Name = "label_stability"; + this.label_stability.Size = new System.Drawing.Size(67, 27); + this.label_stability.TabIndex = 81; + this.label_stability.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(110, 91); + this.label2.Location = new System.Drawing.Point(109, 110); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -74,7 +75,7 @@ // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(114, 38); + this.label9.Location = new System.Drawing.Point(112, 57); this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(83, 27); @@ -87,7 +88,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_stability); this.Controls.Add(this.label2); this.Controls.Add(this.label9); this.Name = "stability"; @@ -98,8 +99,8 @@ #endregion 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 label9; + public System.Windows.Forms.Label label_stability; } } diff --git a/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs b/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs index bb130f0..f16c7ca 100644 --- a/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs @@ -98,7 +98,6 @@ this.label_z.Name = "label_z"; this.label_z.Size = new System.Drawing.Size(109, 25); this.label_z.TabIndex = 13; - this.label_z.Text = "快锁"; this.label_z.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_y @@ -110,7 +109,6 @@ this.label_y.Name = "label_y"; this.label_y.Size = new System.Drawing.Size(109, 25); this.label_y.TabIndex = 12; - this.label_y.Text = "快锁"; this.label_y.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_x @@ -122,7 +120,6 @@ this.label_x.Name = "label_x"; this.label_x.Size = new System.Drawing.Size(109, 25); this.label_x.TabIndex = 11; - this.label_x.Text = "快锁"; this.label_x.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_lat @@ -134,7 +131,6 @@ this.label_lat.Name = "label_lat"; this.label_lat.Size = new System.Drawing.Size(109, 25); this.label_lat.TabIndex = 10; - this.label_lat.Text = "快锁"; this.label_lat.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_lng @@ -146,7 +142,6 @@ this.label_lng.Name = "label_lng"; this.label_lng.Size = new System.Drawing.Size(109, 25); this.label_lng.TabIndex = 9; - this.label_lng.Text = "快锁"; this.label_lng.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // labelLocation @@ -322,7 +317,6 @@ this.label_mjd.Name = "label_mjd"; this.label_mjd.Size = new System.Drawing.Size(109, 25); this.label_mjd.TabIndex = 8; - this.label_mjd.Text = "快锁"; this.label_mjd.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_time @@ -334,7 +328,6 @@ this.label_time.Name = "label_time"; this.label_time.Size = new System.Drawing.Size(109, 25); this.label_time.TabIndex = 7; - this.label_time.Text = "快锁"; this.label_time.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_date @@ -346,7 +339,6 @@ this.label_date.Name = "label_date"; this.label_date.Size = new System.Drawing.Size(109, 25); this.label_date.TabIndex = 6; - this.label_date.Text = "快锁"; this.label_date.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // labelTime diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 77ac28c..fcb7086 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -29,11 +29,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -62,7 +62,7 @@ this.tab_accuracy = new System.Windows.Forms.TabPage(); this.tab_bootFeature = new System.Windows.Forms.TabPage(); this.tab_ageRate = new System.Windows.Forms.TabPage(); - this.tab_count = new System.Windows.Forms.TabPage(); + this.tab_counter = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridView_Data = new System.Windows.Forms.DataGridView(); this.panel1.SuspendLayout(); @@ -161,11 +161,11 @@ // this.label_customerComp.BackColor = System.Drawing.Color.Transparent; this.label_customerComp.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerComp.ForeColor = System.Drawing.Color.Gray; - this.label_customerComp.Location = new System.Drawing.Point(310, 64); + this.label_customerComp.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerComp.Location = new System.Drawing.Point(305, 64); this.label_customerComp.Margin = new System.Windows.Forms.Padding(0); this.label_customerComp.Name = "label_customerComp"; - this.label_customerComp.Size = new System.Drawing.Size(120, 27); + this.label_customerComp.Size = new System.Drawing.Size(112, 27); this.label_customerComp.TabIndex = 80; this.label_customerComp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -173,11 +173,11 @@ // this.label_devCode.BackColor = System.Drawing.Color.Transparent; this.label_devCode.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devCode.ForeColor = System.Drawing.Color.Gray; - this.label_devCode.Location = new System.Drawing.Point(310, 30); + this.label_devCode.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_devCode.Location = new System.Drawing.Point(305, 30); this.label_devCode.Margin = new System.Windows.Forms.Padding(0); this.label_devCode.Name = "label_devCode"; - this.label_devCode.Size = new System.Drawing.Size(120, 27); + this.label_devCode.Size = new System.Drawing.Size(115, 27); this.label_devCode.TabIndex = 79; this.label_devCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -185,11 +185,11 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.Color.Gray; + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; this.label_customerName.Location = new System.Drawing.Point(98, 62); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); + this.label_customerName.Size = new System.Drawing.Size(127, 27); this.label_customerName.TabIndex = 76; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -197,11 +197,11 @@ // 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.Color.Gray; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(98, 30); 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.Size = new System.Drawing.Size(127, 27); this.label_devModel.TabIndex = 75; this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -223,7 +223,7 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label1.Location = new System.Drawing.Point(225, 64); + this.label1.Location = new System.Drawing.Point(221, 64); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(85, 27); @@ -249,7 +249,7 @@ this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label8.Location = new System.Drawing.Point(229, 30); + this.label8.Location = new System.Drawing.Point(224, 30); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(81, 27); @@ -316,14 +316,14 @@ this.dataGridView_times.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_times.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_times.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dataGridView_times.ColumnHeadersHeight = 28; this.dataGridView_times.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_times.GridColor = System.Drawing.Color.White; @@ -331,13 +331,13 @@ this.dataGridView_times.Name = "dataGridView_times"; this.dataGridView_times.RowHeadersVisible = false; this.dataGridView_times.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle12; this.dataGridView_times.RowTemplate.Height = 23; this.dataGridView_times.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView_times.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -366,7 +366,7 @@ this.tabControl1.Controls.Add(this.tab_accuracy); this.tabControl1.Controls.Add(this.tab_bootFeature); this.tabControl1.Controls.Add(this.tab_ageRate); - this.tabControl1.Controls.Add(this.tab_count); + this.tabControl1.Controls.Add(this.tab_counter); this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabControl1.HotTrack = true; this.tabControl1.Location = new System.Drawing.Point(0, 460); @@ -419,15 +419,15 @@ this.tab_ageRate.Text = "日老化率"; this.tab_ageRate.UseVisualStyleBackColor = true; // - // tab_count + // tab_counter // - this.tab_count.Location = new System.Drawing.Point(4, 4); - this.tab_count.Name = "tab_count"; - this.tab_count.Padding = new System.Windows.Forms.Padding(3); - this.tab_count.Size = new System.Drawing.Size(433, 19); - this.tab_count.TabIndex = 4; - this.tab_count.Text = "计数器范围及灵敏度"; - this.tab_count.UseVisualStyleBackColor = true; + this.tab_counter.Location = new System.Drawing.Point(4, 4); + this.tab_counter.Name = "tab_counter"; + this.tab_counter.Padding = new System.Windows.Forms.Padding(3); + this.tab_counter.Size = new System.Drawing.Size(433, 19); + this.tab_counter.TabIndex = 4; + this.tab_counter.Text = "计数器范围及灵敏度"; + this.tab_counter.UseVisualStyleBackColor = true; // // groupBox1 // @@ -449,27 +449,27 @@ this.dataGridView_Data.AllowUserToDeleteRows = false; this.dataGridView_Data.AllowUserToResizeColumns = false; this.dataGridView_Data.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridView_Data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView_Data.BackgroundColor = System.Drawing.Color.White; this.dataGridView_Data.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_Data.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_Data.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dataGridView_Data.ColumnHeadersHeight = 28; this.dataGridView_Data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_Data.GridColor = System.Drawing.Color.White; @@ -479,15 +479,15 @@ this.dataGridView_Data.ReadOnly = true; this.dataGridView_Data.RowHeadersVisible = false; this.dataGridView_Data.RowHeadersWidth = 30; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.NullValue = "-"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.NullValue = "-"; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView_Data.RowTemplate.Height = 26; this.dataGridView_Data.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_Data.Size = new System.Drawing.Size(431, 447); @@ -551,7 +551,7 @@ private System.Windows.Forms.TabPage tab_accuracy; private System.Windows.Forms.TabPage tab_bootFeature; private System.Windows.Forms.TabPage tab_ageRate; - private System.Windows.Forms.TabPage tab_count; + private System.Windows.Forms.TabPage tab_counter; private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index 179389d..caabb86 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -47,9 +47,12 @@ DataTable tableTimes = new DataTable(); DetectionService detectionService = new DetectionServiceImpl(); DetectionItemService detectionItemService = new DetectionItemServiceImpl(); + CounterDataService counterDataService = new CounterDataServiceImpl(); + long deviceId = -1; string startTime = ""; string endTime = ""; + string resultStr = ""; public Action HideMaskAction { @@ -68,10 +71,9 @@ { startTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[0].Cells[3].Value.ToString(); LoadData(deviceId, "1", startTime, endTime); - stability result = new stability(); - result.Show(); - panel_result.Controls.Add(result); + tabPageEvent("tab_stability"); } } @@ -128,6 +130,56 @@ } } + private void LoadData_Counter(long deviceId) + { + tableOriginData = new DataTable(); + + // 设置表格的列 + 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")); + + + // 获取当前页的数据 + List queryList = counterDataService.getList(deviceId, "", "", ""); + if (null != queryList && queryList.Count > 0) + { + int index = 1; + foreach (CounterData counterData in queryList) + { + tableOriginData.Rows.Add(index, counterData.OutValue, counterData.Value, counterData.Sensitivity,counterData.LogTime); + index++; + } + + label_noData.Visible = false; + dataGridView_Data.DataSource = tableOriginData; + + // width=425px + dataGridView_Data.Columns[0].Width = 50; + dataGridView_Data.Columns[1].Width = 100; + dataGridView_Data.Columns[2].Width = 100; + dataGridView_Data.Columns[3].Width = 100; + dataGridView_Data.Columns[4].Width = 120; + + dataGridView_Data.Columns[0].ReadOnly = true; + dataGridView_Data.Columns[1].ReadOnly = true; + dataGridView_Data.Columns[2].ReadOnly = true; + + dataGridView_Data.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; + } + else + { + dataGridView_Data.DataSource = null; + label_noData.Visible = true; + } + } + + + // 检测记录列表 private void LoadTimes(long deviceId) { @@ -140,6 +192,7 @@ tableTimes.Columns.Add("序号", Type.GetType("System.String")); tableTimes.Columns.Add("开始时间", Type.GetType("System.String")); tableTimes.Columns.Add("结束时间", Type.GetType("System.String")); + tableTimes.Columns.Add("result", Type.GetType("System.String")); // 获取当前页的数据 List queryList = detectionItemService.search(deviceId, false); @@ -154,13 +207,15 @@ } label_noTimes.Visible = false; - dataGridView_times.DataSource = tableTimes; + + // width=407px dataGridView_times.Columns[0].Width = 47; dataGridView_times.Columns[1].Width = 180; dataGridView_times.Columns[2].Width = 180; + dataGridView_times.Columns[3].Visible = false; dataGridView_times.Columns[0].ReadOnly = true; @@ -191,6 +246,8 @@ int rowIndex = e.RowIndex; startTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[rowIndex].Cells[3].Value.ToString(); + tabPageEvent(tabControl1.SelectedTab.Name); } @@ -204,6 +261,7 @@ LoadData(deviceId, "1", startTime, endTime); groupBox3.Text = "频率稳定度"; stability result = new stability(); + result.label_stability.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -213,6 +271,7 @@ LoadData(deviceId, "2", startTime, endTime); groupBox3.Text = "频率准确度"; accuracy result = new accuracy(); + result.label_accuracy.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -222,6 +281,7 @@ LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; bootFeature result = new bootFeature(); + result.label_bootFeature.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -231,10 +291,23 @@ LoadData(deviceId, "4", startTime, endTime); groupBox3.Text = "日老化率"; ageRate result = new ageRate(tableOriginData); + if (resultStr.Split(',').Length > 1) + { + result.label_k.Text = resultStr.Split(',')[0]; + result.label_r.Text = resultStr.Split(',')[1]; + } result.Show(); panel_result.Controls.Add(result); break; } + case "tab_counter": + { + LoadData_Counter(deviceId); + groupBox3.Text = "计数器范围及灵敏度"; + //ageRate result = new ageRate(tableOriginData); + //result.Show(); + break; + } default: break; } diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 7c1cfbc..2b0ab6e 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -362,10 +362,10 @@ addDevDlg.StartPosition = FormStartPosition.CenterParent; // 指定窗口弹出在父窗口的中间位置 // 设置默认值 - DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("startTime", true)[0]; + DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("picker_startTime", true)[0]; startTimeInput.Value = DateTime.Now; - DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("endTime", true)[0]; + DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("picker_endTime", true)[0]; endTimeInput.Value = DateTime.Now.AddDays(1); addDevDlg.ShowDialog(); @@ -491,6 +491,7 @@ string devCode = (string)dataGridView_DevList.Rows[rowIndex].Cells[4].Value; AddDevDlg editDlg = new AddDevDlg(); + editDlg.deviceId = Convert.ToInt64(dataGridView_DevList.Rows[rowIndex].Cells[9].Value); editDlg.Controls.Find("labelTitle", true)[0].Text = "修改"; editDlg.Controls.Find("inputDevName", true)[0].Text = devName; editDlg.Controls.Find("inputDevModel", true)[0].Text = devModel; @@ -502,6 +503,7 @@ editDlg.btnSave.Text = "保存"; if (((string)dataGridView_DevList.Rows[rowIndex].Cells[7].Value).Equals("检测中")) { + editDlg.isInDetection = true; DetectionItemService detectionItemService = new DetectionItemServiceImpl(); DetectionItem detectionItem = (detectionItemService.search(id, true))[0]; editDlg.groupBox1.Enabled = false; diff --git a/RbFreqStandMeasure/info/accuracy.designer.cs b/RbFreqStandMeasure/info/accuracy.designer.cs index f60767b..9fe1e3a 100644 --- a/RbFreqStandMeasure/info/accuracy.designer.cs +++ b/RbFreqStandMeasure/info/accuracy.designer.cs @@ -28,23 +28,23 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); + this.label_accuracy = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label_devModel = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // label1 + // label_accuracy // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(206, 110); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 100; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_accuracy.BackColor = System.Drawing.Color.Transparent; + this.label_accuracy.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_accuracy.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_accuracy.Location = new System.Drawing.Point(206, 110); + this.label_accuracy.Margin = new System.Windows.Forms.Padding(0); + this.label_accuracy.Name = "label_accuracy"; + this.label_accuracy.Size = new System.Drawing.Size(83, 27); + this.label_accuracy.TabIndex = 100; + this.label_accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // @@ -62,12 +62,13 @@ // 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.ControlDark; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(206, 61); 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; // // label9 @@ -86,7 +87,7 @@ // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label1); + this.Controls.Add(this.label_accuracy); this.Controls.Add(this.label4); this.Controls.Add(this.label_devModel); this.Controls.Add(this.label9); @@ -97,10 +98,9 @@ } #endregion - - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label9; + public System.Windows.Forms.Label label_accuracy; } } diff --git a/RbFreqStandMeasure/info/ageRate.designer.cs b/RbFreqStandMeasure/info/ageRate.designer.cs index 5780827..e310441 100644 --- a/RbFreqStandMeasure/info/ageRate.designer.cs +++ b/RbFreqStandMeasure/info/ageRate.designer.cs @@ -28,81 +28,77 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_r = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); + this.label_k = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); this.SuspendLayout(); // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 67); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 42); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(402, 176); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 201); this.chart1.TabIndex = 117; this.chart1.Text = "chart1"; // - // label1 + // label_r // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(318, 35); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 116; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_r.BackColor = System.Drawing.Color.Transparent; + this.label_r.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_r.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_r.Location = new System.Drawing.Point(318, 12); + this.label_r.Margin = new System.Windows.Forms.Padding(0); + this.label_r.Name = "label_r"; + this.label_r.Size = new System.Drawing.Size(83, 27); + this.label_r.TabIndex = 116; + this.label_r.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(199, 35); + this.label4.Location = new System.Drawing.Point(213, 12); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(119, 27); + this.label4.Size = new System.Drawing.Size(105, 27); this.label4.TabIndex = 115; this.label4.Text = "相关系数(%):"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_k // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(100, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(57, 27); - this.label_customerName.TabIndex = 114; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_k.BackColor = System.Drawing.Color.Transparent; + this.label_k.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_k.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_k.Location = new System.Drawing.Point(100, 12); + this.label_k.Margin = new System.Windows.Forms.Padding(0); + this.label_k.Name = "label_k"; + this.label_k.Size = new System.Drawing.Size(101, 27); + this.label_k.TabIndex = 114; + this.label_k.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(13, 35); + this.label2.Location = new System.Drawing.Point(13, 12); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -110,67 +106,15 @@ this.label2.Text = "测量结果:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label3 - // - this.label3.BackColor = System.Drawing.Color.Transparent; - this.label3.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label3.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label3.Location = new System.Drawing.Point(318, 8); - this.label3.Margin = new System.Windows.Forms.Padding(0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(83, 27); - this.label3.TabIndex = 119; - this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label5 - // - this.label5.BackColor = System.Drawing.Color.Transparent; - this.label5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label5.Location = new System.Drawing.Point(231, 8); - this.label5.Margin = new System.Windows.Forms.Padding(0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(87, 27); - this.label5.TabIndex = 118; - this.label5.Text = "标准偏差:"; - this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label9 - // - this.label9.BackColor = System.Drawing.Color.Transparent; - this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(17, 8); - this.label9.Margin = new System.Windows.Forms.Padding(0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(83, 27); - this.label9.TabIndex = 111; - this.label9.Text = "预热天数:"; - this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label_devModel - // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(100, 8); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 113; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // ageRate // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label3); - this.Controls.Add(this.label5); this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_r); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_k); this.Controls.Add(this.label2); - this.Controls.Add(this.label9); this.Name = "ageRate"; this.Size = new System.Drawing.Size(405, 246); ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); @@ -181,13 +125,9 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label_customerName; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_r; + public System.Windows.Forms.Label label_k; } } diff --git a/RbFreqStandMeasure/info/bootFeature.designer.cs b/RbFreqStandMeasure/info/bootFeature.designer.cs index 8993819..b0d3d73 100644 --- a/RbFreqStandMeasure/info/bootFeature.designer.cs +++ b/RbFreqStandMeasure/info/bootFeature.designer.cs @@ -28,13 +28,13 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_max = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_bootFeature = new System.Windows.Forms.Label(); + this.label_min = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); @@ -42,78 +42,78 @@ // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 65); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 39); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(399, 178); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + series2.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 204); this.chart1.TabIndex = 110; this.chart1.Text = "chart1"; // - // label1 + // label_max // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(294, 6); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 107; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_max.BackColor = System.Drawing.Color.Transparent; + this.label_max.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_max.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_max.Location = new System.Drawing.Point(214, 9); + this.label_max.Margin = new System.Windows.Forms.Padding(0); + this.label_max.Name = "label_max"; + this.label_max.Size = new System.Drawing.Size(66, 27); + this.label_max.TabIndex = 107; + this.label_max.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(207, 6); + this.label4.Location = new System.Drawing.Point(137, 9); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(87, 27); + this.label4.Size = new System.Drawing.Size(83, 27); this.label4.TabIndex = 106; this.label4.Text = "y(t)-Max:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_bootFeature // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(106, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); - this.label_customerName.TabIndex = 103; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_bootFeature.BackColor = System.Drawing.Color.Transparent; + this.label_bootFeature.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_bootFeature.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_bootFeature.Location = new System.Drawing.Point(350, 9); + this.label_bootFeature.Margin = new System.Windows.Forms.Padding(0); + this.label_bootFeature.Name = "label_bootFeature"; + this.label_bootFeature.Size = new System.Drawing.Size(55, 27); + this.label_bootFeature.TabIndex = 103; + this.label_bootFeature.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label_devModel + // label_min // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(106, 6); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 102; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_min.BackColor = System.Drawing.Color.Transparent; + this.label_min.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_min.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_min.Location = new System.Drawing.Point(74, 9); + this.label_min.Margin = new System.Windows.Forms.Padding(0); + this.label_min.Name = "label_min"; + this.label_min.Size = new System.Drawing.Size(67, 27); + this.label_min.TabIndex = 102; + this.label_min.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(19, 35); + this.label2.Location = new System.Drawing.Point(268, 9); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -125,10 +125,10 @@ // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(22, 6); + this.label9.Location = new System.Drawing.Point(-2, 9); this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(84, 27); + this.label9.Size = new System.Drawing.Size(83, 27); this.label9.TabIndex = 100; this.label9.Text = "y(t)-Min:"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -138,10 +138,10 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_max); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_bootFeature); + this.Controls.Add(this.label_min); this.Controls.Add(this.label2); this.Controls.Add(this.label9); this.Name = "bootFeature"; @@ -154,11 +154,11 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - 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 label9; + public System.Windows.Forms.Label label_max; + public System.Windows.Forms.Label label_bootFeature; + public System.Windows.Forms.Label label_min; } } diff --git a/RbFreqStandMeasure/info/stability.designer.cs b/RbFreqStandMeasure/info/stability.designer.cs index 791a330..9ad5415 100644 --- a/RbFreqStandMeasure/info/stability.designer.cs +++ b/RbFreqStandMeasure/info/stability.designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { this.label_customerName = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_stability = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); @@ -38,31 +38,32 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(197, 91); + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerName.Location = new System.Drawing.Point(195, 110); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; this.label_customerName.Size = new System.Drawing.Size(83, 27); this.label_customerName.TabIndex = 82; + this.label_customerName.Text = "101"; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label_devModel + // label_stability // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(197, 38); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 81; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_stability.BackColor = System.Drawing.Color.Transparent; + this.label_stability.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_stability.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_stability.Location = new System.Drawing.Point(195, 57); + this.label_stability.Margin = new System.Windows.Forms.Padding(0); + this.label_stability.Name = "label_stability"; + this.label_stability.Size = new System.Drawing.Size(67, 27); + this.label_stability.TabIndex = 81; + this.label_stability.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(110, 91); + this.label2.Location = new System.Drawing.Point(109, 110); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -74,7 +75,7 @@ // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(114, 38); + this.label9.Location = new System.Drawing.Point(112, 57); this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(83, 27); @@ -87,7 +88,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_stability); this.Controls.Add(this.label2); this.Controls.Add(this.label9); this.Name = "stability"; @@ -98,8 +99,8 @@ #endregion 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 label9; + public System.Windows.Forms.Label label_stability; } } diff --git a/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs b/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs index bb130f0..f16c7ca 100644 --- a/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs @@ -98,7 +98,6 @@ this.label_z.Name = "label_z"; this.label_z.Size = new System.Drawing.Size(109, 25); this.label_z.TabIndex = 13; - this.label_z.Text = "快锁"; this.label_z.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_y @@ -110,7 +109,6 @@ this.label_y.Name = "label_y"; this.label_y.Size = new System.Drawing.Size(109, 25); this.label_y.TabIndex = 12; - this.label_y.Text = "快锁"; this.label_y.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_x @@ -122,7 +120,6 @@ this.label_x.Name = "label_x"; this.label_x.Size = new System.Drawing.Size(109, 25); this.label_x.TabIndex = 11; - this.label_x.Text = "快锁"; this.label_x.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_lat @@ -134,7 +131,6 @@ this.label_lat.Name = "label_lat"; this.label_lat.Size = new System.Drawing.Size(109, 25); this.label_lat.TabIndex = 10; - this.label_lat.Text = "快锁"; this.label_lat.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_lng @@ -146,7 +142,6 @@ this.label_lng.Name = "label_lng"; this.label_lng.Size = new System.Drawing.Size(109, 25); this.label_lng.TabIndex = 9; - this.label_lng.Text = "快锁"; this.label_lng.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // labelLocation @@ -322,7 +317,6 @@ this.label_mjd.Name = "label_mjd"; this.label_mjd.Size = new System.Drawing.Size(109, 25); this.label_mjd.TabIndex = 8; - this.label_mjd.Text = "快锁"; this.label_mjd.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_time @@ -334,7 +328,6 @@ this.label_time.Name = "label_time"; this.label_time.Size = new System.Drawing.Size(109, 25); this.label_time.TabIndex = 7; - this.label_time.Text = "快锁"; this.label_time.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_date @@ -346,7 +339,6 @@ this.label_date.Name = "label_date"; this.label_date.Size = new System.Drawing.Size(109, 25); this.label_date.TabIndex = 6; - this.label_date.Text = "快锁"; this.label_date.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // labelTime diff --git a/RbFreqStandMeasure/status/StatusCtrlForm.cs b/RbFreqStandMeasure/status/StatusCtrlForm.cs index 68f50a9..43263a2 100644 --- a/RbFreqStandMeasure/status/StatusCtrlForm.cs +++ b/RbFreqStandMeasure/status/StatusCtrlForm.cs @@ -1,4 +1,5 @@ -using System; +using Casic.Birmm.RbFreqStandMeasure.tools; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -18,10 +19,14 @@ InitializeComponent(); statusCtrlForm = this; + //label_date.Text = DateTime.Now.ToString("yyyy-MM-dd"); + //label_time.Text = DateTime.Now.ToString("HH:mm:ss"); + + //panelSite.BackgroundImage = Properties.Resources.地球; coo = new Coordinate(); panelSite.Controls.Add(coo); - coo.Show(); + coo.Show(); } } } diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 77ac28c..fcb7086 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -29,11 +29,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -62,7 +62,7 @@ this.tab_accuracy = new System.Windows.Forms.TabPage(); this.tab_bootFeature = new System.Windows.Forms.TabPage(); this.tab_ageRate = new System.Windows.Forms.TabPage(); - this.tab_count = new System.Windows.Forms.TabPage(); + this.tab_counter = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridView_Data = new System.Windows.Forms.DataGridView(); this.panel1.SuspendLayout(); @@ -161,11 +161,11 @@ // this.label_customerComp.BackColor = System.Drawing.Color.Transparent; this.label_customerComp.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerComp.ForeColor = System.Drawing.Color.Gray; - this.label_customerComp.Location = new System.Drawing.Point(310, 64); + this.label_customerComp.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerComp.Location = new System.Drawing.Point(305, 64); this.label_customerComp.Margin = new System.Windows.Forms.Padding(0); this.label_customerComp.Name = "label_customerComp"; - this.label_customerComp.Size = new System.Drawing.Size(120, 27); + this.label_customerComp.Size = new System.Drawing.Size(112, 27); this.label_customerComp.TabIndex = 80; this.label_customerComp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -173,11 +173,11 @@ // this.label_devCode.BackColor = System.Drawing.Color.Transparent; this.label_devCode.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devCode.ForeColor = System.Drawing.Color.Gray; - this.label_devCode.Location = new System.Drawing.Point(310, 30); + this.label_devCode.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_devCode.Location = new System.Drawing.Point(305, 30); this.label_devCode.Margin = new System.Windows.Forms.Padding(0); this.label_devCode.Name = "label_devCode"; - this.label_devCode.Size = new System.Drawing.Size(120, 27); + this.label_devCode.Size = new System.Drawing.Size(115, 27); this.label_devCode.TabIndex = 79; this.label_devCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -185,11 +185,11 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.Color.Gray; + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; this.label_customerName.Location = new System.Drawing.Point(98, 62); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); + this.label_customerName.Size = new System.Drawing.Size(127, 27); this.label_customerName.TabIndex = 76; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -197,11 +197,11 @@ // 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.Color.Gray; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(98, 30); 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.Size = new System.Drawing.Size(127, 27); this.label_devModel.TabIndex = 75; this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -223,7 +223,7 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label1.Location = new System.Drawing.Point(225, 64); + this.label1.Location = new System.Drawing.Point(221, 64); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(85, 27); @@ -249,7 +249,7 @@ this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label8.Location = new System.Drawing.Point(229, 30); + this.label8.Location = new System.Drawing.Point(224, 30); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(81, 27); @@ -316,14 +316,14 @@ this.dataGridView_times.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_times.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_times.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dataGridView_times.ColumnHeadersHeight = 28; this.dataGridView_times.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_times.GridColor = System.Drawing.Color.White; @@ -331,13 +331,13 @@ this.dataGridView_times.Name = "dataGridView_times"; this.dataGridView_times.RowHeadersVisible = false; this.dataGridView_times.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle12; this.dataGridView_times.RowTemplate.Height = 23; this.dataGridView_times.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView_times.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -366,7 +366,7 @@ this.tabControl1.Controls.Add(this.tab_accuracy); this.tabControl1.Controls.Add(this.tab_bootFeature); this.tabControl1.Controls.Add(this.tab_ageRate); - this.tabControl1.Controls.Add(this.tab_count); + this.tabControl1.Controls.Add(this.tab_counter); this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabControl1.HotTrack = true; this.tabControl1.Location = new System.Drawing.Point(0, 460); @@ -419,15 +419,15 @@ this.tab_ageRate.Text = "日老化率"; this.tab_ageRate.UseVisualStyleBackColor = true; // - // tab_count + // tab_counter // - this.tab_count.Location = new System.Drawing.Point(4, 4); - this.tab_count.Name = "tab_count"; - this.tab_count.Padding = new System.Windows.Forms.Padding(3); - this.tab_count.Size = new System.Drawing.Size(433, 19); - this.tab_count.TabIndex = 4; - this.tab_count.Text = "计数器范围及灵敏度"; - this.tab_count.UseVisualStyleBackColor = true; + this.tab_counter.Location = new System.Drawing.Point(4, 4); + this.tab_counter.Name = "tab_counter"; + this.tab_counter.Padding = new System.Windows.Forms.Padding(3); + this.tab_counter.Size = new System.Drawing.Size(433, 19); + this.tab_counter.TabIndex = 4; + this.tab_counter.Text = "计数器范围及灵敏度"; + this.tab_counter.UseVisualStyleBackColor = true; // // groupBox1 // @@ -449,27 +449,27 @@ this.dataGridView_Data.AllowUserToDeleteRows = false; this.dataGridView_Data.AllowUserToResizeColumns = false; this.dataGridView_Data.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridView_Data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView_Data.BackgroundColor = System.Drawing.Color.White; this.dataGridView_Data.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_Data.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_Data.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dataGridView_Data.ColumnHeadersHeight = 28; this.dataGridView_Data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_Data.GridColor = System.Drawing.Color.White; @@ -479,15 +479,15 @@ this.dataGridView_Data.ReadOnly = true; this.dataGridView_Data.RowHeadersVisible = false; this.dataGridView_Data.RowHeadersWidth = 30; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.NullValue = "-"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.NullValue = "-"; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView_Data.RowTemplate.Height = 26; this.dataGridView_Data.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_Data.Size = new System.Drawing.Size(431, 447); @@ -551,7 +551,7 @@ private System.Windows.Forms.TabPage tab_accuracy; private System.Windows.Forms.TabPage tab_bootFeature; private System.Windows.Forms.TabPage tab_ageRate; - private System.Windows.Forms.TabPage tab_count; + private System.Windows.Forms.TabPage tab_counter; private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index 179389d..caabb86 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -47,9 +47,12 @@ DataTable tableTimes = new DataTable(); DetectionService detectionService = new DetectionServiceImpl(); DetectionItemService detectionItemService = new DetectionItemServiceImpl(); + CounterDataService counterDataService = new CounterDataServiceImpl(); + long deviceId = -1; string startTime = ""; string endTime = ""; + string resultStr = ""; public Action HideMaskAction { @@ -68,10 +71,9 @@ { startTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[0].Cells[3].Value.ToString(); LoadData(deviceId, "1", startTime, endTime); - stability result = new stability(); - result.Show(); - panel_result.Controls.Add(result); + tabPageEvent("tab_stability"); } } @@ -128,6 +130,56 @@ } } + private void LoadData_Counter(long deviceId) + { + tableOriginData = new DataTable(); + + // 设置表格的列 + 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")); + + + // 获取当前页的数据 + List queryList = counterDataService.getList(deviceId, "", "", ""); + if (null != queryList && queryList.Count > 0) + { + int index = 1; + foreach (CounterData counterData in queryList) + { + tableOriginData.Rows.Add(index, counterData.OutValue, counterData.Value, counterData.Sensitivity,counterData.LogTime); + index++; + } + + label_noData.Visible = false; + dataGridView_Data.DataSource = tableOriginData; + + // width=425px + dataGridView_Data.Columns[0].Width = 50; + dataGridView_Data.Columns[1].Width = 100; + dataGridView_Data.Columns[2].Width = 100; + dataGridView_Data.Columns[3].Width = 100; + dataGridView_Data.Columns[4].Width = 120; + + dataGridView_Data.Columns[0].ReadOnly = true; + dataGridView_Data.Columns[1].ReadOnly = true; + dataGridView_Data.Columns[2].ReadOnly = true; + + dataGridView_Data.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; + } + else + { + dataGridView_Data.DataSource = null; + label_noData.Visible = true; + } + } + + + // 检测记录列表 private void LoadTimes(long deviceId) { @@ -140,6 +192,7 @@ tableTimes.Columns.Add("序号", Type.GetType("System.String")); tableTimes.Columns.Add("开始时间", Type.GetType("System.String")); tableTimes.Columns.Add("结束时间", Type.GetType("System.String")); + tableTimes.Columns.Add("result", Type.GetType("System.String")); // 获取当前页的数据 List queryList = detectionItemService.search(deviceId, false); @@ -154,13 +207,15 @@ } label_noTimes.Visible = false; - dataGridView_times.DataSource = tableTimes; + + // width=407px dataGridView_times.Columns[0].Width = 47; dataGridView_times.Columns[1].Width = 180; dataGridView_times.Columns[2].Width = 180; + dataGridView_times.Columns[3].Visible = false; dataGridView_times.Columns[0].ReadOnly = true; @@ -191,6 +246,8 @@ int rowIndex = e.RowIndex; startTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[rowIndex].Cells[3].Value.ToString(); + tabPageEvent(tabControl1.SelectedTab.Name); } @@ -204,6 +261,7 @@ LoadData(deviceId, "1", startTime, endTime); groupBox3.Text = "频率稳定度"; stability result = new stability(); + result.label_stability.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -213,6 +271,7 @@ LoadData(deviceId, "2", startTime, endTime); groupBox3.Text = "频率准确度"; accuracy result = new accuracy(); + result.label_accuracy.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -222,6 +281,7 @@ LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; bootFeature result = new bootFeature(); + result.label_bootFeature.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -231,10 +291,23 @@ LoadData(deviceId, "4", startTime, endTime); groupBox3.Text = "日老化率"; ageRate result = new ageRate(tableOriginData); + if (resultStr.Split(',').Length > 1) + { + result.label_k.Text = resultStr.Split(',')[0]; + result.label_r.Text = resultStr.Split(',')[1]; + } result.Show(); panel_result.Controls.Add(result); break; } + case "tab_counter": + { + LoadData_Counter(deviceId); + groupBox3.Text = "计数器范围及灵敏度"; + //ageRate result = new ageRate(tableOriginData); + //result.Show(); + break; + } default: break; } diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 7c1cfbc..2b0ab6e 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -362,10 +362,10 @@ addDevDlg.StartPosition = FormStartPosition.CenterParent; // 指定窗口弹出在父窗口的中间位置 // 设置默认值 - DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("startTime", true)[0]; + DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("picker_startTime", true)[0]; startTimeInput.Value = DateTime.Now; - DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("endTime", true)[0]; + DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("picker_endTime", true)[0]; endTimeInput.Value = DateTime.Now.AddDays(1); addDevDlg.ShowDialog(); @@ -491,6 +491,7 @@ string devCode = (string)dataGridView_DevList.Rows[rowIndex].Cells[4].Value; AddDevDlg editDlg = new AddDevDlg(); + editDlg.deviceId = Convert.ToInt64(dataGridView_DevList.Rows[rowIndex].Cells[9].Value); editDlg.Controls.Find("labelTitle", true)[0].Text = "修改"; editDlg.Controls.Find("inputDevName", true)[0].Text = devName; editDlg.Controls.Find("inputDevModel", true)[0].Text = devModel; @@ -502,6 +503,7 @@ editDlg.btnSave.Text = "保存"; if (((string)dataGridView_DevList.Rows[rowIndex].Cells[7].Value).Equals("检测中")) { + editDlg.isInDetection = true; DetectionItemService detectionItemService = new DetectionItemServiceImpl(); DetectionItem detectionItem = (detectionItemService.search(id, true))[0]; editDlg.groupBox1.Enabled = false; diff --git a/RbFreqStandMeasure/info/accuracy.designer.cs b/RbFreqStandMeasure/info/accuracy.designer.cs index f60767b..9fe1e3a 100644 --- a/RbFreqStandMeasure/info/accuracy.designer.cs +++ b/RbFreqStandMeasure/info/accuracy.designer.cs @@ -28,23 +28,23 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); + this.label_accuracy = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label_devModel = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // label1 + // label_accuracy // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(206, 110); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 100; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_accuracy.BackColor = System.Drawing.Color.Transparent; + this.label_accuracy.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_accuracy.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_accuracy.Location = new System.Drawing.Point(206, 110); + this.label_accuracy.Margin = new System.Windows.Forms.Padding(0); + this.label_accuracy.Name = "label_accuracy"; + this.label_accuracy.Size = new System.Drawing.Size(83, 27); + this.label_accuracy.TabIndex = 100; + this.label_accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // @@ -62,12 +62,13 @@ // 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.ControlDark; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(206, 61); 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; // // label9 @@ -86,7 +87,7 @@ // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label1); + this.Controls.Add(this.label_accuracy); this.Controls.Add(this.label4); this.Controls.Add(this.label_devModel); this.Controls.Add(this.label9); @@ -97,10 +98,9 @@ } #endregion - - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label9; + public System.Windows.Forms.Label label_accuracy; } } diff --git a/RbFreqStandMeasure/info/ageRate.designer.cs b/RbFreqStandMeasure/info/ageRate.designer.cs index 5780827..e310441 100644 --- a/RbFreqStandMeasure/info/ageRate.designer.cs +++ b/RbFreqStandMeasure/info/ageRate.designer.cs @@ -28,81 +28,77 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_r = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); + this.label_k = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); this.SuspendLayout(); // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 67); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 42); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(402, 176); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 201); this.chart1.TabIndex = 117; this.chart1.Text = "chart1"; // - // label1 + // label_r // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(318, 35); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 116; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_r.BackColor = System.Drawing.Color.Transparent; + this.label_r.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_r.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_r.Location = new System.Drawing.Point(318, 12); + this.label_r.Margin = new System.Windows.Forms.Padding(0); + this.label_r.Name = "label_r"; + this.label_r.Size = new System.Drawing.Size(83, 27); + this.label_r.TabIndex = 116; + this.label_r.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(199, 35); + this.label4.Location = new System.Drawing.Point(213, 12); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(119, 27); + this.label4.Size = new System.Drawing.Size(105, 27); this.label4.TabIndex = 115; this.label4.Text = "相关系数(%):"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_k // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(100, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(57, 27); - this.label_customerName.TabIndex = 114; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_k.BackColor = System.Drawing.Color.Transparent; + this.label_k.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_k.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_k.Location = new System.Drawing.Point(100, 12); + this.label_k.Margin = new System.Windows.Forms.Padding(0); + this.label_k.Name = "label_k"; + this.label_k.Size = new System.Drawing.Size(101, 27); + this.label_k.TabIndex = 114; + this.label_k.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(13, 35); + this.label2.Location = new System.Drawing.Point(13, 12); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -110,67 +106,15 @@ this.label2.Text = "测量结果:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label3 - // - this.label3.BackColor = System.Drawing.Color.Transparent; - this.label3.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label3.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label3.Location = new System.Drawing.Point(318, 8); - this.label3.Margin = new System.Windows.Forms.Padding(0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(83, 27); - this.label3.TabIndex = 119; - this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label5 - // - this.label5.BackColor = System.Drawing.Color.Transparent; - this.label5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label5.Location = new System.Drawing.Point(231, 8); - this.label5.Margin = new System.Windows.Forms.Padding(0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(87, 27); - this.label5.TabIndex = 118; - this.label5.Text = "标准偏差:"; - this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label9 - // - this.label9.BackColor = System.Drawing.Color.Transparent; - this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(17, 8); - this.label9.Margin = new System.Windows.Forms.Padding(0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(83, 27); - this.label9.TabIndex = 111; - this.label9.Text = "预热天数:"; - this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label_devModel - // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(100, 8); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 113; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // ageRate // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label3); - this.Controls.Add(this.label5); this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_r); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_k); this.Controls.Add(this.label2); - this.Controls.Add(this.label9); this.Name = "ageRate"; this.Size = new System.Drawing.Size(405, 246); ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); @@ -181,13 +125,9 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label_customerName; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_r; + public System.Windows.Forms.Label label_k; } } diff --git a/RbFreqStandMeasure/info/bootFeature.designer.cs b/RbFreqStandMeasure/info/bootFeature.designer.cs index 8993819..b0d3d73 100644 --- a/RbFreqStandMeasure/info/bootFeature.designer.cs +++ b/RbFreqStandMeasure/info/bootFeature.designer.cs @@ -28,13 +28,13 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_max = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_bootFeature = new System.Windows.Forms.Label(); + this.label_min = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); @@ -42,78 +42,78 @@ // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 65); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 39); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(399, 178); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + series2.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 204); this.chart1.TabIndex = 110; this.chart1.Text = "chart1"; // - // label1 + // label_max // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(294, 6); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 107; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_max.BackColor = System.Drawing.Color.Transparent; + this.label_max.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_max.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_max.Location = new System.Drawing.Point(214, 9); + this.label_max.Margin = new System.Windows.Forms.Padding(0); + this.label_max.Name = "label_max"; + this.label_max.Size = new System.Drawing.Size(66, 27); + this.label_max.TabIndex = 107; + this.label_max.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(207, 6); + this.label4.Location = new System.Drawing.Point(137, 9); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(87, 27); + this.label4.Size = new System.Drawing.Size(83, 27); this.label4.TabIndex = 106; this.label4.Text = "y(t)-Max:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_bootFeature // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(106, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); - this.label_customerName.TabIndex = 103; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_bootFeature.BackColor = System.Drawing.Color.Transparent; + this.label_bootFeature.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_bootFeature.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_bootFeature.Location = new System.Drawing.Point(350, 9); + this.label_bootFeature.Margin = new System.Windows.Forms.Padding(0); + this.label_bootFeature.Name = "label_bootFeature"; + this.label_bootFeature.Size = new System.Drawing.Size(55, 27); + this.label_bootFeature.TabIndex = 103; + this.label_bootFeature.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label_devModel + // label_min // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(106, 6); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 102; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_min.BackColor = System.Drawing.Color.Transparent; + this.label_min.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_min.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_min.Location = new System.Drawing.Point(74, 9); + this.label_min.Margin = new System.Windows.Forms.Padding(0); + this.label_min.Name = "label_min"; + this.label_min.Size = new System.Drawing.Size(67, 27); + this.label_min.TabIndex = 102; + this.label_min.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(19, 35); + this.label2.Location = new System.Drawing.Point(268, 9); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -125,10 +125,10 @@ // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(22, 6); + this.label9.Location = new System.Drawing.Point(-2, 9); this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(84, 27); + this.label9.Size = new System.Drawing.Size(83, 27); this.label9.TabIndex = 100; this.label9.Text = "y(t)-Min:"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -138,10 +138,10 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_max); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_bootFeature); + this.Controls.Add(this.label_min); this.Controls.Add(this.label2); this.Controls.Add(this.label9); this.Name = "bootFeature"; @@ -154,11 +154,11 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - 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 label9; + public System.Windows.Forms.Label label_max; + public System.Windows.Forms.Label label_bootFeature; + public System.Windows.Forms.Label label_min; } } diff --git a/RbFreqStandMeasure/info/stability.designer.cs b/RbFreqStandMeasure/info/stability.designer.cs index 791a330..9ad5415 100644 --- a/RbFreqStandMeasure/info/stability.designer.cs +++ b/RbFreqStandMeasure/info/stability.designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { this.label_customerName = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_stability = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); @@ -38,31 +38,32 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(197, 91); + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerName.Location = new System.Drawing.Point(195, 110); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; this.label_customerName.Size = new System.Drawing.Size(83, 27); this.label_customerName.TabIndex = 82; + this.label_customerName.Text = "101"; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label_devModel + // label_stability // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(197, 38); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 81; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_stability.BackColor = System.Drawing.Color.Transparent; + this.label_stability.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_stability.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_stability.Location = new System.Drawing.Point(195, 57); + this.label_stability.Margin = new System.Windows.Forms.Padding(0); + this.label_stability.Name = "label_stability"; + this.label_stability.Size = new System.Drawing.Size(67, 27); + this.label_stability.TabIndex = 81; + this.label_stability.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(110, 91); + this.label2.Location = new System.Drawing.Point(109, 110); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -74,7 +75,7 @@ // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(114, 38); + this.label9.Location = new System.Drawing.Point(112, 57); this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(83, 27); @@ -87,7 +88,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_stability); this.Controls.Add(this.label2); this.Controls.Add(this.label9); this.Name = "stability"; @@ -98,8 +99,8 @@ #endregion 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 label9; + public System.Windows.Forms.Label label_stability; } } diff --git a/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs b/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs index bb130f0..f16c7ca 100644 --- a/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs @@ -98,7 +98,6 @@ this.label_z.Name = "label_z"; this.label_z.Size = new System.Drawing.Size(109, 25); this.label_z.TabIndex = 13; - this.label_z.Text = "快锁"; this.label_z.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_y @@ -110,7 +109,6 @@ this.label_y.Name = "label_y"; this.label_y.Size = new System.Drawing.Size(109, 25); this.label_y.TabIndex = 12; - this.label_y.Text = "快锁"; this.label_y.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_x @@ -122,7 +120,6 @@ this.label_x.Name = "label_x"; this.label_x.Size = new System.Drawing.Size(109, 25); this.label_x.TabIndex = 11; - this.label_x.Text = "快锁"; this.label_x.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_lat @@ -134,7 +131,6 @@ this.label_lat.Name = "label_lat"; this.label_lat.Size = new System.Drawing.Size(109, 25); this.label_lat.TabIndex = 10; - this.label_lat.Text = "快锁"; this.label_lat.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_lng @@ -146,7 +142,6 @@ this.label_lng.Name = "label_lng"; this.label_lng.Size = new System.Drawing.Size(109, 25); this.label_lng.TabIndex = 9; - this.label_lng.Text = "快锁"; this.label_lng.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // labelLocation @@ -322,7 +317,6 @@ this.label_mjd.Name = "label_mjd"; this.label_mjd.Size = new System.Drawing.Size(109, 25); this.label_mjd.TabIndex = 8; - this.label_mjd.Text = "快锁"; this.label_mjd.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_time @@ -334,7 +328,6 @@ this.label_time.Name = "label_time"; this.label_time.Size = new System.Drawing.Size(109, 25); this.label_time.TabIndex = 7; - this.label_time.Text = "快锁"; this.label_time.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_date @@ -346,7 +339,6 @@ this.label_date.Name = "label_date"; this.label_date.Size = new System.Drawing.Size(109, 25); this.label_date.TabIndex = 6; - this.label_date.Text = "快锁"; this.label_date.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // labelTime diff --git a/RbFreqStandMeasure/status/StatusCtrlForm.cs b/RbFreqStandMeasure/status/StatusCtrlForm.cs index 68f50a9..43263a2 100644 --- a/RbFreqStandMeasure/status/StatusCtrlForm.cs +++ b/RbFreqStandMeasure/status/StatusCtrlForm.cs @@ -1,4 +1,5 @@ -using System; +using Casic.Birmm.RbFreqStandMeasure.tools; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -18,10 +19,14 @@ InitializeComponent(); statusCtrlForm = this; + //label_date.Text = DateTime.Now.ToString("yyyy-MM-dd"); + //label_time.Text = DateTime.Now.ToString("HH:mm:ss"); + + //panelSite.BackgroundImage = Properties.Resources.地球; coo = new Coordinate(); panelSite.Controls.Add(coo); - coo.Show(); + coo.Show(); } } } diff --git a/RbFreqStandMeasure/tools/DataHelper.cs b/RbFreqStandMeasure/tools/DataHelper.cs index 3d25f18..39cc40b 100644 --- a/RbFreqStandMeasure/tools/DataHelper.cs +++ b/RbFreqStandMeasure/tools/DataHelper.cs @@ -97,12 +97,13 @@ } } catch (Exception ex) - { - MessageBox.Show(ex.Message.ToString()); + { + MessageBox.Show(ex.Message); } } catch (Exception ex) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "数据库备份失败!\r\n" + ex.Message); throw new Exception("数据库备份失败!\r\n" + ex.ToString()); } } diff --git a/RbFreqStandMeasure/App.config b/RbFreqStandMeasure/App.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/App.config +++ b/RbFreqStandMeasure/App.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/DataBackupDlg.cs b/RbFreqStandMeasure/DataBackupDlg.cs index ee52093..af56643 100644 --- a/RbFreqStandMeasure/DataBackupDlg.cs +++ b/RbFreqStandMeasure/DataBackupDlg.cs @@ -48,6 +48,11 @@ } if (rdDataBackup.Checked) { + if (textBoxX1.Text.IndexOf(' ') > -1) + { + MessageBox.Show("保存路径不能有空格,请重新选择!"); + return; + } DataHelper.Backup(textBoxX1.Text); } else if (rdDataRecover.Checked) diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs index 425eef2..86b854e 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/CounterDataServiceImpl.cs @@ -25,7 +25,7 @@ } string sQry = "INSERT INTO r_counter_data (DEVICE_ID, OUT_VALUE, VALUE, SENSITIVITY, LOG_TIME, DETEC_TYPE)" + - "values(@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; + " values (@DEVICE_ID,@OUT_VALUE,@VALUE,@SENSITIVITY,@LOG_TIME,@DETEC_TYPE)"; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); cmd.Parameters.Add("@DEVICE_ID", MySqlDbType.Int64, 20).Value = deviceId; @@ -33,7 +33,7 @@ cmd.Parameters.Add("@VALUE", MySqlDbType.String, 0).Value = value; cmd.Parameters.Add("@SENSITIVITY", MySqlDbType.String, 0).Value = sensitivity; cmd.Parameters.Add("@LOG_TIME", MySqlDbType.DateTime, 0).Value = logTime; - cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.DateTime, 0).Value = detecType; + cmd.Parameters.Add("@DETEC_TYPE", MySqlDbType.String, 0).Value = detecType; cmd.ExecuteNonQuery(); @@ -151,6 +151,7 @@ return iRetval; } + public List getList(long deviceId, string startTime, string endTime, string detecType) { List counterDataList = new List(); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs index ca34a86..7da0d4b 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DetectionItemServiceImpl.cs @@ -116,7 +116,7 @@ if (!counterDetec.Equals("")) sQry = sQry + " COUNTER_DETEC=@COUNTER_DETEC"; - sQry = sQry + " DEVICE_ID = " + deviceId; + sQry = sQry + " where DEVICE_ID = " + deviceId; MySqlCommand cmd = new MySqlCommand(sQry, DbConnectService.mySqlConnect); diff --git a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs index 28451a5..d666fbe 100644 --- a/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs +++ b/RbFreqStandMeasure/R_DataBase/Service/Impl/DeviceServiceImpl.cs @@ -179,14 +179,14 @@ deviceDto.DevTypeName = dictService.getNameByCode("devType", aReader.GetString(3)); } if (!aReader.IsDBNull(4)) deviceDto.DevModel = aReader.GetString(4); - if (!aReader.IsDBNull(5)) deviceDto.CustomerName = aReader.GetString(6); - if (!aReader.IsDBNull(6)) deviceDto.CustomerDev = aReader.GetString(7); - if (!aReader.IsDBNull(7)) + if (!aReader.IsDBNull(6)) deviceDto.CustomerName = aReader.GetString(6); + if (!aReader.IsDBNull(7)) deviceDto.CustomerDev = aReader.GetString(7); + if (!aReader.IsDBNull(8)) { deviceDto.StatusId = aReader.GetString(7); - deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(7)); + deviceDto.StatusName = dictService.getNameByCode("devStatus", aReader.GetString(8)); } - if (!aReader.IsDBNull(8)) deviceDto.Channel = aReader.GetString(8); + if (!aReader.IsDBNull(9)) deviceDto.Channel = aReader.GetString(9); deviceDtoList.Add(deviceDto); } diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 2faf988..2aa0e43 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config index 37001ad..c8b531d 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe.config @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index dafa1d5..dedb841 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -445,7 +445,7 @@ } if (index < 2) output = cyc + "s"; else if (index >= 2 && index < 5) output = cyc * 1000 + "ms"; - else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "μs"; + else if (index >= 5 && index < 8) output = cyc * 1000 * 1000 + "us"; else if (index >= 8) output = cyc * 1000 * 1000 * 1000 + "ns"; } else if (input.Contains("s")) @@ -454,7 +454,7 @@ { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000; } - else if (input.Contains("μs")) + else if (input.Contains("us")) { inputMumberCye = Convert.ToInt32(input.Substring(0, input.Length - 2)) / 1000 / 1000; } @@ -528,24 +528,24 @@ SensitivityContentParam sensitivityContentParam = new SensitivityContentParam(); if (type.Equals("freq")) { - sensitivityContentParam.Freq = row.Cells[5].Value.ToString(); + sensitivityContentParam.Freq = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "0"; } else { - sensitivityContentParam.Period = row.Cells[5].Value.ToString(); + sensitivityContentParam.Period = row.Cells[4].Value.ToString(); sensitivityContentParam.CheckModel = "1"; } int re = sensitivityService.beginTest(type, gPIBService, tcpService, counterCheckParam, ref sensitivityContentParam);//0:成功;-1:失败 - string outValue = ""; - outValue = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; + string value = ""; + value = type.Equals("freq") ? sensitivityContentParam.ReFreq : sensitivityContentParam.RePeriod; if (re == 0) { - counterDataService.add(deviceId, row.Cells[5].Value.ToString(), outValue, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); - row.Cells[5].Value = outValue; + counterDataService.add(deviceId, row.Cells[4].Value.ToString(), value, sensitivityContentParam.VolTage, sensitivityContentParam.CheckTime, typeId); + row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; } } diff --git a/RbFreqStandMeasure/home/HomeCtrlForm.cs b/RbFreqStandMeasure/home/HomeCtrlForm.cs index 1ecae81..5c19f83 100644 --- a/RbFreqStandMeasure/home/HomeCtrlForm.cs +++ b/RbFreqStandMeasure/home/HomeCtrlForm.cs @@ -54,8 +54,8 @@ InitializeComponent(); homeCtrlForm = this; - DetectionHelper.startClockFresh(); - DetectionHelper.startSatelliteFresh(); + //DetectionHelper.startClockFresh(); + //DetectionHelper.startSatelliteFresh(); } private void HomeCtrlForm_Load(object sender, EventArgs e) @@ -141,7 +141,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "联系人", - Location = new Point(440, 0), + Location = new Point(444, 0), Size = new Size(100, 32) }; tableToBeTested.Controls.Add(colCustomName); @@ -156,7 +156,7 @@ BackColor = titleBackColor, AutoSize = false, Text = "送检单位", - Location = new Point(600, 0), + Location = new Point(602, 0), Size = new Size(120, 32) }; tableToBeTested.Controls.Add(colCustomComp); @@ -490,8 +490,8 @@ channelsTable.Columns.Add("devName", Type.GetType("System.String")); channelsTable.Columns.Add("devCode", Type.GetType("System.String")); channelsTable.Columns.Add("customComp", Type.GetType("System.String")); - channelsTable.Columns.Add("startTime", Type.GetType("System.DateTime")); - channelsTable.Columns.Add("endTime", Type.GetType("System.DateTime")); + channelsTable.Columns.Add("startTime", Type.GetType("System.String")); + channelsTable.Columns.Add("endTime", Type.GetType("System.String")); channelsTable.Columns.Add("channelStatus", Type.GetType("System.String")); channelsTable.Columns.Add("startup", Type.GetType("System.String")); channelsTable.Columns.Add("stablility", Type.GetType("System.String")); @@ -513,42 +513,53 @@ channelFreeList.Add("2"); channelFreeList.Add("3"); channelFreeList.Add("4"); - channelFreeList.Add("5"); - - foreach (DeviceView device in listChannelStatus) + channelFreeList.Add("5"); + + if (listChannelStatus != null && listChannelStatus.Count > 0) { - channelFreeList.Remove(device.Channel); - int index = Convert.ToInt32(device.Channel) - 1; - channelsTable.Rows[index]["channelNo"] = device.Channel; - channelsTable.Rows[index]["devName"] = device.DevName; - channelsTable.Rows[index]["devCode"] = device.DevCode; - channelsTable.Rows[index]["customComp"] = device.CustomerDev; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["endTime"] = device.EndTime; - channelsTable.Rows[index]["startTime"] = device.StartTime; - channelsTable.Rows[index]["channelStatus"] = "占用"; - channelsTable.Rows[index]["deviceId"] = device.Id; - if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + foreach (DeviceView device in listChannelStatus) + { + channelFreeList.Remove(device.Channel); + int index = Convert.ToInt32(device.Channel) - 1; + channelsTable.Rows[index]["channelNo"] = device.Channel; + channelsTable.Rows[index]["devName"] = device.DevName; + channelsTable.Rows[index]["devCode"] = device.DevCode; + channelsTable.Rows[index]["customComp"] = device.CustomerDev; + channelsTable.Rows[index]["startTime"] = device.StartTime; + channelsTable.Rows[index]["endTime"] = device.EndTime; + channelsTable.Rows[index]["channelStatus"] = "占用"; + channelsTable.Rows[index]["deviceId"] = device.Id; + if (device.Stability.Equals("-3")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Stability.Equals("-2")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Stability.Equals("-1")) this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_stability_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.Accuracy.Equals("-3")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.Accuracy.Equals("-2")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.Accuracy.Equals("-1")) this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_accuracy_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.AgeRate.Equals("-3")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.AgeRate.Equals("-2")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.AgeRate.Equals("-1")) this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_ageRate_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; - else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; - else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; - else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; + if (device.BootFeature.Equals("-3")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.line; + else if (device.BootFeature.Equals("-2")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_gray; + else if (device.BootFeature.Equals("-1")) this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_orange; + else this.Controls.Find("pic_bootFeature_" + device.Channel, true)[0].BackgroundImage = Properties.Resources.dot_green; - + + } + } + else + { + channelsTable.Rows.Clear(); + channelsTable.Rows.Add("1","","","","","","空闲",""); + channelsTable.Rows.Add("2", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("3", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("4", "", "", "", "", "", "空闲", ""); + channelsTable.Rows.Add("5", "", "", "", "", "", "空闲", ""); } foreach (string no in channelFreeList) @@ -562,7 +573,6 @@ // width=764px dataGridView_Channel.Columns[11].Visible = false; - //dataGridView_Channel.Columns[12].Visible = false; dataGridView_Channel.Columns[0].Width = 50; dataGridView_Channel.Columns[1].Width = 110; dataGridView_Channel.Columns[2].Width = 110; @@ -670,8 +680,12 @@ == DialogResult.Yes) { int deviceId = (int)dataGridView_Channel.Rows[rowIndex].Cells[11].Value; - DateTime startTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[4].Value; - DateTime endTime = (DateTime)dataGridView_Channel.Rows[rowIndex].Cells[5].Value; + DateTime startTime = new DateTime(); + DateTime endTime = new DateTime(); + if (dataGridView_Channel.Rows[rowIndex].Cells[4].Value != null) + { startTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[4].Value); } + if (dataGridView_Channel.Rows[rowIndex].Cells[5].Value != null) + { endTime = Convert.ToDateTime(dataGridView_Channel.Rows[rowIndex].Cells[5].Value); } if (MessageBox.Show("删除之前是否保存此次检测的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs index 2f56540..ef9e744 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.Designer.cs @@ -86,7 +86,7 @@ this.panel1.Controls.Add(this.label3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(637, 32); + this.panel1.Size = new System.Drawing.Size(638, 32); this.panel1.TabIndex = 10; this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // diff --git a/RbFreqStandMeasure/home/SetDevChannelDlg.cs b/RbFreqStandMeasure/home/SetDevChannelDlg.cs index b301b31..42c9457 100644 --- a/RbFreqStandMeasure/home/SetDevChannelDlg.cs +++ b/RbFreqStandMeasure/home/SetDevChannelDlg.cs @@ -5,8 +5,12 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; +using System.Reflection; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -47,6 +51,7 @@ get; set; } + public object SeriralPort { get; private set; } public SetDevChannelDlg(int channelNo) { @@ -83,55 +88,115 @@ private void btnSave_Click(object sender, EventArgs e) { - if (text_devCode.Text.Equals("")) + try { - MessageBox.Show("请选择待检仪器!"); - return; - } - if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) - { - MessageBox.Show("请选择频率稳定度采样时间!"); - return; - } - if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) - { - MessageBox.Show("请选择检测项目!"); - return; - } - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1";} - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + if (text_devCode.Text.Equals("")) + { + MessageBox.Show("请选择待检仪器!"); + return; + } + if (checkBox_stability.Checked && !radio_1s.Checked && !radio_10s.Checked && !radio_20s.Checked && !radio_100s.Checked) + { + MessageBox.Show("请选择频率稳定度采样时间!"); + return; + } + if (!checkBox_accuracy.Checked && !checkBox_stability.Checked && !checkBox_ageRate.Checked && !checkBox_bootFeature.Checked) + { + MessageBox.Show("请选择检测项目!"); + return; + } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + textBox_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + if (port == null) + { + MessageBox.Show("无法打开串口,添加检测失败!"); + return; + } + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if(radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + //开始检测 + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (check_startNow.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); + + this.HideMaskAction(); + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); } + catch (Exception ex) + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测错误:" + ex.Message); - detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, textBox_channelNo.Text); - - this.HideMaskAction(); - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - HomeCtrlForm.homeCtrlForm.LoadDevToBeTested(); - this.HideMaskAction(); + } } private void btn_downChannelList_Click(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/home/SetDevTestDlg.cs b/RbFreqStandMeasure/home/SetDevTestDlg.cs index 164d277..acce89d 100644 --- a/RbFreqStandMeasure/home/SetDevTestDlg.cs +++ b/RbFreqStandMeasure/home/SetDevTestDlg.cs @@ -4,8 +4,11 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; +using Casic.Birmm.RbFreqStandMeasure.Tools; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -79,31 +82,79 @@ string bootFeature = "-3"; string ageRate = "-3"; string interval = ""; - string counterDetec = "-3"; - if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) stability = "-1"; - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = timePicker_startTime.Value; + DateTime endTime = timePicker_endTime.Value; + + //开始检测 if (checkBox_stability.Checked) { + if (radio_1s.Checked) interval = "1"; else if (radio_10s.Checked) interval = "10"; else if (radio_20s.Checked) interval = "20"; else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } - + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || timePicker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + detectionItemService.add(deviceId, timePicker_startTime.Value, timePicker_endTime.Value, stability, accuracy, bootFeature, ageRate, interval, text_channelNo.Text); diff --git a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs index 4f3e7b8..d436f8d 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.Designer.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.Designer.cs @@ -29,7 +29,7 @@ /// private void InitializeComponent() { - this.checkBox_startNow = new System.Windows.Forms.CheckBox(); + this.checkBox_now = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.btnExitDev = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -68,8 +68,8 @@ this.checkBox_bootFeature = new System.Windows.Forms.CheckBox(); this.checkBox_accuracy = new System.Windows.Forms.CheckBox(); this.checkBox_stability = new System.Windows.Forms.CheckBox(); - this.endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); - this.startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_endTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); + this.picker_startTime = new DevComponents.Editors.DateTimeAdv.DateTimeInput(); this.label3 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); @@ -84,23 +84,23 @@ this.panel1.SuspendLayout(); this.groupBox4.SuspendLayout(); this.groupBox1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).BeginInit(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // - // checkBox_startNow + // checkBox_now // - this.checkBox_startNow.AutoSize = true; - this.checkBox_startNow.Enabled = false; - this.checkBox_startNow.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.checkBox_startNow.Location = new System.Drawing.Point(500, 429); - this.checkBox_startNow.Name = "checkBox_startNow"; - this.checkBox_startNow.Size = new System.Drawing.Size(84, 24); - this.checkBox_startNow.TabIndex = 19; - this.checkBox_startNow.Text = "立即开始"; - this.checkBox_startNow.UseVisualStyleBackColor = true; - this.checkBox_startNow.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); + this.checkBox_now.AutoSize = true; + this.checkBox_now.Enabled = false; + this.checkBox_now.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.checkBox_now.Location = new System.Drawing.Point(500, 429); + this.checkBox_now.Name = "checkBox_now"; + this.checkBox_now.Size = new System.Drawing.Size(84, 24); + this.checkBox_now.TabIndex = 19; + this.checkBox_now.Text = "立即开始"; + this.checkBox_now.UseVisualStyleBackColor = true; + this.checkBox_now.CheckedChanged += new System.EventHandler(this.checkBox_startNow_CheckedChanged); // // panel1 // @@ -537,8 +537,8 @@ this.groupBox1.Controls.Add(this.checkBox_bootFeature); this.groupBox1.Controls.Add(this.checkBox_accuracy); this.groupBox1.Controls.Add(this.checkBox_stability); - this.groupBox1.Controls.Add(this.endTime); - this.groupBox1.Controls.Add(this.startTime); + this.groupBox1.Controls.Add(this.picker_endTime); + this.groupBox1.Controls.Add(this.picker_startTime); this.groupBox1.Controls.Add(this.label3); this.groupBox1.Controls.Add(this.label12); this.groupBox1.Controls.Add(this.label13); @@ -595,105 +595,105 @@ this.checkBox_stability.UseVisualStyleBackColor = true; this.checkBox_stability.CheckedChanged += new System.EventHandler(this.checkBox_stability_CheckedChanged); // - // endTime + // picker_endTime // // // // - this.endTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.endTime.ButtonDropDown.Visible = true; - this.endTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.endTime.IsPopupCalendarOpen = false; - this.endTime.Location = new System.Drawing.Point(401, 75); + this.picker_endTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_endTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_endTime.ButtonDropDown.Visible = true; + this.picker_endTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_endTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_endTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_endTime.IsPopupCalendarOpen = false; + this.picker_endTime.Location = new System.Drawing.Point(401, 75); // // // // // // - this.endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.endTime.MonthCalendar.ClearButtonVisible = true; + this.picker_endTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_endTime.MonthCalendar.ClearButtonVisible = true; // // // - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_endTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_endTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.endTime.MonthCalendar.TodayButtonVisible = true; - this.endTime.Name = "endTime"; - this.endTime.ShowUpDown = true; - this.endTime.Size = new System.Drawing.Size(210, 23); - this.endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.endTime.TabIndex = 44; - this.endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_endTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_endTime.MonthCalendar.TodayButtonVisible = true; + this.picker_endTime.Name = "picker_endTime"; + this.picker_endTime.ShowUpDown = true; + this.picker_endTime.Size = new System.Drawing.Size(210, 23); + this.picker_endTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_endTime.TabIndex = 44; + this.picker_endTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // - // startTime + // picker_startTime // // // // - this.startTime.BackgroundStyle.Class = "DateTimeInputBackground"; - this.startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; - this.startTime.ButtonDropDown.Visible = true; - this.startTime.CustomFormat = "yyyy-MM-dd HH:mm"; - this.startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; - this.startTime.IsPopupCalendarOpen = false; - this.startTime.Location = new System.Drawing.Point(107, 75); + this.picker_startTime.BackgroundStyle.Class = "DateTimeInputBackground"; + this.picker_startTime.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.ButtonDropDown.Shortcut = DevComponents.DotNetBar.eShortcut.AltDown; + this.picker_startTime.ButtonDropDown.Visible = true; + this.picker_startTime.CustomFormat = "yyyy-MM-dd HH:mm"; + this.picker_startTime.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.picker_startTime.Format = DevComponents.Editors.eDateTimePickerFormat.Custom; + this.picker_startTime.IsPopupCalendarOpen = false; + this.picker_startTime.Location = new System.Drawing.Point(107, 75); // // // // // // - this.startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); - this.startTime.MonthCalendar.ClearButtonVisible = true; + this.picker_startTime.MonthCalendar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.CalendarDimensions = new System.Drawing.Size(1, 1); + this.picker_startTime.MonthCalendar.ClearButtonVisible = true; // // // - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; - this.startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; - this.startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); - this.startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground2; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.BorderTopWidth = 1; + this.picker_startTime.MonthCalendar.CommandsBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.DisplayMonth = new System.DateTime(2021, 3, 1, 0, 0, 0, 0); + this.picker_startTime.MonthCalendar.FirstDayOfWeek = System.DayOfWeek.Monday; // // // - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; - this.startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.startTime.MonthCalendar.TodayButtonVisible = true; - this.startTime.Name = "startTime"; - this.startTime.ShowUpDown = true; - this.startTime.Size = new System.Drawing.Size(200, 23); - this.startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.startTime.TabIndex = 43; - this.startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorGradientAngle = 90; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.picker_startTime.MonthCalendar.NavigationBackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.picker_startTime.MonthCalendar.TodayButtonVisible = true; + this.picker_startTime.Name = "picker_startTime"; + this.picker_startTime.ShowUpDown = true; + this.picker_startTime.Size = new System.Drawing.Size(200, 23); + this.picker_startTime.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.picker_startTime.TabIndex = 43; + this.picker_startTime.Value = new System.DateTime(2021, 3, 24, 15, 59, 31, 0); // // label3 // @@ -861,7 +861,7 @@ this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox4); - this.Controls.Add(this.checkBox_startNow); + this.Controls.Add(this.checkBox_now); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnCancelSetDev); this.Controls.Add(this.panel1); @@ -874,8 +874,8 @@ this.groupBox4.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.endTime)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.startTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_endTime)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.picker_startTime)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.ResumeLayout(false); @@ -915,9 +915,9 @@ public DevComponents.DotNetBar.Controls.TextBoxX inputDevCode; public DevComponents.DotNetBar.Controls.TextBoxX inputDevName; public DevComponents.DotNetBar.Controls.TextBoxX text_devType; - public System.Windows.Forms.CheckBox checkBox_startNow; - public DevComponents.Editors.DateTimeAdv.DateTimeInput endTime; - public DevComponents.Editors.DateTimeAdv.DateTimeInput startTime; + public System.Windows.Forms.CheckBox checkBox_now; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_endTime; + public DevComponents.Editors.DateTimeAdv.DateTimeInput picker_startTime; public System.Windows.Forms.CheckBox checkBox_ageRate; public System.Windows.Forms.CheckBox checkBox_bootFeature; public System.Windows.Forms.CheckBox checkBox_accuracy; diff --git a/RbFreqStandMeasure/info/AddDevDlg.cs b/RbFreqStandMeasure/info/AddDevDlg.cs index 19169bb..c9fefd1 100644 --- a/RbFreqStandMeasure/info/AddDevDlg.cs +++ b/RbFreqStandMeasure/info/AddDevDlg.cs @@ -5,11 +5,13 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Dto; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service; using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; +using Casic.Birmm.RbFreqStandMeasure.tools; using Casic.Birmm.RbFreqStandMeasure.Tools; using DevComponents.DotNetBar.Controls; using DevComponents.Editors; using System; using System.Collections.Generic; +using System.IO.Ports; using System.Runtime.InteropServices; using System.Threading; using System.Windows.Forms; @@ -40,6 +42,10 @@ CounterDataService counterDataService = new CounterDataServiceImpl(); SensitivityService sensitivityService = new SensitivityServiceImpl(); + + public long deviceId = -1; + public bool isInDetection = false; + public Action HideMaskAction { get; @@ -132,62 +138,112 @@ 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 channelNo = text_channelNo.Text; // 初始化数据访问接口 DeviceService devService = new DeviceServiceImpl(); - + if (labelTitle.Text.Equals("添加")) { - long deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); - if (deviceId != -1) - { - string stability = "-3"; - string accuracy = "-3"; - string bootFeature = "-3"; - string ageRate = "-3"; - string interval = ""; - if (checkBox_startNow.Checked || startTime.Value == DateTime.Now) - { - if (checkBox_stability.Checked) { stability = "-1"; } - if (checkBox_accuracy.Checked) accuracy = "-1"; - if (checkBox_bootFeature.Checked) bootFeature = "-1"; - if (checkBox_ageRate.Checked) ageRate = "-1"; - } - else - { - if (checkBox_stability.Checked) stability = "-2"; - if (checkBox_accuracy.Checked) accuracy = "-2"; - if (checkBox_bootFeature.Checked) bootFeature = "-2"; - if (checkBox_ageRate.Checked) ageRate = "-2"; - } - - if (checkBox_stability.Checked) - { - if (radio_1s.Checked) interval = "1"; - else if (radio_10s.Checked) interval = "10"; - else if (radio_20s.Checked) interval = "20"; - else if (radio_100s.Checked) interval = "100"; - } - detectionItemService.add(deviceId, startTime.Value, endTime.Value, stability, accuracy, bootFeature, ageRate, interval,text_channelNo.Text); - // 重新加载首页的通道状态 - HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); - - // 添加成功,继续保存检测项目和开始时间 - this.HideMaskAction(); - - - } - else + deviceId = devService.add(devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); + if (deviceId == -1) { LogHelper.WriteErrorLog(this.GetType(), "添加仪器[" + devName + "]失败"); + MessageBox.Show("添加仪器[" + devName + "]失败","错误"); } } else if (labelTitle.Text.Equals("修改")) { - + devService.update(deviceId, devName, devCode, devTypeCode, devModel, devCustomComp, devCustomName, channelNo); } + if (deviceId != -1 && !isInDetection) + { + // 打开串口 + DetectionHelper detectionHelper = new DetectionHelper(); + string portName = ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[0]; + int band = Convert.ToInt32(ConfigHelper.GetAppConfig("channel" + text_channelNo.Text).Split(' ')[1]); + SerialPort port = detectionHelper.portOpen(portName, band); + + DateTime startTime = picker_startTime.Value; + DateTime endTime = picker_endTime.Value; + + string stability = "-3"; + string accuracy = "-3"; + string bootFeature = "-3"; + string ageRate = "-3"; + string interval = ""; + + if (checkBox_stability.Checked) + { + + if (radio_1s.Checked) interval = "1"; + else if (radio_10s.Checked) interval = "10"; + else if (radio_20s.Checked) interval = "20"; + else if (radio_100s.Checked) interval = "100"; + + stability = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + stability = "-1"; + detectionHelper.detecStability(deviceId, startTime, interval, port, true); + } + else + { + detectionHelper.detecStability(deviceId, startTime, interval, port, false); + } + + + } + if (checkBox_accuracy.Checked) + { + accuracy = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + accuracy = "-1"; + detectionHelper.detecAccuracy(deviceId, port, endTime, true); + } + else + { + detectionHelper.detecAccuracy(deviceId, port, endTime, false); + } + } + if (checkBox_bootFeature.Checked) + { + bootFeature = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + bootFeature = "-1"; + detectionHelper.detecBootFeature(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecBootFeature(deviceId, startTime, port, false); + } + + } + if (checkBox_ageRate.Checked) + { + ageRate = "-2"; + if (checkBox_now.Checked || picker_startTime.Value == DateTime.Now) + { + ageRate = "-1"; + detectionHelper.detecAgeRate(deviceId, startTime, port, true); + } + else + { + detectionHelper.detecAgeRate(deviceId, startTime, port, false); + } + } + + //开始检测 + + detectionItemService.add(deviceId, startTime, endTime, stability, accuracy, bootFeature, ageRate, interval, channelNo); + // 重新加载首页的通道状态 + HomeCtrlForm.homeCtrlForm.LoadChannelStatus(); + } + + // 添加成功,继续保存检测项目和开始时间 + this.HideMaskAction(); } private void btn_downChannelList_Click(object sender, EventArgs e) @@ -214,7 +270,7 @@ private void checkBox_startNow_CheckedChanged(object sender, EventArgs e) { - startTime.Value = DateTime.Now; + picker_startTime.Value = DateTime.Now; } private void cbBox_devType_SelectedIndexChanged(object sender, EventArgs e) diff --git a/RbFreqStandMeasure/info/DetailDlg.Designer.cs b/RbFreqStandMeasure/info/DetailDlg.Designer.cs index 77ac28c..fcb7086 100644 --- a/RbFreqStandMeasure/info/DetailDlg.Designer.cs +++ b/RbFreqStandMeasure/info/DetailDlg.Designer.cs @@ -29,11 +29,11 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.btnClose = new System.Windows.Forms.Button(); this.labelTitle = new System.Windows.Forms.Label(); @@ -62,7 +62,7 @@ this.tab_accuracy = new System.Windows.Forms.TabPage(); this.tab_bootFeature = new System.Windows.Forms.TabPage(); this.tab_ageRate = new System.Windows.Forms.TabPage(); - this.tab_count = new System.Windows.Forms.TabPage(); + this.tab_counter = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.dataGridView_Data = new System.Windows.Forms.DataGridView(); this.panel1.SuspendLayout(); @@ -161,11 +161,11 @@ // this.label_customerComp.BackColor = System.Drawing.Color.Transparent; this.label_customerComp.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerComp.ForeColor = System.Drawing.Color.Gray; - this.label_customerComp.Location = new System.Drawing.Point(310, 64); + this.label_customerComp.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerComp.Location = new System.Drawing.Point(305, 64); this.label_customerComp.Margin = new System.Windows.Forms.Padding(0); this.label_customerComp.Name = "label_customerComp"; - this.label_customerComp.Size = new System.Drawing.Size(120, 27); + this.label_customerComp.Size = new System.Drawing.Size(112, 27); this.label_customerComp.TabIndex = 80; this.label_customerComp.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -173,11 +173,11 @@ // this.label_devCode.BackColor = System.Drawing.Color.Transparent; this.label_devCode.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_devCode.ForeColor = System.Drawing.Color.Gray; - this.label_devCode.Location = new System.Drawing.Point(310, 30); + this.label_devCode.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_devCode.Location = new System.Drawing.Point(305, 30); this.label_devCode.Margin = new System.Windows.Forms.Padding(0); this.label_devCode.Name = "label_devCode"; - this.label_devCode.Size = new System.Drawing.Size(120, 27); + this.label_devCode.Size = new System.Drawing.Size(115, 27); this.label_devCode.TabIndex = 79; this.label_devCode.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -185,11 +185,11 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.Color.Gray; + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; this.label_customerName.Location = new System.Drawing.Point(98, 62); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); + this.label_customerName.Size = new System.Drawing.Size(127, 27); this.label_customerName.TabIndex = 76; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -197,11 +197,11 @@ // 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.Color.Gray; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(98, 30); 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.Size = new System.Drawing.Size(127, 27); this.label_devModel.TabIndex = 75; this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // @@ -223,7 +223,7 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label1.Location = new System.Drawing.Point(225, 64); + this.label1.Location = new System.Drawing.Point(221, 64); this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(85, 27); @@ -249,7 +249,7 @@ this.label8.BackColor = System.Drawing.Color.Transparent; this.label8.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); this.label8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.label8.Location = new System.Drawing.Point(229, 30); + this.label8.Location = new System.Drawing.Point(224, 30); this.label8.Margin = new System.Windows.Forms.Padding(0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(81, 27); @@ -316,14 +316,14 @@ this.dataGridView_times.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_times.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_times.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_times.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; this.dataGridView_times.ColumnHeadersHeight = 28; this.dataGridView_times.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_times.GridColor = System.Drawing.Color.White; @@ -331,13 +331,13 @@ this.dataGridView_times.Name = "dataGridView_times"; this.dataGridView_times.RowHeadersVisible = false; this.dataGridView_times.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle2.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle12.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.dataGridView_times.RowsDefaultCellStyle = dataGridViewCellStyle12; this.dataGridView_times.RowTemplate.Height = 23; this.dataGridView_times.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView_times.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -366,7 +366,7 @@ this.tabControl1.Controls.Add(this.tab_accuracy); this.tabControl1.Controls.Add(this.tab_bootFeature); this.tabControl1.Controls.Add(this.tab_ageRate); - this.tabControl1.Controls.Add(this.tab_count); + this.tabControl1.Controls.Add(this.tab_counter); this.tabControl1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.tabControl1.HotTrack = true; this.tabControl1.Location = new System.Drawing.Point(0, 460); @@ -419,15 +419,15 @@ this.tab_ageRate.Text = "日老化率"; this.tab_ageRate.UseVisualStyleBackColor = true; // - // tab_count + // tab_counter // - this.tab_count.Location = new System.Drawing.Point(4, 4); - this.tab_count.Name = "tab_count"; - this.tab_count.Padding = new System.Windows.Forms.Padding(3); - this.tab_count.Size = new System.Drawing.Size(433, 19); - this.tab_count.TabIndex = 4; - this.tab_count.Text = "计数器范围及灵敏度"; - this.tab_count.UseVisualStyleBackColor = true; + this.tab_counter.Location = new System.Drawing.Point(4, 4); + this.tab_counter.Name = "tab_counter"; + this.tab_counter.Padding = new System.Windows.Forms.Padding(3); + this.tab_counter.Size = new System.Drawing.Size(433, 19); + this.tab_counter.TabIndex = 4; + this.tab_counter.Text = "计数器范围及灵敏度"; + this.tab_counter.UseVisualStyleBackColor = true; // // groupBox1 // @@ -449,27 +449,27 @@ this.dataGridView_Data.AllowUserToDeleteRows = false; this.dataGridView_Data.AllowUserToResizeColumns = false; this.dataGridView_Data.AllowUserToResizeRows = false; - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle13.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13; this.dataGridView_Data.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView_Data.BackgroundColor = System.Drawing.Color.White; this.dataGridView_Data.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView_Data.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; this.dataGridView_Data.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14; this.dataGridView_Data.ColumnHeadersHeight = 28; this.dataGridView_Data.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridView_Data.GridColor = System.Drawing.Color.White; @@ -479,15 +479,15 @@ this.dataGridView_Data.ReadOnly = true; this.dataGridView_Data.RowHeadersVisible = false; this.dataGridView_Data.RowHeadersWidth = 30; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle5.BackColor = System.Drawing.Color.White; - dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.NullValue = "-"; - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.LightGray; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle15.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.NullValue = "-"; + dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.LightGray; + dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView_Data.RowsDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView_Data.RowTemplate.Height = 26; this.dataGridView_Data.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView_Data.Size = new System.Drawing.Size(431, 447); @@ -551,7 +551,7 @@ private System.Windows.Forms.TabPage tab_accuracy; private System.Windows.Forms.TabPage tab_bootFeature; private System.Windows.Forms.TabPage tab_ageRate; - private System.Windows.Forms.TabPage tab_count; + private System.Windows.Forms.TabPage tab_counter; private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/RbFreqStandMeasure/info/DetailDlg.cs b/RbFreqStandMeasure/info/DetailDlg.cs index 179389d..caabb86 100644 --- a/RbFreqStandMeasure/info/DetailDlg.cs +++ b/RbFreqStandMeasure/info/DetailDlg.cs @@ -47,9 +47,12 @@ DataTable tableTimes = new DataTable(); DetectionService detectionService = new DetectionServiceImpl(); DetectionItemService detectionItemService = new DetectionItemServiceImpl(); + CounterDataService counterDataService = new CounterDataServiceImpl(); + long deviceId = -1; string startTime = ""; string endTime = ""; + string resultStr = ""; public Action HideMaskAction { @@ -68,10 +71,9 @@ { startTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[0].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[0].Cells[3].Value.ToString(); LoadData(deviceId, "1", startTime, endTime); - stability result = new stability(); - result.Show(); - panel_result.Controls.Add(result); + tabPageEvent("tab_stability"); } } @@ -128,6 +130,56 @@ } } + private void LoadData_Counter(long deviceId) + { + tableOriginData = new DataTable(); + + // 设置表格的列 + 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")); + + + // 获取当前页的数据 + List queryList = counterDataService.getList(deviceId, "", "", ""); + if (null != queryList && queryList.Count > 0) + { + int index = 1; + foreach (CounterData counterData in queryList) + { + tableOriginData.Rows.Add(index, counterData.OutValue, counterData.Value, counterData.Sensitivity,counterData.LogTime); + index++; + } + + label_noData.Visible = false; + dataGridView_Data.DataSource = tableOriginData; + + // width=425px + dataGridView_Data.Columns[0].Width = 50; + dataGridView_Data.Columns[1].Width = 100; + dataGridView_Data.Columns[2].Width = 100; + dataGridView_Data.Columns[3].Width = 100; + dataGridView_Data.Columns[4].Width = 120; + + dataGridView_Data.Columns[0].ReadOnly = true; + dataGridView_Data.Columns[1].ReadOnly = true; + dataGridView_Data.Columns[2].ReadOnly = true; + + dataGridView_Data.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable; + dataGridView_Data.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; + } + else + { + dataGridView_Data.DataSource = null; + label_noData.Visible = true; + } + } + + + // 检测记录列表 private void LoadTimes(long deviceId) { @@ -140,6 +192,7 @@ tableTimes.Columns.Add("序号", Type.GetType("System.String")); tableTimes.Columns.Add("开始时间", Type.GetType("System.String")); tableTimes.Columns.Add("结束时间", Type.GetType("System.String")); + tableTimes.Columns.Add("result", Type.GetType("System.String")); // 获取当前页的数据 List queryList = detectionItemService.search(deviceId, false); @@ -154,13 +207,15 @@ } label_noTimes.Visible = false; - dataGridView_times.DataSource = tableTimes; + + // width=407px dataGridView_times.Columns[0].Width = 47; dataGridView_times.Columns[1].Width = 180; dataGridView_times.Columns[2].Width = 180; + dataGridView_times.Columns[3].Visible = false; dataGridView_times.Columns[0].ReadOnly = true; @@ -191,6 +246,8 @@ int rowIndex = e.RowIndex; startTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[1].Value).ToString("yyyy-MM-dd HH:mm:ss"); endTime = Convert.ToDateTime(dataGridView_times.Rows[rowIndex].Cells[2].Value).ToString("yyyy-MM-dd HH:mm:ss"); + resultStr = dataGridView_times.Rows[rowIndex].Cells[3].Value.ToString(); + tabPageEvent(tabControl1.SelectedTab.Name); } @@ -204,6 +261,7 @@ LoadData(deviceId, "1", startTime, endTime); groupBox3.Text = "频率稳定度"; stability result = new stability(); + result.label_stability.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -213,6 +271,7 @@ LoadData(deviceId, "2", startTime, endTime); groupBox3.Text = "频率准确度"; accuracy result = new accuracy(); + result.label_accuracy.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -222,6 +281,7 @@ LoadData(deviceId, "3", startTime, endTime); groupBox3.Text = "开机特性"; bootFeature result = new bootFeature(); + result.label_bootFeature.Text = resultStr; result.Show(); panel_result.Controls.Add(result); break; @@ -231,10 +291,23 @@ LoadData(deviceId, "4", startTime, endTime); groupBox3.Text = "日老化率"; ageRate result = new ageRate(tableOriginData); + if (resultStr.Split(',').Length > 1) + { + result.label_k.Text = resultStr.Split(',')[0]; + result.label_r.Text = resultStr.Split(',')[1]; + } result.Show(); panel_result.Controls.Add(result); break; } + case "tab_counter": + { + LoadData_Counter(deviceId); + groupBox3.Text = "计数器范围及灵敏度"; + //ageRate result = new ageRate(tableOriginData); + //result.Show(); + break; + } default: break; } diff --git a/RbFreqStandMeasure/info/InfoCtrlForm.cs b/RbFreqStandMeasure/info/InfoCtrlForm.cs index 7c1cfbc..2b0ab6e 100644 --- a/RbFreqStandMeasure/info/InfoCtrlForm.cs +++ b/RbFreqStandMeasure/info/InfoCtrlForm.cs @@ -362,10 +362,10 @@ addDevDlg.StartPosition = FormStartPosition.CenterParent; // 指定窗口弹出在父窗口的中间位置 // 设置默认值 - DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("startTime", true)[0]; + DateTimeInput startTimeInput = (DateTimeInput) addDevDlg.Controls.Find("picker_startTime", true)[0]; startTimeInput.Value = DateTime.Now; - DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("endTime", true)[0]; + DateTimeInput endTimeInput = (DateTimeInput)addDevDlg.Controls.Find("picker_endTime", true)[0]; endTimeInput.Value = DateTime.Now.AddDays(1); addDevDlg.ShowDialog(); @@ -491,6 +491,7 @@ string devCode = (string)dataGridView_DevList.Rows[rowIndex].Cells[4].Value; AddDevDlg editDlg = new AddDevDlg(); + editDlg.deviceId = Convert.ToInt64(dataGridView_DevList.Rows[rowIndex].Cells[9].Value); editDlg.Controls.Find("labelTitle", true)[0].Text = "修改"; editDlg.Controls.Find("inputDevName", true)[0].Text = devName; editDlg.Controls.Find("inputDevModel", true)[0].Text = devModel; @@ -502,6 +503,7 @@ editDlg.btnSave.Text = "保存"; if (((string)dataGridView_DevList.Rows[rowIndex].Cells[7].Value).Equals("检测中")) { + editDlg.isInDetection = true; DetectionItemService detectionItemService = new DetectionItemServiceImpl(); DetectionItem detectionItem = (detectionItemService.search(id, true))[0]; editDlg.groupBox1.Enabled = false; diff --git a/RbFreqStandMeasure/info/accuracy.designer.cs b/RbFreqStandMeasure/info/accuracy.designer.cs index f60767b..9fe1e3a 100644 --- a/RbFreqStandMeasure/info/accuracy.designer.cs +++ b/RbFreqStandMeasure/info/accuracy.designer.cs @@ -28,23 +28,23 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); + this.label_accuracy = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label_devModel = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // label1 + // label_accuracy // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(206, 110); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 100; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_accuracy.BackColor = System.Drawing.Color.Transparent; + this.label_accuracy.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_accuracy.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_accuracy.Location = new System.Drawing.Point(206, 110); + this.label_accuracy.Margin = new System.Windows.Forms.Padding(0); + this.label_accuracy.Name = "label_accuracy"; + this.label_accuracy.Size = new System.Drawing.Size(83, 27); + this.label_accuracy.TabIndex = 100; + this.label_accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // @@ -62,12 +62,13 @@ // 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.ControlDark; + this.label_devModel.ForeColor = System.Drawing.SystemColors.GrayText; this.label_devModel.Location = new System.Drawing.Point(206, 61); 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; // // label9 @@ -86,7 +87,7 @@ // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label1); + this.Controls.Add(this.label_accuracy); this.Controls.Add(this.label4); this.Controls.Add(this.label_devModel); this.Controls.Add(this.label9); @@ -97,10 +98,9 @@ } #endregion - - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label_devModel; private System.Windows.Forms.Label label9; + public System.Windows.Forms.Label label_accuracy; } } diff --git a/RbFreqStandMeasure/info/ageRate.designer.cs b/RbFreqStandMeasure/info/ageRate.designer.cs index 5780827..e310441 100644 --- a/RbFreqStandMeasure/info/ageRate.designer.cs +++ b/RbFreqStandMeasure/info/ageRate.designer.cs @@ -28,81 +28,77 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_r = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); + this.label_k = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); this.SuspendLayout(); // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 67); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 42); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(402, 176); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 201); this.chart1.TabIndex = 117; this.chart1.Text = "chart1"; // - // label1 + // label_r // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(318, 35); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 116; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_r.BackColor = System.Drawing.Color.Transparent; + this.label_r.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_r.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_r.Location = new System.Drawing.Point(318, 12); + this.label_r.Margin = new System.Windows.Forms.Padding(0); + this.label_r.Name = "label_r"; + this.label_r.Size = new System.Drawing.Size(83, 27); + this.label_r.TabIndex = 116; + this.label_r.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(199, 35); + this.label4.Location = new System.Drawing.Point(213, 12); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(119, 27); + this.label4.Size = new System.Drawing.Size(105, 27); this.label4.TabIndex = 115; this.label4.Text = "相关系数(%):"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_k // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(100, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(57, 27); - this.label_customerName.TabIndex = 114; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_k.BackColor = System.Drawing.Color.Transparent; + this.label_k.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_k.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_k.Location = new System.Drawing.Point(100, 12); + this.label_k.Margin = new System.Windows.Forms.Padding(0); + this.label_k.Name = "label_k"; + this.label_k.Size = new System.Drawing.Size(101, 27); + this.label_k.TabIndex = 114; + this.label_k.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(13, 35); + this.label2.Location = new System.Drawing.Point(13, 12); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -110,67 +106,15 @@ this.label2.Text = "测量结果:"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label3 - // - this.label3.BackColor = System.Drawing.Color.Transparent; - this.label3.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label3.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label3.Location = new System.Drawing.Point(318, 8); - this.label3.Margin = new System.Windows.Forms.Padding(0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(83, 27); - this.label3.TabIndex = 119; - this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label5 - // - this.label5.BackColor = System.Drawing.Color.Transparent; - this.label5.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label5.Location = new System.Drawing.Point(231, 8); - this.label5.Margin = new System.Windows.Forms.Padding(0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(87, 27); - this.label5.TabIndex = 118; - this.label5.Text = "标准偏差:"; - this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label9 - // - this.label9.BackColor = System.Drawing.Color.Transparent; - this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(17, 8); - this.label9.Margin = new System.Windows.Forms.Padding(0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(83, 27); - this.label9.TabIndex = 111; - this.label9.Text = "预热天数:"; - this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // label_devModel - // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(100, 8); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 113; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // ageRate // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.label3); - this.Controls.Add(this.label5); this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_r); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_k); this.Controls.Add(this.label2); - this.Controls.Add(this.label9); this.Name = "ageRate"; this.Size = new System.Drawing.Size(405, 246); ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); @@ -181,13 +125,9 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label_customerName; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label_devModel; + public System.Windows.Forms.Label label_r; + public System.Windows.Forms.Label label_k; } } diff --git a/RbFreqStandMeasure/info/bootFeature.designer.cs b/RbFreqStandMeasure/info/bootFeature.designer.cs index 8993819..b0d3d73 100644 --- a/RbFreqStandMeasure/info/bootFeature.designer.cs +++ b/RbFreqStandMeasure/info/bootFeature.designer.cs @@ -28,13 +28,13 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); - System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - this.label1 = new System.Windows.Forms.Label(); + this.label_max = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.label_customerName = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_bootFeature = new System.Windows.Forms.Label(); + this.label_min = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); @@ -42,78 +42,78 @@ // // chart1 // - chartArea1.AxisX.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisX.MajorGrid.Enabled = false; - chartArea1.AxisY.LabelAutoFitMaxFontSize = 9; - chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; - chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); - this.chart1.Location = new System.Drawing.Point(3, 65); + chartArea2.AxisX.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisX.MajorGrid.Enabled = false; + chartArea2.AxisY.LabelAutoFitMaxFontSize = 9; + chartArea2.AxisY.MajorGrid.LineColor = System.Drawing.Color.Silver; + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + this.chart1.Location = new System.Drawing.Point(0, 39); this.chart1.Name = "chart1"; - series1.ChartArea = "ChartArea1"; - series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; - series1.IsVisibleInLegend = false; - series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; - series1.Name = "Series1"; - series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(399, 178); + series2.ChartArea = "ChartArea1"; + series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series2.IsVisibleInLegend = false; + series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; + series2.Name = "Series1"; + series2.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(405, 204); this.chart1.TabIndex = 110; this.chart1.Text = "chart1"; // - // label1 + // label_max // - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label1.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label1.Location = new System.Drawing.Point(294, 6); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 27); - this.label1.TabIndex = 107; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_max.BackColor = System.Drawing.Color.Transparent; + this.label_max.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_max.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_max.Location = new System.Drawing.Point(214, 9); + this.label_max.Margin = new System.Windows.Forms.Padding(0); + this.label_max.Name = "label_max"; + this.label_max.Size = new System.Drawing.Size(66, 27); + this.label_max.TabIndex = 107; + this.label_max.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label4 // this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label4.Location = new System.Drawing.Point(207, 6); + this.label4.Location = new System.Drawing.Point(137, 9); this.label4.Margin = new System.Windows.Forms.Padding(0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(87, 27); + this.label4.Size = new System.Drawing.Size(83, 27); this.label4.TabIndex = 106; this.label4.Text = "y(t)-Max:"; this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // - // label_customerName + // label_bootFeature // - this.label_customerName.BackColor = System.Drawing.Color.Transparent; - this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(106, 35); - this.label_customerName.Margin = new System.Windows.Forms.Padding(0); - this.label_customerName.Name = "label_customerName"; - this.label_customerName.Size = new System.Drawing.Size(83, 27); - this.label_customerName.TabIndex = 103; - this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_bootFeature.BackColor = System.Drawing.Color.Transparent; + this.label_bootFeature.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_bootFeature.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_bootFeature.Location = new System.Drawing.Point(350, 9); + this.label_bootFeature.Margin = new System.Windows.Forms.Padding(0); + this.label_bootFeature.Name = "label_bootFeature"; + this.label_bootFeature.Size = new System.Drawing.Size(55, 27); + this.label_bootFeature.TabIndex = 103; + this.label_bootFeature.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label_devModel + // label_min // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(106, 6); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 102; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_min.BackColor = System.Drawing.Color.Transparent; + this.label_min.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_min.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_min.Location = new System.Drawing.Point(74, 9); + this.label_min.Margin = new System.Windows.Forms.Padding(0); + this.label_min.Name = "label_min"; + this.label_min.Size = new System.Drawing.Size(67, 27); + this.label_min.TabIndex = 102; + this.label_min.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(19, 35); + this.label2.Location = new System.Drawing.Point(268, 9); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -125,10 +125,10 @@ // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(22, 6); + this.label9.Location = new System.Drawing.Point(-2, 9); this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(84, 27); + this.label9.Size = new System.Drawing.Size(83, 27); this.label9.TabIndex = 100; this.label9.Text = "y(t)-Min:"; this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -138,10 +138,10 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.chart1); - this.Controls.Add(this.label1); + this.Controls.Add(this.label_max); this.Controls.Add(this.label4); - this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_bootFeature); + this.Controls.Add(this.label_min); this.Controls.Add(this.label2); this.Controls.Add(this.label9); this.Name = "bootFeature"; @@ -154,11 +154,11 @@ #endregion private System.Windows.Forms.DataVisualization.Charting.Chart chart1; - private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label4; - 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 label9; + public System.Windows.Forms.Label label_max; + public System.Windows.Forms.Label label_bootFeature; + public System.Windows.Forms.Label label_min; } } diff --git a/RbFreqStandMeasure/info/stability.designer.cs b/RbFreqStandMeasure/info/stability.designer.cs index 791a330..9ad5415 100644 --- a/RbFreqStandMeasure/info/stability.designer.cs +++ b/RbFreqStandMeasure/info/stability.designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { this.label_customerName = new System.Windows.Forms.Label(); - this.label_devModel = new System.Windows.Forms.Label(); + this.label_stability = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.SuspendLayout(); @@ -38,31 +38,32 @@ // this.label_customerName.BackColor = System.Drawing.Color.Transparent; this.label_customerName.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.label_customerName.ForeColor = System.Drawing.SystemColors.ControlDark; - this.label_customerName.Location = new System.Drawing.Point(197, 91); + this.label_customerName.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_customerName.Location = new System.Drawing.Point(195, 110); this.label_customerName.Margin = new System.Windows.Forms.Padding(0); this.label_customerName.Name = "label_customerName"; this.label_customerName.Size = new System.Drawing.Size(83, 27); this.label_customerName.TabIndex = 82; + this.label_customerName.Text = "101"; this.label_customerName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // label_devModel + // label_stability // - 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.ControlDark; - this.label_devModel.Location = new System.Drawing.Point(197, 38); - this.label_devModel.Margin = new System.Windows.Forms.Padding(0); - this.label_devModel.Name = "label_devModel"; - this.label_devModel.Size = new System.Drawing.Size(67, 27); - this.label_devModel.TabIndex = 81; - this.label_devModel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label_stability.BackColor = System.Drawing.Color.Transparent; + this.label_stability.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.label_stability.ForeColor = System.Drawing.SystemColors.GrayText; + this.label_stability.Location = new System.Drawing.Point(195, 57); + this.label_stability.Margin = new System.Windows.Forms.Padding(0); + this.label_stability.Name = "label_stability"; + this.label_stability.Size = new System.Drawing.Size(67, 27); + this.label_stability.TabIndex = 81; + this.label_stability.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label2 // this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(110, 91); + this.label2.Location = new System.Drawing.Point(109, 110); this.label2.Margin = new System.Windows.Forms.Padding(0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(87, 27); @@ -74,7 +75,7 @@ // this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(114, 38); + this.label9.Location = new System.Drawing.Point(112, 57); this.label9.Margin = new System.Windows.Forms.Padding(0); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(83, 27); @@ -87,7 +88,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.label_customerName); - this.Controls.Add(this.label_devModel); + this.Controls.Add(this.label_stability); this.Controls.Add(this.label2); this.Controls.Add(this.label9); this.Name = "stability"; @@ -98,8 +99,8 @@ #endregion 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 label9; + public System.Windows.Forms.Label label_stability; } } diff --git a/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs b/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs index bb130f0..f16c7ca 100644 --- a/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs +++ b/RbFreqStandMeasure/status/StatusCtrlForm.Designer.cs @@ -98,7 +98,6 @@ this.label_z.Name = "label_z"; this.label_z.Size = new System.Drawing.Size(109, 25); this.label_z.TabIndex = 13; - this.label_z.Text = "快锁"; this.label_z.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_y @@ -110,7 +109,6 @@ this.label_y.Name = "label_y"; this.label_y.Size = new System.Drawing.Size(109, 25); this.label_y.TabIndex = 12; - this.label_y.Text = "快锁"; this.label_y.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_x @@ -122,7 +120,6 @@ this.label_x.Name = "label_x"; this.label_x.Size = new System.Drawing.Size(109, 25); this.label_x.TabIndex = 11; - this.label_x.Text = "快锁"; this.label_x.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_lat @@ -134,7 +131,6 @@ this.label_lat.Name = "label_lat"; this.label_lat.Size = new System.Drawing.Size(109, 25); this.label_lat.TabIndex = 10; - this.label_lat.Text = "快锁"; this.label_lat.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_lng @@ -146,7 +142,6 @@ this.label_lng.Name = "label_lng"; this.label_lng.Size = new System.Drawing.Size(109, 25); this.label_lng.TabIndex = 9; - this.label_lng.Text = "快锁"; this.label_lng.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // labelLocation @@ -322,7 +317,6 @@ this.label_mjd.Name = "label_mjd"; this.label_mjd.Size = new System.Drawing.Size(109, 25); this.label_mjd.TabIndex = 8; - this.label_mjd.Text = "快锁"; this.label_mjd.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_time @@ -334,7 +328,6 @@ this.label_time.Name = "label_time"; this.label_time.Size = new System.Drawing.Size(109, 25); this.label_time.TabIndex = 7; - this.label_time.Text = "快锁"; this.label_time.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // label_date @@ -346,7 +339,6 @@ this.label_date.Name = "label_date"; this.label_date.Size = new System.Drawing.Size(109, 25); this.label_date.TabIndex = 6; - this.label_date.Text = "快锁"; this.label_date.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // labelTime diff --git a/RbFreqStandMeasure/status/StatusCtrlForm.cs b/RbFreqStandMeasure/status/StatusCtrlForm.cs index 68f50a9..43263a2 100644 --- a/RbFreqStandMeasure/status/StatusCtrlForm.cs +++ b/RbFreqStandMeasure/status/StatusCtrlForm.cs @@ -1,4 +1,5 @@ -using System; +using Casic.Birmm.RbFreqStandMeasure.tools; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -18,10 +19,14 @@ InitializeComponent(); statusCtrlForm = this; + //label_date.Text = DateTime.Now.ToString("yyyy-MM-dd"); + //label_time.Text = DateTime.Now.ToString("HH:mm:ss"); + + //panelSite.BackgroundImage = Properties.Resources.地球; coo = new Coordinate(); panelSite.Controls.Add(coo); - coo.Show(); + coo.Show(); } } } diff --git a/RbFreqStandMeasure/tools/DataHelper.cs b/RbFreqStandMeasure/tools/DataHelper.cs index 3d25f18..39cc40b 100644 --- a/RbFreqStandMeasure/tools/DataHelper.cs +++ b/RbFreqStandMeasure/tools/DataHelper.cs @@ -97,12 +97,13 @@ } } catch (Exception ex) - { - MessageBox.Show(ex.Message.ToString()); + { + MessageBox.Show(ex.Message); } } catch (Exception ex) { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "数据库备份失败!\r\n" + ex.Message); throw new Exception("数据库备份失败!\r\n" + ex.ToString()); } } diff --git a/RbFreqStandMeasure/tools/DetectionHelper.cs b/RbFreqStandMeasure/tools/DetectionHelper.cs index 1546de6..1598cf1 100644 --- a/RbFreqStandMeasure/tools/DetectionHelper.cs +++ b/RbFreqStandMeasure/tools/DetectionHelper.cs @@ -16,228 +16,314 @@ namespace Casic.Birmm.RbFreqStandMeasure.tools { - static class DetectionHelper + public class DetectionHelper { - private static System.Threading.Timer timerAccuracy; + private readonly object obj = new object(); + private bool isUsing = false; + + private System.Threading.Timer timerAccuracy; delegate void TimerDelegate(string text); - private static long devIdAccuracy = -1; - private static SerialPort portAccuracy; + private long devIdAccuracy = -1; + private SerialPort portAccuracy; - private static System.Threading.Timer timerStability; - private static long devIdStability = -1; - private static SerialPort portStability; - private static List resultStability = new List(); + private System.Threading.Timer timerStability; + private long devIdStability = -1; + private SerialPort portStability; + private List resultStability = new List(); - private static System.Threading.Timer timerBootFeature; - private static long devIdBootFeature = -1; - private static SerialPort portBootFeature; - private static List resultBootFeature = new List(); + private System.Threading.Timer timerBootFeature; + private long devIdBootFeature = -1; + private SerialPort portBootFeature; + private List resultBootFeature = new List(); - private static System.Threading.Timer timerAgeRate; - private static long devIdAgeRate = -1; - private static SerialPort portAgeRate; - private static List resultAgeRate = new List(); + private System.Threading.Timer timerAgeRate; + private long devIdAgeRate = -1; + private SerialPort portAgeRate; + private List resultAgeRate = new List(); - private static DetectionService detectionService = new DetectionServiceImpl(); - private static DetectionItemService detectionItemService = new DetectionItemServiceImpl(); - private static DeviceService deviceService = new DeviceServiceImpl(); + private DetectionService detectionService = new DetectionServiceImpl(); + private DetectionItemService detectionItemService = new DetectionItemServiceImpl(); + private DeviceService deviceService = new DeviceServiceImpl(); - private static System.Threading.Timer timerClock; + private System.Threading.Timer timerClock; private static System.Threading.Timer timerSatellite; //1-STABILITY,2-ACCURACY,3-BOOT_FEATURE,4-AGE_RATE + public DetectionHelper() + { } - - - public static void detecAccuracy(long deviceId, SerialPort port, DateTime endTime) + #region 检测 + #region 准确度 + public void detecAccuracy(long deviceId, SerialPort port, DateTime endTime, bool isStartNow) { portAccuracy = port; devIdAccuracy = deviceId; - TimeSpan secondSpan = new TimeSpan(endTime.Ticks - DateTime.Now.Ticks); - int delay = secondSpan.Milliseconds; + int delay = 0; + if (!isStartNow) + { + TimeSpan secondSpan = new TimeSpan(endTime.Ticks - DateTime.Now.Ticks); + delay = secondSpan.Milliseconds; + } timerAccuracy = new System.Threading.Timer(exeAccuracy, null, delay + 200 ,60000); } - - private static void exeAccuracy(Object State) + private void exeAccuracy(Object State) { - string result = ""; - double sum = 0.0; - for (int i = 0; i < 3; i++) + while (true) { - string fre = getFrequencyData(portAccuracy); - if (fre.Equals("")) + lock (obj) { - MessageBox.Show("从"+ portAccuracy.PortName + "获取数据失败!"); - return; + if (!isUsing) + { + isUsing = true; + string result = ""; + double sum = 0.0; + for (int i = 0; i < 3; i++) + { + string fre = getFrequencyData(portAccuracy); + if (fre.Equals("")) + { + MessageBox.Show("从" + portAccuracy.PortName + "获取数据失败!"); + return; + } + sum = sum + Convert.ToDouble(fre); + detectionService.add(devIdAccuracy, fre, "2"); + + Thread.Sleep(1000); + } + + result = sum / 3 + ""; + detectionItemService.updateDetecStatus(devIdAccuracy, "", result, "", "", ""); + + deviceService.updateStatus(devIdAccuracy, "3", ""); + timerAccuracy.Dispose(); + isUsing = false; + break; + } } - sum = sum + Convert.ToDouble(fre); - detectionService.add(devIdAccuracy, fre, "2"); - - Thread.Sleep(1000); } - - result = sum / 3 + ""; - detectionItemService.updateDetecStatus(devIdAccuracy, "", result, "", "", ""); - - deviceService.updateStatus(devIdAccuracy, "3", ""); - timerAccuracy.Dispose(); } + #endregion - public static void detecStability(long deviceId, DateTime startTime, string interval, SerialPort port) + #region 稳定度 + public void detecStability(long deviceId, DateTime startTime, string interval, SerialPort port, bool isStartNow) { portStability = port; devIdStability = deviceId; - TimeSpan secondSpan = new TimeSpan(startTime.Ticks - DateTime.Now.Ticks); - int delay = secondSpan.Milliseconds; - timerStability = new System.Threading.Timer(exeStability, null, delay + 100, Convert.ToInt32(interval)); + int delay = 0; + if (!isStartNow) + { + TimeSpan secondSpan = new TimeSpan(startTime.Ticks - DateTime.Now.Ticks); + delay = secondSpan.Milliseconds; + } + timerStability = new System.Threading.Timer(exeStability, null, delay + 100, Convert.ToInt32(interval)*1000); } - private static void exeStability(Object State) + private void exeStability(Object State) { - string result = ""; - - string fre = getFrequencyData(portAccuracy); - if (fre.Equals("")) + while (true) { - MessageBox.Show("从" + portAccuracy.PortName + "获取数据失败!"); - return; - } - resultStability.Add(fre); - - detectionService.add(devIdStability, fre, "1"); - - if (resultStability.Count == 101) - { - result = FreMath.Stable(resultStability) + ""; - - detectionItemService.updateDetecStatus(devIdStability, result, "", "", "", ""); - - List detectionItemList = detectionItemService.search(devIdStability, true); - if (detectionItemList != null && detectionItemList.Count > 0) + lock (obj) { - DetectionItem detectionItem = detectionItemList[0]; - if (!detectionItem.Stability.Equals("-1") && !detectionItem.Accuracy.Equals("-1") && !detectionItem.AgeRate.Equals("-1") && !detectionItem.BootFeature.Equals("-1")) + if (!isUsing) { - deviceService.updateStatus(devIdStability, "3", ""); - } - } - timerStability.Dispose(); - resultStability.Clear(); - } + isUsing = true; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测稳定度"); + string result = ""; + + string fre = getFrequencyData(portStability); + if (fre.Equals("")) + { + MessageBox.Show("从" + portStability.PortName + "获取数据失败!"); + return; + } + resultStability.Add(fre); + + detectionService.add(devIdStability, fre, "1"); + + if (resultStability.Count == 101) + { + result = FreMath.Stable(resultStability) + ""; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "稳定度检测结果:" + result); + + detectionItemService.updateDetecStatus(devIdStability, result, "", "", "", ""); + + List detectionItemList = detectionItemService.search(devIdStability, true); + if (detectionItemList != null && detectionItemList.Count > 0) + { + DetectionItem detectionItem = detectionItemList[0]; + if (!detectionItem.Stability.Equals("-1") && !detectionItem.Accuracy.Equals("-1") && !detectionItem.AgeRate.Equals("-1") && !detectionItem.BootFeature.Equals("-1")) + { + deviceService.updateStatus(devIdStability, "3", ""); + } + } + timerStability.Dispose(); + resultStability.Clear(); + } + isUsing = false; + break; + } + } + } } + #endregion - public static void detecBootFeature(long deviceId, DateTime startTime, SerialPort port) + #region 开机特性 + public void detecBootFeature(long deviceId, DateTime startTime, SerialPort port, bool isStartNow) { portBootFeature = port; devIdBootFeature = deviceId; - TimeSpan secondSpan = new TimeSpan(startTime.Ticks - DateTime.Now.Ticks); - int delay = secondSpan.Milliseconds; + int delay = 0; + if (!isStartNow) + { + TimeSpan secondSpan = new TimeSpan(startTime.Ticks - DateTime.Now.Ticks); + delay = secondSpan.Milliseconds; + } timerBootFeature = new System.Threading.Timer(exeBootFeature, null, delay + 100, 60*60*1000); } - private static void exeBootFeature(Object State) + private void exeBootFeature(Object State) { - string result = ""; - double sum = 0.0; - for(int i = 0; i<3;i++) + while (true) { - string fre = getFrequencyData(portAccuracy); - if (fre.Equals("")) + lock (obj) { - MessageBox.Show("从" + portAccuracy.PortName + "获取数据失败!"); - return; - } - detectionService.add(devIdStability, fre, "3"); - sum = sum + Convert.ToDouble(fre); - } - resultBootFeature.Add(sum / 3 + ""); - - if (resultBootFeature.Count == 8) - { - string max = "0.0"; - string min = "0.0"; - foreach (string fre in resultBootFeature) - { - if (Convert.ToDouble(fre) > Convert.ToDouble(max)) max = fre; - if (Convert.ToDouble(fre) < Convert.ToDouble(min) || min.Equals("0.0")) min = fre; - } - result = (Convert.ToDouble(max) - Convert.ToDouble(min)) + ""; - - detectionItemService.updateDetecStatus(devIdBootFeature, "", "", result, "", ""); - - List detectionItemList = detectionItemService.search(devIdBootFeature, true); - if (detectionItemList != null && detectionItemList.Count > 0) - { - DetectionItem detectionItem = detectionItemList[0]; - if (!detectionItem.Stability.Equals("-1") && !detectionItem.Accuracy.Equals("-1") && !detectionItem.AgeRate.Equals("-1") && !detectionItem.BootFeature.Equals("-1")) + if (!isUsing) { - deviceService.updateStatus(devIdBootFeature, "3", ""); + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测开机特性"); + + isUsing = true; + string result = ""; + double sum = 0.0; + for (int i = 0; i < 3; i++) + { + string fre = getFrequencyData(portBootFeature); + if (fre.Equals("")) + { + MessageBox.Show("从" + portBootFeature.PortName + "获取数据失败!"); + return; + } + detectionService.add(devIdStability, fre, "3"); + sum = sum + Convert.ToDouble(fre); + } + resultBootFeature.Add(sum / 3 + ""); + + if (resultBootFeature.Count == 8) + { + string max = "0.0"; + string min = "0.0"; + foreach (string fre in resultBootFeature) + { + if (Convert.ToDouble(fre) > Convert.ToDouble(max)) max = fre; + if (Convert.ToDouble(fre) < Convert.ToDouble(min) || min.Equals("0.0")) min = fre; + } + result = (Convert.ToDouble(max) - Convert.ToDouble(min)) + ""; + + detectionItemService.updateDetecStatus(devIdBootFeature, "", "", result, "", ""); + + List detectionItemList = detectionItemService.search(devIdBootFeature, true); + if (detectionItemList != null && detectionItemList.Count > 0) + { + DetectionItem detectionItem = detectionItemList[0]; + if (!detectionItem.Stability.Equals("-1") && !detectionItem.Accuracy.Equals("-1") && !detectionItem.AgeRate.Equals("-1") && !detectionItem.BootFeature.Equals("-1")) + { + deviceService.updateStatus(devIdBootFeature, "3", ""); + } + } + timerBootFeature.Dispose(); + resultBootFeature.Clear(); + } + + isUsing = false; + + break; } } - timerBootFeature.Dispose(); - resultBootFeature.Clear(); } } + #endregion - public static void detecAgeRate(long deviceId, DateTime startTime, SerialPort port) + #region 日老化率 + public void detecAgeRate(long deviceId, DateTime startTime, SerialPort port, bool isStartNow) { portAgeRate = port; devIdAgeRate = deviceId; - TimeSpan secondSpan = new TimeSpan(startTime.Ticks - DateTime.Now.Ticks); - int delay = secondSpan.Milliseconds; + int delay = 0; + if (!isStartNow) + { + TimeSpan secondSpan = new TimeSpan(startTime.Ticks - DateTime.Now.Ticks); + delay = secondSpan.Milliseconds; + } timerAgeRate = new System.Threading.Timer(exeAgeRate, null, delay + 100, 12 * 60 * 60 * 1000); } - private static void exeAgeRate(Object State) + private void exeAgeRate(Object State) { - string result = ""; - double sum = 0.0; - for (int i = 0; i < 3; i++) + while (true) { - string fre = getFrequencyData(portAccuracy); - if (fre.Equals("")) + lock (obj) { - MessageBox.Show("从" + portAccuracy.PortName + "获取数据失败!"); - return; - } - detectionService.add(devIdStability, fre, "4"); - sum = sum + Convert.ToDouble(fre); - } - resultAgeRate.Add(sum / 3 + ""); - - if (resultAgeRate.Count == 15) - { - double r = 0.0; - double k= FreMath.DriftRate(resultAgeRate, out r); - result = k + "," + r; - - detectionItemService.updateDetecStatus(devIdAgeRate, "", "","", result, ""); - - List detectionItemList = detectionItemService.search(devIdAgeRate, true); - if (detectionItemList != null && detectionItemList.Count > 0) - { - DetectionItem detectionItem = detectionItemList[0]; - if (!detectionItem.Stability.Equals("-1") && !detectionItem.Accuracy.Equals("-1") && !detectionItem.AgeRate.Equals("-1") && !detectionItem.BootFeature.Equals("-1")) + if (!isUsing) { - deviceService.updateStatus(devIdAgeRate, "3", ""); + isUsing = true; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始检测日老化率"); + + string result = ""; + double sum = 0.0; + for (int i = 0; i < 3; i++) + { + string fre = getFrequencyData(portAgeRate); + if (fre.Equals("")) + { + MessageBox.Show("从" + portAgeRate.PortName + "获取数据失败!"); + return; + } + detectionService.add(devIdStability, fre, "4"); + sum = sum + Convert.ToDouble(fre); + } + resultAgeRate.Add(sum / 3 + ""); + + if (resultAgeRate.Count == 15) + { + double r = 0.0; + double k = FreMath.DriftRate(resultAgeRate, out r); + result = k + "," + r; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "日老化率检测结果:" + result); + + detectionItemService.updateDetecStatus(devIdAgeRate, "", "", "", result, ""); + + List detectionItemList = detectionItemService.search(devIdAgeRate, true); + if (detectionItemList != null && detectionItemList.Count > 0) + { + DetectionItem detectionItem = detectionItemList[0]; + if (!detectionItem.Stability.Equals("-1") && !detectionItem.Accuracy.Equals("-1") && !detectionItem.AgeRate.Equals("-1") && !detectionItem.BootFeature.Equals("-1")) + { + deviceService.updateStatus(devIdAgeRate, "3", ""); + } + } + timerAgeRate.Dispose(); + resultAgeRate.Clear(); + } + isUsing = false; + + break; } } - timerAgeRate.Dispose(); - resultAgeRate.Clear(); } - - } + #endregion + + #endregion - - public static SerialPort portOpen(string portName, int bandRate) + public SerialPort portOpen(string portName, int bandRate) { try { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, portName + " " + bandRate); + SerialPort port = new SerialPort(); // 搜索串口 string[] names = SerialPort.GetPortNames(); @@ -246,7 +332,7 @@ return null; } // 设置串口参数 - port.PortName = names[0]; + port.PortName = portName; port.BaudRate = bandRate; port.Parity = Parity.None; port.DataBits = 8; @@ -259,9 +345,12 @@ if (!port.IsOpen) { port.Open(); + } if (port.IsOpen) { + LogHelper.WriteInfoLog(MethodBase.GetCurrentMethod().DeclaringType, "打开串口成功!"); + return port; } @@ -275,61 +364,90 @@ } // 获取检测数据 - public static string getFrequencyData(SerialPort port) + public string getFrequencyData(SerialPort port) { - string received = ""; - if (ConfigHelper.GetAppConfig("deviceType").ToString().Equals("1")) + //lock(obj) + //isUsing = true; + + try { - int count = 0; - while (count < 5) + if(port.IsOpen)LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "portname:"+port.PortName); + else LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "port closed"); + string received = ""; + if (ConfigHelper.GetAppConfig("deviceType").ToString().Equals("1")) { - int readLen = port.BytesToRead; - if (readLen > 0) + int count = 0; + while (count < 5) { - 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) + int readLen = port.BytesToRead; + if (readLen > 0) { - received = dataArray[0].Replace("$", "") + "." + data.Split(' ')[1].Replace(".", "").TrimEnd('0'); - break; + 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) + { + received = dataArray[0].Replace("$", "") + "." + data.Split(' ')[1].Replace(".", "").TrimEnd('0'); + break; + } } + count++; } - count++; } + else + { + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "开始获取测量值2"); + + int count = 0; + + while (count < 10000) + { + int readLen = port.BytesToRead; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "readLen=" + readLen); + + if (readLen > 0) + { + byte[] buffer = new byte[readLen]; + port.Read(buffer, 0, readLen);// 接收数据到buffer里面 + string data = Encoding.ASCII.GetString(buffer); + string[] dataArray = data.Split(' '); + if (dataArray.Length >= 3) + { + foreach (string sss in dataArray) + { + if (sss.Contains("E")) + { + received = sss; + //received = float.Parse(received)+""; + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "获取测量值2:" + received + ":" + data); + break; + } + } + if (!received.Equals("")) break; + } + } + count++; + } + } + //isUsing = false; + return received; } - else + catch (Exception ex) { - int count = 0; - while (count < 11) - { - int readLen = port.BytesToRead; - if (readLen > 0) - { - byte[] buffer = new byte[readLen]; - port.Read(buffer, 0, readLen);// 接收数据到buffer里面 - string data = Encoding.ASCII.GetString(buffer); - string[] dataArray = data.Split(' '); - if (dataArray.Length == 3) - { - received = dataArray[2]; - break; - } - } - count++; - } + LogHelper.WriteErrorLog(MethodBase.GetCurrentMethod().DeclaringType, "错误:" + ex.Message); + return ""; } - return received; + } // 获取铷钟数据 - public static void startClockFresh() + public void startClockFresh() { timerClock = new System.Threading.Timer(exeClock, null, 50, 60 * 1000); } - public static void exeClock(Object State) + public void exeClock(Object State) { string portName = ConfigHelper.GetAppConfig("clock").Split(' ')[0]; int bandRate = Convert.ToInt32(ConfigHelper.GetAppConfig("clock").Split(' ')[1]); @@ -374,12 +492,12 @@ } // 获取卫星RMC数据 - public static void startSatelliteFresh() + public void startSatelliteFresh() { timerSatellite = new System.Threading.Timer(exeSatellite, null, 50, 60 * 1000); } - public static void exeSatellite(Object State) + public void exeSatellite(Object State) { List gpList = new List(); List bdList = new List(); @@ -533,7 +651,7 @@ } } - private static string getMJD(string ys, string ms, string ds) + private string getMJD(string ys, string ms, string ds) { int y = Convert.ToInt32(ys) - 1900; int m = Convert.ToInt32(ms); @@ -544,7 +662,7 @@ return njdINT+""; } - private static string parseGGA(string ggaStr) + private string parseGGA(string ggaStr) { double f = 1 / 298.257223563; /*基准椭球体的极扁率*/ double a = 6378137.0; /*基准椭球体的长半径*/ @@ -571,7 +689,7 @@ return X + "," + Y + "," + Z; } - private static string parseCoord (string coord, string dir) + private string parseCoord (string coord, string dir) { //$GPGGA,081918.00,3954.7889938,N,11615.5667600,E,1,28,0.68,78.6748,M,-9.7970,M,02,*7D if ( coord.Equals("")) @@ -591,7 +709,7 @@ } return sgn * (Convert.ToDouble(coord.Substring(0, n)) + Convert.ToDouble(coord.Substring(n)) / 60) + ""; } - private static string BLH2XYX (string objectBLH) + private string BLH2XYX (string objectBLH) { // var objectBLH ={l:116.259446,b:39.91314989666667,h:78.6748};//for test // var N = a / Math.sqrt(1 - e2 * Math.sin(objectBLH.b * pi_180) * Math.sin(objectBLH.b * pi_180)); @@ -614,7 +732,7 @@ return X+","+Y+","+Z; } - private static void draw(List gsvList, string type) + private void draw(List gsvList, string type) { foreach (string gsv in gsvList) {