部分换电流程更改

master
lxw 3 months ago
parent c927207e80
commit 25f6e4515b

@ -109,16 +109,16 @@ public class InfoEnum
[Const("空闲")] Idel, [Const("空闲")] Idel,
[Const("车辆到站(入口雷达检测到车辆驶入)")] RadarInFlag, [Const("车辆到站(入口雷达检测到车辆驶入)")] RadarInFlag,
[Const("rfid扫描完成")] RfidReadFlag, [Const("rfid扫描完成")] RfidReadFlag,
[Const("云平台车辆认证")] CloudVelCheckFlag, // [Const("云平台车辆认证")] CloudVelCheckFlag,
[Const("车辆到位")] CarInPositionFlag, [Const("车辆到位")] CarInPositionFlag,
[Const("云平台下发换电指令")] CloudCarCanStartFlag, // [Const("云平台下发换电指令")] CloudCarCanStartFlag,
[Const("车辆解锁")] VelUnlockFlag, [Const("车辆解锁")] VelUnlockFlag,
[Const("下发plc选包")] DistributeSelectPackFlag, [Const("下发plc选包")] DistributeSelectPackFlag,
[Const("开始换电")] StartSwappingFlag, [Const("开始换电")] StartSwappingFlag,
[Const("拆旧电池完成")] UnOldBatteryFlag, [Const("拆旧电池完成")] UnOldBatteryFlag,
[Const("入库旧电池完成")] StorageOldBatteryFlag, // [Const("入库旧电池完成")] StorageOldBatteryFlag,
[Const("搬运新电池完成")] OutNewBatteryFlag, // [Const("搬运新电池完成")] OutNewBatteryFlag,
[Const("安装新电池完成")] InstallNewBatteryFlag, [Const("安装新电池完成")] InstallNewBatteryFlag,
[Const("安装完成")] FinishNewBatteryFlag, [Const("安装完成")] FinishNewBatteryFlag,
[Const("车辆上锁")] VelLockFlag, [Const("车辆上锁")] VelLockFlag,

@ -71,8 +71,8 @@ public class CarCtrlState : IState
machine.ManualConfirmCarUnlockFlag = false; machine.ManualConfirmCarUnlockFlag = false;
machine.BoxCarInfoModel = carInfo.Result; machine.BoxCarInfoModel = carInfo.Result;
machine.VelUnlockFlag = true; machine.VelUnlockFlag = true;
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudCarCanStartFlag, // _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudCarCanStartFlag,
machine); // machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelUnlockFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelUnlockFlag,
machine); machine);
if (a==0) if (a==0)

