diff --git a/Entity/Constant/InfoEnum.cs b/Entity/Constant/InfoEnum.cs index 9054727..5237b70 100644 --- a/Entity/Constant/InfoEnum.cs +++ b/Entity/Constant/InfoEnum.cs @@ -10,7 +10,7 @@ public class InfoEnum { ////01 - // [Info("欢迎光临换电站!(正在营业)","欢迎光临换电站!,本站正在营业中")]WelcomeInfo, + [Info("欢迎光临换电站!(正在营业)","欢迎光临换电站!,本站正在营业中")]WelcomeInfo, // //02 // [Info("标签读写失败", "标签读写失败")] ErrorReadRfid , // //03 @@ -68,7 +68,7 @@ public class InfoEnum [Info("换电完成刷新", "换电完成刷新")] InfoCarLeaveflushed,//15 [Info("请驶离中", "请驶离中")] PleaseAway,//15 [Info("请驶离印尼中", "请驶离印尼中")] PleaseAwayyin,//15 - [Info(" ", " ")] IDEI,//15 + // [Info(" ", " ")] IDEI,//15 } diff --git a/Service/Execute/Step/CarCtrlState.cs b/Service/Execute/Step/CarCtrlState.cs index 1b7c9df..970fdeb 100644 --- a/Service/Execute/Step/CarCtrlState.cs +++ b/Service/Execute/Step/CarCtrlState.cs @@ -77,9 +77,6 @@ public class CarCtrlState : IState } }, () => { - // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrUnLockCar.GetLed()); - // SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrUnLockCar); - // LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrUnLockCar.GetLed()); SoundClient = AppInfo.Container.Resolve(); SoundClient.SoundPlay(SoundEnum.music104); @@ -88,6 +85,6 @@ public class CarCtrlState : IState }, false, () => { machine.ExceptionReason = ExceptionReason.UnLockCarError; } - , 3, InvokeStatus.None); + , 8, InvokeStatus.None); } } \ No newline at end of file diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs index 2aa686f..a4b5f41 100644 --- a/Service/Execute/Step/StationReadyState.cs +++ b/Service/Execute/Step/StationReadyState.cs @@ -37,7 +37,7 @@ public class StationReadyState : IState machine.Reset(); - + //判断换电站是否具备换电条件 前端页面 if (!IsAutoSwapping()) { @@ -45,12 +45,13 @@ public class StationReadyState : IState } _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel, machine); - - + + LedClient.SendMsgByKey(InfoEnum.SwapInfo.WelcomeInfo.GetLed()); ////开启雷达 var beginRadar = ControlRadar(machine, 1); if (InvokeStatus.Done != beginRadar) { + return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None); } @@ -190,6 +191,7 @@ public class StationReadyState : IState /// public InvokeStatus ControlRadar(SwappingStateMachine machine, byte flag) { + return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0 || machine.ManualSkipRadar, () => { PadarMgr._PadarClient?.PadarControl(flag); }); @@ -389,7 +391,7 @@ public class StationReadyState : IState } - }, false, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }, 30, + }, false, () => { machine.ExceptionReason = ExceptionReason.ReadRfidError; }, 10, InvokeStatus.None); } diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs index 59e6a42..03ea591 100644 --- a/Service/Execute/Step/SwapDoneState.cs +++ b/Service/Execute/Step/SwapDoneState.cs @@ -225,13 +225,6 @@ public class SwapDoneState : IState // SoundClient.SoundPlay(SoundEnum.music77); machine.BoxCarInfoModel = carInfo.Result; - // SoundApi.PlayOneSound(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success - // ? (int)InfoEnum.SwapInfo.InfoCarLeave - // : (int)InfoEnum.SwapInfo.ErrInfoCarLeave); - - //LedClient.SendMsgByKey(machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success - // ? InfoEnum.SwapInfo.PleaseAway.GetLed() - // : InfoEnum.SwapInfo.PleaseAway.GetLed()); machine.VelLockFlag = true; //断连Tbox @@ -304,10 +297,8 @@ public class SwapDoneState : IState machine.ExceptionReason = ExceptionReason.None; _log.Info("exist radar true"); - // for (int a = 0; a < 8; a++) - // { LedClient.SendMsgByKey(InfoEnum.SwapInfo.PleaseAwayyin.GetLed()); - // } + PlcApi.Traffic(1); //出口写红灯 //更新车辆离场时间,上报云平台 diff --git a/Service/Led/LedClient.cs b/Service/Led/LedClient.cs index f048f78..3909228 100644 --- a/Service/Led/LedClient.cs +++ b/Service/Led/LedClient.cs @@ -123,7 +123,7 @@ public class LedClient public static Dictionary Dictionary = new Dictionary() { - //{"欢迎光临换电站!(正在营业)",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x3D,0x00,0x00,0x00,0x3D,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x53,0x65,0x6C,0x61,0x6D,0x61,0x74,0x20,0x64,0x61,0x74,0x61,0x6E,0x67,0x20,0x64,0x69,0x20,0x73,0x74,0x61,0x73,0x69,0x75,0x6E,0x20,0x70,0x65,0x72,0x74,0x75,0x6B,0x61,0x72,0x61,0x6E,0x20,0x62,0x61,0x74,0x65,0x72,0x61,0x69,0x21,0x20,0x28,0x54,0x75,0x74,0x75,0x70,0x29,0x00,0x00,0x0D,0x0A,}}, + {"欢迎光临换电站!(正在营业)",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x3D,0x00,0x00,0x00,0x3D,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x53,0x65,0x6C,0x61,0x6D,0x61,0x74,0x20,0x64,0x61,0x74,0x61,0x6E,0x67,0x20,0x64,0x69,0x20,0x73,0x74,0x61,0x73,0x69,0x75,0x6E,0x20,0x70,0x65,0x72,0x74,0x75,0x6B,0x61,0x72,0x61,0x6E,0x20,0x62,0x61,0x74,0x65,0x72,0x61,0x69,0x21,0x20,0x28,0x54,0x75,0x74,0x75,0x70,0x29,0x00,0x00,0x0D,0x0A,}}, //{"标签读写失败",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x26,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x47,0x61,0x67,0x61,0x6C,0x20,0x6D,0x65,0x6D,0x62,0x61,0x63,0x61,0x20,0x61,0x74,0x61,0x75,0x20,0x6D,0x65,0x6E,0x75,0x6C,0x69,0x73,0x20,0x74,0x61,0x67,0x00,0x00,0x0D,0x0A,}}, //{"车辆连接失败",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x1F,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x4B,0x6F,0x6E,0x65,0x6B,0x73,0x69,0x20,0x6B,0x65,0x6E,0x64,0x61,0x72,0x61,0x61,0x6E,0x20,0x67,0x61,0x67,0x61,0x6C,0x00,0x00,0x0D,0x0A,}}, //{"云端校验失败",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x1E,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x56,0x65,0x72,0x69,0x66,0x69,0x6B,0x61,0x73,0x69,0x20,0x63,0x6C,0x6F,0x75,0x64,0x20,0x67,0x61,0x67,0x61,0x6C,0x00,0x00,0x0D,0x0A,}}, @@ -178,11 +178,11 @@ public class LedClient private static readonly ILog Log = LogManager.GetLogger(typeof(LedClient)); private static Socket? _socket; private static string _ip = "192.168.3.79"; - //private static string _ip = "127.0.0.1"; + // private static string _ip = "127.0.0.1"; private static int _port = 10000; private static DateTime LastestSendTime; - private static string LastestKey=InfoEnum.SwapInfo.IDEI.GetLed(); + private static string LastestKey=InfoEnum.SwapInfo.WelcomeInfo.GetLed(); private static byte[] Heart = new byte[] { @@ -220,7 +220,7 @@ public class LedClient { var now = DateTime.Now; - if ((now - LastestSendTime).TotalSeconds > 3) + if ((now - LastestSendTime).TotalSeconds > 5) { SendMsgByKey(LastestKey); } @@ -265,8 +265,8 @@ public class LedClient } catch (SocketException ex) { - _socket.Close(); - Connect(); + // _socket.Close(); + // Connect(); Log.Error($"Failed to send data. Reason: {ex.Message}"); return false; @@ -301,7 +301,7 @@ public class LedClient { Thread.Sleep(100); count++; - if (count > 5) + if (count > 10) { return false; }