From e65b91b5402a5fc4b5720c2d5969f6c5e771493b Mon Sep 17 00:00:00 2001 From: lxw Date: Mon, 24 Jun 2024 23:28:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E6=B1=A0=E7=A7=BB=E4=BB=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Station/MonitorService.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Service/Station/MonitorService.cs b/Service/Station/MonitorService.cs index 5a28cd2..671bd6a 100644 --- a/Service/Station/MonitorService.cs +++ b/Service/Station/MonitorService.cs @@ -66,7 +66,6 @@ public class MonitorService : null, Break = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Break, Gear = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel?.CarStatus?.Gear, - }, BatteryInfo = new() { @@ -173,15 +172,29 @@ public class MonitorService return Result.Fail(); } - result = PlcMgr.ReadTaskStatus(2); + int count = 3; + while (count > 0) + { + result = PlcMgr.ReadTaskStatus(2); + if (result) + { + break; + } + + count--; + Thread.Sleep(1000); + } + if (!result) { + Log.Error("BatteryRelocation PlcMgr.ReadTaskStatus(2) =false"); return Result.Fail(); } result = PlcMgr.HoldOn(); if (!result) { + Log.Error("BatteryRelocation PlcMgr.HoldOn() =false"); return Result.Fail(); }