using HslCommunication;
|
using System;
|
using System.Collections.Generic;
|
using System.Threading;
|
using System.Threading.Tasks;
|
using WIDESEA_Common.Tools;
|
using WIDESEA_Core.EFDbContext;
|
using WIDESEA_Services.IRepositories;
|
using WIDESEA_Services.Repositories;
|
using WIDESEA_WCS.WCSClient;
|
|
namespace WIDESEA_WCS.SchedulerExecute.AGV
|
{
|
public partial class AGVSchedulerExecute
|
{
|
/// <summary>
|
/// 传递AGV与负极SB动作流对接信号
|
/// </summary>
|
public static void AgvAndEquiWorkFJ()
|
{
|
// Console.WriteLine($"心跳调度JOP:开始时间:{DateTime.Now}");
|
VOLContext Context = new VOLContext();
|
Idt_plcinfodetailRepository plcdetailRep = new dt_plcinfodetailRepository(Context);
|
Idt_plcinfoheadRepository plcheadRep = new dt_plcinfoheadRepository(Context);
|
PLCClient agvplcZ = WCSService.Clients.Find(v => v.PLCName == "正极AGV调度");
|
PLCClient agvplcF = WCSService.Clients.Find(v => v.PLCName == "负极AGV调度");
|
PLCClient agvplc = WCSService.Clients.Find(v => v.PLCName == "组装AGV调度");
|
List<Task> taskList = new List<Task>();
|
var tokenSource = new CancellationTokenSource();
|
//var token = tokenSource.Token;
|
Task.Run(() =>
|
{
|
try
|
{
|
if (WCSService.Clients == null || agvplc == null)
|
{
|
return;
|
}
|
OperateResult W_AGV_XTZZ = agvplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1000.306.0", true);
|
// Console.WriteLine($"组装AGV调度:[{W_AGV_XTZZ.IsSuccess}],时间:{DateTime.Now}");
|
if (!W_AGV_XTZZ.IsSuccess)
|
{
|
return;
|
}
|
|
}
|
catch (Exception)
|
{
|
|
throw;
|
}
|
});
|
Task.Run(() =>
|
{
|
try
|
{
|
if (WCSService.Clients == null || agvplcZ == null)
|
{
|
return;
|
}
|
OperateResult W_AGV_XTZ = agvplcZ.SiemensPLCClient.SiemensS7NetClient.Write("DB1000.306.0", true);
|
// Console.WriteLine($"正极AGV调度:[{W_AGV_XTZ.IsSuccess}],时间:{DateTime.Now}");
|
if (!W_AGV_XTZ.IsSuccess)
|
{
|
return;
|
}
|
}
|
catch (Exception)
|
{
|
|
throw;
|
}
|
});
|
Task.Run(() =>
|
{
|
try
|
{
|
if (WCSService.Clients == null || agvplcF == null)
|
{
|
return;
|
}
|
OperateResult W_AGV_XTF = agvplcF.SiemensPLCClient.SiemensS7NetClient.Write("DB1000.306.0", true);
|
//Console.WriteLine($"负极AGV调度:[{W_AGV_XTF.IsSuccess}],时间:{DateTime.Now}");
|
if (!W_AGV_XTF.IsSuccess)
|
{
|
return;
|
}
|
}
|
catch (Exception)
|
{
|
|
throw;
|
}
|
|
});
|
|
|
}
|
}
|
}
|