修改前端上报

master
zby 3 months ago
parent 83e337f97a
commit cacf63a312

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

@ -45,8 +45,11 @@ public class CommonMgr
StartTime = DateTime.Now, StartTime = DateTime.Now,
Status = 1 Status = 1
}; };
machine.StepModel[stepModel.StepNo.ToString()] = stepModel; machine.StepModel[stepModel.StepNo.ToString()] = stepModel;
if (machine.SwapOrder != null) if (machine.SwapOrder != null)
{ {
if (!string.IsNullOrEmpty(machine.SwapOrder.Sn)) if (!string.IsNullOrEmpty(machine.SwapOrder.Sn))

@ -9,6 +9,7 @@ public class BeginState: IState
{ {
SwappingState = SwappingState.StationReady SwappingState = SwappingState.StationReady
//SwappingState = SwappingState.DoSwapping
}; };
} }
} }

@ -71,6 +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,
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelUnlockFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelUnlockFlag,
machine); machine);
if (a==0) if (a==0)

@ -219,7 +219,7 @@ public class CarPrepareState : IState
{ {
SoundClient = AppInfo.Container.Resolve<SoundClient>(); SoundClient = AppInfo.Container.Resolve<SoundClient>();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address03")); //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address03"));
SoundClient.SoundPlay(SoundEnum.music43); // SoundClient.SoundPlay(SoundEnum.music43);
//machine.ExceptionReason = ExceptionReason.ConnTBoxError; //machine.ExceptionReason = ExceptionReason.ConnTBoxError;
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn); //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);
}, false, () => }, false, () =>

@ -38,6 +38,67 @@ public class DoSwappingState : IState
// _log.Info($"BusinessSwappingForCloudState={machine.BusinessSwappingForCloudState}"); // _log.Info($"BusinessSwappingForCloudState={machine.BusinessSwappingForCloudState}");
// CloudApi.SendStateLog(machine.SwapOrder, InfoEnum.BusinessSwappingForCloudState.BeginSwap); // CloudApi.SendStateLog(machine.SwapOrder, InfoEnum.BusinessSwappingForCloudState.BeginSwap);
//while (true)
//{
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel,
// machine);
// Thread.Sleep(1000);
// //_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
// //machine);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudCarCanStartFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelUnlockFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.DistributeSelectPackFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StartSwappingFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag,
// machine);
// Thread.Sleep(1000);
// _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
// machine);
// Thread.Sleep(1000);
// //_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarOutFlag,
// // machine);
// Thread.Sleep(10000);
// machine.Reset();
//}
@ -86,12 +147,13 @@ public class DoSwappingState : IState
return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None); return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
} }
// 车辆离开 //车辆离开
//var adjustCarByRadar = AdjustCarByRadar(machine); var adjustCarByRadar = AdjustCarByRadar(machine);
//if (InvokeStatus.Done != adjustCarByRadar) machine.Reset();
//{ if (InvokeStatus.Done != adjustCarByRadar)
// return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None); {
//} return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
}
@ -187,6 +249,10 @@ public class DoSwappingState : IState
machine.SwapOrderBatteryInfo.UpBinInfo.No); machine.SwapOrderBatteryInfo.UpBinInfo.No);
if (c==0) if (c==0)
{ {
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StartSwappingFlag,
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.DistributeSelectPackFlag,
machine);
SoundClient = AppInfo.Container.Resolve<SoundClient>(); SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music91); SoundClient.SoundPlay(SoundEnum.music91);
Thread.Sleep(3000); Thread.Sleep(3000);
@ -200,8 +266,7 @@ public class DoSwappingState : IState
_CommonMgr.UpdateSwapOrder(machine); _CommonMgr.UpdateSwapOrder(machine);
machine.SwapStatus = 0; machine.SwapStatus = 0;
machine.StartSwappingFlag = true; machine.StartSwappingFlag = true;
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StartSwappingFlag,
machine);
} }
} }
@ -279,7 +344,9 @@ public class DoSwappingState : IState
if (machine.InstallNewBatteryFlag) if (machine.InstallNewBatteryFlag)
{ {
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.InstallNewBatteryFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag,
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StorageOldBatteryFlag,
machine); machine);
} }
}, () => }, () =>
@ -316,12 +383,17 @@ public class DoSwappingState : IState
SoundClient = AppInfo.Container.Resolve<SoundClient>(); SoundClient = AppInfo.Container.Resolve<SoundClient>();
if (b==0) if (b==0)
{ {
SoundClient.SoundPlay(SoundEnum.music77); // SoundClient.SoundPlay(SoundEnum.music77);
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPackFinish.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPackFinish.GetLed());
b = 1; b = 1;
} }
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.OutNewBatteryFlag,
machine);
_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);
@ -369,9 +441,16 @@ public class DoSwappingState : IState
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address19")); //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address19"));
if (v == 0) if (v == 0)
{ {
SoundClient.SoundPlay(SoundEnum.music76);
Thread.Sleep(3000); _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarOutFlag,
machine);
SoundClient.SoundPlay(SoundEnum.music77); SoundClient.SoundPlay(SoundEnum.music77);
Thread.Sleep(3000);
SoundClient.SoundPlay(SoundEnum.music76);
v = 1; v = 1;
} }
//断连Tbox //断连Tbox
@ -381,8 +460,6 @@ public class DoSwappingState : IState
} }
//新增小步 //新增小步
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag,
machine);
} }
} }
}, () => }, () =>

