فهرست منبع

秤点状态监控

BourneCao 3 سال پیش
والد
کامیت
d5c5670b34
4فایلهای تغییر یافته به همراه86 افزوده شده و 2 حذف شده
  1. 1 1
      CarMeterSystem/App.config
  2. 37 0
      CarMeterSystem/Form1.cs
  3. 37 0
      CarMeterSystem/frmMain.cs
  4. 11 1
      Common/vo/base/MeterBaseSpotInfo.cs

+ 1 - 1
CarMeterSystem/App.config

@@ -15,7 +15,7 @@
     <!--<add key="ServiceUrl" value="http://jgwzjl.jiugang.com/icore.icp.web/pass/systemBase/v1"/>-->
     <!--<add key="ServiceUrl" value="http://10.130.1.2/icore.icp.web/pass/systemBase/v1"/>-->
     <!--实时库地址-->
-    <add key="icoredbTcp" value="tarantool://guest@10.99.200.86:21019" />
+    <add key="icoredbTcp" value="tarantool://guest@10.130.1.3:2101" />
     <add key="icoredbTcp2" value="tarantool://guest@10.99.200.86:2101" />
     <!--<add key="icoredbTcp" value="tarantool://guest@10.130.1.3:2101" />-->
     <!--SFTP或者vsftp服务端连接及地址-->

+ 37 - 0
CarMeterSystem/Form1.cs

@@ -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
     }
 }

+ 37 - 0
CarMeterSystem/frmMain.cs

@@ -14,6 +14,7 @@ using System.Data;
 using System.Diagnostics;
 using System.Drawing;
 using System.Linq;
+using System.Net.NetworkInformation;
 using System.Threading;
 using System.Windows.Forms;
 using SystemOffLine;
@@ -1021,6 +1022,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);
@@ -1388,5 +1401,29 @@ namespace CarMeterSystem
             thWriteMonitor.Start();
         }
         #endregion 更新监控表线程
+
+        #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
     }
 }

+ 11 - 1
Common/vo/base/MeterBaseSpotInfo.cs

@@ -164,6 +164,16 @@ namespace Common
 		/// 是否允许使用期限皮重
 		/// <summary>
 		public string allowedTareWeight { get; set; }
-		
+
+		/// <summary>
+		/// MOXA卡IP
+		/// <summary>
+		public string moxaIp { get; set; }
+
+		/// <summary>
+		/// PLCIP
+		/// <summary>
+		public string plcIp { get; set; }
+
 	}
 }