From 248f2a7eebefc7413cfaff7dbd474cbb1299a021 Mon Sep 17 00:00:00 2001 From: zby <2494737567@qq.com> Date: Mon, 28 Oct 2024 13:33:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9rfid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Execute/Step/StationReadyState.cs | 25 +++++++++++++++++------ Service/Led/LedClient.cs | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs index a4b5f41..18fba46 100644 --- a/Service/Execute/Step/StationReadyState.cs +++ b/Service/Execute/Step/StationReadyState.cs @@ -47,6 +47,7 @@ public class StationReadyState : IState machine); LedClient.SendMsgByKey(InfoEnum.SwapInfo.WelcomeInfo.GetLed()); + Thread.Sleep(2000); ////开启雷达 var beginRadar = ControlRadar(machine, 1); if (InvokeStatus.Done != beginRadar) @@ -340,14 +341,26 @@ public class StationReadyState : IState private InvokeStatus ReadRfid(SwappingStateMachine machine) { //开始读rifd - return Invoker.Invoke("read rfid", 3000, 10, machine.IsCanceled, + return Invoker.Invoke("read rfid", 1000, 10, machine.IsCanceled, () => machine.RfidReadFlag, () => { Task rfidReadModel = RfidApi.ReadRfid(); rfidReadModel.Wait(); var machineRfidReadModel = rfidReadModel.Result; - - + Thread.Sleep(1000); + Task beginRead = RfidApi.BeginRead(); + beginRead.Wait(); + if (!beginRead.Result) + { + _log.Info("begin read rfid error"); + } + else + { + machine.ExceptionReason = ExceptionReason.None; + _log.Info("begin read done"); + machine.BeginRfidReadFlag = true; + } + Thread.Sleep(1000); if (rfidReadModel.IsCompletedSuccessfully && machineRfidReadModel != null && machineRfidReadModel.Result == 1 && !string.IsNullOrEmpty(machineRfidReadModel.VelVin)) @@ -365,11 +378,11 @@ public class StationReadyState : IState _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag, machine,param:JsonConvert.SerializeObject(machine.RfidReadModel)); - //RfidApi.StopRead(); - // _log.Info("stop read rfid"); - // RfidApi.DisConnect(); machine.RfidConnectFlag = false; machine.RfidReadFlag = true; + + + } }, () => { diff --git a/Service/Led/LedClient.cs b/Service/Led/LedClient.cs index 995ec66..cda3f41 100644 --- a/Service/Led/LedClient.cs +++ b/Service/Led/LedClient.cs @@ -227,7 +227,7 @@ public class LedClient } }*/ - Thread.Sleep(3000); + Thread.Sleep(4500); } }