@ -32,11 +32,14 @@ public class StationReadyState : IState
public StateResult Handle(SwappingStateMachine machine) public StateResult Handle(SwappingStateMachine machine)
{ {
_log.Info($"'goto stationReady"); _log.Info($"'goto stationReady");
machine.Reset(); machine.Reset();
machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.Idle; //machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.Idle;
machine.BusinessSwappingStateUpdateTime = DateTime.Now; //machine.BusinessSwappingStateUpdateTime = DateTime.Now;
//判断换电站是否具备换电条件 前端页面 //判断换电站是否具备换电条件 前端页面
if (!IsAutoSwapping()) if (!IsAutoSwapping())
@ -98,6 +101,9 @@ public class StationReadyState : IState
public InvokeStatus PlcIsAuto(SwappingStateMachine machine) public InvokeStatus PlcIsAuto(SwappingStateMachine machine)
{ {
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel,
machine);
int a = 0; int a = 0;
bool isAuto = false; bool isAuto = false;
return Invoker.Invoke("check plc auto", 1000, 5, machine.IsCanceled, () => isAuto, return Invoker.Invoke("check plc auto", 1000, 5, machine.IsCanceled, () => isAuto,
@ -171,6 +177,9 @@ public class StationReadyState : IState
/// <returns></returns> /// <returns></returns>
public InvokeStatus ControlRadar(SwappingStateMachine machine, byte flag) public InvokeStatus ControlRadar(SwappingStateMachine machine, byte flag)
{ {
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
machine);
return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0, return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0,
() => { PadarMgr._PadarClient?.PadarControl(flag); }); () => { PadarMgr._PadarClient?.PadarControl(flag); });
} }
@ -185,9 +194,7 @@ public class StationReadyState : IState
() => () =>
{ {
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarInPosition.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarInPosition.GetLed());
//新增小步
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag,
machine);
if (PadarMgr._PadarClient?.CarState==6) if (PadarMgr._PadarClient?.CarState==6)
{ {
LedClient.SendMsgByKey(InfoEnum.SwapInfo.Backoff.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.Backoff.GetLed());
@ -230,10 +237,12 @@ public class StationReadyState : IState
beginRead.Wait(); beginRead.Wait();
if (!beginRead.Result) if (!beginRead.Result)
{ {
_log.Info("begin read rfid error"); _log.Info("begin read rfid error");
} }
else else
{ {
machine.ExceptionReason = ExceptionReason.None; machine.ExceptionReason = ExceptionReason.None;
_log.Info("begin read done"); _log.Info("begin read done");
machine.BeginRfidReadFlag = true; machine.BeginRfidReadFlag = true;
@ -243,7 +252,7 @@ public class StationReadyState : IState
machine.LedTool.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed()); machine.LedTool.WriteProgramContent(InfoEnum.SwapInfo.ErrorReadRfid.GetLed());
SoundClient = AppInfo.Container.Resolve<SoundClient>(); SoundClient = AppInfo.Container.Resolve<SoundClient>();
//SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address02")); //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address02"));
SoundClient.SoundPlay(SoundEnum.music74); // SoundClient.SoundPlay(SoundEnum.music74);
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid); //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorReadRfid);
//LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrorReadRfid.GetLed()); //LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrorReadRfid.GetLed());
@ -304,12 +313,12 @@ public class StationReadyState : IState
//新增换电订单 //新增换电订单
machine.SwapOrder = _CommonMgr.SaveOrder(BuildOrder(machine.RfidReadModel)); machine.SwapOrder = _CommonMgr.SaveOrder(BuildOrder(machine.RfidReadModel));
//新增小步 //新增小步
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel,
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RadarInFlag,
machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.RfidReadFlag,
machine); machine);
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CloudVelCheckFlag,
machine);
// 前端页面 // 前端页面
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag,

@ -1,4 +1,5 @@
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Reflection.PortableExecutable;
using Autofac; using Autofac;
using Entity.Attr; using Entity.Attr;
using Entity.Constant; using Entity.Constant;
@ -73,16 +74,16 @@ public class SwappingStateMachine : IDisposable
["0"] = new StepModel { StepNo = 0, Status = 0, StepName = "空闲" }, ["0"] = new StepModel { StepNo = 0, Status = 0, StepName = "空闲" },
["1"] = new StepModel { StepNo = 1, Status = 0, StepName = "车辆到站(入口雷达检测到车辆驶入)" }, ["1"] = new StepModel { StepNo = 1, Status = 0, StepName = "车辆到站(入口雷达检测到车辆驶入)" },
["2"] = new StepModel { StepNo = 2, Status = 0, StepName = "rfid扫描完成" }, ["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 = "车辆到位" }, ["4"] = new StepModel { StepNo = 4, Status = 0, StepName = "车辆到位" },
// ["5"] = new StepModel { StepNo = 5, Status = 0, StepName = "云平台下发换电指令" }, ["5"] = new StepModel { StepNo = 5, 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 = "下发plc选包" },
["6"] = new StepModel { StepNo = 6, Status = 0, StepName = "开始换电" }, ["6"] = new StepModel { StepNo = 6, Status = 0, StepName = "开始换电" },
["7"] = new StepModel { StepNo = 7, Status = 0, StepName = "拆旧电池完成" }, ["7"] = new StepModel { StepNo = 7, Status = 0, StepName = "拆旧电池完成" },
//["8"] = new StepModel { StepNo = 8, Status = 0, StepName = "入库旧电池完成" }, ["8"] = new StepModel { StepNo = 8, Status = 0, StepName = "入库旧电池完成" },
//["9"] = new StepModel { StepNo = 9, Status = 0, StepName = "搬运新电池完成" }, ["9"] = new StepModel { StepNo = 9, Status = 0, StepName = "搬运新电池完成" },
["10"] = new StepModel { StepNo = 10, Status = 0, StepName = "安装新电池完成" }, ["10"] = new StepModel { StepNo = 10, Status = 0, StepName = "安装新电池完成" },
["11"] = new StepModel { StepNo = 11, Status = 0, StepName = "安装完成" }, ["11"] = new StepModel { StepNo = 11, Status = 0, StepName = "安装完成" },
["12"] = new StepModel { StepNo = 12, Status = 0, StepName = "车辆上锁" }, ["12"] = new StepModel { StepNo = 12, Status = 0, StepName = "车辆上锁" },
@ -270,6 +271,8 @@ public class SwappingStateMachine : IDisposable
public void Reset() public void Reset()
{ {
Log.Info("reset data"); Log.Info("reset data");
/*if (PlcMgr.PlcClient?.ReadTaskNo() == 1) /*if (PlcMgr.PlcClient?.ReadTaskNo() == 1)
@ -441,6 +444,8 @@ public class SwappingStateMachine : IDisposable
private void ResetOrderAmtStatus() private void ResetOrderAmtStatus()
{ {
// SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn); // SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrorTBoxConn);
LedClient.SendMsgByKey(InfoEnum.SwapInfo.WelcomeInfo.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.WelcomeInfo.GetLed());

Loading…
Cancel
Save