|
|
@@ -14,6 +14,7 @@ using System.Diagnostics;
|
|
|
using System.Drawing;
|
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
|
+using System.Net.NetworkInformation;
|
|
|
using System.Windows.Forms;
|
|
|
using SystemOffLine;
|
|
|
|
|
|
@@ -946,6 +947,18 @@ namespace CarMeterSystem
|
|
|
meterWorkMonitorEventDataI.isOverWgt = "";
|
|
|
meterWorkMonitorEventDataI.isHelp = "0";
|
|
|
meterWorkMonitorEventDataI.wgt = e.weight;
|
|
|
+
|
|
|
+ // 终端机,DVR,MOXA,PLC状态监控
|
|
|
+ // 20220928 by BourneCao
|
|
|
+ bool DVR_Online = PingIp(PbCache.sportInfo.videoIp);
|
|
|
+ meterWorkMonitorEventDataI.dvrState = DVR_Online == true ? "0" : "1";
|
|
|
+ bool Power_Online = PingIp(PbCache.sportInfo.controlIp);
|
|
|
+ meterWorkMonitorEventDataI.powerState = Power_Online == true ? "0" : "1";
|
|
|
+ bool MOXA_Online = PingIp(PbCache.sportInfo.moxaIp);
|
|
|
+ meterWorkMonitorEventDataI.moxaState = MOXA_Online == true ? "0" : "1";
|
|
|
+ bool PLC_Online = PingIp(PbCache.sportInfo.plcIp);
|
|
|
+ meterWorkMonitorEventDataI.plcState = PLC_Online == true ? "0" : "1";
|
|
|
+
|
|
|
//*
|
|
|
//另外初始化一次监控数据
|
|
|
RESTfulResult<string> rmssEventData = meterWorkMonitor.doUpdateWf(meterWorkMonitorEventDataI);
|
|
|
@@ -1663,5 +1676,29 @@ namespace CarMeterSystem
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ #region PING IP
|
|
|
+ /// <summary>
|
|
|
+ /// ping ip,测试能否ping通
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="strIP">IP地址</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool PingIp(string strIP)
|
|
|
+ {
|
|
|
+ bool bRet = false;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Ping pingSend = new Ping();
|
|
|
+ PingReply reply = pingSend.Send(strIP, 1000);
|
|
|
+ if (reply.Status == IPStatus.Success)
|
|
|
+ bRet = true;
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ bRet = false;
|
|
|
+ }
|
|
|
+ return bRet;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|