1 根据传感器测量各个数据的量程,对异常数据的范围进行了初步判断
2 设置软件若存在已启动的,则无法再次启动
This commit is contained in:
parent
bc7ea19a6a
commit
84a5587f97
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -91,7 +91,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
|
||||
return openCloseState;
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ADCPIsOpenError:" + ex.Message);
|
||||
EveryDayLog.WriteErrorADCP("ADCPIsOpenError:" + ex.Message);
|
||||
@ -596,7 +596,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
dataReader.Close();
|
||||
dataReader.Dispose();
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ADCPSearchError:" + ex.Message);
|
||||
EveryDayLog.WriteErrorADCP("ADCPSearchError:" + ex.Message);
|
||||
@ -1840,49 +1840,51 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
|
||||
|
||||
#region 异常数据
|
||||
//if (waveHeight < Limit.ADCPWaveHeightMin || waveHeight > Limit.ADCPWaveHeightMax || wavePeriod < Limit.ADCPWavePeriodMin || wavePeriod > Limit.ADCPWavePeriodMax ||
|
||||
// waveLocation < Limit.ADCPWaveLocationMin || waveLocation > Limit.ADCPWaveLocationMax || depth < Limit.ADCPDepthMin || depth > Limit.ADCPDepthMax ||
|
||||
// speed1 < Limit.ADCPSpeed1Min || speed1 > Limit.ADCPSpeed1Max || speed2 < Limit.ADCPSpeed2Min || speed2 > Limit.ADCPSpeed2Max ||
|
||||
// speed3 < Limit.ADCPSpeed3Min || speed3 > Limit.ADCPSpeed3Max || speed4 < Limit.ADCPSpeed4Min || speed4 > Limit.ADCPSpeed4Max ||
|
||||
// speed5 < Limit.ADCPSpeed5Min || speed5 > Limit.ADCPSpeed5Max || direction1 < Limit.ADCPLocation1Min||direction1>Limit.ADCPLocation1Max||
|
||||
// direction2<Limit.ADCPLocation2Min||direction2>Limit.ADCPLocation2Max||direction3<Limit.ADCPLocation3Min||direction3>Limit.ADCPLocation3Max||
|
||||
// direction4<Limit.ADCPLocation4Min||direction4>Limit.ADCPLocation4Max||direction5<Limit.ADCPLocation5Min||direction5>Limit.ADCPLocation5Max)
|
||||
//{
|
||||
// //异常数据
|
||||
// Others.adcpReceiveAbnormalDataTimes++;
|
||||
//waveHeight < Limit.ADCPWaveHeightMin || waveHeight > Limit.ADCPWaveHeightMax ||
|
||||
//depth < Limit.ADCPDepthMin || depth > Limit.ADCPDepthMax ||
|
||||
if (wavePeriod < Limit.ADCPWavePeriodMin || wavePeriod > Limit.ADCPWavePeriodMax ||
|
||||
waveLocation < Limit.ADCPWaveLocationMin || waveLocation > Limit.ADCPWaveLocationMax ||
|
||||
speed1 < Limit.ADCPSpeed1Min || speed1 > Limit.ADCPSpeed1Max || speed2 < Limit.ADCPSpeed2Min || speed2 > Limit.ADCPSpeed2Max ||
|
||||
speed3 < Limit.ADCPSpeed3Min || speed3 > Limit.ADCPSpeed3Max || speed4 < Limit.ADCPSpeed4Min || speed4 > Limit.ADCPSpeed4Max ||
|
||||
speed5 < Limit.ADCPSpeed5Min || speed5 > Limit.ADCPSpeed5Max || direction1 < Limit.ADCPLocation1Min || direction1 > Limit.ADCPLocation1Max ||
|
||||
direction2 < Limit.ADCPLocation2Min || direction2 > Limit.ADCPLocation2Max || direction3 < Limit.ADCPLocation3Min || direction3 > Limit.ADCPLocation3Max ||
|
||||
direction4 < Limit.ADCPLocation4Min || direction4 > Limit.ADCPLocation4Max || direction5 < Limit.ADCPLocation5Min || direction5 > Limit.ADCPLocation5Max)
|
||||
{
|
||||
//异常数据
|
||||
Others.adcpReceiveAbnormalDataTimes++;
|
||||
|
||||
// sqlTime = DateTime.Now;
|
||||
// num1 = 0;
|
||||
// cycleTime = 0;
|
||||
// while (cycleTime < 3)
|
||||
// {
|
||||
// string sqlId = IdHelper.GetId();
|
||||
sqlTime = DateTime.Now;
|
||||
num1 = 0;
|
||||
cycleTime = 0;
|
||||
while (cycleTime < 3)
|
||||
{
|
||||
string sqlId = IdHelper.GetId();
|
||||
|
||||
// string sql = $"insert into tb_adcp_abnormaldata(id,record_time,device_number,speed1,direction1,speed2,direction2,speed3,direction3,speed4,direction4,speed5,direction5,height,period,wavedirection,depth,error_code) " +
|
||||
// $"values('{sqlId}','{sqlTime}','1',FORMAT('{speed1}',2),FORMAT('{direction1}',2),FORMAT('{speed2}',2),FORMAT('{direction2}',2),FORMAT('{speed3}',2),FORMAT('{direction3}',2),FORMAT('{speed4}',2),FORMAT('{direction4}',2)," +
|
||||
// $"FORMAT('{speed5}',2),FORMAT('{direction5}',2),FORMAT('{waveHeight}',2),FORMAT('{wavePeriod}',2),FORMAT('{waveLocation}',2),FORMAT('{depth}',2),'{message}');";
|
||||
// try
|
||||
// {
|
||||
// num1 = MySQL.ExecuteSql(sql);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Console.WriteLine("Insert ADCP Abnormal Data Error:" + ex.Message);
|
||||
// }
|
||||
string sql = $"insert into tb_adcp_abnormaldata(id,record_time,device_number,speed1,direction1,speed2,direction2,speed3,direction3,speed4,direction4,speed5,direction5,height,period,wavedirection,depth,error_code) " +
|
||||
$"values('{sqlId}','{sqlTime}','1',FORMAT('{speed1}',2),FORMAT('{direction1}',2),FORMAT('{speed2}',2),FORMAT('{direction2}',2),FORMAT('{speed3}',2),FORMAT('{direction3}',2),FORMAT('{speed4}',2),FORMAT('{direction4}',2)," +
|
||||
$"FORMAT('{speed5}',2),FORMAT('{direction5}',2),FORMAT('{waveHeight}',2),FORMAT('{wavePeriod}',2),FORMAT('{waveLocation}',2),FORMAT('{depth}',2),'{message}');";
|
||||
try
|
||||
{
|
||||
num1 = MySQL.ExecuteSql(sql);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Insert ADCP Abnormal Data Error:" + ex.Message);
|
||||
}
|
||||
|
||||
// if (num1 > 0)
|
||||
// {
|
||||
// Console.WriteLine("Insert ADCP Abnormal Data Success!" + DateTime.Now);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine("Insert ADCP Abnormal Data Default, Please Reinsert!" + DateTime.Now);
|
||||
// }
|
||||
if (num1 > 0)
|
||||
{
|
||||
Console.WriteLine("Insert ADCP Abnormal Data Success!" + DateTime.Now);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Insert ADCP Abnormal Data Default, Please Reinsert!" + DateTime.Now);
|
||||
}
|
||||
|
||||
// cycleTime++;
|
||||
// Thread.Sleep(1);
|
||||
// }
|
||||
//}
|
||||
cycleTime++;
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
@ -2008,7 +2010,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
|
||||
private void timerChangeDisLink_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if(!Others.isADCPWork)
|
||||
if (!Others.isADCPWork)
|
||||
{
|
||||
CallInvokeUIUpdate("UpdateState", "连接断开");
|
||||
|
||||
@ -2023,16 +2025,16 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
|
||||
private void ADCPDataForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if(clientADCP!=null)
|
||||
if (clientADCP != null)
|
||||
{
|
||||
if(clientADCP.Connected)
|
||||
if (clientADCP.Connected)
|
||||
{
|
||||
clientADCP.Close();
|
||||
clientADCP.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
if (thConnect!=null)
|
||||
if (thConnect != null)
|
||||
{
|
||||
thConnect.Abort();
|
||||
}
|
||||
|
||||
@ -260,34 +260,42 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
// }
|
||||
//}
|
||||
|
||||
string sqlMaxCon = $"select ifnull(max(potency),'') from tb_co2_data {fac} order by record_time desc limit 50;";
|
||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sqlMaxCon);
|
||||
if (dataReader.Read())
|
||||
try
|
||||
{
|
||||
lblMaxCon.Text = (dataReader.GetString(0) == null) ? "" : dataReader.GetString(0).ToString();
|
||||
}
|
||||
string sqlMinCon = $"select ifnull(min(potency),'') from tb_co2_data {fac} order by record_time desc limit 50;";
|
||||
dataReader = MySQL.ExecuteReader(sqlMinCon);
|
||||
if (dataReader.Read())
|
||||
{
|
||||
lblMaxCon.Text = dataReader.GetString(0).ToString();
|
||||
}
|
||||
string sqlMeanCon = $"select ifnull(avg(potency),'') from tb_co2_data {fac} order by record_time desc limit 50;";
|
||||
dataReader = MySQL.ExecuteReader(sqlMeanCon);
|
||||
if (dataReader.Read())
|
||||
{
|
||||
if (dataReader.GetString(0).ToString() == "")
|
||||
string sqlMaxCon = $"select ifnull(max(potency),'') from tb_co2_data {fac} order by record_time desc limit 50;";
|
||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sqlMaxCon);
|
||||
if (dataReader.Read())
|
||||
{
|
||||
lblMeanCon.Text = dataReader.GetString(0).ToString();
|
||||
lblMaxCon.Text = (dataReader.GetString(0) == null) ? "" : dataReader.GetString(0).ToString();
|
||||
}
|
||||
else
|
||||
string sqlMinCon = $"select ifnull(min(potency),'') from tb_co2_data {fac} order by record_time desc limit 50;";
|
||||
dataReader = MySQL.ExecuteReader(sqlMinCon);
|
||||
if (dataReader.Read())
|
||||
{
|
||||
lblMeanCon.Text = dataReader.GetFloat(0).ToString("f2");
|
||||
lblMaxCon.Text = dataReader.GetString(0).ToString();
|
||||
}
|
||||
string sqlMeanCon = $"select ifnull(avg(potency),'') from tb_co2_data {fac} order by record_time desc limit 50;";
|
||||
dataReader = MySQL.ExecuteReader(sqlMeanCon);
|
||||
if (dataReader.Read())
|
||||
{
|
||||
if (dataReader.GetString(0).ToString() == "")
|
||||
{
|
||||
lblMeanCon.Text = dataReader.GetString(0).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
lblMeanCon.Text = dataReader.GetFloat(0).ToString("f2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dataReader.Close();
|
||||
dataReader.Dispose();
|
||||
dataReader.Close();
|
||||
dataReader.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("CO2SearchError:" + ex.Message);
|
||||
EveryDayLog.WriteErrorCO2("CO2SearchError:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1164,43 +1172,43 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
|
||||
|
||||
#region 异常数据
|
||||
//if(pressure<Limit.CO2PressureMin||pressure>Limit.CO2PressureMax)
|
||||
//{
|
||||
// //异常数据
|
||||
// Others.co2ReceiveAbnormalDataTimes++;
|
||||
if (potency < Limit.CO2ConcentrationMin || potency > Limit.CO2ConcentrationMax)
|
||||
{
|
||||
//异常数据
|
||||
Others.co2ReceiveAbnormalDataTimes++;
|
||||
|
||||
// sqlTime = DateTime.Now;
|
||||
// num = 0;
|
||||
// cycleTime = 0;
|
||||
// while (cycleTime < 3)
|
||||
// {
|
||||
// sqlId = IdHelper.GetId();
|
||||
sqlTime = DateTime.Now;
|
||||
num = 0;
|
||||
cycleTime = 0;
|
||||
while (cycleTime < 3)
|
||||
{
|
||||
sqlId = IdHelper.GetId();
|
||||
|
||||
// string sql = $"insert into tb_co2_abnormaldata(id,record_time,pressure,potency,state_code,error_code) " +
|
||||
// $"values('{sqlId}','{sqlTime}',FORMAT('{pressure}',2),FORMAT('{potency}',2),'{state + state1 + state2}','{message}');";
|
||||
// try
|
||||
// {
|
||||
// num = MySQL.ExecuteSql(sql);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Console.WriteLine("Insert CO2 Abnormal Data Error:" + ex.Message);
|
||||
// }
|
||||
string sql = $"insert into tb_co2_abnormaldata(id,record_time,potency,state_code,error_code) " +
|
||||
$"values('{sqlId}','{sqlTime}',FORMAT('{potency}',2),'{state + state1 + state2}','{message}');";
|
||||
try
|
||||
{
|
||||
num = MySQL.ExecuteSql(sql);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Insert CO2 Abnormal Data Error:" + ex.Message);
|
||||
}
|
||||
|
||||
// if (num > 0)
|
||||
// {
|
||||
// Console.WriteLine("Insert CO2 Abnormal Data Success!" + DateTime.Now);
|
||||
// break;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine("Insert CO2 Abnormal Data Default, Please Reinsert!" + DateTime.Now);
|
||||
// }
|
||||
if (num > 0)
|
||||
{
|
||||
Console.WriteLine("Insert CO2 Abnormal Data Success!" + DateTime.Now);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Insert CO2 Abnormal Data Default, Please Reinsert!" + DateTime.Now);
|
||||
}
|
||||
|
||||
// cycleTime++;
|
||||
// Thread.Sleep(1);
|
||||
// }
|
||||
//}
|
||||
cycleTime++;
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@ -544,7 +544,7 @@
|
||||
//
|
||||
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.columnConductivity.DefaultCellStyle = dataGridViewCellStyle5;
|
||||
this.columnConductivity.HeaderText = "电导率 ms/cm";
|
||||
this.columnConductivity.HeaderText = "电导率 mS/cm";
|
||||
this.columnConductivity.Name = "columnConductivity";
|
||||
this.columnConductivity.ReadOnly = true;
|
||||
this.columnConductivity.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
|
||||
@ -1321,47 +1321,48 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
|
||||
|
||||
#region 异常数据
|
||||
//if(temperature<Limit.CTDTemperatureMin||temperature>Limit.CTDTemperatureMax|| pressure<Limit.CTDPressureMin||pressure>Limit.CTDPressureMax||
|
||||
// conductivity<Limit.CTDConductivityMin||conductivity>Limit.CTDConductivityMax)
|
||||
//{
|
||||
// //异常数据
|
||||
// Others.ctdReceiveAbnormalDataTimes++;
|
||||
//pressure < Limit.CTDPressureMin || pressure > Limit.CTDPressureMax ||
|
||||
if (temperature < Limit.CTDTemperatureMin || temperature > Limit.CTDTemperatureMax ||
|
||||
conductivity < Limit.CTDConductivityMin || conductivity > Limit.CTDConductivityMax)
|
||||
{
|
||||
//异常数据
|
||||
Others.ctdReceiveAbnormalDataTimes++;
|
||||
|
||||
// sqlTime = DateTime.Now;
|
||||
// num = 0;
|
||||
// cycleTime = 0;
|
||||
// while (cycleTime < 3)
|
||||
// {
|
||||
// sqlId = IdHelper.GetId();
|
||||
sqlTime = DateTime.Now;
|
||||
num = 0;
|
||||
cycleTime = 0;
|
||||
while (cycleTime < 3)
|
||||
{
|
||||
sqlId = IdHelper.GetId();
|
||||
|
||||
// string sql = $"insert into tb_ctd_abnormaldata(id,record_time,temperature,conductivity,pressure,date,time,error_code) " +
|
||||
// $"values('{sqlId}','{sqlTime}',FORMAT('{temperature}',2),FORMAT('{conductivity}',2),FORMAT('{pressure}',2)" +
|
||||
// $",'{date}','{time}','{message}');";
|
||||
// try
|
||||
// {
|
||||
// num = MySQL.ExecuteSql(sql);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Console.WriteLine("Insert State Abnormal Data Error:" + ex.Message);
|
||||
//EveryDayLog.WriteErrorCTD("Insert State Data Error:" + ex.Message);
|
||||
// }
|
||||
string sql = $"insert into tb_ctd_abnormaldata(id,record_time,temperature,conductivity,pressure,date,time,error_code) " +
|
||||
$"values('{sqlId}','{sqlTime}',FORMAT('{temperature}',2),FORMAT('{conductivity}',2),FORMAT('{pressure}',2)" +
|
||||
$",'{date}','{time}','{message}');";
|
||||
try
|
||||
{
|
||||
num = MySQL.ExecuteSql(sql);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Insert State Abnormal Data Error:" + ex.Message);
|
||||
EveryDayLog.WriteErrorCTD("Insert State Data Error:" + ex.Message);
|
||||
}
|
||||
|
||||
// if (num > 0)
|
||||
// {
|
||||
// Console.WriteLine("Insert State Abnormal Data Success!" + DateTime.Now);
|
||||
// break;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine("Insert State Abnormal Data Default, Please Reinsert!" + DateTime.Now);
|
||||
//EveryDayLog.WriteErrorCTD("Insert State Data Default, Please Reinsert!");
|
||||
// }
|
||||
if (num > 0)
|
||||
{
|
||||
Console.WriteLine("Insert State Abnormal Data Success!" + DateTime.Now);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Insert State Abnormal Data Default, Please Reinsert!" + DateTime.Now);
|
||||
EveryDayLog.WriteErrorCTD("Insert State Data Default, Please Reinsert!");
|
||||
}
|
||||
|
||||
// cycleTime++;
|
||||
// Thread.Sleep(1);
|
||||
// }
|
||||
//}
|
||||
cycleTime++;
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@ -120,23 +120,23 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
public static float YXVoltageVidMin = 0.00f;
|
||||
|
||||
//CTD
|
||||
public static float CTDTemperatureMax = 0.00f;
|
||||
public static float CTDConductivityMax = 0.00f;
|
||||
public static float CTDPressureMax = 0.00f;
|
||||
public static float CTDTemperatureMax = 45.00f;
|
||||
public static float CTDConductivityMax = 70.00f;
|
||||
//public static float CTDPressureMax = 0.00f;
|
||||
|
||||
public static float CTDTemperatureMin = 0.00f;
|
||||
public static float CTDTemperatureMin = -5.00f;
|
||||
public static float CTDConductivityMin = 0.00f;
|
||||
public static float CTDPressureMin = 0.00f;
|
||||
//public static float CTDPressureMin = 0.00f;
|
||||
|
||||
//EXO2
|
||||
public static float EXO2TemperatureMax = 0.00f;
|
||||
public static float EXO2DissolvedOxygenMax = 0.00f;
|
||||
public static float EXO2SalinityMax = 0.00f;
|
||||
public static float EXO2TurbidityMax = 0.00f;
|
||||
public static float EXO2PHMax = 0.00f;
|
||||
public static float EXO2ChlorophyllMax = 0.00f;
|
||||
public static float EXO2TemperatureMax = 50.00f;
|
||||
public static float EXO2DissolvedOxygenMax = 50.00f;
|
||||
public static float EXO2SalinityMax = 7.00f;
|
||||
public static float EXO2TurbidityMax = 4000.00f;
|
||||
public static float EXO2PHMax = 14.00f;
|
||||
public static float EXO2ChlorophyllMax = 400.00f;
|
||||
|
||||
public static float EXO2TemperatureMin = 0.00f;
|
||||
public static float EXO2TemperatureMin = -5.00f;
|
||||
public static float EXO2DissolvedOxygenMin = 0.00f;
|
||||
public static float EXO2SalinityMin = 0.00f;
|
||||
public static float EXO2TurbidityMin = 0.00f;
|
||||
@ -144,41 +144,41 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
public static float EXO2ChlorophyllMin = 0.00f;
|
||||
|
||||
//ADCP
|
||||
public static float ADCPSpeed1Max = 0.00f;
|
||||
public static float ADCPLocation1Max = 0.00f;
|
||||
public static float ADCPSpeed2Max = 0.00f;
|
||||
public static float ADCPLocation2Max = 0.00f;
|
||||
public static float ADCPSpeed3Max = 0.00f;
|
||||
public static float ADCPLocation3Max = 0.00f;
|
||||
public static float ADCPSpeed4Max = 0.00f;
|
||||
public static float ADCPLocation4Max = 0.00f;
|
||||
public static float ADCPSpeed5Max = 0.00f;
|
||||
public static float ADCPLocation5Max = 0.00f;
|
||||
public static float ADCPWaveHeightMax = 0.00f;
|
||||
public static float ADCPWavePeriodMax = 0.00f;
|
||||
public static float ADCPWaveLocationMax = 0.00f;
|
||||
public static float ADCPDepthMax = 0.00f;
|
||||
public static float ADCPSpeed1Max = 20.00f;
|
||||
public static float ADCPLocation1Max = 360.00f;
|
||||
public static float ADCPSpeed2Max = 20.00f;
|
||||
public static float ADCPLocation2Max = 360.00f;
|
||||
public static float ADCPSpeed3Max = 20.00f;
|
||||
public static float ADCPLocation3Max = 360.00f;
|
||||
public static float ADCPSpeed4Max = 20.00f;
|
||||
public static float ADCPLocation4Max = 360.00f;
|
||||
public static float ADCPSpeed5Max = 20.00f;
|
||||
public static float ADCPLocation5Max = 360.00f;
|
||||
//public static float ADCPWaveHeightMax = 0.00f;
|
||||
public static float ADCPWavePeriodMax = 50.00f;
|
||||
public static float ADCPWaveLocationMax = 360.00f;
|
||||
//public static float ADCPDepthMax = 0.00f;
|
||||
|
||||
public static float ADCPSpeed1Min = 0.00f;
|
||||
public static float ADCPSpeed1Min = -20.00f;
|
||||
public static float ADCPLocation1Min = 0.00f;
|
||||
public static float ADCPSpeed2Min = 0.00f;
|
||||
public static float ADCPSpeed2Min = -20.00f;
|
||||
public static float ADCPLocation2Min = 0.00f;
|
||||
public static float ADCPSpeed3Min = 0.00f;
|
||||
public static float ADCPSpeed3Min = -20.00f;
|
||||
public static float ADCPLocation3Min = 0.00f;
|
||||
public static float ADCPSpeed4Min = 0.00f;
|
||||
public static float ADCPSpeed4Min = -20.00f;
|
||||
public static float ADCPLocation4Min = 0.00f;
|
||||
public static float ADCPSpeed5Min = 0.00f;
|
||||
public static float ADCPSpeed5Min = -20.00f;
|
||||
public static float ADCPLocation5Min = 0.00f;
|
||||
public static float ADCPWaveHeightMin = 0.00f;
|
||||
public static float ADCPWavePeriodMin = 0.00f;
|
||||
//public static float ADCPWaveHeightMin = 0.00f;
|
||||
public static float ADCPWavePeriodMin = 1.00f;
|
||||
public static float ADCPWaveLocationMin = 0.00f;
|
||||
public static float ADCPDepthMin = 0.00f;
|
||||
//public static float ADCPDepthMin = 0.00f;
|
||||
|
||||
//CO2
|
||||
public static float CO2PressureMax = 0.00f;
|
||||
//public static float CO2ConcentrationMax = 0.00f;
|
||||
//public static float CO2PressureMax = 0.00f;
|
||||
public static float CO2ConcentrationMax = 1000.00f;
|
||||
|
||||
public static float CO2PressureMin = 0.00f;
|
||||
//public static float CO2ConcentrationMin = 0.00f;
|
||||
//public static float CO2PressureMin = 0.00f;
|
||||
public static float CO2ConcentrationMin = 200.00f;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1489,47 +1489,47 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
|
||||
|
||||
#region 异常数据
|
||||
//if (salinity < Limit.EXO2SalinityMin || salinity > Limit.EXO2SalinityMax || temperature < Limit.EXO2TemperatureMin || temperature > Limit.EXO2TemperatureMax ||
|
||||
// dissolvedoxygen < Limit.EXO2DissolvedOxygenMin || dissolvedoxygen > Limit.EXO2DissolvedOxygenMax || turbidity < Limit.EXO2TurbidityMin || turbidity > Limit.EXO2TurbidityMax ||
|
||||
// chlorophyll < Limit.EXO2ChlorophyllMin || chlorophyll > Limit.EXO2ChlorophyllMax||ph<Limit.EXO2PHMin||ph>Limit.EXO2PHMax)
|
||||
//{
|
||||
// //异常数据
|
||||
// Others.multiReceiveAbnormalDataTimes++;
|
||||
if (salinity < Limit.EXO2SalinityMin || salinity > Limit.EXO2SalinityMax || temperature < Limit.EXO2TemperatureMin || temperature > Limit.EXO2TemperatureMax ||
|
||||
dissolvedoxygen < Limit.EXO2DissolvedOxygenMin || dissolvedoxygen > Limit.EXO2DissolvedOxygenMax || turbidity < Limit.EXO2TurbidityMin || turbidity > Limit.EXO2TurbidityMax ||
|
||||
chlorophyll < Limit.EXO2ChlorophyllMin || chlorophyll > Limit.EXO2ChlorophyllMax || ph < Limit.EXO2PHMin || ph > Limit.EXO2PHMax)
|
||||
{
|
||||
//异常数据
|
||||
Others.multiReceiveAbnormalDataTimes++;
|
||||
|
||||
// sqlTime = DateTime.Now;
|
||||
// num = 0;
|
||||
// cycleTime = 0;
|
||||
// while (cycleTime < 3)
|
||||
// {
|
||||
// sqlId = IdHelper.GetId();
|
||||
sqlTime = DateTime.Now;
|
||||
num = 0;
|
||||
cycleTime = 0;
|
||||
while (cycleTime < 3)
|
||||
{
|
||||
sqlId = IdHelper.GetId();
|
||||
|
||||
// string sql = $"insert into tb_multi_abnormaldata(id,record_time,device_number,water_temperature,dissolved_oxygen,conductivity,turbidity,pH,chlorophyll,error_code) " +
|
||||
// $"values('{sqlId}','{sqlTime}','1',FORMAT('{temperature}',2),FORMAT('{dissolvedoxygen}',2),FORMAT('{salinity}',2),FORMAT('{turbidity}',2),FORMAT('{ph}',2),FORMAT('{chlorophyll}',2),'{message}');";
|
||||
// try
|
||||
// {
|
||||
// num = MySQL.ExecuteSql(sql);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Console.WriteLine("Insert Multi Abnormal Data Error:" + ex.Message);
|
||||
//EveryDayLog.WriteErrorEXO2("Insert Multi Abnormal Data Error:" + ex.Message);
|
||||
// }
|
||||
string sql = $"insert into tb_multi_abnormaldata(id,record_time,device_number,water_temperature,dissolved_oxygen,conductivity,turbidity,pH,chlorophyll,error_code) " +
|
||||
$"values('{sqlId}','{sqlTime}','1',FORMAT('{temperature}',2),FORMAT('{dissolvedoxygen}',2),FORMAT('{salinity}',2),FORMAT('{turbidity}',2),FORMAT('{ph}',2),FORMAT('{chlorophyll}',2),'{message}');";
|
||||
try
|
||||
{
|
||||
num = MySQL.ExecuteSql(sql);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Insert Multi Abnormal Data Error:" + ex.Message);
|
||||
EveryDayLog.WriteErrorEXO2("Insert Multi Abnormal Data Error:" + ex.Message);
|
||||
}
|
||||
|
||||
// if (num > 0)
|
||||
// {
|
||||
// Console.WriteLine("Insert Multi Abnormal Data Success!" + DateTime.Now);
|
||||
// break;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine("Insert Multi Abnormal Data Default, Please Reinsert!" + DateTime.Now);
|
||||
//EveryDayLog.WriteErrorEXO2("Insert Multi Abnormal Data Default, Please Reinsert!");
|
||||
// }
|
||||
if (num > 0)
|
||||
{
|
||||
Console.WriteLine("Insert Multi Abnormal Data Success!" + DateTime.Now);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Insert Multi Abnormal Data Default, Please Reinsert!" + DateTime.Now);
|
||||
EveryDayLog.WriteErrorEXO2("Insert Multi Abnormal Data Default, Please Reinsert!");
|
||||
}
|
||||
|
||||
// cycleTime++;
|
||||
// Thread.Sleep(1);
|
||||
// }
|
||||
//}
|
||||
cycleTime++;
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
@ -14,10 +15,43 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
//Application.Run(new MainForm());
|
||||
LoadingForm.LoadAndRun(new MainForm());
|
||||
//Application.EnableVisualStyles();
|
||||
//Application.SetCompatibleTextRenderingDefault(false);
|
||||
////Application.Run(new MainForm());
|
||||
//LoadingForm.LoadAndRun(new MainForm());
|
||||
|
||||
Process thisProcess = System.Diagnostics.Process.GetCurrentProcess();
|
||||
var arrProcesses = System.Diagnostics.Process.GetProcessesByName(thisProcess.ProcessName);
|
||||
if (arrProcesses.Length > 1)
|
||||
{
|
||||
|
||||
//DialogResult result = MessageBox.Show("检测到进程已启动,是否关闭之前的进程?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
|
||||
//bool isClose = result == DialogResult.OK;
|
||||
//if (isClose)// 确定关闭的场合
|
||||
//{
|
||||
// foreach (System.Diagnostics.Process processItem in arrProcesses)
|
||||
// {
|
||||
// if (processItem.Id != thisProcess.Id)
|
||||
// processItem.Kill();//关闭之前打开的进程
|
||||
|
||||
// Application.EnableVisualStyles();
|
||||
// Application.SetCompatibleTextRenderingDefault(false);
|
||||
// //Application.Run(new MainForm());
|
||||
// LoadingForm.LoadAndRun(new MainForm());
|
||||
// }
|
||||
//}
|
||||
//else// 取消的场合
|
||||
|
||||
EveryDayLog.WriteErrorOther("该软件已启动,无法再次启动!");
|
||||
thisProcess.Kill();// 关闭当前进程
|
||||
}
|
||||
else
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
//Application.Run(new MainForm());
|
||||
LoadingForm.LoadAndRun(new MainForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -425,9 +425,9 @@
|
||||
this.label14.AutoSize = true;
|
||||
this.label14.Location = new System.Drawing.Point(318, 115);
|
||||
this.label14.Name = "label14";
|
||||
this.label14.Size = new System.Drawing.Size(94, 31);
|
||||
this.label14.Size = new System.Drawing.Size(98, 31);
|
||||
this.label14.TabIndex = 35;
|
||||
this.label14.Text = "ms/cm";
|
||||
this.label14.Text = "mS/cm";
|
||||
//
|
||||
// label15
|
||||
//
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user