From 731936513120372288a69703ba0d9b1e9b00aeab Mon Sep 17 00:00:00 2001 From: lxw Date: Tue, 25 Jun 2024 13:35:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E7=A1=AE=E8=AE=A4=E8=A7=A3?= =?UTF-8?q?=E9=94=81=E6=88=90=E5=8A=9F=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Execute/Step/CarCtrlState.cs | 3 +- Service/Execute/Step/SwapDoneState.cs | 3 +- Service/Execute/SwappingStateMachine.cs | 28 +++++++++++++++---- .../Controllers/SwapMonitorController.cs | 20 +++++++++++++ 4 files changed, 47 insertions(+), 7 deletions(-) diff --git a/Service/Execute/Step/CarCtrlState.cs b/Service/Execute/Step/CarCtrlState.cs index 32f361b..2503e3d 100644 --- a/Service/Execute/Step/CarCtrlState.cs +++ b/Service/Execute/Step/CarCtrlState.cs @@ -61,8 +61,9 @@ public class CarCtrlState : IState //查询车辆锁止状态 Task carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin); var resultHeartBeatMsg = carInfo.Result.CarStatus; - if (resultHeartBeatMsg?.LockStatus == 1) + if (resultHeartBeatMsg?.LockStatus == 1 || machine.ManualConfirmCarUnlockFlag) { + machine.ManualConfirmCarUnlockFlag = false; machine.BoxCarInfoModel = carInfo.Result; machine.VelUnlockFlag = true; _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelUnlockFlag, diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs index 19fd5c0..94f1f46 100644 --- a/Service/Execute/Step/SwapDoneState.cs +++ b/Service/Execute/Step/SwapDoneState.cs @@ -103,8 +103,9 @@ public class SwapDoneState : IState { //查询车辆锁止状态 Task carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin); - if (carInfo.Result?.CarStatus?.LockStatus == 2) + if (carInfo.Result?.CarStatus?.LockStatus == 2 || machine.ManualConfirmCarLockFlag) { + machine.ManualConfirmCarLockFlag = false; machine.BoxCarInfoModel = carInfo.Result; //设置出口的是绿灯 if (PlcApi.WriteExistLamp(1000)) diff --git a/Service/Execute/SwappingStateMachine.cs b/Service/Execute/SwappingStateMachine.cs index 022f871..317496b 100644 --- a/Service/Execute/SwappingStateMachine.cs +++ b/Service/Execute/SwappingStateMachine.cs @@ -32,11 +32,12 @@ public class SwappingStateMachine : IDisposable //手动确认换电成功 public bool ManualSwapSuccFlag { get; set; } = false; - - //手动确认解锁/上锁成功 - public bool ManualConfirmCarOperateFlag { get; set; } + //手动确认解锁/上锁成功 + public bool ManualConfirmCarUnlockFlag { get; set; } + //手动确认解锁/上锁成功 + public bool ManualConfirmCarLockFlag { get; set; } public OperateModel OperateModel = null; public readonly LedTool? LedTool = null; @@ -279,6 +280,23 @@ public class SwappingStateMachine : IDisposable Log.Info($"ManualSwapSuccFlag machine ok"); return true; } + + public bool ManualConfirmLockCar() + { + ManualConfirmCarLockFlag = true; + Thread.Sleep(2000); + Log.Info($"ManualConfirmLockCar ok"); + return true; + } + + public bool ManualConfirmUnLockCar() + { + ManualConfirmCarUnlockFlag = true; + Thread.Sleep(2000); + Log.Info($"ManualConfirmLockCar ok"); + return true; + } + private void ResetData() @@ -305,8 +323,8 @@ public class SwappingStateMachine : IDisposable PlcSwapFlag = false; ManualSwapSuccFlag = false; OperateModel = null; - ManualConfirmCarOperateFlag = false; - + ManualConfirmCarUnlockFlag = false; + ManualConfirmCarLockFlag = false; CancelFlag = false; StopFlag = false; } diff --git a/WebStarter/Controllers/SwapMonitorController.cs b/WebStarter/Controllers/SwapMonitorController.cs index 1cead45..1aebf33 100644 --- a/WebStarter/Controllers/SwapMonitorController.cs +++ b/WebStarter/Controllers/SwapMonitorController.cs @@ -293,4 +293,24 @@ public class SwapMonitorController : ControllerBase return Result>.Success(carInfoList.Where(i => i.CarNo.Length >= 17).ToList()); } + + /// + /// 确认上锁成功 + /// + [HttpGet("ConfirmLockSucc")] + public async Task> ConfirmLockSucc() + { + StationSoftMgr.SwappingStateMachine.ManualConfirmLockCar(); + return Result.Success(); + } + + /// + /// 确认解锁成功 + /// + [HttpGet("ConfirmUnLockSucc")] + public async Task> ConfirmUnLockSucc() + { + StationSoftMgr.SwappingStateMachine.ManualConfirmUnLockCar(); + return Result.Success(); + } } \ No newline at end of file