@ -67,12 +67,6 @@ public class DoSwappingState : IState
return SwappingStateMachine.ReturnWithInvokeErr(packFinish, ExceptionReason.None); 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); var beginRadar = ControlRadar(machine, 1);
@ -81,13 +75,6 @@ public class DoSwappingState : IState
return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None); return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
} }
//车辆离开
//var adjustCarByRadar = AdjustCarByRadar(machine);
//machine.Reset();
//if (InvokeStatus.Done != adjustCarByRadar)
//{
// return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
//}
@ -222,7 +209,7 @@ public class DoSwappingState : IState
/// <returns></returns> /// <returns></returns>
public InvokeStatus UnPack(SwappingStateMachine machine) public InvokeStatus UnPack(SwappingStateMachine machine)
{ {
int s = 0;
int i = 0; int i = 0;
return Invoker.Invoke("plc UnPack", 500, 5, machine.IsCanceled, return Invoker.Invoke("plc UnPack", 500, 5, machine.IsCanceled,
() => machine.UnOldBatteryFlag, () => () => machine.UnOldBatteryFlag, () =>
@ -231,14 +218,7 @@ public class DoSwappingState : IState
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoUnPack.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoUnPack.GetLed());
SoundClient = AppInfo.Container.Resolve<SoundClient>(); SoundClient = AppInfo.Container.Resolve<SoundClient>();
//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; machine.UnOldBatteryFlag = ClientMgr.PlcClient.DisassembleDone;
@ -250,24 +230,17 @@ public class DoSwappingState : IState
}, },
() => () =>
{
if(i==0)
{ {
SoundClient = AppInfo.Container.Resolve<SoundClient>(); SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music51); SoundClient.SoundPlay(SoundEnum.music51);
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack);
i = 1;
}
}, false, () => { }, 30,
}, false, () => { }, 10,
InvokeStatus.None); InvokeStatus.None);
} }
public InvokeStatus Pack(SwappingStateMachine machine) public InvokeStatus Pack(SwappingStateMachine machine)
{ {
int a = 0;
return Invoker.Invoke("plc Pack ing", 500, 5, machine.IsCanceled, return Invoker.Invoke("plc Pack ing", 500, 5, machine.IsCanceled,
() => machine.InstallNewBatteryFlag, () => () => machine.InstallNewBatteryFlag, () =>
{ {
@ -278,9 +251,7 @@ public class DoSwappingState : IState
if (machine.InstallNewBatteryFlag) if (machine.InstallNewBatteryFlag)
{ {
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag,
machine); machine);
} }
}, () => }, () =>
@ -288,16 +259,12 @@ public class DoSwappingState : IState
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack); //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack);
SoundClient = AppInfo.Container.Resolve<SoundClient>(); SoundClient = AppInfo.Container.Resolve<SoundClient>();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address12")); //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address12"));
if (a == 0)
{
SoundClient.SoundPlay(SoundEnum.music52); SoundClient.SoundPlay(SoundEnum.music52);
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPack.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPack.GetLed());
a = 1;
}
},false, () => { }, },false, () => { },
10,InvokeStatus.None); 30,InvokeStatus.None);
} }
public InvokeStatus PackFinish(SwappingStateMachine machine) public InvokeStatus PackFinish(SwappingStateMachine machine)
@ -306,28 +273,15 @@ public class DoSwappingState : IState
return Invoker.Invoke("plc Pack Finish", 500, 5, machine.IsCanceled, return Invoker.Invoke("plc Pack Finish", 500, 5, machine.IsCanceled,
() => machine.FinishNewBatteryFlag, () => () => machine.FinishNewBatteryFlag, () =>
{ {
// machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
if (ClientMgr.PlcClient.SwapDone) if (ClientMgr.PlcClient.SwapDone)
{ {
machine.FinishNewBatteryFlag = true; machine.FinishNewBatteryFlag = true;
machine.BusinessSwappingForCloudState = machine.BusinessSwappingForCloudState =
InfoEnum.BusinessSwappingForCloudState.SwapFinish; InfoEnum.BusinessSwappingForCloudState.SwapFinish;
// CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState);
machine.BusinessSwappingStateUpdateTime = DateTime.Now; machine.BusinessSwappingStateUpdateTime = DateTime.Now;
SoundClient = AppInfo.Container.Resolve<SoundClient>();
if (b==0)
{
// SoundClient.SoundPlay(SoundEnum.music77);
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
b = 1;
}
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag, SoundClient = AppInfo.Container.Resolve<SoundClient>();
machine); SoundClient.SoundPlay(SoundEnum.music53);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
machine); machine);
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition); //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoToSafePosition);
@ -336,8 +290,12 @@ public class DoSwappingState : IState
machine.SwapStatus = 1; machine.SwapStatus = 1;
} }
}, () => { },false, () => { }, }, () =>
10,InvokeStatus.None); {
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
},false, () => { },
30,InvokeStatus.None);
} }

@ -336,8 +336,8 @@ public class StationReadyState : IState
//新增小步 //新增小步
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag,
machine); machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag, // _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
machine); // machine);
@ -385,8 +385,8 @@ public class StationReadyState : IState
//新增小步 //新增小步
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag,
machine); machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag, // _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
machine); // machine);
// 前端页面 // 前端页面
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag,

@ -96,6 +96,9 @@ public class SwapDoneState : IState
//} //}
machine.Reset(); machine.Reset();

@ -70,28 +70,7 @@ public class SwappingStateMachine : IDisposable
public ConcurrentDictionary<string, StepModel> StepModel = public ConcurrentDictionary<string, StepModel> StepModel =
new ConcurrentDictionary<string, StepModel> new ConcurrentDictionary<string, StepModel>
{ ();
["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 小步状态 #region 小步状态
//雷达检测/车辆进入 //雷达检测/车辆进入
@ -351,10 +330,17 @@ public class SwappingStateMachine : IDisposable
SwapOrderBatteryInfo = null; SwapOrderBatteryInfo = null;
StepSort = 0; StepSort = 0;
foreach (var key in StepModel.Keys.ToList()) Array values = Enum.GetValues(typeof(InfoEnum.BusinessSwappingStep));
foreach (var value in values)
{
StepModel[(string)value] = new StepModel()
{ {
StepModel[key].Status = 0; StepNo = (int)value,
StepModel[key].StartTime = null; Status = 0,
StepName = BaseEnumExtensions.GetEnumDescriptionByCode<InfoEnum.BusinessSwappingStep>((int)value)
}
;
;
} }
PlcSwapFlag = false; PlcSwapFlag = false;

Loading…
Cancel
Save