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 { /// /// 传递AGV与负极SB动作流对接信号 /// public static void AgvAndEquiWorkFJ() { // Console.WriteLine($"心跳调度JOP:开始时间:{DateTime.Now}"); VOLContext Context = new VOLContext(); 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调度"); Task.Run(() => { while (true) { try { WriteLog.GetLog().Write($"开始时间:{DateTime.Now} --------------", $"AGV心跳"); if (agvplc != null) { OperateResult W_AGV_XTZZ = agvplc.SiemensPLCClient.SiemensS7NetClient.Write("DB1000.306.0", true); ; } if (agvplcZ != null) { OperateResult W_AGV_XTZ = agvplcZ.SiemensPLCClient.SiemensS7NetClient.Write("DB1000.306.0", true); } if (agvplcF != null) { OperateResult W_AGV_XTF = agvplcF.SiemensPLCClient.SiemensS7NetClient.Write("DB1000.306.0", true); } Thread.Sleep(300); WriteLog.GetLog().Write($"结束时间:{DateTime.Now} --------------", $"AGV心跳"); } catch (Exception ex) { //throw new Exception(ex.Message); } } }); //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; // } //}); } } }