部分换电流程更改

master
lxw 3 months ago
parent c927207e80
commit 25f6e4515b

@ -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,

@ -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)

@ -67,12 +67,6 @@ 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);
@ -81,13 +75,6 @@ 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);
//}
@ -222,7 +209,7 @@ public class DoSwappingState : IState
/// <returns></returns>
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>();
//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;
@ -250,24 +230,17 @@ public class DoSwappingState : IState
},
() =>
{
if(i==0)
{
SoundClient = AppInfo.Container.Resolve<SoundClient>();
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>();
//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<SoundClient>();
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>();
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);
}

@ -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,

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

@ -70,28 +70,7 @@ public class SwappingStateMachine : IDisposable
public ConcurrentDictionary<string, StepModel> 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 小步状态
//雷达检测/车辆进入
@ -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[(string)value] = new StepModel()
{
StepModel[key].Status = 0;
StepModel[key].StartTime = null;
StepNo = (int)value,
Status = 0,
StepName = BaseEnumExtensions.GetEnumDescriptionByCode<InfoEnum.BusinessSwappingStep>((int)value)
}
;
;
}
PlcSwapFlag = false;

Loading…
Cancel
Save