From 026a2bbb8c912c5c74a58b0c7915af9548df7204 Mon Sep 17 00:00:00 2001 From: pengliangyang <1406009520@qq.com> Date: Mon, 24 Oct 2022 17:20:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=B3=E9=AD=94=E6=96=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DosingSystem/Model/SiemensPlc/SensorInfo.cs | 24 +++++++++++++++++++ .../ViewModel/RecipeControlViewModel.cs | 10 +++++--- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 DosingSystem/Model/SiemensPlc/SensorInfo.cs diff --git a/DosingSystem/Model/SiemensPlc/SensorInfo.cs b/DosingSystem/Model/SiemensPlc/SensorInfo.cs new file mode 100644 index 00000000..79f363ec --- /dev/null +++ b/DosingSystem/Model/SiemensPlc/SensorInfo.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.DosingSystem.Model.SiemensPlc +{ + public class SensorInfo + { + public bool LocalEStop { get; set; } + public bool RemoteEStop {get; set; } + + public bool[] Sensor { get; set; } = new bool[8]; + + public bool[] Standby1 { get; set; } = new bool[6]; + public bool[] CylinderBase { get; set; } = new bool[8]; + public bool[] CylinderWork { get; set; } = new bool[8]; + + public bool[] Standby2 { get; set; } = new bool[8]; + public bool AlarmAxis1 { get; set; } + public bool AlarmAxis2 { get; set; } + } +} diff --git a/DosingSystem/ViewModel/RecipeControlViewModel.cs b/DosingSystem/ViewModel/RecipeControlViewModel.cs index f4157cee..f8cf025b 100644 --- a/DosingSystem/ViewModel/RecipeControlViewModel.cs +++ b/DosingSystem/ViewModel/RecipeControlViewModel.cs @@ -119,14 +119,18 @@ namespace BPASmartClient.DosingSystem.ViewModel Stopwatch sw = new Stopwatch(); App.Current.Dispatcher.Invoke(() => { recipeProcesses.Add(Recipes.ElementAt(index)); }); sw.Restart(); - while (!GlobalDevice.PlcData.ResComplete) + while (true) { - if (sw.ElapsedMilliseconds >= 3000) + if (sw.ElapsedMilliseconds >= 3000 && !GlobalDevice.PlcData.ResComplete) { MessageNotify.GetInstance.ShowRunLog("获取配方下发反馈超时"); break; } - if (GlobalDevice.PlcData.ResComplete) SiemensDevice.GetInstance.MySiemens.Write("DB3.DBX0.1", false); + if (GlobalDevice.PlcData.ResComplete) + { + SiemensDevice.GetInstance.MySiemens.Write("DB3.DBX0.1", false); + break; + } Thread.Sleep(100); } #endregion