修改红绿灯帧类型

master
zby 2 months ago
parent ed2a3a3ca8
commit 0761a2cd1d

@ -58,13 +58,13 @@ public class CarCtrlState : IState
return Invoker.Invoke("UnLockCar", 500, 100, machine.IsCanceled, return Invoker.Invoke("UnLockCar", 500, 100, machine.IsCanceled,
() => machine.VelUnlockFlag, () => () => machine.VelUnlockFlag, () =>
{ {
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelNo); Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result; bool unLock = result.Result;
if (unLock) if (unLock)
{ {
//查询车辆锁止状态 //查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo); Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
var resultHeartBeatMsg = carInfo.Result.CarStatus; var resultHeartBeatMsg = carInfo.Result.CarStatus;
if (resultHeartBeatMsg?.LockStatus == 1 || machine.ManualConfirmCarUnlockFlag) if (resultHeartBeatMsg?.LockStatus == 1 || machine.ManualConfirmCarUnlockFlag)
{ {

@ -166,7 +166,7 @@ public class CarPrepareState : IState
return Invoker.Invoke("check TBox connect", 1000, 10, machine.IsCanceled, return Invoker.Invoke("check TBox connect", 1000, 10, machine.IsCanceled,
() => machine.BoxConnectFlag, () => () => machine.BoxConnectFlag, () =>
{ {
Task<bool> result = TBoxApi.IsConnected(machine.RfidReadModel.VelNo); Task<bool> result = TBoxApi.IsConnected(machine.RfidReadModel.VelVin);
// result.Wait(); // result.Wait();
bool isConnect = result.Result; bool isConnect = result.Result;
@ -213,12 +213,12 @@ public class CarPrepareState : IState
return Invoker.Invoke("TBox connect", 1000, 10, machine.IsCanceled, return Invoker.Invoke("TBox connect", 1000, 10, machine.IsCanceled,
() => machine.BoxConnectFlag, () => () => machine.BoxConnectFlag, () =>
{ {
Task<bool> result = TBoxApi.Connect(machine.RfidReadModel.VelNo); Task<bool> result = TBoxApi.Connect(machine.RfidReadModel.VelVin);
bool isConnect = result.Result; bool isConnect = result.Result;
if (isConnect) if (isConnect)
{ {
//读取车辆carNo=carVin //读取车辆carNo=carVin
Task<TboxCarInfoModel> carInfoResult = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo); Task<TboxCarInfoModel> carInfoResult = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
var tboxCarInfoModel = carInfoResult.Result; var tboxCarInfoModel = carInfoResult.Result;
var carInfo = tboxCarInfoModel?.CarInfo; var carInfo = tboxCarInfoModel?.CarInfo;
if (carInfo != null) if (carInfo != null)

@ -162,7 +162,7 @@ public class DoSwappingState : IState
return Invoker.Invoke("StartSwapping", 1000, 5, machine.IsCanceled, return Invoker.Invoke("StartSwapping", 1000, 5, machine.IsCanceled,
() => machine.StartSwappingFlag, () => () => machine.StartSwappingFlag, () =>
{ {
Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelNo); Task<bool> result = TBoxApi.UnLockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result; bool unLock = result.Result;
if (unLock) if (unLock)
{ {

@ -47,6 +47,9 @@ public class StationReadyState : IState
return null; return null;
} }
//plc是否是自动模式 //plc是否是自动模式
var plcIsAuto = PlcIsAuto(machine); var plcIsAuto = PlcIsAuto(machine);
if (InvokeStatus.Done != plcIsAuto) if (InvokeStatus.Done != plcIsAuto)
@ -61,21 +64,19 @@ public class StationReadyState : IState
return SwappingStateMachine.ReturnWithInvokeErr(plcIsRemote, ExceptionReason.None); return SwappingStateMachine.ReturnWithInvokeErr(plcIsRemote, ExceptionReason.None);
} }
////开启雷达
//var beginRadar = ControlRadar(machine, 1);
//if (InvokeStatus.Done != beginRadar)
//{
// return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
//}
//开启雷达 ////调整车辆
var beginRadar = ControlRadar(machine, 1); //var adjustCarByRadar = AdjustCarByRadar(machine);
if (InvokeStatus.Done != beginRadar) //if (InvokeStatus.Done != adjustCarByRadar)
{ //{
return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None); // return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
} //}
//调整车辆
var adjustCarByRadar = AdjustCarByRadar(machine);
if (InvokeStatus.Done != adjustCarByRadar)
{
return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None);
}
//手动模式 //手动模式
if (StaticStationInfo.VehicleManually == 1) if (StaticStationInfo.VehicleManually == 1)
@ -106,6 +107,12 @@ public class StationReadyState : IState
} }
return new StateResult() return new StateResult()
{ {
SwappingState = SwappingState.CarPrepare, SwappingState = SwappingState.CarPrepare,
@ -139,7 +146,11 @@ public class StationReadyState : IState
//SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoStationModel) ; //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoStationModel) ;
LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoStationModel.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoStationModel.GetLed());
}, true, () => { }, 5, InvokeStatus.None); }, true,
() =>
{
}, 5, InvokeStatus.None);
} }

@ -29,13 +29,11 @@ public class SwapDoneState : IState
public StateResult Handle(SwappingStateMachine machine) public StateResult Handle(SwappingStateMachine machine)
{ {
//更新换电订单 //更新换电订单
machine.SwapOrder!.SwapResult = machine.SwapStatus; machine.SwapOrder!.SwapResult = machine.SwapStatus;
machine.SwapOrder.SwapEndTime = DateTime.Now; machine.SwapOrder.SwapEndTime = DateTime.Now;
machine.SwapOrder.FailReason = machine.SwapFailReason; machine.SwapOrder.FailReason = machine.SwapFailReason;
_CommonMgr.UpdateSwapOrder(machine); _CommonMgr.UpdateSwapOrder(machine);
////修改预约单 ////修改预约单
if (machine.SwapOrderBatteryInfo!.swapAmtOrder != null) if (machine.SwapOrderBatteryInfo!.swapAmtOrder != null)
{ {
@ -215,13 +213,13 @@ public class SwapDoneState : IState
return Invoker.Invoke("LockCar", 500, 100, machine.IsCanceled, machine.IsManualSwapSucc, return Invoker.Invoke("LockCar", 500, 100, machine.IsCanceled, machine.IsManualSwapSucc,
() => machine.VelLockFlag, () => () => machine.VelLockFlag, () =>
{ {
Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelNo); Task<bool> result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin);
bool unLock = result.Result; bool unLock = result.Result;
if (unLock) if (unLock)
{ {
//查询车辆锁止状态 //查询车辆锁止状态
Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelNo); Task<TboxCarInfoModel> carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin);
if (carInfo.Result?.CarStatus?.LockStatus == 2 || machine.ManualConfirmCarLockFlag) if (carInfo.Result?.CarStatus?.LockStatus == 2 || machine.ManualConfirmCarLockFlag)
{ {

@ -331,17 +331,22 @@ public class SwappingStateMachine : IDisposable
StepSort = 0; StepSort = 0;
Array values = Enum.GetValues(typeof(InfoEnum.BusinessSwappingStep)); Array values = Enum.GetValues(typeof(InfoEnum.BusinessSwappingStep));
foreach (var value in values) foreach (var key in StepModel.Keys.ToList())
{ {
StepModel[(string)value] = new StepModel() StepModel[key].Status = 0;
{ StepModel[key].StartTime = null;
StepNo = (int)value, }
Status = 0, //foreach (var value in values)
StepName = BaseEnumExtensions.GetEnumDescriptionByCode<InfoEnum.BusinessSwappingStep>((int)value) //{
} // StepModel[(string)value] = new StepModel()
; // {
; // StepNo = (int)value,
} // Status = 0,
// StepName = BaseEnumExtensions.GetEnumDescriptionByCode<InfoEnum.BusinessSwappingStep>((int)value)
// }
// ;
// ;
//}
PlcSwapFlag = false; PlcSwapFlag = false;
ManualSwapSuccFlag = false; ManualSwapSuccFlag = false;

@ -197,7 +197,7 @@ public class Decoder : ByteToMessageDecoder
/*0x*/ /*0x*/
94 => ModelConvert.Decode<MoveCommandResq>(bytes), 94 => ModelConvert.Decode<MoveCommandResq>(bytes),
119=> ModelConvert.Decode < TrafficLightResq>(bytes), 121=> ModelConvert.Decode < TrafficLightResq>(bytes),
_ => new ASDU() _ => new ASDU()
}; };

@ -16,7 +16,7 @@ public class TrafficLightReq: ASDU {
public TrafficLightReq(byte trafficLight) public TrafficLightReq(byte trafficLight)
{ {
FrameTypeNo = 118; FrameTypeNo = 120;
MsgBodyCount = 1; MsgBodyCount = 1;
TransReason = 3; TransReason = 3;
PublicAddr = 0; PublicAddr = 0;

@ -143,7 +143,7 @@
"Enabled": false "Enabled": false
}, },
"led": { "led": {
"enable": true, "enable": false,
"ip": "192.168.3.79", "ip": "192.168.3.79",
"port": 10000 "port": 10000
} }

Loading…
Cancel
Save