1
czw
2025-07-09 993e734be337d5acea34cba80c6f0de2db9fe1bc
2025年6月12日/AuxAllWCS/Build/Project/代码/VS自定义类/AutoThread.cs
@@ -27,6 +27,7 @@
using System.Threading;
using System.IO;
using GZ.Device.Agv;
using System.Net.NetworkInformation;
namespace GZ.Projects.AuxAllWCS
{
@@ -133,13 +134,33 @@
            tasks.Add(GetTask(ThreadMXC3, tag, 3000));
            tasks.Add(GetTask(ThreadMXC4, tag, 3000));
            tasks.Add(GetTask(ResetGats, tag, 3000));
            Task.WaitAll(tasks.ToArray());
        }
        public static bool IsMachineOnline(string hostNameOrIp, int timeout = 1000)
        {
            try
            {
                using (var ping = new Ping())
                {
                    var reply = ping.Send(hostNameOrIp, timeout);
                    return reply.Status == IPStatus.Success;
                }
            }
            catch (PingException)
            {
                return false;
            }
            catch (Exception)
            {
                // 鍏朵粬寮傚父澶勭悊
                return false;
            }
        }
        private Task GetTask(Action<Tag> action, Tag tag, int i = 2500)
        {