wangxinhui
2024-11-06 8f392cc88b0768b74efca3b68785cf5aa1c38e70
wcs-server-hbf/WIDESEA_WCS/Jobs/AGV/AGVUpdateStatusJob.cs
@@ -9,6 +9,7 @@
using System.Runtime.Serialization.Json;
using System.Security.Policy;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WIDESEA_Common.Tools;
using WIDESEA_Entity.DomainModels.Equipment;
@@ -17,6 +18,7 @@
using WIDESEA_WCS.JobsPart.AGV;
using WIDESEA_WCS.SchedulerExecute.AGV;
using WIDESEA_WCS.WCSClient;
using static FreeSql.Internal.GlobalFilter;
namespace WIDESEA_WCS
{
@@ -26,6 +28,7 @@
    [DisallowConcurrentExecution]
    public class AGVUpdateStatusJob : JobBase, IJob
    {
        private static int lockObj1 = 0;
        public Task Execute(IJobExecutionContext context)
        {
            try
@@ -37,9 +40,16 @@
        }
        private void DoAction(IJobExecutionContext context)
        {
            if (lockObj1 == 0)
            {
            try
            {
                List<string> AGVS = new List<string> { "组装AGV调度", "正极AGV调度", "负极AGV调度", "组装AGV调度" };
                    lockObj1 = 1;
                    Task task = Task.Run(() =>
                    {
                        List<string> AGVS = new List<string> { "组装AGV调度", "正极AGV调度", "负极AGV调度" };
                        while (true)
                        {
                foreach (var item in AGVS)
                {
                    PLCClient pLCClient = WCSService.Clients.Find(v => v.PLCName == item);
@@ -47,13 +57,19 @@
                    {
                        continue;
                    }
                    AGVSchedulerExecute.UpdateAgvTask(pLCClient);
                                AGVSchedulerExecute.UpdateAgvTaskText(pLCClient);
                }
                            Thread.Sleep(200);
                        }
                    });
            }
            catch (Exception ex)
            {
                    lockObj1 = 0;
                throw new Exception(ex.Message);
            }
        }
        }
    }
}