| | |
| | | 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_WCS.JobsPart.AGV; |
| | | using WIDESEA_WCS.SchedulerExecute.AGV; |
| | | using WIDESEA_WCS.WCSClient; |
| | | using static FreeSql.Internal.GlobalFilter; |
| | | |
| | | namespace WIDESEA_WCS |
| | | { |
| | |
| | | [DisallowConcurrentExecution] |
| | | public class AGVUpdateStatusJob : JobBase, IJob |
| | | { |
| | | private static int lockObj1 = 0; |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | try |
| | |
| | | } |
| | | private void DoAction(IJobExecutionContext context) |
| | | { |
| | | try |
| | | if (lockObj1 == 0) |
| | | { |
| | | List<string> AGVS = new List<string> { "组装AGV调度", "正极AGV调度", "负极AGV调度", "组装AGV调度" }; |
| | | foreach (var item in AGVS) |
| | | try |
| | | { |
| | | PLCClient pLCClient = WCSService.Clients.Find(v => v.PLCName == item); |
| | | if (pLCClient == null) |
| | | lockObj1 = 1; |
| | | Task task = Task.Run(() => |
| | | { |
| | | continue; |
| | | } |
| | | AGVSchedulerExecute.UpdateAgvTask(pLCClient); |
| | | 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); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |