修改led与扫不上rfid时间

master
赵宝玉 4 weeks ago
parent e2bbddb92b
commit 6738f669fa

@ -10,7 +10,7 @@ public class InfoEnum
{ {
////01 ////01
// [Info("欢迎光临换电站!(正在营业)","欢迎光临换电站!,本站正在营业中")]WelcomeInfo, [Info("欢迎光临换电站!(正在营业)","欢迎光临换电站!,本站正在营业中")]WelcomeInfo,
// //02 // //02
// [Info("标签读写失败", "标签读写失败")] ErrorReadRfid , // [Info("标签读写失败", "标签读写失败")] ErrorReadRfid ,
// //03 // //03
@ -68,7 +68,7 @@ public class InfoEnum
[Info("换电完成刷新", "换电完成刷新")] InfoCarLeaveflushed,//15 [Info("换电完成刷新", "换电完成刷新")] InfoCarLeaveflushed,//15
[Info("请驶离中", "请驶离中")] PleaseAway,//15 [Info("请驶离中", "请驶离中")] PleaseAway,//15
[Info("请驶离印尼中", "请驶离印尼中")] PleaseAwayyin,//15 [Info("请驶离印尼中", "请驶离印尼中")] PleaseAwayyin,//15
[Info(" ", " ")] IDEI,//15 // [Info(" ", " ")] IDEI,//15
} }

@ -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>(); SoundClient = AppInfo.Container.Resolve<SoundClient>();
SoundClient.SoundPlay(SoundEnum.music104); SoundClient.SoundPlay(SoundEnum.music104);
@ -88,6 +85,6 @@ public class CarCtrlState : IState
}, false, () => { machine.ExceptionReason = ExceptionReason.UnLockCarError; } }, false, () => { machine.ExceptionReason = ExceptionReason.UnLockCarError; }
, 3, InvokeStatus.None); , 8, InvokeStatus.None);
} }
} }

@ -46,11 +46,12 @@ public class StationReadyState : IState
_CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel, _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.Idel,
machine); machine);
LedClient.SendMsgByKey(InfoEnum.SwapInfo.WelcomeInfo.GetLed());
////开启雷达 ////开启雷达
var beginRadar = ControlRadar(machine, 1); var beginRadar = ControlRadar(machine, 1);
if (InvokeStatus.Done != beginRadar) if (InvokeStatus.Done != beginRadar)
{ {
return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None); return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None);
} }
@ -190,6 +191,7 @@ public class StationReadyState : IState
/// <returns></returns> /// <returns></returns>
public InvokeStatus ControlRadar(SwappingStateMachine machine, byte flag) public InvokeStatus ControlRadar(SwappingStateMachine machine, byte flag)
{ {
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
|| machine.ManualSkipRadar, || machine.ManualSkipRadar,
() => { PadarMgr._PadarClient?.PadarControl(flag); }); () => { 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); InvokeStatus.None);
} }

@ -225,13 +225,6 @@ public class SwapDoneState : IState
// SoundClient.SoundPlay(SoundEnum.music77); // SoundClient.SoundPlay(SoundEnum.music77);
machine.BoxCarInfoModel = carInfo.Result; 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; machine.VelLockFlag = true;
//断连Tbox //断连Tbox
@ -304,10 +297,8 @@ public class SwapDoneState : IState
machine.ExceptionReason = ExceptionReason.None; machine.ExceptionReason = ExceptionReason.None;
_log.Info("exist radar true"); _log.Info("exist radar true");
// for (int a = 0; a < 8; a++)
// {
LedClient.SendMsgByKey(InfoEnum.SwapInfo.PleaseAwayyin.GetLed()); LedClient.SendMsgByKey(InfoEnum.SwapInfo.PleaseAwayyin.GetLed());
// }
PlcApi.Traffic(1); PlcApi.Traffic(1);
//出口写红灯 //出口写红灯
//更新车辆离场时间,上报云平台 //更新车辆离场时间,上报云平台

@ -123,7 +123,7 @@ public class LedClient
public static Dictionary<string, byte[]> Dictionary = new Dictionary<string, byte[]>() public static Dictionary<string, byte[]> Dictionary = new Dictionary<string, byte[]>()
{ {
//{"欢迎光临换电站!(正在营业)",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,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,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,}}, //{"云端校验失败",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 readonly ILog Log = LogManager.GetLogger(typeof(LedClient));
private static Socket? _socket; private static Socket? _socket;
private static string _ip = "192.168.3.79"; 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 int _port = 10000;
private static DateTime LastestSendTime; 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[] private static byte[] Heart = new byte[]
{ {
@ -220,7 +220,7 @@ public class LedClient
{ {
var now = DateTime.Now; var now = DateTime.Now;
if ((now - LastestSendTime).TotalSeconds > 3) if ((now - LastestSendTime).TotalSeconds > 5)
{ {
SendMsgByKey(LastestKey); SendMsgByKey(LastestKey);
} }
@ -265,8 +265,8 @@ public class LedClient
} }
catch (SocketException ex) catch (SocketException ex)
{ {
_socket.Close(); // _socket.Close();
Connect(); // Connect();
Log.Error($"Failed to send data. Reason: {ex.Message}"); Log.Error($"Failed to send data. Reason: {ex.Message}");
return false; return false;
@ -301,7 +301,7 @@ public class LedClient
{ {
Thread.Sleep(100); Thread.Sleep(100);
count++; count++;
if (count > 5) if (count > 10)
{ {
return false; return false;
} }

Loading…
Cancel
Save