From 477ba825269b68d531082992aa910994b21551d8 Mon Sep 17 00:00:00 2001 From: tfarcraw <123211521@163.com> Date: Wed, 12 Aug 2026 09:44:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=A1=8C=E5=B0=B1=E9=94=81=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ViewModel/MainWindowVM.cs | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/ViewModel/MainWindowVM.cs b/ViewModel/MainWindowVM.cs index 0fd0c8f..eb0e629 100644 --- a/ViewModel/MainWindowVM.cs +++ b/ViewModel/MainWindowVM.cs @@ -2034,11 +2034,26 @@ namespace ViewModel LogicDispatch(LogicDispatchFlow); + if (MyPLC != null && MyPLC.PLC != null && MyPLC.PLC.PlcStatus.StatusBackground == ColorStr.Green) + { + if (lockTime.AddSeconds(1) < DateTime.Now) + { + + lockTime = DateTime.Now; + MyPLC.PLC.Write("Y2", true); + Door = "已锁"; + break; + + } + + + } } } } + private DateTime lockTime = DateTime.Now; private DateTime powerTime = DateTime.Now; #endregion @@ -2170,7 +2185,7 @@ namespace ViewModel MyHand = AllGrouhandList.Where(w => w.State.StatusBackground == ColorStr.Blue).FirstOrDefault(); if (MyHand != null) { - + MyFlow.RunStep++; MyFlow.RunTime = DateTime.Now; } @@ -3204,11 +3219,16 @@ namespace ViewModel /// public void Start(object per) { - if (MyPLC != null && MyPLC.PLC != null && MyPLC.PLC.PlcStatus.StatusBackground == ColorStr.Green) + + + if (Door != "已锁") { - MyPLC.PLC.Write("Y2", true); //锁门 - Door = "已锁"; + + ExcepStop("请关闭门锁后再启动"); + return; + } + if (RunStatu == RunStatuEnum.Normal) { return;