修改电子腔输出数据显示部分的bug(电脑版未运行)

This commit is contained in:
春风过客 2023-08-24 08:29:41 +08:00
parent 331ec69303
commit 0d6a23e60d
11 changed files with 143 additions and 143 deletions

View File

@ -410,10 +410,10 @@ namespace ZTTMS_Manage_yibayiyi_20230320
Others.isUV3Work = false; Others.isUV3Work = false;
Others.isUV4Work = false; Others.isUV4Work = false;
////加载存储的状态 //加载存储的状态
//Thread thLoadState = new Thread(LoadState); Thread thLoadState = new Thread(LoadState);
//thLoadState.IsBackground = true; thLoadState.IsBackground = true;
//thLoadState.Start(); thLoadState.Start();
} }
private void MainForm_Shown(object sender, EventArgs e) private void MainForm_Shown(object sender, EventArgs e)
@ -483,11 +483,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();
@ -511,106 +511,106 @@ namespace ZTTMS_Manage_yibayiyi_20230320
btnRealTimeData_Click(null, new EventArgs()); btnRealTimeData_Click(null, new EventArgs());
//try try
//{ {
// trdConnect = new Thread(ListenConnect); trdConnect = new Thread(ListenConnect);
// trdConnect.IsBackground = true; trdConnect.IsBackground = true;
// trdConnect.Start(); trdConnect.Start();
// trdDataSplit = new Thread(DataSplit); trdDataSplit = new Thread(DataSplit);
// trdDataSplit.IsBackground = true; trdDataSplit.IsBackground = true;
// trdDataSplit.Start(); trdDataSplit.Start();
// trdDataAnalysis = new Thread(DataAnalysis); trdDataAnalysis = new Thread(DataAnalysis);
// trdDataAnalysis.IsBackground = true; trdDataAnalysis.IsBackground = true;
// trdDataAnalysis.Start(); trdDataAnalysis.Start();
//} }
//catch (Exception ee) catch (Exception ee)
//{ {
// Console.WriteLine("LinkError" + ee.Message); Console.WriteLine("LinkError" + ee.Message);
// EveryDayLog.WriteErrorDZ("建立连接Error" + ee.Message); EveryDayLog.WriteErrorDZ("建立连接Error" + ee.Message);
//} }
//timerContinueRecord.Interval = 60 * 1000; timerContinueRecord.Interval = 60 * 1000;
//timerContinueRecord.Enabled = true; timerContinueRecord.Enabled = true;
//timerContinueRecord.Start(); timerContinueRecord.Start();
//timerStartOrStop.Enabled = true; timerStartOrStop.Enabled = true;
//timerStartOrStop.Interval = 60 * 1000; timerStartOrStop.Interval = 60 * 1000;
//timerStartOrStop.Start(); timerStartOrStop.Start();
//Task.Run(() => Task.Run(() =>
//{ {
// string ffmpegPath = Others.FFmpegPath; string ffmpegPath = Others.FFmpegPath;
// string year = DateTime.Now.Year.ToString(); string year = DateTime.Now.Year.ToString();
// string month = DateTime.Now.Month.ToString("00"); string month = DateTime.Now.Month.ToString("00");
// string day = DateTime.Now.Day.ToString("00"); string day = DateTime.Now.Day.ToString("00");
// if (!Directory.Exists(Others.totalPath + "Video\\Video_01")) if (!Directory.Exists(Others.totalPath + "Video\\Video_01"))
// { {
// Directory.CreateDirectory(Others.totalPath + "Video\\Video_01"); Directory.CreateDirectory(Others.totalPath + "Video\\Video_01");
// } }
// if (!Directory.Exists(Others.totalPath + "Video\\Video_01\\" + year)) if (!Directory.Exists(Others.totalPath + "Video\\Video_01\\" + year))
// { {
// Directory.CreateDirectory(Others.totalPath + "Video\\Video_01\\" + year); Directory.CreateDirectory(Others.totalPath + "Video\\Video_01\\" + year);
// } }
// if (!Directory.Exists(Others.totalPath + "Video\\Video_01\\" + year + "\\" + month)) if (!Directory.Exists(Others.totalPath + "Video\\Video_01\\" + year + "\\" + month))
// { {
// Directory.CreateDirectory(Others.totalPath + "Video\\Video_01\\" + year + "\\" + month); Directory.CreateDirectory(Others.totalPath + "Video\\Video_01\\" + year + "\\" + month);
// } }
// if (!Directory.Exists(Others.totalPath + "Video\\Video_01\\" + year + "\\" + month + "\\" + day)) if (!Directory.Exists(Others.totalPath + "Video\\Video_01\\" + year + "\\" + month + "\\" + day))
// { {
// Directory.CreateDirectory(Others.totalPath + "Video\\Video_01\\" + year + "\\" + month + "\\" + day); Directory.CreateDirectory(Others.totalPath + "Video\\Video_01\\" + year + "\\" + month + "\\" + day);
// } }
// string path = Others.totalPath + "Video\\Video_01\\" + year + "\\" + month + "\\" + day + "\\"; string path = Others.totalPath + "Video\\Video_01\\" + year + "\\" + month + "\\" + day + "\\";
// string pathLocal = Others.totalPath + "Video\\Video_01\\"; string pathLocal = Others.totalPath + "Video\\Video_01\\";
// string name = $"{DateTime.Now:HHmmss}.mp4"; string name = $"{DateTime.Now:HHmmss}.mp4";
// string nameLocal = $"{DateTime.Now:HHmmss}.mp4"; string nameLocal = $"{DateTime.Now:HHmmss}.mp4";
// string fileName = Path.Combine(path, name); string fileName = Path.Combine(path, name);
// string fileNameLocal = Path.Combine(pathLocal, nameLocal); string fileNameLocal = Path.Combine(pathLocal, nameLocal);
// finalName = fileName; finalName = fileName;
// try try
// { {
// //string cmd = @"-y -i rtsp://admin:ZTTztt1811!@41.244.68.68:554/Streaming/Channels/101 -vcodec copy -an -f mp4 F:/Code/text/daojiao/Video/20230607/11.mp4"; //string cmd = @"-y -i rtsp://admin:ZTTztt1811!@41.244.68.68:554/Streaming/Channels/101 -vcodec copy -an -f mp4 F:/Code/text/daojiao/Video/20230607/11.mp4";
// string cmd = "-y -i rtsp://admin:ZTTztt1811!@41.244.68.68:554/Streaming/Channels/101 -vcodec copy -an -f mp4 \"" + fileNameLocal + "\""; string cmd = "-y -i rtsp://admin:ZTTztt1811!@41.244.68.68:554/Streaming/Channels/101 -vcodec copy -an -f mp4 \"" + fileNameLocal + "\"";
// Console.WriteLine("开始录像"); Console.WriteLine("开始录像");
// process = new Process(); process = new Process();
// process.StartInfo.FileName = ffmpegPath; process.StartInfo.FileName = ffmpegPath;
// process.StartInfo.Arguments = cmd; //执行参数 process.StartInfo.Arguments = cmd; //执行参数
// process.StartInfo.UseShellExecute = false; //不使用系统外壳程序启动进程 process.StartInfo.UseShellExecute = false; //不使用系统外壳程序启动进程
// process.StartInfo.CreateNoWindow = true; //不显示dos程序窗口 process.StartInfo.CreateNoWindow = true; //不显示dos程序窗口
// //在启动过程之前设置标准输出重定向 //在启动过程之前设置标准输出重定向
// process.StartInfo.RedirectStandardInput = true; process.StartInfo.RedirectStandardInput = true;
// process.Start(); process.Start();
// isRecording = true; isRecording = true;
// Thread.Sleep(1000 * 3 + 1000 * 60 * 10); Thread.Sleep(1000 * 3 + 1000 * 60 * 10);
// //Thread.Sleep(23 * 1000); //Thread.Sleep(23 * 1000);
// Console.WriteLine("结束录像"); Console.WriteLine("结束录像");
// //发送退出命令 //发送退出命令
// process.StandardInput.WriteLine("q"); process.StandardInput.WriteLine("q");
// process.WaitForExit(); process.WaitForExit();
// isRecording = false; isRecording = false;
// Thread thUploadVideo = new Thread(UploadVideo); Thread thUploadVideo = new Thread(UploadVideo);
// thUploadVideo.IsBackground = true; thUploadVideo.IsBackground = true;
// thUploadVideo.Start(fileName); thUploadVideo.Start(fileName);
// } }
// catch (Exception ex) catch (Exception ex)
// { {
// isRecording = false; isRecording = false;
// Console.WriteLine("录制视频出错:" + ex.Message); Console.WriteLine("录制视频出错:" + ex.Message);
// EveryDayLog.WriteErrorCamAndVid("录制视频出错:" + ex.Message); EveryDayLog.WriteErrorCamAndVid("录制视频出错:" + ex.Message);
// } }
//}); });
//检测设备的使能状态 //检测设备的使能状态
Thread thIsDeviceWork = new Thread(IsDeviceWork); Thread thIsDeviceWork = new Thread(IsDeviceWork);
@ -2635,13 +2635,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
// $"FORMAT('{outputVoltageUV3}',2),FORMAT('{outputCurrentUV3}',2)," + // $"FORMAT('{outputVoltageUV3}',2),FORMAT('{outputCurrentUV3}',2)," +
// $"FORMAT('{outputVoltageUV4}',2),FORMAT('{outputCurrentUV4}',2),FORMAT('{outputVoltageCO2}',2),FORMAT('{outputCurrentCO2}',2),FORMAT('{outputVoltageIma}',2),FORMAT('{outputCurrentIma}',2));"; // $"FORMAT('{outputVoltageUV4}',2),FORMAT('{outputCurrentUV4}',2),FORMAT('{outputVoltageCO2}',2),FORMAT('{outputCurrentCO2}',2),FORMAT('{outputVoltageIma}',2),FORMAT('{outputCurrentIma}',2));";
string sql = $"insert into tb_outputstateinfo_data(id,record_time,equipment_type,equipment_id,version_number,serialnumber,number,revoltage48," + string sql = $"insert into tb_outputstateinfo_data(id,record_time,equipment_type,equipment_id,version_number,serialnumber,number," +
$"recurrent48,revoltage24,recurrent24,revoltage12,recurrent12,voltage_multi,current_multi,voltage_ctd,current_ctd,voltage_adcp," + $"recurrent48,recurrent24,recurrent12,current_multi,current_ctd," +
$"current_adcp,voltage_uv1,current_uv1,voltage_uv2,current_uv2,voltage_uv3,current_uv3,voltage_uv4,current_uv4,voltage_co2,current_co2,camvidvoltage,camvidcurrent) " + $"current_adcp,current_uv1,current_uv2,current_uv3,current_uv4,current_co2,camvidvoltage) " +
$"values('{sqlId}','{g_sqlRecordTime}','{g_sqlTerminalEquipmentType}','{g_sqlTerminalEquipmentId}','{g_sqlVersionNumber}','{sqlSerialNum}','{number}'," + $"values('{sqlId}','{g_sqlRecordTime}','{g_sqlTerminalEquipmentType}','{g_sqlTerminalEquipmentId}','{g_sqlVersionNumber}','{sqlSerialNum}','{number}'," +
$"FORMAT('{reOutputCurrent48}',2),FORMAT('{reOutputCurrent24}',2),FORMAT('{reOutputCurrent12}',2),FORMAT('{outputCurrentMulti}',2)," + $"FORMAT('{reOutputCurrent48}',2),FORMAT('{reOutputCurrent24}',2),FORMAT('{reOutputCurrent12}',2),FORMAT('{outputCurrentMulti}',2)," +
$"FORMAT('{outputCurrentCTD}',2),FORMAT('{outputCurrentADCP}',2),FORMAT('{outputCurrentUV1}',2),FORMAT('{outputCurrentUV2}',2)," + $"FORMAT('{outputCurrentCTD}',2),FORMAT('{outputCurrentADCP}',2),FORMAT('{outputCurrentUV1}',2),FORMAT('{outputCurrentUV2}',2)," +
$"FORMAT('{outputCurrentUV3}',2),FORMAT('{outputCurrentUV4}',2),FORMAT('{outputCurrentCO2}',2),FORMAT('{outputVoltageIma}',2),FORMAT('{outputCurrentIma}',2));"; $"FORMAT('{outputCurrentUV3}',2),FORMAT('{outputCurrentUV4}',2),FORMAT('{outputCurrentCO2}',2),FORMAT('{outputVoltageIma}',2));";
try try
{ {
@ -2755,13 +2755,13 @@ namespace ZTTMS_Manage_yibayiyi_20230320
string sqlId = IdHelper.GetId(); string sqlId = IdHelper.GetId();
num = 0; num = 0;
string sql = $"insert into tb_outputstateinfo_abnormaldata(id,record_time,equipment_type,equipment_id,version_number,serialnumber,number,revoltage48," + string sql = $"insert into tb_outputstateinfo_data(id,record_time,equipment_type,equipment_id,version_number,serialnumber,number," +
$"recurrent48,revoltage24,recurrent24,revoltage12,recurrent12,voltage_multi,current_multi,voltage_ctd,current_ctd,voltage_adcp," + $"recurrent48,recurrent24,recurrent12,current_multi,current_ctd," +
$"current_adcp,voltage_uv1,current_uv1,voltage_uv2,current_uv2,voltage_uv3,current_uv3,voltage_uv4,current_uv4,voltage_co2,current_co2,camvidvoltage,camvidcurrent) " + $"current_adcp,current_uv1,current_uv2,current_uv3,current_uv4,current_co2,camvidvoltage) " +
$"values('{sqlId}','{g_sqlRecordTime}','{g_sqlTerminalEquipmentType}','{g_sqlTerminalEquipmentId}','{g_sqlVersionNumber}','{sqlSerialNum}','{number}'," + $"values('{sqlId}','{g_sqlRecordTime}','{g_sqlTerminalEquipmentType}','{g_sqlTerminalEquipmentId}','{g_sqlVersionNumber}','{sqlSerialNum}','{number}'," +
$"FORMAT('{reOutputCurrent48}',2),FORMAT('{reOutputCurrent24}',2),FORMAT('{reOutputCurrent12}',2)," + $"FORMAT('{reOutputCurrent48}',2),FORMAT('{reOutputCurrent24}',2),FORMAT('{reOutputCurrent12}',2),FORMAT('{outputCurrentMulti}',2)," +
$"FORMAT('{outputCurrentMulti}',2),FORMAT('{outputCurrentCTD}',2),FORMAT('{outputCurrentADCP}',2),FORMAT('{outputCurrentUV1}',2),FORMAT('{outputCurrentUV2}',2)," + $"FORMAT('{outputCurrentCTD}',2),FORMAT('{outputCurrentADCP}',2),FORMAT('{outputCurrentUV1}',2),FORMAT('{outputCurrentUV2}',2)," +
$"FORMAT('{outputCurrentUV3}',2),FORMAT('{outputCurrentUV4}',2),FORMAT('{outputCurrentCO2}',2),FORMAT('{outputVoltageIma}',2),FORMAT('{outputCurrentIma}',2));"; $"FORMAT('{outputCurrentUV3}',2),FORMAT('{outputCurrentUV4}',2),FORMAT('{outputCurrentCO2}',2),FORMAT('{outputVoltageIma}',2));";
try try
{ {

View File

@ -96,11 +96,11 @@ namespace ZTTMS_Manage_yibayiyi_20230320
} }
else if (date1 == date2) else if (date1 == date2)
{ {
RefreshData1($"select * from tb_outputstateinfo_data where record_time='{date1}' and revoltage48!='' order by record_time desc limit 50;"); RefreshData1($"select * from tb_outputstateinfo_data where record_time='{date1}' and recurrent48!='' order by record_time desc limit 50;");
} }
else else
{ {
RefreshData1($"select * from tb_outputstateinfo_data where record_time between '{date1}'and '{date2}' and revoltage48!='' order by record_time desc limit 50;"); RefreshData1($"select * from tb_outputstateinfo_data where record_time between '{date1}'and '{date2}' and recurrent48!='' order by record_time desc limit 50;");
} }
EveryDayLog.WriteDZ("上位机进行筛选电子腔输出端口状态数据操作,数据范围为'" + date1.ToString() + "'-'" + date2.ToString() + "'!"); EveryDayLog.WriteDZ("上位机进行筛选电子腔输出端口状态数据操作,数据范围为'" + date1.ToString() + "'-'" + date2.ToString() + "'!");
@ -111,7 +111,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
dtpStartTime.Value = new DateTime(2023, 1, 1, 00, 00, 00); dtpStartTime.Value = new DateTime(2023, 1, 1, 00, 00, 00);
dtpStopTime.Value = new DateTime(2023, 1, 1, 00, 00, 00); dtpStopTime.Value = new DateTime(2023, 1, 1, 00, 00, 00);
RefreshData1($"select * from tb_outputstateinfo_data where revoltage48!='' order by record_time desc limit 50;"); RefreshData1($"select * from tb_outputstateinfo_data where recurrent48!='' order by record_time desc limit 50;");
EveryDayLog.WriteDZ("上位机进行重置电子腔输出端口状态数据操作!"); EveryDayLog.WriteDZ("上位机进行重置电子腔输出端口状态数据操作!");
} }
@ -121,7 +121,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
dtpStartTime.Value = new DateTime(2023, 1, 1, 00, 00, 00); dtpStartTime.Value = new DateTime(2023, 1, 1, 00, 00, 00);
dtpStopTime.Value = new DateTime(2023, 1, 1, 00, 00, 00); dtpStopTime.Value = new DateTime(2023, 1, 1, 00, 00, 00);
RefreshData1($"select * from tb_outputstateinfo_data where revoltage48!='' order by record_time desc limit 50;"); RefreshData1($"select * from tb_outputstateinfo_data where recurrent48!='' order by record_time desc limit 50;");
EveryDayLog.WriteDZ("上位机进行刷新电子腔输出端口状态数据操作!"); EveryDayLog.WriteDZ("上位机进行刷新电子腔输出端口状态数据操作!");
} }
@ -560,7 +560,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
private void OutputStatusInfoDataForm_Shown(object sender, EventArgs e) private void OutputStatusInfoDataForm_Shown(object sender, EventArgs e)
{ {
RefreshData($"select * from tb_outputstateinfo_data where revoltage48!='' order by record_time desc limit 50;"); RefreshData($"select * from tb_outputstateinfo_data where recurrent48!='' order by record_time desc limit 50;");
} }
private void OutputStatusInfoDataForm_Load(object sender, EventArgs e) private void OutputStatusInfoDataForm_Load(object sender, EventArgs e)
@ -581,7 +581,7 @@ namespace ZTTMS_Manage_yibayiyi_20230320
private void lblTitle_TextChanged(object sender, EventArgs e) private void lblTitle_TextChanged(object sender, EventArgs e)
{ {
RefreshData($"select * from tb_outputstateinfo_data where revoltage48!='' order by record_time desc limit 50;"); RefreshData($"select * from tb_outputstateinfo_data where recurrent48!='' order by record_time desc limit 50;");
} }

