仅供参考
This commit is contained in:
parent
372e7d30f9
commit
7185fb99e2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -26,6 +26,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathADCP))
|
if (File.Exists(LogPathADCP))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -52,6 +54,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteADCPError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -60,6 +67,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathCO2))
|
if (File.Exists(LogPathCO2))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -86,6 +95,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteCO2Error:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -94,6 +108,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathCTD))
|
if (File.Exists(LogPathCTD))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -120,7 +136,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteCTDError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -129,6 +149,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathDZ))
|
if (File.Exists(LogPathDZ))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -155,6 +177,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteDZError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -163,6 +190,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathGDFL))
|
if (File.Exists(LogPathGDFL))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -189,6 +218,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteGDFLError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -197,6 +231,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathMulti))
|
if (File.Exists(LogPathMulti))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -223,6 +259,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteMultiError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -231,6 +272,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathOther))
|
if (File.Exists(LogPathOther))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -257,6 +300,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteOtherError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -265,6 +313,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathCamAndVid))
|
if (File.Exists(LogPathCamAndVid))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -291,6 +341,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteCamAndVidError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -299,6 +354,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathMQTT))
|
if (File.Exists(LogPathMQTT))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -325,6 +382,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteMQTTError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -333,6 +395,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathErrorDZ))
|
if (File.Exists(LogPathErrorDZ))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -359,6 +423,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteErrorDZError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -367,6 +436,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathErrorGDFL))
|
if (File.Exists(LogPathErrorGDFL))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -393,6 +464,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteErrorGDFLError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -401,6 +477,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathErrorEXO2))
|
if (File.Exists(LogPathErrorEXO2))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -427,6 +505,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteErrorEXO2Error:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -435,6 +518,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathErrorCTD))
|
if (File.Exists(LogPathErrorCTD))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -461,6 +546,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteErrorCTDError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -469,6 +559,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathErrorADCP))
|
if (File.Exists(LogPathErrorADCP))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -495,6 +587,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteErrorADCPError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -503,6 +600,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathErrorCO2))
|
if (File.Exists(LogPathErrorCO2))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -529,6 +628,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteErrorCO2Error:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -537,6 +641,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathErrorCamAndVid))
|
if (File.Exists(LogPathErrorCamAndVid))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -563,6 +669,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteErrorCamAndVidError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@ -571,6 +682,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (File.Exists(LogPathErrorOther))
|
if (File.Exists(LogPathErrorOther))
|
||||||
{
|
{
|
||||||
//追加文件
|
//追加文件
|
||||||
@ -597,6 +710,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("WriteErrorOtherError:" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -725,7 +725,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
private void MqttConnectAsync()
|
private bool MqttConnectAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -748,11 +748,15 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
mqttClient.ApplicationMessageReceivedAsync += MqttClient_ApplicationMessageReceivedAsync;
|
mqttClient.ApplicationMessageReceivedAsync += MqttClient_ApplicationMessageReceivedAsync;
|
||||||
Task task = mqttClient.ConnectAsync(mqttClientOptions, CancellationToken.None);
|
Task task = mqttClient.ConnectAsync(mqttClientOptions, CancellationToken.None);
|
||||||
task.Wait();
|
task.Wait();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Mqtt客户端尝试连接出错:{ex.Message}");
|
Console.WriteLine($"Mqtt客户端尝试连接出错:{ex.Message}");
|
||||||
EveryDayLog.WriteMQTT($"Mqtt客户端尝试连接出错:{ex.Message}");
|
EveryDayLog.WriteMQTT($"Mqtt客户端尝试连接出错:{ex.Message}");
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,15 +798,16 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
|
|
||||||
|
|
||||||
//建立连接
|
//建立连接
|
||||||
public void Connect()
|
public bool Connect()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Server) && Port == 0)
|
if (string.IsNullOrEmpty(Server) && Port == 0)
|
||||||
{
|
{
|
||||||
Console.WriteLine("IP或端口未赋值");
|
Console.WriteLine("IP或端口未赋值");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
MqttConnectAsync();
|
bool result=MqttConnectAsync();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -258,12 +258,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
public string[] GetGDFL()
|
public string[] GetGDFL()
|
||||||
{
|
{
|
||||||
string[] data = new string[6] { "", "", "", "", "", "" };
|
string[] data = new string[6] { "", "", "", "", "", "" };
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string serialnumber = "";
|
string serialnumber = "";
|
||||||
string sql = $"select * from tb_gdflstateinfo_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_gdflstateinfo_data order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
serialnumber = dataReader[5].ToString();
|
serialnumber = dataReader[5].ToString();
|
||||||
@ -328,6 +329,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetGDFLError:" + ex.Message);
|
Console.WriteLine("GetGDFLError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetGDFLError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetGDFLError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!= null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -338,12 +347,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
string[] data = new string[27];
|
string[] data = new string[27];
|
||||||
for (int i = 0; i < data.Length; i++)
|
for (int i = 0; i < data.Length; i++)
|
||||||
data[i] = "";
|
data[i] = "";
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string serialnumber = "";
|
string serialnumber = "";
|
||||||
string sql = $"select * from tb_workstateinfo_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_workstateinfo_data order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
serialnumber = dataReader[5].ToString();
|
serialnumber = dataReader[5].ToString();
|
||||||
@ -601,6 +611,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetDZError:" + ex.Message);
|
Console.WriteLine("GetDZError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetDZError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetDZError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!=null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -612,13 +630,16 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
for (int i = 0; i < data.Length; i++)
|
for (int i = 0; i < data.Length; i++)
|
||||||
data[i] = "";
|
data[i] = "";
|
||||||
|
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
MySqlDataReader dataReaderState = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string serialnumber = "";
|
string serialnumber = "";
|
||||||
string sql = $"select * from tb_outputstateinfo_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_outputstateinfo_data order by record_time desc limit 1;";
|
||||||
string sqlState = $"select * from tb_stateinfo_state where serialnumber!='' order by record_time desc limit 1;";
|
string sqlState = $"select * from tb_stateinfo_state where serialnumber!='' order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
MySqlDataReader dataReaderState = MySQL.ExecuteReader(sqlState);
|
dataReaderState = MySQL.ExecuteReader(sqlState);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
serialnumber = dataReader[5].ToString();
|
serialnumber = dataReader[5].ToString();
|
||||||
@ -945,6 +966,20 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetDZPortStateError:" + ex.Message);
|
Console.WriteLine("GetDZPortStateError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetDZPortStateError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetDZPortStateError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!=null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dataReaderState!=null)
|
||||||
|
{
|
||||||
|
dataReaderState.Close();
|
||||||
|
dataReaderState.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -953,12 +988,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
public string[] GetEXO2Info()
|
public string[] GetEXO2Info()
|
||||||
{
|
{
|
||||||
string[] data = new string[6] { "", "", "", "", "", "" };
|
string[] data = new string[6] { "", "", "", "", "", "" };
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string devicenumber = "";
|
string devicenumber = "";
|
||||||
string sql = $"select * from tb_multi_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_multi_data order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
devicenumber = dataReader[2].ToString();
|
devicenumber = dataReader[2].ToString();
|
||||||
@ -997,6 +1033,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetEXO2InfoError:" + ex.Message);
|
Console.WriteLine("GetEXO2InfoError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetEXO2InfoError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetEXO2InfoError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!=null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -1005,12 +1049,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
public string[] GetEXO2Data()
|
public string[] GetEXO2Data()
|
||||||
{
|
{
|
||||||
string[] data = new string[6] { "", "", "", "", "", "" };
|
string[] data = new string[6] { "", "", "", "", "", "" };
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string devicenumber = "";
|
string devicenumber = "";
|
||||||
string sql = $"select * from tb_multi_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_multi_data order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
devicenumber = dataReader[2].ToString();
|
devicenumber = dataReader[2].ToString();
|
||||||
@ -1096,6 +1141,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetEXO2DataError:" + ex.Message);
|
Console.WriteLine("GetEXO2DataError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetEXO2DataError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetEXO2DataError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!=null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -1104,12 +1157,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
public string[] GetCO2Info()
|
public string[] GetCO2Info()
|
||||||
{
|
{
|
||||||
string[] data = new string[6] { "", "", "", "", "", "" };
|
string[] data = new string[6] { "", "", "", "", "", "" };
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string devicenumber = "";
|
string devicenumber = "";
|
||||||
string sql = $"select * from tb_co2_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_co2_data order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
devicenumber = dataReader[2].ToString();
|
devicenumber = dataReader[2].ToString();
|
||||||
@ -1183,6 +1237,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetCO2InfoError:" + ex.Message);
|
Console.WriteLine("GetCO2InfoError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetCO2InfoError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetCO2InfoError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!=null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -1191,12 +1253,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
public string[] GetCO2Data()
|
public string[] GetCO2Data()
|
||||||
{
|
{
|
||||||
string[] data = new string[1] { "" };
|
string[] data = new string[1] { "" };
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string devicenumber = "";
|
string devicenumber = "";
|
||||||
string sql = $"select * from tb_co2_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_co2_data order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
devicenumber = dataReader[2].ToString();
|
devicenumber = dataReader[2].ToString();
|
||||||
@ -1227,6 +1290,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetCO2DataError:" + ex.Message);
|
Console.WriteLine("GetCO2DataError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetCO2DataError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetCO2DataError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!= null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -1235,12 +1306,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
public string[] GetCTDInfo()
|
public string[] GetCTDInfo()
|
||||||
{
|
{
|
||||||
string[] data = new string[6] { "", "", "", "", "", "" };
|
string[] data = new string[6] { "", "", "", "", "", "" };
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string devicenumber = "";
|
string devicenumber = "";
|
||||||
string sql = $"select * from tb_ctd_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_ctd_data order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
devicenumber = dataReader[2].ToString();
|
devicenumber = dataReader[2].ToString();
|
||||||
@ -1279,6 +1351,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetCTDInfoError:" + ex.Message);
|
Console.WriteLine("GetCTDInfoError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetCTDInfoError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetCTDInfoError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!=null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -1287,12 +1367,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
public string[] GetCTDData()
|
public string[] GetCTDData()
|
||||||
{
|
{
|
||||||
string[] data = new string[3] { "", "", "" };
|
string[] data = new string[3] { "", "", "" };
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string devicenumber = "";
|
string devicenumber = "";
|
||||||
string sql = $"select * from tb_ctd_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_ctd_data order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
devicenumber = dataReader[2].ToString();
|
devicenumber = dataReader[2].ToString();
|
||||||
@ -1345,6 +1426,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetCTDDataError:" + ex.Message);
|
Console.WriteLine("GetCTDDataError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetCTDDataError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetCTDDataError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!=null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -1353,12 +1442,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
public string[] GetADCPInfo()
|
public string[] GetADCPInfo()
|
||||||
{
|
{
|
||||||
string[] data = new string[6] { "", "", "", "", "", "" };
|
string[] data = new string[6] { "", "", "", "", "", "" };
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string devicenumber = "";
|
string devicenumber = "";
|
||||||
string sql = $"select * from tb_adcp_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_adcp_data order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
devicenumber = dataReader[2].ToString();
|
devicenumber = dataReader[2].ToString();
|
||||||
@ -1397,6 +1487,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetADCPInfoError:" + ex.Message);
|
Console.WriteLine("GetADCPInfoError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetADCPInfoError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetADCPInfoError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!=null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -1408,11 +1506,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
for (int i = 0; i < data.Length; i++)
|
for (int i = 0; i < data.Length; i++)
|
||||||
data[i] = "";
|
data[i] = "";
|
||||||
|
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string devicenumber = "";
|
string devicenumber = "";
|
||||||
string sql = $"select * from tb_adcp_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_adcp_data order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
devicenumber = dataReader[2].ToString();
|
devicenumber = dataReader[2].ToString();
|
||||||
@ -1586,6 +1686,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetADCPDataError:" + ex.Message);
|
Console.WriteLine("GetADCPDataError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetADCPDataError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetADCPDataError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!=null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -1594,12 +1702,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
public string[] GetYX()
|
public string[] GetYX()
|
||||||
{
|
{
|
||||||
string[] data = new string[10] { "", "", "", "", "", "", "", "", "", "" };
|
string[] data = new string[10] { "", "", "", "", "", "", "", "", "", "" };
|
||||||
|
MySqlDataReader dataReader = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string serialnumber = "";
|
string serialnumber = "";
|
||||||
string sql = $"select * from tb_camandvid_data order by record_time desc limit 1;";
|
string sql = $"select * from tb_camandvid_data order by record_time desc limit 1;";
|
||||||
MySqlDataReader dataReader = MySQL.ExecuteReader(sql);
|
dataReader = MySQL.ExecuteReader(sql);
|
||||||
if (dataReader.Read())
|
if (dataReader.Read())
|
||||||
{
|
{
|
||||||
serialnumber = dataReader[2].ToString();
|
serialnumber = dataReader[2].ToString();
|
||||||
@ -1759,6 +1868,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
Console.WriteLine("GetGDFLError:" + ex.Message);
|
Console.WriteLine("GetGDFLError:" + ex.Message);
|
||||||
EveryDayLog.WriteMQTT("GetGDFLError:" + ex.Message);
|
EveryDayLog.WriteMQTT("GetGDFLError:" + ex.Message);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if(dataReader!=null)
|
||||||
|
{
|
||||||
|
dataReader.Close();
|
||||||
|
dataReader.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ using Google.Protobuf.WellKnownTypes;
|
|||||||
using Gst;
|
using Gst;
|
||||||
using Gst.Base;
|
using Gst.Base;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
|
using MySqlX.XDevAPI.Common;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Org.BouncyCastle.Utilities;
|
using Org.BouncyCastle.Utilities;
|
||||||
using Pango;
|
using Pango;
|
||||||
@ -212,7 +213,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
public static RelayControlForm relayControlForm = new RelayControlForm();
|
public static RelayControlForm relayControlForm = new RelayControlForm();
|
||||||
public static OutputStatusInfoDataForm outputStatusInfoDataForm = new OutputStatusInfoDataForm();
|
public static OutputStatusInfoDataForm outputStatusInfoDataForm = new OutputStatusInfoDataForm();
|
||||||
public static OtherSettingForm otherSettingForm = new OtherSettingForm();
|
public static OtherSettingForm otherSettingForm = new OtherSettingForm();
|
||||||
PhotoelectricSeparationDataForm photoelectricSeparationDataForm = new PhotoelectricSeparationDataForm();
|
public static PhotoelectricSeparationDataForm photoelectricSeparationDataForm = new PhotoelectricSeparationDataForm();
|
||||||
public static OutputPortStateData outputPortStateData = new OutputPortStateData();
|
public static OutputPortStateData outputPortStateData = new OutputPortStateData();
|
||||||
|
|
||||||
|
|
||||||
@ -478,11 +479,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
EveryDayLog.WriteOther("定时器(生成化学数据记录小时级)已开启!");
|
EveryDayLog.WriteOther("定时器(生成化学数据记录小时级)已开启!");
|
||||||
Console.WriteLine("定时器(生成化学数据记录小时级)已开启!");
|
Console.WriteLine("定时器(生成化学数据记录小时级)已开启!");
|
||||||
|
|
||||||
timerSendNorth.Enabled = true;
|
//timerSendNorth.Enabled = true;
|
||||||
timerSendNorth.Interval = 60 * 1000;
|
//timerSendNorth.Interval = 60 * 1000;
|
||||||
timerSendNorth.Start();
|
//timerSendNorth.Start();
|
||||||
EveryDayLog.WriteOther("定时器(常规水下设备信息上报)已开启!");
|
//EveryDayLog.WriteOther("定时器(常规水下设备信息上报)已开启!");
|
||||||
Console.WriteLine("定时器(常规水下设备信息上报)已开启!");
|
//Console.WriteLine("定时器(常规水下设备信息上报)已开启!");
|
||||||
|
|
||||||
////var watch = Stopwatch.StartNew();
|
////var watch = Stopwatch.StartNew();
|
||||||
////SendNorth();
|
////SendNorth();
|
||||||
@ -4316,7 +4317,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
public void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
if (Others.g_socketSend != null)
|
if (Others.g_socketSend != null)
|
||||||
{
|
{
|
||||||
@ -5318,9 +5319,9 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
dataHX2[4] = time.ToString("yyyy-MM-dd");
|
dataHX2[4] = time.ToString("yyyy-MM-dd");
|
||||||
dataHX2[5] = time.ToString("HH:mm:ss");
|
dataHX2[5] = time.ToString("HH:mm:ss");
|
||||||
|
|
||||||
for (int i = 0; i < 13; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
if (i != 12)
|
if (i != 11)
|
||||||
{
|
{
|
||||||
dataHX[2] += dataHX2[i] + ",";
|
dataHX[2] += dataHX2[i] + ",";
|
||||||
}
|
}
|
||||||
@ -5524,9 +5525,9 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
dataHX2[4] = time.ToString("yyyy-MM-dd");
|
dataHX2[4] = time.ToString("yyyy-MM-dd");
|
||||||
dataHX2[5] = time.ToString("HH:mm:ss");
|
dataHX2[5] = time.ToString("HH:mm:ss");
|
||||||
|
|
||||||
for (int i = 0; i < 13; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
if (i != 12)
|
if (i != 11)
|
||||||
{
|
{
|
||||||
dataHX[2] += dataHX2[i] + ",";
|
dataHX[2] += dataHX2[i] + ",";
|
||||||
}
|
}
|
||||||
@ -5753,9 +5754,9 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
dataHX2[4] = time.ToString("yyyy-MM-dd");
|
dataHX2[4] = time.ToString("yyyy-MM-dd");
|
||||||
dataHX2[5] = time.ToString("HH:mm:ss");
|
dataHX2[5] = time.ToString("HH:mm:ss");
|
||||||
|
|
||||||
for (int i = 0; i < 13; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
if (i != 12)
|
if (i != 11)
|
||||||
{
|
{
|
||||||
dataHX[2] += dataHX2[i] + ",";
|
dataHX[2] += dataHX2[i] + ",";
|
||||||
}
|
}
|
||||||
@ -5803,7 +5804,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ItfNHelper itfNHelper = new ItfNHelper(ip, port, userName, password, topic, subName);
|
ItfNHelper itfNHelper = new ItfNHelper(ip, port, userName, password, topic, subName);
|
||||||
itfNHelper.test.Connect();
|
bool result=itfNHelper.test.Connect();
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
Console.WriteLine("SendNorthError:Can not connect!");
|
||||||
|
EveryDayLog.WriteErrorOther("SendNorthError:Can not connect!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string[] basicInfo = new string[4]
|
string[] basicInfo = new string[4]
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,8 +13,8 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
{
|
{
|
||||||
class MySQL
|
class MySQL
|
||||||
{
|
{
|
||||||
//public static string connectionString = @"server=41.244.68.54;port=3306;user=root;password=zttZTT123!;database=daojiao;sslMode=none;charset=utf8;pooling=true;max pool size=1024;connect timeout = 20;AllowPublicKeyRetrieval=true;";
|
public static string connectionString = @"server=41.244.68.54;port=3306;user=root;password=zttZTT123!;database=daojiao;sslMode=none;charset=utf8;pooling=true;max pool size=1024;connect timeout = 20;AllowPublicKeyRetrieval=true;";
|
||||||
public static string connectionString = @"server=127.0.0.1;port=3306;user=root;password=ztt12345;database=daojiao;sslMode=none;charset=utf8;pooling=true;max pool size=1024;connect timeout = 20;";
|
//public static string connectionString = @"server=127.0.0.1;port=3306;user=root;password=ztt12345;database=daojiao;sslMode=none;charset=utf8;pooling=true;max pool size=1024;connect timeout = 20;";
|
||||||
|
|
||||||
|
|
||||||
#region 公用方法
|
#region 公用方法
|
||||||
@ -463,11 +463,42 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
//public static MySqlConnection connection = new MySqlConnection(connectionString);
|
||||||
/// 执行查询语句,返回MySqlDataReader ( 注意:调用该方法后,一定要对MySqlDataReader进行Close )
|
|
||||||
/// </summary>
|
///// <summary>
|
||||||
/// <param name="strSQL">查询语句</param>
|
///// 执行查询语句,返回MySqlDataReader ( 注意:调用该方法后,一定要对MySqlDataReader进行Close )
|
||||||
/// <returns>MySqlDataReader</returns>
|
///// </summary>
|
||||||
|
///// <param name="strSQL">查询语句</param>
|
||||||
|
///// <returns>MySqlDataReader</returns>
|
||||||
|
//public static MySqlDataReader ExecuteReader(string strSQL)
|
||||||
|
//{
|
||||||
|
// MySqlCommand cmd = new MySqlCommand(strSQL, connection);
|
||||||
|
// MySqlDataReader myReader;
|
||||||
|
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// if (connection.State == ConnectionState.Open)
|
||||||
|
// myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// connection.Open();
|
||||||
|
// myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return myReader;
|
||||||
|
// }
|
||||||
|
// catch (MySql.Data.MySqlClient.MySqlException e)
|
||||||
|
// {
|
||||||
|
// connection.Close();
|
||||||
|
|
||||||
|
// EveryDayLog.WriteErrorOther("ExecuteReaderError:" + e);
|
||||||
|
// //throw new Exception("异常信息:", e);
|
||||||
|
// //throw e;
|
||||||
|
// //Console.WriteLine(e);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
public static MySqlDataReader ExecuteReader(string strSQL)
|
public static MySqlDataReader ExecuteReader(string strSQL)
|
||||||
{
|
{
|
||||||
MySqlConnection connection = new MySqlConnection(connectionString);
|
MySqlConnection connection = new MySqlConnection(connectionString);
|
||||||
|
|||||||
@ -108,17 +108,17 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
public static string ftpCTDDataPath = @"/File/SensorData/CTDData";
|
public static string ftpCTDDataPath = @"/File/SensorData/CTDData";
|
||||||
public static string ftpRecordData = @"/File/RecordData";
|
public static string ftpRecordData = @"/File/RecordData";
|
||||||
|
|
||||||
//public static string totalPath = @"E:\Output\";
|
public static string totalPath = @"E:\Output\";
|
||||||
//public static string FFmpegPath = Environment.CurrentDirectory + @"\FFmpeg\bin\x86\ffmpeg.exe";
|
|
||||||
//public static string picPath = @"E:\Output\Image\Image_01\";
|
|
||||||
//public static string picPathShow = @"E:\Output\Image\Image_01";
|
|
||||||
//public static string vidPathShow = @"E:\Output\Video\Video_01";
|
|
||||||
|
|
||||||
public static string picPathShow = @"F:\Code\text\daojiao\Image\Image_01";
|
|
||||||
public static string vidPathShow = @"F:\Code\text\daojiao\Video\Video_01";
|
|
||||||
public static string picPath = @"F:\Code\text\daojiao\Image\Image_01\";
|
|
||||||
public static string totalPath = @"F:\Code\text\daojiao\";
|
|
||||||
public static string FFmpegPath = Environment.CurrentDirectory + @"\FFmpeg\bin\x86\ffmpeg.exe";
|
public static string FFmpegPath = Environment.CurrentDirectory + @"\FFmpeg\bin\x86\ffmpeg.exe";
|
||||||
|
public static string picPath = @"E:\Output\Image\Image_01\";
|
||||||
|
public static string picPathShow = @"E:\Output\Image\Image_01";
|
||||||
|
public static string vidPathShow = @"E:\Output\Video\Video_01";
|
||||||
|
|
||||||
|
//public static string picPathShow = @"F:\Code\text\daojiao\Image\Image_01";
|
||||||
|
//public static string vidPathShow = @"F:\Code\text\daojiao\Video\Video_01";
|
||||||
|
//public static string picPath = @"F:\Code\text\daojiao\Image\Image_01\";
|
||||||
|
//public static string totalPath = @"F:\Code\text\daojiao\";
|
||||||
|
//public static string FFmpegPath = Environment.CurrentDirectory + @"\FFmpeg\bin\x86\ffmpeg.exe";
|
||||||
|
|
||||||
|
|
||||||
//标记设备是否使能
|
//标记设备是否使能
|
||||||
|
|||||||
@ -1428,6 +1428,10 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
g_flagSetLight = true;
|
g_flagSetLight = true;
|
||||||
g_timerSetLight.Stop();
|
g_timerSetLight.Stop();
|
||||||
CallInvokeUIUpdate("UpdateSetLightEnable", "true");
|
CallInvokeUIUpdate("UpdateSetLightEnable", "true");
|
||||||
|
|
||||||
|
MainForm.videoRecordForm.g_flagSetLight = true;
|
||||||
|
MainForm.videoRecordForm.g_timerSetLight.Stop();
|
||||||
|
MainForm.videoRecordForm.CallInvokeUIUpdate("UpdateSetLightEnable", "true");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2733,6 +2737,9 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
|
|
||||||
private void btnSetLight_Click(object sender, EventArgs e)
|
private void btnSetLight_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (txtLight.Text == null)
|
||||||
|
txtLight.Text = "90";
|
||||||
|
|
||||||
Int16 bufferLength = 10 + 2;
|
Int16 bufferLength = 10 + 2;
|
||||||
|
|
||||||
byte[] length = new byte[2];
|
byte[] length = new byte[2];
|
||||||
@ -2827,7 +2834,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
|
|
||||||
SetParam();
|
SetParam();
|
||||||
|
|
||||||
txtLight.Text = "";
|
txtLight.Text = "90";
|
||||||
btnSetLight_Click(null, null);
|
btnSetLight_Click(null, null);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
@ -2863,13 +2870,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
txtExposure.Text = "";
|
txtExposure.Text = "10000";
|
||||||
txtFrameRate.Text = "";
|
txtFrameRate.Text = "15";
|
||||||
txtGain.Text = "";
|
txtGain.Text = "7.7";
|
||||||
|
|
||||||
SetParam();
|
SetParam();
|
||||||
|
|
||||||
txtLight.Text = "";
|
txtLight.Text = "90";
|
||||||
btnSetLight_Click(null, null);
|
btnSetLight_Click(null, null);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@ -91,7 +91,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
dataReader.Dispose();
|
dataReader.Dispose();
|
||||||
|
|
||||||
//CO2传感器
|
//CO2传感器
|
||||||
string sqlCO2 = $"select * from tb_co2_data where pressure!='' order by record_time desc limit 1;";
|
string sqlCO2 = $"select * from tb_co2_data where potency!='' order by record_time desc limit 1;";
|
||||||
dataReader = MySQL.ExecuteReader(sqlCO2);
|
dataReader = MySQL.ExecuteReader(sqlCO2);
|
||||||
while (dataReader.Read())
|
while (dataReader.Read())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -55,6 +55,11 @@
|
|||||||
this.timerLightClose = new System.Windows.Forms.Timer(this.components);
|
this.timerLightClose = new System.Windows.Forms.Timer(this.components);
|
||||||
this.btnShow = new System.Windows.Forms.Button();
|
this.btnShow = new System.Windows.Forms.Button();
|
||||||
this.picReplay = new System.Windows.Forms.PictureBox();
|
this.picReplay = new System.Windows.Forms.PictureBox();
|
||||||
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
|
this.btnSetLight = new System.Windows.Forms.Button();
|
||||||
|
this.txtLight = new System.Windows.Forms.TextBox();
|
||||||
|
this.timerLight = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.timerNight = new System.Windows.Forms.Timer(this.components);
|
||||||
this.pnlTitle.SuspendLayout();
|
this.pnlTitle.SuspendLayout();
|
||||||
this.pnlVideoShow.SuspendLayout();
|
this.pnlVideoShow.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.picVideo)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.picVideo)).BeginInit();
|
||||||
@ -66,6 +71,9 @@
|
|||||||
// pnlTitle
|
// pnlTitle
|
||||||
//
|
//
|
||||||
this.pnlTitle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(118)))), ((int)(((byte)(128)))));
|
this.pnlTitle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(118)))), ((int)(((byte)(128)))));
|
||||||
|
this.pnlTitle.Controls.Add(this.label5);
|
||||||
|
this.pnlTitle.Controls.Add(this.btnSetLight);
|
||||||
|
this.pnlTitle.Controls.Add(this.txtLight);
|
||||||
this.pnlTitle.Controls.Add(this.lblConnectState);
|
this.pnlTitle.Controls.Add(this.lblConnectState);
|
||||||
this.pnlTitle.Controls.Add(this.lblTitle);
|
this.pnlTitle.Controls.Add(this.lblTitle);
|
||||||
this.pnlTitle.Dock = System.Windows.Forms.DockStyle.Top;
|
this.pnlTitle.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
@ -80,7 +88,7 @@
|
|||||||
// lblConnectState
|
// lblConnectState
|
||||||
//
|
//
|
||||||
this.lblConnectState.AutoSize = true;
|
this.lblConnectState.AutoSize = true;
|
||||||
this.lblConnectState.Location = new System.Drawing.Point(1359, 31);
|
this.lblConnectState.Location = new System.Drawing.Point(879, 32);
|
||||||
this.lblConnectState.Name = "lblConnectState";
|
this.lblConnectState.Name = "lblConnectState";
|
||||||
this.lblConnectState.Size = new System.Drawing.Size(121, 29);
|
this.lblConnectState.Size = new System.Drawing.Size(121, 29);
|
||||||
this.lblConnectState.TabIndex = 37;
|
this.lblConnectState.TabIndex = 37;
|
||||||
@ -337,6 +345,48 @@
|
|||||||
this.picReplay.TabStop = false;
|
this.picReplay.TabStop = false;
|
||||||
this.picReplay.Click += new System.EventHandler(this.picReplay_Click);
|
this.picReplay.Click += new System.EventHandler(this.picReplay_Click);
|
||||||
//
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
this.label5.AutoSize = true;
|
||||||
|
this.label5.Font = new System.Drawing.Font("方正楷体简体", 20.25F);
|
||||||
|
this.label5.Location = new System.Drawing.Point(1060, 32);
|
||||||
|
this.label5.Name = "label5";
|
||||||
|
this.label5.Size = new System.Drawing.Size(74, 29);
|
||||||
|
this.label5.TabIndex = 40;
|
||||||
|
this.label5.Text = "亮度:";
|
||||||
|
//
|
||||||
|
// btnSetLight
|
||||||
|
//
|
||||||
|
this.btnSetLight.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
|
this.btnSetLight.Font = new System.Drawing.Font("方正楷体简体", 24F);
|
||||||
|
this.btnSetLight.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
|
this.btnSetLight.Location = new System.Drawing.Point(1305, 12);
|
||||||
|
this.btnSetLight.Name = "btnSetLight";
|
||||||
|
this.btnSetLight.Size = new System.Drawing.Size(210, 60);
|
||||||
|
this.btnSetLight.TabIndex = 39;
|
||||||
|
this.btnSetLight.Text = "设置";
|
||||||
|
this.btnSetLight.UseVisualStyleBackColor = true;
|
||||||
|
this.btnSetLight.Click += new System.EventHandler(this.btnSetLight_Click);
|
||||||
|
//
|
||||||
|
// txtLight
|
||||||
|
//
|
||||||
|
this.txtLight.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(231)))), ((int)(((byte)(236)))), ((int)(((byte)(233)))));
|
||||||
|
this.txtLight.Font = new System.Drawing.Font("方正楷体简体", 20.25F);
|
||||||
|
this.txtLight.Location = new System.Drawing.Point(1142, 28);
|
||||||
|
this.txtLight.Name = "txtLight";
|
||||||
|
this.txtLight.Size = new System.Drawing.Size(144, 39);
|
||||||
|
this.txtLight.TabIndex = 38;
|
||||||
|
this.txtLight.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
|
this.txtLight.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtLight_KeyPress);
|
||||||
|
//
|
||||||
|
// timerLight
|
||||||
|
//
|
||||||
|
this.timerLight.Tick += new System.EventHandler(this.timerLight_Tick);
|
||||||
|
//
|
||||||
|
// timerNight
|
||||||
|
//
|
||||||
|
this.timerNight.Tick += new System.EventHandler(this.timerNight_Tick);
|
||||||
|
//
|
||||||
// VideoRecordForm
|
// VideoRecordForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(15F, 29F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(15F, 29F);
|
||||||
@ -403,5 +453,10 @@
|
|||||||
public System.Windows.Forms.TextBox txtCloseTime;
|
public System.Windows.Forms.TextBox txtCloseTime;
|
||||||
public System.Windows.Forms.TextBox txtOpenTime;
|
public System.Windows.Forms.TextBox txtOpenTime;
|
||||||
private System.Windows.Forms.PictureBox picReplay;
|
private System.Windows.Forms.PictureBox picReplay;
|
||||||
|
public System.Windows.Forms.Label label5;
|
||||||
|
private System.Windows.Forms.Button btnSetLight;
|
||||||
|
public System.Windows.Forms.TextBox txtLight;
|
||||||
|
private System.Windows.Forms.Timer timerLight;
|
||||||
|
private System.Windows.Forms.Timer timerNight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,11 +48,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
#region Timer Set
|
#region Timer Set
|
||||||
public System.Timers.Timer g_timerVideo = new System.Timers.Timer();
|
public System.Timers.Timer g_timerVideo = new System.Timers.Timer();
|
||||||
public System.Timers.Timer g_timerLight = new System.Timers.Timer();
|
public System.Timers.Timer g_timerLight = new System.Timers.Timer();
|
||||||
|
public System.Timers.Timer g_timerSetLight = new System.Timers.Timer();
|
||||||
public System.Timers.Timer g_timerUVC = new System.Timers.Timer();
|
public System.Timers.Timer g_timerUVC = new System.Timers.Timer();
|
||||||
public System.Timers.Timer g_timerSetUVC = new System.Timers.Timer();
|
public System.Timers.Timer g_timerSetUVC = new System.Timers.Timer();
|
||||||
|
|
||||||
public bool g_flagVideo = true;
|
public bool g_flagVideo = true;
|
||||||
public bool g_flagLight = true;
|
public bool g_flagLight = true;
|
||||||
|
public bool g_flagSetLight = true;
|
||||||
public bool g_flagUVC = true;
|
public bool g_flagUVC = true;
|
||||||
public bool g_flagSetUVC = true;
|
public bool g_flagSetUVC = true;
|
||||||
|
|
||||||
@ -74,6 +76,15 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void methodSetLight(object sender, System.Timers.ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
if (g_flagSetLight == false)
|
||||||
|
{
|
||||||
|
Console.WriteLine("影像腔未响应,请重新点击发送!");
|
||||||
|
CallInvokeUIUpdate("UpdateSetLightEnable", "true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void methodUVC(object sender, System.Timers.ElapsedEventArgs e)
|
private void methodUVC(object sender, System.Timers.ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
if (g_flagUVC == false)
|
if (g_flagUVC == false)
|
||||||
@ -106,6 +117,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
g_timerLight.AutoReset = false;
|
g_timerLight.AutoReset = false;
|
||||||
g_timerLight.Elapsed += new System.Timers.ElapsedEventHandler(methodLight);
|
g_timerLight.Elapsed += new System.Timers.ElapsedEventHandler(methodLight);
|
||||||
|
|
||||||
|
g_timerSetLight.Enabled = true;
|
||||||
|
g_timerSetLight.Interval = 20000;
|
||||||
|
g_timerSetLight.AutoReset = false;
|
||||||
|
g_timerSetLight.Elapsed += new System.Timers.ElapsedEventHandler(methodSetLight);
|
||||||
|
|
||||||
g_timerUVC.Enabled = true;
|
g_timerUVC.Enabled = true;
|
||||||
g_timerUVC.Interval = 20000;
|
g_timerUVC.Interval = 20000;
|
||||||
g_timerUVC.AutoReset = false;
|
g_timerUVC.AutoReset = false;
|
||||||
@ -115,6 +131,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
g_timerSetUVC.Interval = 20000;
|
g_timerSetUVC.Interval = 20000;
|
||||||
g_timerSetUVC.AutoReset = false;
|
g_timerSetUVC.AutoReset = false;
|
||||||
g_timerSetUVC.Elapsed += new System.Timers.ElapsedEventHandler(methodSetUVC);
|
g_timerSetUVC.Elapsed += new System.Timers.ElapsedEventHandler(methodSetUVC);
|
||||||
|
|
||||||
|
timerLight.Enabled = true;
|
||||||
|
timerLight.Interval = 50000;
|
||||||
|
timerLight.Start();
|
||||||
|
|
||||||
|
timerNight.Enabled = true;
|
||||||
|
timerNight.Interval = 50000;
|
||||||
|
timerNight.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -148,6 +172,9 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
case "UpdateLightEnable":
|
case "UpdateLightEnable":
|
||||||
btnOpenCloseLight.Enabled = bool.Parse(arg);
|
btnOpenCloseLight.Enabled = bool.Parse(arg);
|
||||||
break;
|
break;
|
||||||
|
case "UpdateSetLightEnable":
|
||||||
|
btnSetLight.Enabled = bool.Parse(arg);
|
||||||
|
break;
|
||||||
case "UpdateUVCEnable":
|
case "UpdateUVCEnable":
|
||||||
btnOpenCloseUVC.Enabled = bool.Parse(arg);
|
btnOpenCloseUVC.Enabled = bool.Parse(arg);
|
||||||
break;
|
break;
|
||||||
@ -662,6 +689,12 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
g_timerSetUVC.Start();
|
g_timerSetUVC.Start();
|
||||||
CallInvokeUIUpdate("UpdateSetUVCEnable", "false");
|
CallInvokeUIUpdate("UpdateSetUVCEnable", "false");
|
||||||
}
|
}
|
||||||
|
else if(str=="设置亮度")
|
||||||
|
{
|
||||||
|
g_flagSetLight = false;
|
||||||
|
g_timerSetLight.Start();
|
||||||
|
CallInvokeUIUpdate("UpdateSetLightEnable", "false");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -743,6 +776,14 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void txtLight_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
if (!(Char.IsNumber(e.KeyChar)) && e.KeyChar != (char)8)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@ -780,5 +821,110 @@ namespace ZTTMS_Manage_yibayiyi_20230320
|
|||||||
videoForm.TopMost = true;
|
videoForm.TopMost = true;
|
||||||
videoForm.Show();
|
videoForm.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnSetLight_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (txtLight.Text == null)
|
||||||
|
txtLight.Text = "90";
|
||||||
|
|
||||||
|
Int16 bufferLength = 10 + 2;
|
||||||
|
|
||||||
|
byte[] length = new byte[2];
|
||||||
|
length[0] = (byte)(bufferLength & 0xff);
|
||||||
|
length[1] = (byte)((bufferLength >> 8) & 0xff);
|
||||||
|
|
||||||
|
byte funcCode = 0x12;
|
||||||
|
|
||||||
|
byte[] sendBuffer = new byte[bufferLength];
|
||||||
|
sendBuffer[0] = CamAndVid.head;
|
||||||
|
sendBuffer[1] = CamAndVid.idHost;
|
||||||
|
sendBuffer[2] = CamAndVid.typeSend;
|
||||||
|
sendBuffer[3] = length[0];
|
||||||
|
sendBuffer[4] = length[1];
|
||||||
|
sendBuffer[5] = funcCode;
|
||||||
|
|
||||||
|
sendBuffer[6] = 0x00;
|
||||||
|
sendBuffer[7] = byte.Parse(txtLight.Text.Trim());
|
||||||
|
|
||||||
|
byte[] checkSum = CamAndVid.CheckSum(new byte[] { sendBuffer[1], sendBuffer[2], sendBuffer[3], sendBuffer[4], sendBuffer[5], sendBuffer[6], sendBuffer[7] });
|
||||||
|
sendBuffer[8] = checkSum[0];
|
||||||
|
sendBuffer[9] = checkSum[1];
|
||||||
|
sendBuffer[10] = CamAndVid.tail[0];
|
||||||
|
sendBuffer[11] = CamAndVid.tail[1];
|
||||||
|
|
||||||
|
SendMessage(sendBuffer, "设置亮度");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void timerLight_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Thread thSetLightLight = new Thread(SetLightLight);
|
||||||
|
thSetLightLight.IsBackground = true;
|
||||||
|
thSetLightLight.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetLightLight()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DateTime NowDate = DateTime.Now;
|
||||||
|
if (NowDate.Hour == 6 && NowDate.Minute == 0)
|
||||||
|
{
|
||||||
|
EveryDayLog.WriteADCP("摄像机将在2min后设置白天亮度!");
|
||||||
|
Console.WriteLine("摄像机将在2min后设置白天亮度!");
|
||||||
|
|
||||||
|
timerLight.Enabled = false;
|
||||||
|
timerLight.Stop();
|
||||||
|
Thread.Sleep(2 * 1000);
|
||||||
|
timerLight.Enabled = true;
|
||||||
|
timerLight.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
txtLight.Text = "90";
|
||||||
|
btnSetLight_Click(null, null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
EveryDayLog.WriteErrorCamAndVid("SetParamLightError:" + ex.Message);
|
||||||
|
Console.WriteLine("SetParamLightError:" + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void timerNight_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Thread thSetLightNight = new Thread(SetLightNight);
|
||||||
|
thSetLightNight.IsBackground = true;
|
||||||
|
thSetLightNight.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetLightNight()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DateTime NowDate = DateTime.Now;
|
||||||
|
if (NowDate.Hour == 19 && NowDate.Minute == 0)
|
||||||
|
{
|
||||||
|
EveryDayLog.WriteADCP("摄像机将在2min后设置晚上亮度!");
|
||||||
|
Console.WriteLine("摄像机将在2min后设置晚上亮度!");
|
||||||
|
|
||||||
|
timerNight.Enabled = false;
|
||||||
|
timerNight.Stop();
|
||||||
|
Thread.Sleep(2 * 1000);
|
||||||
|
timerNight.Enabled = true;
|
||||||
|
timerNight.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
txtLight.Text = "90";
|
||||||
|
btnSetLight_Click(null, null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
EveryDayLog.WriteErrorCamAndVid("SetParamNightError:" + ex.Message);
|
||||||
|
Console.WriteLine("SetParamNightError:" + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,6 +126,12 @@
|
|||||||
<metadata name="timerLightClose.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="timerLightClose.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>567, 17</value>
|
<value>567, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="timerLight.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>833, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="timerNight.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>945, 17</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>50</value>
|
<value>50</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user