using Furion.JsonSerialization;
|
using Microsoft.CodeAnalysis;
|
using Newtonsoft.Json;
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
|
using Quartz;
|
using System;
|
using System.Collections.Generic;
|
using System.IO;
|
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;
|
using WIDESEA_Services.Services;
|
using WIDESEA_WCS.Jobs;
|
using WIDESEA_WCS.JobsPart.AGV;
|
using WIDESEA_WCS.SchedulerExecute.AGV;
|
using WIDESEA_WCS.WCSClient;
|
using static FreeSql.Internal.GlobalFilter;
|
|
namespace WIDESEA_WCS
|
{
|
/// <summary>
|
/// AGV调度
|
/// </summary>
|
[DisallowConcurrentExecution]
|
public class AGVUpdateStatusJob : JobBase, IJob
|
{
|
private static int lockObj1 = 0;
|
public Task Execute(IJobExecutionContext context)
|
{
|
try
|
{
|
ExecuteJob(context, DoAction);
|
}
|
catch { }
|
return Task.FromResult(string.Empty);
|
}
|
private void DoAction(IJobExecutionContext context)
|
{
|
if (lockObj1 == 0)
|
{
|
try
|
{
|
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);
|
if (pLCClient == null)
|
{
|
continue;
|
}
|
AGVSchedulerExecute.UpdateAgvTaskText(pLCClient);
|
}
|
Thread.Sleep(200);
|
}
|
});
|
}
|
catch (Exception ex)
|
{
|
lockObj1 = 0;
|
throw new Exception(ex.Message);
|
}
|
}
|
|
}
|
}
|
}
|