From 9075071f7065261474fbe4c4a55b022d904188e6 Mon Sep 17 00:00:00 2001 From: zby <24947@USER> Date: Tue, 3 Sep 2024 21:15:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A8=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Execute/Api/PlcApi.cs | 6 +- Service/Execute/Mgr/CommonMgr.cs | 8 +- Service/Execute/Step/CarPrepareState.cs | 10 +- Service/Execute/Step/DoSwappingState.cs | 195 ++++++++++++++++++++-- Service/Execute/Step/StationReadyState.cs | 47 +++--- Service/Execute/Step/SwapDoneState.cs | 46 ++--- Service/Led/LedClient.cs | 4 +- WebStarter/Program.cs | 17 +- WebStarter/appsettings.dev.json | 9 +- WebStarter/appsettings.prod.json | 6 +- 10 files changed, 274 insertions(+), 74 deletions(-) diff --git a/Service/Execute/Api/PlcApi.cs b/Service/Execute/Api/PlcApi.cs index a8a9600..ea204f3 100644 --- a/Service/Execute/Api/PlcApi.cs +++ b/Service/Execute/Api/PlcApi.cs @@ -41,7 +41,11 @@ public class PlcApi /// public static bool IsAuto() { - return ClientMgr.PlcClient.Auto; + if (ClientMgr.PlcClient!=null) + { + return ClientMgr.PlcClient.Auto; + } + return false; } /// diff --git a/Service/Execute/Mgr/CommonMgr.cs b/Service/Execute/Mgr/CommonMgr.cs index 814328f..e177da4 100644 --- a/Service/Execute/Mgr/CommonMgr.cs +++ b/Service/Execute/Mgr/CommonMgr.cs @@ -47,9 +47,13 @@ public class CommonMgr }; machine.StepModel[stepModel.StepNo.ToString()] = stepModel; + if (machine.SwapOrder != null) + { + if (!string.IsNullOrEmpty(machine.SwapOrder.Sn)) + _swapOrderStepService.InsertSwapStepForSwapMain(step, machine.StepSort++, machine.SwapOrder.Sn); + } - if(!string.IsNullOrEmpty(machine.SwapOrder.Sn)) - _swapOrderStepService.InsertSwapStepForSwapMain(step, machine.StepSort++, machine.SwapOrder.Sn); + } diff --git a/Service/Execute/Step/CarPrepareState.cs b/Service/Execute/Step/CarPrepareState.cs index 5baa22d..1089a67 100644 --- a/Service/Execute/Step/CarPrepareState.cs +++ b/Service/Execute/Step/CarPrepareState.cs @@ -55,7 +55,7 @@ public class CarPrepareState : IState return SwappingStateMachine.ReturnWithInvokeErr(checkTBoxConnect, ExceptionReason.None); } - //车辆本地验证 + //车辆本地验证 InvokeStatus checkTBoxVelLocal = CheckTBoxVelLocalFlag(machine); if (checkTBoxVelLocal != InvokeStatus.Done) { @@ -63,7 +63,8 @@ public class CarPrepareState : IState } - + + machine.ExceptionReason = ExceptionReason.None; //选包 @@ -326,7 +327,10 @@ public class CarPrepareState : IState LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrorSelectPack.GetLed()); SoundClient = AppInfo.Container.Resolve(); SoundClient.SoundPlay(SoundEnum.music49); - _log.Info($"SelectPack error CanSwap={machine.SwapOrderBatteryInfo.CanSwap}"); + + // _log.Info($"SelectPack error CanSwap={machine.SwapOrderBatteryInfo.CanSwap}"); + + } else { diff --git a/Service/Execute/Step/DoSwappingState.cs b/Service/Execute/Step/DoSwappingState.cs index 6296268..46da3a0 100644 --- a/Service/Execute/Step/DoSwappingState.cs +++ b/Service/Execute/Step/DoSwappingState.cs @@ -11,6 +11,7 @@ using Service.Execute.SwapException; using Service.Execute.Utils; using Service.Init; using Service.Led; +using Service.Padar.Client; using Service.Sound.SoundClient; namespace Service.Execute.Step; @@ -28,9 +29,9 @@ public class DoSwappingState : IState public StateResult Handle(SwappingStateMachine machine) { //上报云平台换电开始 - machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.BeginSwap; - machine.BusinessSwappingStateUpdateTime = DateTime.Now; - _log.Info($"BusinessSwappingForCloudState={machine.BusinessSwappingForCloudState}"); + // machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.BeginSwap; + // machine.BusinessSwappingStateUpdateTime = DateTime.Now; + // _log.Info($"BusinessSwappingForCloudState={machine.BusinessSwappingForCloudState}"); // CloudApi.SendStateLog(machine.SwapOrder, InfoEnum.BusinessSwappingForCloudState.BeginSwap); @@ -40,7 +41,6 @@ public class DoSwappingState : IState InvokeStatus startSwapping = StartSwapping(machine); if (startSwapping != InvokeStatus.Done) { - return SwappingStateMachine.ReturnWithInvokeErr(startSwapping, ExceptionReason.None); } @@ -68,8 +68,26 @@ 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); + if (InvokeStatus.Done != beginRadar) + { + return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None); + } + //车辆离开 + var adjustCarByRadar = AdjustCarByRadar(machine); + if (InvokeStatus.Done != adjustCarByRadar) + { + return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None); + } return new StateResult() { @@ -77,6 +95,69 @@ public class DoSwappingState : IState }; } + + /// + /// 控制雷达启停 + /// + /// + /// + /// + public InvokeStatus ControlRadar(SwappingStateMachine machine, byte flag) + { + return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, () => PadarMgr._PadarClient?.CarState > 0, + () => { PadarMgr._PadarClient?.PadarControl(flag); }); + } + + + //public void leida () + //{ + + // switch (PadarMgr._PadarClient?.CarState) + // { + // case 1: + // _log.Info("radar 无车"); + // break; + // case 2: + // _log.Info("radar 无电池"); + // break; + // case 3: + // _log.Info("radar 角度偏移过大"); + // break; + // case 4: + // _log.Info("radar 车辆靠后"); + // break; + // case 5: + // _log.Info("radar 车辆靠前"); + // break; + // ; + // } + + //} + + public InvokeStatus AdjustCarByRadar(SwappingStateMachine machine) + { + + return Invoker.Invoke("begin Radar", 1000, 20, machine.IsCanceled, + () => + { + //新增小步 + _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.CarInPositionFlag, + machine); + var carState = PadarMgr._PadarClient?.CarState; + return carState.HasValue && (carState.Value == 1 || carState.Value == 2 || carState.Value == 3 || carState.Value == 4 || carState.Value == 5); + }, + () => + { + switch (PadarMgr._PadarClient?.CarState) + { + case 6: + _log.Info("车辆未驶离"); + break; + + } + }); + } + /// /// 下发plc启动换电 /// @@ -103,11 +184,12 @@ public class DoSwappingState : IState _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.StartSwappingFlag, machine); } + } }, () => { - SoundClient = AppInfo.Container.Resolve(); - SoundClient.SoundPlay(SoundEnum.music70); + //SoundClient = AppInfo.Container.Resolve(); + //SoundClient.SoundPlay(SoundEnum.music70); LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrStartSwap.GetLed()); },false, () => { },10,InvokeStatus.None); } @@ -122,6 +204,8 @@ public class DoSwappingState : IState /// public InvokeStatus UnPack(SwappingStateMachine machine) { + int s = 0; + int i = 0; return Invoker.Invoke("plc UnPack", 500, 5, machine.IsCanceled, () => machine.UnOldBatteryFlag, () => { @@ -130,7 +214,12 @@ public class DoSwappingState : IState LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoUnPack.GetLed()); SoundClient = AppInfo.Container.Resolve(); //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address11")); - SoundClient.SoundPlay(SoundEnum.music51); + if (s==0) + { + SoundClient.SoundPlay(SoundEnum.music51); + s = 1; + } + machine.UnOldBatteryFlag = ClientMgr.PlcClient.DisassembleDone; if (machine.UnOldBatteryFlag) @@ -138,18 +227,27 @@ public class DoSwappingState : IState _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.UnOldBatteryFlag, machine); } + }, () => { - //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack); - SoundClient = AppInfo.Container.Resolve(); - SoundClient.SoundPlay(SoundEnum.music51); + + if(i==0) + { + SoundClient = AppInfo.Container.Resolve(); + SoundClient.SoundPlay(SoundEnum.music51); + //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoUnPack); + i = 1; + } + + }, false, () => { }, 10, InvokeStatus.None); } public InvokeStatus Pack(SwappingStateMachine machine) { + int a = 0; return Invoker.Invoke("plc Pack ing", 500, 5, machine.IsCanceled, () => machine.InstallNewBatteryFlag, () => { @@ -168,14 +266,21 @@ public class DoSwappingState : IState //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.InfoPack); SoundClient = AppInfo.Container.Resolve(); //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address12")); - SoundClient.SoundPlay(SoundEnum.music52); - LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPack.GetLed()); + if (a == 0) + { + SoundClient.SoundPlay(SoundEnum.music52); + LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPack.GetLed()); + a = 1; + } + + },false, () => { }, 10,InvokeStatus.None); } public InvokeStatus PackFinish(SwappingStateMachine machine) { + int b = 0; return Invoker.Invoke("plc Pack Finish", 500, 5, machine.IsCanceled, () => machine.FinishNewBatteryFlag, () => { @@ -188,8 +293,13 @@ public class DoSwappingState : IState // CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState); machine.BusinessSwappingStateUpdateTime = DateTime.Now; SoundClient = AppInfo.Container.Resolve(); - SoundClient.SoundPlay(SoundEnum.music52); - LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPackFinish.GetLed()); + if (b==0) + { + SoundClient.SoundPlay(SoundEnum.music52); + LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoPackFinish.GetLed()); + b = 1; + } + _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.FinishNewBatteryFlag, machine); @@ -202,4 +312,61 @@ public class DoSwappingState : IState }, () => { },false, () => { }, 10,InvokeStatus.None); } + + + + /// + /// 车辆上锁 + /// + /// + public InvokeStatus LockCar(SwappingStateMachine machine) + { + int v = 0; + return Invoker.Invoke("LockCar", 500, 100, machine.IsCanceled, machine.IsManualSwapSucc, + () => machine.VelLockFlag, () => + { + Task result = TBoxApi.LockCarManyTimes(machine.RfidReadModel.VelVin); + + bool unLock = result.Result; + if (unLock) + { + //查询车辆锁止状态 + Task carInfo = TBoxApi.GetCarInfo(machine.RfidReadModel.VelVin); + if (carInfo.Result?.CarStatus?.LockStatus == 2) + { + 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.InfoCarLeave.GetLed() + : InfoEnum.SwapInfo.ErrInfoCarLeave.GetLed()); + machine.VelLockFlag = true; + //断连Tbox + if (StaticStationInfo.TboxStateDisConnect) + { + TBoxApi.DisConnect(machine.BoxCarInfoModel.CarNo); + } + + _CommonMgr.InsertStep(InfoEnum.BusinessSwappingStep.VelLockFlag, + machine); + } + } + }, () => + { + // machine.LedTool?.WriteProgramContent(InfoEnum.SwapInfo.ErrLockCar.GetLed()); + // SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.ErrLockCar); + var SoundClient = AppInfo.Container.Resolve(); + //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address19")); + if (v==0) + { + SoundClient.SoundPlay(SoundEnum.music59); + v = 1; + } + + LedClient.SendMsgByKey(InfoEnum.SwapInfo.ErrLockCar.GetLed()); + }, false, () => { machine.ExceptionReason = ExceptionReason.LockCarError; } + , 10, InvokeStatus.None); + } } diff --git a/Service/Execute/Step/StationReadyState.cs b/Service/Execute/Step/StationReadyState.cs index 24321ec..e5af31c 100644 --- a/Service/Execute/Step/StationReadyState.cs +++ b/Service/Execute/Step/StationReadyState.cs @@ -38,7 +38,7 @@ public class StationReadyState : IState machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.Idle; machine.BusinessSwappingStateUpdateTime = DateTime.Now; - //判断换电站是否具备换电条件 + //判断换电站是否具备换电条件 前端页面 if (!IsAutoSwapping()) { return null; @@ -51,19 +51,34 @@ public class StationReadyState : IState return SwappingStateMachine.ReturnWithInvokeErr(plcIsAuto, ExceptionReason.None); } - //plc是否是远程模式 + ////plc是否是远程模式 var plcIsRemote = PlcIsRemote(machine); if (InvokeStatus.Done != plcIsRemote) { return SwappingStateMachine.ReturnWithInvokeErr(plcIsRemote, ExceptionReason.None); } + + //开启雷达 + var beginRadar = ControlRadar(machine, 1); + if (InvokeStatus.Done != beginRadar) + { + return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None); + } + + //调整车辆 + var adjustCarByRadar = AdjustCarByRadar(machine); + if (InvokeStatus.Done != adjustCarByRadar) + { + return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None); + } + + //开始读rifd var beginRfid = BeginRead(machine); if (InvokeStatus.Done != beginRfid) { return SwappingStateMachine.ReturnWithInvokeErr(beginRfid, ExceptionReason.None); - } @@ -74,20 +89,9 @@ public class StationReadyState : IState return SwappingStateMachine.ReturnWithInvokeErr(readRfid, ExceptionReason.ReadRfidError); } - //开启雷达 - var beginRadar = ControlRadar(machine, 1); - if (InvokeStatus.Done != beginRadar) - { - return SwappingStateMachine.ReturnWithInvokeErr(beginRadar, ExceptionReason.None); - } - //调整车辆 - var adjustCarByRadar = AdjustCarByRadar(machine); - if (InvokeStatus.Done != adjustCarByRadar) - { - return SwappingStateMachine.ReturnWithInvokeErr(adjustCarByRadar, ExceptionReason.None); - } - + + return new StateResult() { @@ -133,10 +137,14 @@ public class StationReadyState : IState else { //LED显示-欢迎光临_换电站点_正在营业 - string welcomeContent = "欢迎光临换电站!(正在营业)"; + //string welcomeContent = "欢迎光临换电站!(正在营业)"; - //SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address01")); - SoundClient.SoundPlay(SoundEnum.music41); + ////SoundClient.SoundPlay(AppSettingsHelper.GetContent("SoundAddr", "Address01")); + //if(SoundClient.SoundPlay!=null) + //{ + // SoundClient.SoundPlay(SoundEnum.music41); + //} + //SoundApi.PlayOneSound((int)InfoEnum.SwapInfo.WelcomeInfo); LedClient.SendMsgByKey(InfoEnum.SwapInfo.WelcomeInfo.GetLed()); isRemote = true; @@ -206,6 +214,7 @@ public class StationReadyState : IState return Invoker.Invoke(" BeginRead read rfid", 1000, 20, machine.IsCanceled, () => machine.BeginRfidReadFlag, () => { + Task open = RfidApi.Connect(); Task beginRead = RfidApi.BeginRead(); beginRead.Wait(); if (!beginRead.Result) diff --git a/Service/Execute/Step/SwapDoneState.cs b/Service/Execute/Step/SwapDoneState.cs index beaf141..fb10083 100644 --- a/Service/Execute/Step/SwapDoneState.cs +++ b/Service/Execute/Step/SwapDoneState.cs @@ -47,8 +47,8 @@ public class SwapDoneState : IState Task.Run(() => { - //新增换电成功上报云平台数据 - _CommonMgr.InsertCloudReportForSwapSuccess(machine); + //新增换电成功上报云平台数据 + // _CommonMgr.InsertCloudReportForSwapSuccess(machine); //换电成功关于bininfo表的更新 _CommonMgr.UpdateBinInfoForSwapSuccess(machine); @@ -60,33 +60,37 @@ public class SwapDoneState : IState if (machine.SwapStatus == (int)InfoEnum.SwapOrderResult.Success) { //上传云平台换电状态 - machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.SwapDoneWithVel; + // machine.BusinessSwappingForCloudState = InfoEnum.BusinessSwappingForCloudState.SwapDoneWithVel; // CloudApi.SendStateLog(machine.SwapOrder, machine.BusinessSwappingForCloudState); } - //云平台没有匹配的失败状态 - //车辆上锁 ,提示请驶离 - InvokeStatus lockCar = LockCar(machine); + ////云平台没有匹配的失败状态 + ////车辆上锁 ,提示请驶离 + //InvokeStatus lockCar = LockCar(machine); - if (lockCar != InvokeStatus.Done) - { - return SwappingStateMachine.ReturnWithInvokeErr(lockCar, ExceptionReason.None); - } + //if (lockCar != InvokeStatus.Done) + //{ + // return SwappingStateMachine.ReturnWithInvokeErr(lockCar, ExceptionReason.None); + //} LedClient.SendMsgByKey(InfoEnum.SwapInfo.InfoCarLeave.GetLed()); //出口雷达监测 - InvokeStatus existRadar = ExistRadar(machine); - if (existRadar != InvokeStatus.Done) - { - return SwappingStateMachine.ReturnWithInvokeErr(existRadar, ExceptionReason.None); - } - //关闭雷达 - var closeRadar = ControlRadar(machine, 0); - if (InvokeStatus.Done != closeRadar) - { - return SwappingStateMachine.ReturnWithInvokeErr(closeRadar, ExceptionReason.None); - } + //InvokeStatus existRadar = ExistRadar(machine); + //if (existRadar != InvokeStatus.Done) + //{ + // return SwappingStateMachine.ReturnWithInvokeErr(existRadar, ExceptionReason.None); + //} + ////关闭雷达 + //var closeRadar = ControlRadar(machine, 0); + //if (InvokeStatus.Done != closeRadar) + //{ + // return SwappingStateMachine.ReturnWithInvokeErr(closeRadar, ExceptionReason.None); + //} + + + + return new StateResult() { diff --git a/Service/Led/LedClient.cs b/Service/Led/LedClient.cs index f8df8c1..4de79f2 100644 --- a/Service/Led/LedClient.cs +++ b/Service/Led/LedClient.cs @@ -57,8 +57,8 @@ public class LedClient {"云端校验失败",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,}}, {"请熄火挂空挡拉手刹",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x46,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x48,0x61,0x72,0x61,0x70,0x20,0x6D,0x61,0x74,0x69,0x6B,0x61,0x6E,0x20,0x6B,0x75,0x6E,0x63,0x69,0x20,0x6B,0x6F,0x6E,0x74,0x61,0x6B,0x20,0x64,0x61,0x6E,0x20,0x74,0x61,0x72,0x69,0x6B,0x20,0x72,0x65,0x6D,0x20,0x74,0x61,0x6E,0x67,0x61,0x6E,0x20,0x64,0x69,0x20,0x67,0x69,0x67,0x69,0x20,0x6E,0x65,0x74,0x72,0x61,0x6C,0x00,0x00,0x0D,0x0A,}}, - - {"云平台下发换电失败",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x46,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x48,0x61,0x72,0x61,0x70,0x20,0x6D,0x61,0x74,0x69,0x6B,0x61,0x6E,0x20,0x6B,0x75,0x6E,0x63,0x69,0x20,0x6B,0x6F,0x6E,0x74,0x61,0x6B,0x20,0x64,0x61,0x6E,0x20,0x74,0x61,0x72,0x69,0x6B,0x20,0x72,0x65,0x6D,0x20,0x74,0x61,0x6E,0x67,0x61,0x6E,0x20,0x64,0x69,0x20,0x67,0x69,0x67,0x69,0x20,0x6E,0x65,0x74,0x72,0x61,0x6C,0x00,0x00,0x0D,0x0A, }}, + + {"解锁车辆失败",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x29,0x00,0x00,0x00,0x29,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x47,0x61,0x67,0x61,0x6C,0x20,0x6D,0x65,0x6D,0x62,0x75,0x6B,0x61,0x20,0x6B,0x75,0x6E,0x63,0x69,0x20,0x6B,0x65,0x6E,0x64,0x61,0x72,0x61,0x61,0x6E,0x0D,0x0A,0x0D,0x0A,0x00,0x00,0x0D,0x0A,}}, {"选包失败,请驶离",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,0x2C,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x47,0x61,0x67,0x61,0x6C,0x20,0x6D,0x65,0x6D,0x69,0x6C,0x69,0x68,0x20,0x74,0x61,0x73,0x2C,0x20,0x73,0x69,0x6C,0x61,0x6B,0x61,0x6E,0x20,0x70,0x65,0x72,0x67,0x69,0x0D,0x0A,0x0D,0x0A,0x00,0x00,0x0D,0x0A,}}, {"雷达定位失败,请在三分钟内重新调整车辆位置",new byte[]{0x55,0xAA,0x00,0x00,0x01,0x01,0x00,0xD9,0x00,0x00,0x00,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x23,0x00,0x25,0x64,0x69,0x73,0x70,0x30,0x3A,0x3A,0x50,0x65,0x6D,0x6F,0x73,0x69,0x73,0x69,0x61,0x6E,0x20,0x72,0x61,0x64,0x61,0x72,0x20,0x67,0x61,0x67,0x61,0x6C,0x2C,0x0D,0x0A,0x0D,0x0A,0x00,0x00,0x0D,0x0A,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,0x20,0x68,0x61,0x72,0x61,0x70,0x20,0x75,0x62,0x61,0x68,0x20,0x70,0x6F,0x73,0x69,0x73,0x69,0x20,0x6B,0x65,0x6E,0x64,0x61,0x72,0x61,0x61,0x6E,0x20,0x64,0x61,0x6C,0x61,0x6D,0x20,0x77,0x61,0x6B,0x74,0x75,0x20,0x74,0x69,0x67,0x61,0x20,0x6D,0x65,0x6E,0x69,0x74,0x0D,0x0A,0x00,0x00,0x0D,0x0A,}}, diff --git a/WebStarter/Program.cs b/WebStarter/Program.cs index 9de2ee1..d62d56b 100644 --- a/WebStarter/Program.cs +++ b/WebStarter/Program.cs @@ -175,14 +175,17 @@ AppInfo.Container = app.Services.GetAutofacRoot(); //} ////PLC -//if (AppSettingsHelper.GetBool("plc", "enable")) -//{ -// PlcMgr.Init(); -//} +if (AppSettingsHelper.GetBool("plc", "enable")) +{ + ClientMgr.InitClient(); +} +//雷达 +if (AppSettingsHelper.GetBool("padar", "enable")) +{ + PadarMgr.InitClient(); +} -//雷达 -PadarMgr.InitClient(); ////启动换电流程 if (AppSettingsHelper.GetBool("swap", "enable")) { @@ -197,7 +200,7 @@ if (AppSettingsHelper.GetBool("led", "enable")) } -//现场调试plc连接 +////现场调试plc连接 AppInfo.Container = app.Services.GetAutofacRoot(); //ClientMgr.InitClient(); diff --git a/WebStarter/appsettings.dev.json b/WebStarter/appsettings.dev.json index 18627cd..036c366 100644 --- a/WebStarter/appsettings.dev.json +++ b/WebStarter/appsettings.dev.json @@ -33,7 +33,7 @@ "Address26": "D:\\Voice\\26.mp4", "Address27": "D:\\Voice\\27.mp4", "Address28": "D:\\Voice\\28.mp4", - "Address29": "D:\\Voice\\29.mp4", + "Address29": "D:\\Voice\\29.mp4" }, "Update": { @@ -62,7 +62,7 @@ "PasswordStrengthValidationMsg": "密码必须包含大小写字母、数字和特殊字符的组合,长度在6-16之间", // 密码强度验证消息提示 "CryptoType": "SM2", - // 密码加密算法:MD5、SM2、SM4 + // 密码加密算法:MD5、SM2、SM4 "PublicKey": "0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312", // 公钥 "PrivateKey": "8EDB615B1D48B8BE188FC0F18EC08A41DF50EA731FA28BF409E6552809E3A111" @@ -145,8 +145,11 @@ "cloud": { "enable": false }, + "padar": { + "enable" : true + }, "plc": { - "enable": false + "enable": true }, "swap": { "enable": false diff --git a/WebStarter/appsettings.prod.json b/WebStarter/appsettings.prod.json index 7e70ecd..8266ef7 100644 --- a/WebStarter/appsettings.prod.json +++ b/WebStarter/appsettings.prod.json @@ -125,7 +125,9 @@ "fire": { "enable": false }, - + "padar": { + "enable": false + }, "Task": { "Disabled": "ChargeOrderUploadTask" }, @@ -140,7 +142,7 @@ "SignalR": { "Enabled": false }, -"led": { + "led": { "enable": false, "ip": "127.0.0.1", "port": 2048