From e86c8971179fbf600196da8db1bd2db37c2bc45a Mon Sep 17 00:00:00 2001 From: CZ Date: Mon, 19 Aug 2024 09:55:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E6=AD=A5=E7=8A=B6=E6=80=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Constant/InfoEnum.cs | 6 +++--- Service/Execute/Mgr/CommonMgr.cs | 4 ++-- Service/Execute/Step/StationReadyState.cs | 9 ++++++++- Service/Execute/SwappingStateMachine.cs | 10 +++++----- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Entity/Constant/InfoEnum.cs b/Entity/Constant/InfoEnum.cs index e835970..0528fc4 100644 --- a/Entity/Constant/InfoEnum.cs +++ b/Entity/Constant/InfoEnum.cs @@ -105,7 +105,7 @@ public class InfoEnum [Const("空闲")] Idel, [Const("车辆到站(入口雷达检测到车辆驶入)")] RadarInFlag, [Const("rfid扫描完成")] RfidReadFlag, - [Const("云平台车辆认证")] CloudVelCheckFlag, + //[Const("云平台车辆认证")] CloudVelCheckFlag, [Const("车辆到位")] CarInPositionFlag, // [Const("云平台下发换电指令")] CloudCarCanStartFlag, [Const("车辆解锁")] VelUnlockFlag, @@ -113,8 +113,8 @@ public class InfoEnum [Const("开始换电")] StartSwappingFlag, [Const("拆旧电池完成")] UnOldBatteryFlag, - [Const("入库旧电池完成")] StorageOldBatteryFlag, - [Const("搬运新电池完成")] OutNewBatteryFlag, + //[Const("入库旧电池完成")] StorageOldBatteryFlag, + //[Const("搬运新电池完成")] OutNewBatteryFlag, [Const("安装新电池完成")] InstallNewBatteryFlag, [Const("安装完成")] FinishNewBatteryFlag, [Const("车辆上锁")] VelLockFlag, diff --git a/Service/Execute/Mgr/CommonMgr.cs b/Service/Execute/Mgr/CommonMgr.cs index 6fc57f1..814328f 100644 --- a/Service/Execute/Mgr/CommonMgr.cs +++ b/Service/Execute/Mgr/CommonMgr.cs @@ -48,8 +48,8 @@ public class CommonMgr machine.StepModel[stepModel.StepNo.ToString()] = stepModel; - _swapOrderStepService.InsertSwapStepForSwapMain(step, - machine.StepSort++, machine.SwapOrder.Sn); + if(!string.IsNullOrEmpty(machine.SwapOrder.Sn)) + _swapOrderStepService.InsertSwapStepForSwapMain(step, machine.StepSort++, machine.SwapOrder.Sn); } diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs index 73f13ad..24321ec 100644 --- a/Service/Execute/Step/StationReadyState.cs +++ b/Service/Execute/Step/StationReadyState.cs @@ -170,7 +170,14 @@ public class StationReadyState : IState public InvokeStatus AdjustCarByRadar(SwappingStateMachine machine) { - return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState == 6, + return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, + () => + { + //新增小步 + _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag, + machine); + return PadarMgr._PadarClient?.CarState == 6; + }, () => { switch (PadarMgr._PadarClient?.CarState) diff --git a/Service/Execute/SwappingStateMachine.cs b/Service/Execute/SwappingStateMachine.cs index 3ad81dc..eac0185 100644 --- a/Service/Execute/SwappingStateMachine.cs +++ b/Service/Execute/SwappingStateMachine.cs @@ -1,11 +1,9 @@ using System.Collections.Concurrent; using Autofac; -using DotNetty.Common.Utilities; using Entity.Constant; using Entity.DbModel.Station; using HybirdFrameworkCore.Autofac; using log4net; -using Newtonsoft.Json; using Repository.Station; using Service.Charger.Client; using Service.Execute.Api; @@ -73,7 +71,7 @@ public class SwappingStateMachine : IDisposable ["0"] = new StepModel { StepNo = 0, Status = 0, StepName = "空闲" }, ["1"] = new StepModel { StepNo = 1, Status = 0, StepName = "车辆到站(入口雷达检测到车辆驶入)" }, ["2"] = new StepModel { StepNo = 2, Status = 0, StepName = "rfid扫描完成" }, - ["3"] = new StepModel { StepNo = 3, Status = 0, StepName = "云平台车辆认证" }, + //["3"] = new StepModel { StepNo = 3, Status = 0, StepName = "云平台车辆认证" }, ["4"] = new StepModel { StepNo = 4, Status = 0, StepName = "车辆到位" }, // ["5"] = new StepModel { StepNo = 5, Status = 0, StepName = "云平台下发换电指令" }, ["5"] = new StepModel { StepNo = 5, Status = 0, StepName = "车辆解锁" }, @@ -81,13 +79,15 @@ public class SwappingStateMachine : IDisposable ["6"] = new StepModel { StepNo = 6, Status = 0, StepName = "开始换电" }, ["7"] = new StepModel { StepNo = 7, Status = 0, StepName = "拆旧电池完成" }, - ["8"] = new StepModel { StepNo = 8, Status = 0, StepName = "入库旧电池完成" }, - ["9"] = new StepModel { StepNo = 9, Status = 0, StepName = "搬运新电池完成" }, + //["8"] = new StepModel { StepNo = 8, Status = 0, StepName = "入库旧电池完成" }, + //["9"] = new StepModel { StepNo = 9, Status = 0, StepName = "搬运新电池完成" }, ["10"] = new StepModel { StepNo = 10, Status = 0, StepName = "安装新电池完成" }, ["11"] = new StepModel { StepNo = 11, Status = 0, StepName = "安装完成" }, ["12"] = new StepModel { StepNo = 12, Status = 0, StepName = "车辆上锁" }, ["13"] = new StepModel { StepNo = 13, Status = 0, StepName = "换电完成(车辆驶离)" }, ["14"] = new StepModel { StepNo = 14, Status = 0, StepName = "换电失败(车辆驶离)" }, + + }; #region 小步状态