diff --git a/Entity/Constant/InfoEnum.cs b/Entity/Constant/InfoEnum.cs
index 6c7a455..d013a09 100644
--- a/Entity/Constant/InfoEnum.cs
+++ b/Entity/Constant/InfoEnum.cs
@@ -109,16 +109,16 @@ public class InfoEnum
[Const("空闲")] Idel,
[Const("车辆到站(入口雷达检测到车辆驶入)")] RadarInFlag,
[Const("rfid扫描完成")] RfidReadFlag,
- [Const("云平台车辆认证")] CloudVelCheckFlag,
+ // [Const("云平台车辆认证")] CloudVelCheckFlag,
[Const("车辆到位")] CarInPositionFlag,
- [Const("云平台下发换电指令")] CloudCarCanStartFlag,
+ // [Const("云平台下发换电指令")] CloudCarCanStartFlag,
[Const("车辆解锁")] VelUnlockFlag,
[Const("下发plc选包")] DistributeSelectPackFlag,
[Const("开始换电")] StartSwappingFlag,
[Const("拆旧电池完成")] UnOldBatteryFlag,
- [Const("入库旧电池完成")] StorageOldBatteryFlag,
- [Const("搬运新电池完成")] OutNewBatteryFlag,
+ // [Const("入库旧电池完成")] StorageOldBatteryFlag,
+ // [Const("搬运新电池完成")] OutNewBatteryFlag,
[Const("安装新电池完成")] InstallNewBatteryFlag,
[Const("安装完成")] FinishNewBatteryFlag,
[Const("车辆上锁")] VelLockFlag,
diff --git a/Service/Execute/Step/CarCtrlState.cs b/Service/Execute/Step/CarCtrlState.cs
index b38ddc8..19c7959 100644
--- a/Service/Execute/Step/CarCtrlState.cs
+++ b/Service/Execute/Step/CarCtrlState.cs
@@ -71,8 +71,8 @@ public class CarCtrlState : IState
machine.ManualConfirmCarUnlockFlag = false;
machine.BoxCarInfoModel = carInfo.Result;
machine.VelUnlockFlag = true;
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudCarCanStartFlag,
- machine);
+ // _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudCarCanStartFlag,
+ // machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelUnlockFlag,
machine);
if (a==0)
diff --git a/Service/Execute/Step/DoSwappingState.cs b/Service/Execute/Step/DoSwappingState.cs
index 6deee3c..489315f 100644
--- a/Service/Execute/Step/DoSwappingState.cs
+++ b/Service/Execute/Step/DoSwappingState.cs
@@ -67,13 +67,7 @@ public class DoSwappingState : IState
return SwappingStateMachine.ReturnWithInvokeErr(packFinish, ExceptionReason.None);
}
- //车辆上锁
- //InvokeStatus lockCar = LockCar(machine);
- //if (lockCar != InvokeStatus.Done)
- //{
- // return SwappingStateMachine.ReturnWithInvokeErr(lockCar, ExceptionReason.None);
- //}
-
+
//开启雷达
var beginRadar = ControlRadar(machine, 1);
if (InvokeStatus.Done != beginRadar)
@@ -81,14 +75,7 @@ public class DoSwappingState : IState
return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
}
- //车辆离开
- //var adjustCarByRadar = AdjustCarByRadar(machine);
- //machine.Reset();
- //if (InvokeStatus.Done != adjustCarByRadar)
- //{
- // return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
- //}
-
+
return new StateResult()
@@ -222,7 +209,7 @@ public class DoSwappingState : IState
///
public InvokeStatus UnPack(SwappingStateMachine machine)
{
- int s = 0;
+
int i = 0;
return Invoker.Invoke("plc UnPack", 500, 5, machine.IsCanceled,
() => machine.UnOldBatteryFlag, () =>
@@ -231,14 +218,7 @@ public class DoSwappingState : IState
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoUnPack.GetLed());
SoundClient = AppInfo.Container.Resolve();
- //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address11"));
- if (s==0)
- {
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
- machine);
- //SoundClient.SoundPlay(SoundEnum.music51);
- //s = 1;
- }
+
machine.UnOldBatteryFlag = ClientMgr.PlcClient.DisassembleDone;
@@ -251,23 +231,16 @@ public class DoSwappingState : IState
},
() =>
{
-
- if(i==0)
- {
SoundClient = AppInfo.Container.Resolve();
SoundClient.SoundPlay(SoundEnum.music51);
- //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack);
- i = 1;
- }
-
-
- }, false, () => { }, 10,
+
+ }, false, () => { }, 30,
InvokeStatus.None);
}
public InvokeStatus Pack(SwappingStateMachine machine)
{
- int a = 0;
+
return Invoker.Invoke("plc Pack ing", 500, 5, machine.IsCanceled,
() => machine.InstallNewBatteryFlag, () =>
{
@@ -278,9 +251,7 @@ public class DoSwappingState : IState
if (machine.InstallNewBatteryFlag)
{
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
- machine);
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag,
+ _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
machine);
}
}, () =>
@@ -288,16 +259,12 @@ public class DoSwappingState : IState
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack);
SoundClient = AppInfo.Container.Resolve();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address12"));
- if (a == 0)
- {
+
SoundClient.SoundPlay(SoundEnum.music52);
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPack.GetLed());
- a = 1;
- }
-
},false, () => { },
- 10,InvokeStatus.None);
+ 30,InvokeStatus.None);
}
public InvokeStatus PackFinish(SwappingStateMachine machine)
@@ -306,28 +273,15 @@ public class DoSwappingState : IState
return Invoker.Invoke("plc Pack Finish", 500, 5, machine.IsCanceled,
() => machine.FinishNewBatteryFlag, () =>
{
- // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
if (ClientMgr.PlcClient.SwapDone)
{
machine.FinishNewBatteryFlag = true;
machine.BusinessSwappingForCloudState =
InfoEnum.BusinessSwappingForCloudState.SwapFinish;
- // CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
machine.BusinessSwappingStateUpdateTime = DateTime.Now;
- SoundClient = AppInfo.Container.Resolve();
- if (b==0)
- {
- // SoundClient.SoundPlay(SoundEnum.music77);
-
- LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
- b = 1;
- }
-
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag,
- machine);
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
- machine);
+ SoundClient = AppInfo.Container.Resolve();
+ SoundClient.SoundPlay(SoundEnum.music53);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
machine);
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
@@ -336,8 +290,12 @@ public class DoSwappingState : IState
machine.SwapStatus = 1;
}
- }, () => { },false, () => { },
- 10,InvokeStatus.None);
+ }, () =>
+ {
+ LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
+
+ },false, () => { },
+ 30,InvokeStatus.None);
}
diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs
index 3c9de56..ee7e741 100644
--- a/Service/Execute/Step/StationReadyState.cs
+++ b/Service/Execute/Step/StationReadyState.cs
@@ -336,8 +336,8 @@ public class StationReadyState : IState
//新增小步
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag,
machine);
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
- machine);
+ // _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
+ // machine);
@@ -385,8 +385,8 @@ public class StationReadyState : IState
//新增小步
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag,
machine);
- _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
- machine);
+ // _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
+ // machine);
// 前端页面
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag,
diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs
index d34edc3..924c5a1 100644
--- a/Service/Execute/Step/SwapDoneState.cs
+++ b/Service/Execute/Step/SwapDoneState.cs
@@ -94,6 +94,9 @@ public class SwapDoneState : IState
//{
// return SwappingStateMachine.ReturnWithInvokeErr(closeRadar, ExceptionReason.None);
//}
+
+
+
machine.Reset();
diff --git a/Service/Execute/SwappingStateMachine.cs b/Service/Execute/SwappingStateMachine.cs
index c9b9bd1..12b6a7d 100644
--- a/Service/Execute/SwappingStateMachine.cs
+++ b/Service/Execute/SwappingStateMachine.cs
@@ -70,28 +70,7 @@ public class SwappingStateMachine : IDisposable
public ConcurrentDictionary StepModel =
new ConcurrentDictionary
- {
- ["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 = "云平台车辆认证" },
- ["4"] = new StepModel { StepNo = 4, Status = 0, StepName = "车辆到位" },
- ["5"] = new StepModel { StepNo = 5, Status = 0, StepName = "云平台下发换电指令" },
- ["5"] = new StepModel { StepNo = 5, Status = 0, StepName = "车辆解锁" },
- ["6"] = new StepModel { StepNo = 6, Status = 0, StepName = "下发plc选包" },
-
- ["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 = "搬运新电池完成" },
- ["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 小步状态
//雷达检测/车辆进入
@@ -351,10 +330,17 @@ public class SwappingStateMachine : IDisposable
SwapOrderBatteryInfo = null;
StepSort = 0;
- foreach (var key in StepModel.Keys.ToList())
+ Array values = Enum.GetValues(typeof(InfoEnum.BusinessSwappingStep));
+ foreach (var value in values)
{
- StepModel[key].Status = 0;
- StepModel[key].StartTime = null;
+ StepModel[(string)value] = new StepModel()
+ {
+ StepNo = (int)value,
+ Status = 0,
+ StepName = BaseEnumExtensions.GetEnumDescriptionByCode((int)value)
+ }
+ ;
+ ;
}
PlcSwapFlag = false;