View File

@ -68,45 +68,45 @@ namespace ZTTMS_Manage_yibayiyi_20230320
g_serialDataError = 0; g_serialDataError = 0;
g_serialRequestData = 0; g_serialRequestData = 0;
try //try
{ //{
//在服务器端创建一个负责IP地址和端口号的Socket // //在服务器端创建一个负责IP地址和端口号的Socket
g_socketWatch = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); // g_socketWatch = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
//g_socketWatch.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); // //g_socketWatch.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
//string ip3 = "192.168.1.240"; // //string ip3 = "192.168.1.240";
IPAddress ip2 = IPAddress.Any; // IPAddress ip2 = IPAddress.Any;
//创建端口号对象 // //创建端口号对象
Console.WriteLine("创建端口号对象"); // Console.WriteLine("创建端口号对象");
//IPEndPoint point = new IPEndPoint(IPAddress.Parse(ip3), g_port); // //IPEndPoint point = new IPEndPoint(IPAddress.Parse(ip3), g_port);
IPEndPoint point = new IPEndPoint(ip2, g_port); // IPEndPoint point = new IPEndPoint(ip2, g_port);
//监听 // //监听
g_socketWatch.Bind(point); // g_socketWatch.Bind(point);
g_socketWatch.Listen(10); // g_socketWatch.Listen(10);
trdConnect = new Thread(ListenConnect); // trdConnect = new Thread(ListenConnect);
trdConnect.IsBackground = true; // trdConnect.IsBackground = true;
trdConnect.Start(g_socketWatch); // trdConnect.Start(g_socketWatch);
//trdConnect = new Thread(ListenConnectClient); // //trdConnect = new Thread(ListenConnectClient);
//trdConnect.IsBackground = true; // //trdConnect.IsBackground = true;
//trdConnect.Start(); // //trdConnect.Start();
Thread trdDataSplit = new Thread(DataSplit); // Thread trdDataSplit = new Thread(DataSplit);
trdDataSplit.IsBackground = true; // trdDataSplit.IsBackground = true;
trdDataSplit.Start(); // trdDataSplit.Start();
Thread trdDataAnalysis = new Thread(DataAnalysis); // Thread trdDataAnalysis = new Thread(DataAnalysis);
trdDataAnalysis.IsBackground = true; // trdDataAnalysis.IsBackground = true;
trdDataAnalysis.Start(); // trdDataAnalysis.Start();
} //}
catch (Exception ee) //catch (Exception ee)
{ //{
Console.WriteLine("GDFLLinkError" + ee.Message); // Console.WriteLine("GDFLLinkError" + ee.Message);
EveryDayLog.WriteErrorGDFL("GDFLLinkError" + ee.Message); // EveryDayLog.WriteErrorGDFL("GDFLLinkError" + ee.Message);
Others.g_gdflReceive = false; // Others.g_gdflReceive = false;
Others.g_socketSendGDFL = null; // Others.g_socketSendGDFL = null;
} //}
} }