diff --git a/Entity/Api/Resp/SwappingStateInfoResp.cs b/Entity/Api/Resp/SwappingStateInfoResp.cs
index 38f9c49..168e0d8 100644
--- a/Entity/Api/Resp/SwappingStateInfoResp.cs
+++ b/Entity/Api/Resp/SwappingStateInfoResp.cs
@@ -16,6 +16,10 @@ public class SwappingStateInfoResp
///
/// 换电步序时刻
///
- public DateTime StartTime{ get; set; }
-
+ public DateTime? StartTime{ get; set; }
+ ///
+ /// 步序执行状态
+ /// 0:初始化 1:执行完成
+ ///
+ public int Status{ get; set; }
}
\ No newline at end of file
diff --git a/Service/Execute/Mgr/CommonMgr.cs b/Service/Execute/Mgr/CommonMgr.cs
index a4377bf..6b578f2 100644
--- a/Service/Execute/Mgr/CommonMgr.cs
+++ b/Service/Execute/Mgr/CommonMgr.cs
@@ -39,12 +39,15 @@ public class CommonMgr
///
public void InsertStep(InfoEnum.BusinessSwappingStep step, SwappingStateMachine machine)
{
- machine.StepModel.Add(new()
+ var stepModel = new StepModel
{
StepName = BaseEnumExtensions.GetDescription(step),
StepNo = (int)step,
- StartTime = DateTime.Now
- });
+ StartTime = DateTime.Now,
+ Status = 1
+ };
+ machine.StepModel[step.ToString()] = stepModel;
+
_swapOrderStepService.InsertSwapStepForSwapMain(step,
machine.StepSort++, machine.SwapOrder.Sn);
}
diff --git a/Service/Execute/Model/StepModel.cs b/Service/Execute/Model/StepModel.cs
index 9cfd210..105042e 100644
--- a/Service/Execute/Model/StepModel.cs
+++ b/Service/Execute/Model/StepModel.cs
@@ -19,5 +19,10 @@ public class StepModel
///
/// 换电步序时刻
///
- public DateTime StartTime{ get; set; }
+ public DateTime? StartTime{ get; set; }
+ ///
+ /// 步序执行状态
+ /// 0:初始化 1:执行完成
+ ///
+ public int Status{ get; set; }
}
\ No newline at end of file
diff --git a/Service/Execute/SwappingStateMachine.cs b/Service/Execute/SwappingStateMachine.cs
index 6f11e30..0fa9635 100644
--- a/Service/Execute/SwappingStateMachine.cs
+++ b/Service/Execute/SwappingStateMachine.cs
@@ -1,4 +1,5 @@
-using Autofac;
+using System.Collections.Concurrent;
+using Autofac;
using DotNetty.Common.Utilities;
using Entity.Constant;
using Entity.DbModel.Station;
@@ -66,9 +67,26 @@ public class SwappingStateMachine : IDisposable
public SwapOrderBatteryInfo? SwapOrderBatteryInfo = null;
- public List StepModel = null;
-
-
+ public ConcurrentDictionary StepModel =
+ new ConcurrentDictionary
+ {
+ ["1"] = new StepModel { StepNo = 1, Status = 0, StepName = "空闲" },
+ ["2"] = new StepModel { StepNo = 2, Status = 0, StepName = "车辆到站(入口雷达检测到车辆驶入)" },
+ ["3"] = new StepModel { StepNo = 3, Status = 0, StepName = "rfid扫描完成" },
+ ["4"] = new StepModel { StepNo = 4, Status = 0, StepName = "云平台车辆认证" },
+ ["5"] = new StepModel { StepNo = 5, Status = 0, StepName = "车辆到位" },
+ ["6"] = new StepModel { StepNo = 6, Status = 0, StepName = "车辆解锁" },
+ ["7"] = new StepModel { StepNo = 7, Status = 0, StepName = "下发plc选包" },
+ ["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 = "车辆上锁" },
+ ["15"] = new StepModel { StepNo = 15, Status = 0, StepName = "换电完成(车辆驶离)" },
+ ["16"] = new StepModel { StepNo = 16, Status = 0, StepName = "换电失败(车辆驶离)" },
+ };
#region 小步状态
//雷达检测/车辆进入
@@ -323,7 +341,12 @@ public class SwappingStateMachine : IDisposable
SwapOrderBatteryInfo = null;
StepSort = 0;
- StepModel = new List();
+
+ foreach (var key in StepModel.Keys.ToList())
+ {
+ StepModel[key].Status = 0;
+ StepModel[key].StartTime = null;
+ }
PlcSwapFlag = false;
ManualSwapSuccFlag = false;
diff --git a/Service/Station/MonitorService.cs b/Service/Station/MonitorService.cs
index 00e0ceb..692547f 100644
--- a/Service/Station/MonitorService.cs
+++ b/Service/Station/MonitorService.cs
@@ -1,10 +1,13 @@
+using System.Collections.Concurrent;
using System.ComponentModel;
+using Autofac;
using AutoMapper;
using Common.Util;
using Entity.Api.Resp;
using Entity.Constant;
using Entity.DbModel.Station;
using Entity.Dto.Req;
+using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Entity;
using log4net;
@@ -15,6 +18,7 @@ using Service.Cloud.Client;
using Service.Execute;
using Service.Execute.Api;
using Service.Execute.Model;
+using Service.Execute.Utils;
using Service.Init;
using Service.Mgr;
using Service.Plc.Client;
@@ -80,10 +84,16 @@ public class MonitorService
var configBinInfo =
new MapperConfiguration(cfg => cfg.CreateMap().ReverseMap());
IMapper mapperBinInfo = configBinInfo.CreateMapper();
-
- List stateInfoList =
- mapperBinInfo.Map>(StationSoftMgr.SwappingStateMachine.StepModel);
-
+
+
+ List stateInfoList = new List();
+ ConcurrentDictionary dictionary = StationSoftMgr.SwappingStateMachine.StepModel;
+ stateInfoList = dictionary.Values
+ .OrderBy(model => model.StepNo)
+ .Select(model => mapperBinInfo.Map(model))
+ .ToList();
+
+
var tboxCarInfoModel = StationSoftMgr.SwappingStateMachine.BoxCarInfoModel;
List binInfos = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1);